From patchwork Fri Sep 16 07:13:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elo, Matias \(Nokia - FI/Espoo\)" X-Patchwork-Id: 76357 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp347308qgf; Fri, 16 Sep 2016 00:15:41 -0700 (PDT) X-Received: by 10.237.32.106 with SMTP id 97mr5180049qta.156.1474010141078; Fri, 16 Sep 2016 00:15:41 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e126si4685532qkc.144.2016.09.16.00.15.40; Fri, 16 Sep 2016 00:15:41 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id A31C960C9B; Fri, 16 Sep 2016 07:15:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 19E8760D03; Fri, 16 Sep 2016 07:14:39 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0209260C75; Fri, 16 Sep 2016 07:14:29 +0000 (UTC) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0105.outbound.protection.outlook.com [104.47.0.105]) by lists.linaro.org (Postfix) with ESMTPS id D40A260D29 for ; Fri, 16 Sep 2016 07:13:59 +0000 (UTC) Received: from AM2PR07CA0033.eurprd07.prod.outlook.com (10.163.24.171) by VI1PR0701MB1999.eurprd07.prod.outlook.com (10.167.209.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.609.9; Fri, 16 Sep 2016 07:13:55 +0000 Received: from AM1FFO11FD002.protection.gbl (2a01:111:f400:7e00::169) by AM2PR07CA0033.outlook.office365.com (2a01:111:e400:8448::43) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.629.8 via Frontend Transport; Fri, 16 Sep 2016 07:13:55 +0000 Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.240 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.240; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.240) by AM1FFO11FD002.mail.protection.outlook.com (10.174.64.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.619.6 via Frontend Transport; Fri, 16 Sep 2016 07:13:54 +0000 Received: from fihe3nok0734.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u8G7DXKg017482 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 16 Sep 2016 10:13:33 +0300 Received: from 10.144.19.15 ([10.144.104.92]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u8G7DXpo017473 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Fri, 16 Sep 2016 10:13:33 +0300 X-HPESVCS-Source-Ip: 10.144.104.92 From: Matias Elo To: Date: Fri, 16 Sep 2016 10:13:27 +0300 Message-ID: <1474010009-7435-3-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474010009-7435-1-git-send-email-matias.elo@nokia.com> References: <1474010009-7435-1-git-send-email-matias.elo@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.240; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(107886002)(2906002)(2351001)(356003)(19580395003)(450100001)(19580405001)(106466001)(189998001)(5003940100001)(626004)(229853001)(36756003)(11100500001)(7846002)(305945005)(586003)(87936001)(16796002)(97736004)(48376002)(5660300001)(77096005)(2950100001)(68736007)(92566002)(50466002)(8936002)(8676002)(50986999)(50226002)(76176999)(110136003)(33646002)(81166006)(47776003)(81156014)(334744003)(32563001)(42882005); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0701MB1999; H:fihe3nok0734.emea.nsn-net.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD002; 1:sedeXF3p9LieLUh2QvL26KE3V1Ic8r60ke9pWhK+X1vKW/XKANOEhiR1nVRWZ8hVPA3CwLBcArCSBTXlm48+CVXbqn/O5Sxr5m9pptuI5xwwQZ1oTdDYbHB/+2FR+5dua8sit2H/4jraby/idKrGsEuC2PvZyRxWLPs9YrvnxG7qtzE+H+9+UnyrpmQfDfuXC8f4E7euPbZqdGheCI9/mx87fzhkrd5dZYQFxIUiOOB2lW/Q+1PIBX9rAVyqAc7IA3hhcEOCNmA61F2nd9LEht+SgOMDLCyvuXxCxO0+CXk7fQc0dtXJZDFbhdU4eJh+hXzfjYf5y+nJml8Jkr85axYxswb3sUOG1E5d6YM/tb8HR94L6Pd/6jcGfZs5rhiZ3cWvXzlTkwfX8ze7+uzPPDxTbFTBpaVdrUy7NZUySN4JKeoT2wvdvLwJzlgiJMit89ezWFbOEf+2apr659p7LIjjG5wRAUTADDBfVWf5dPs= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 82639e80-fe00-4cb1-5db5-08d3de0104bf X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1999; 2:AU20pdgoAPwRMYsVrCie9N3h5Oiq5NWY1tL/aeTOPO/GXhk/mclZNQeMy6BDb+vAdgw1dsuw7I405Nqe1TZShoAxwcFfDU3hxTBYSe1twSIAwerrnbdCPfoYuz4A2jL8qpEmwW8Xw3Sd902XmXC2dZdZI1i36d+NeQophnFHNJr1s3zQ+lExyfxkifjbLs3E; 3:LHhmEMj2GW7VdCw4ODU+fHoi/Dvfy43AHBmPLUzxupbW4zdXZHx302DQ4GzwVuyoxZMaKeIuU4RMhv/X8n1jP615iYrYwT/bEJ9Ox0EPesnTzpb/S9A4qnJsDxAy2t3qEapJnkZUCE9xQI6IOm8ZIHxBSChS2gpz3asq2UwxDQTVuTkoLVVuzxhCTrNqsXN6GBGHR+K7o4zWjYmpKf45jPiXjfcMtbnlSDBX5+Ge2xSrYDz+eE6korTGNAL+855a/CbxC4y73CKGuZqaA2hJ9Q==; 25:U1Bhv/FOxOmsrdauT37Vw4AQq+vFaAjfAKohW8LuH+fn7ZaES4TCDJAEgIxIGqY83rKmqAtyprrUEttZcZ0Eok6wPX21DhC/IYxPyvWZU9I8tKaNhqC+itROEUyO/X/rrbMrBzYafjHTbsm67YZKNwv3qumGvMpZG0PnF0E1A0dYf6Ypr0+2ywV0PMJ8cbY05E2gwgquV/4pppQZ52f8lAStpn4mTXsJuIsrXSljyzhNZjfSWYmVb2XsciStmpHa9dgEvmHe+QQwK3egcU6JqkO8x+pktvDqkJekH8R1nhxa9eEsezS/pUpQeiysvshhrsptMhScpESOZVQ2lvBzbL63mCGgLRP5AEIC1eK49PDLAK09aaez2RUcB9e2wtng7BGhGWS+CyklPW/CC//EKv1zlukv0CKyK581YWwoDXc= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:VI1PR0701MB1999; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1999; 31:R0wina+GQDD+F2BarwZY3jKli40xrnnIVEzhmmJ9dYQq2VTtrAHHXBTAHiRliAX74lrZXiSIvuf7/m33zAm7mNBmVqi4FqjwDUMtLXwoLeCp28w+gJP20wQ/CbII+sFu8DlwlwKSFrBpmvVKU1x9rVa1YAW0ZI/IJJn20RWrtElTjxv5szruX/c8RuzWvFqdbeto64otVX+x66sOj8IIMKN79GnGKXo6D/VFl6EZOvY=; 20:3/pV4rhLC4wtWVgf5EcNFp3Y9q3DEDp+OX789crRC8beYx1XESdOjwkZyRAWwgvLSv2HryVM8x/1LQ98ZzaImgwdaYogvsjR8mr6mIHTcviU/iETJwtUmpF1HmhLOdIC1wlVomzXUPMKtjUK1yUQ2f0KdOwTnA3895Qvav0j/SylpDDO1g6JGK7J5WJiYytq41mC57FdKOYQaRqcCvNzBiaZrGtUdxf+GzMf3uPtwPhnbld1nYhHPEo5Gs6XCCbo64BKWxCXEHHDqa2Hlq7sbrObt4moOgHleIxnGM5Qn/nTsuTXK2tLCEP9JBpyCvdtD8N6WQoEujB4zcASx7h4r/M/oYNB+/iaJ1rnYBeIA5lkxermovZwP2odCraNJm8a5aD63UuK7JWyMGAYFsE7gcAGPGRHRlgJHplVnsb36zekLP7EOMfTcC17oDorxywe2JZ2jiG14IbDAZ1wVR6doUubWnzdWU+cQtQon+oBb0jNC52u2FOMYXZWBPFOdFkklJJr2dHnmGTrej/joJFmS82Zmv7SMxo6vmM0STKuIkvJNXjIz9XShAMSyST+17lQtsCbS2HS3ybApGgdtid/eOfxeDb7/VoOc3kgJ1rltjI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(82608151540597); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13018025)(13016025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:VI1PR0701MB1999; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0701MB1999; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1999; 4:E0pWF3jaw74DZMM6eH3+f7Zds14o8vozo4FCLHX1MUWajMBoBMApKQod0R5QOozi+t9SE80El1TeesZZk04muFtUPZEamn6cL4mab2A056BNwMbdD20jpPfCAKTrkeA+P+7aZEAEeeQjmZYL8rcLITtq1Wgm3ZE0bWGfQpnN7XuXLiWObWga8iyaCa+FWEE0xbDM3HbXWgsJ69us3L/vTqO/knmvHakdrod3q9rlwFXC5o3WafjJ/2Ap1vPz2fJ5U+t043YljbDKwPK6dtv3Gd1IPE4XMj50u+GJzDBEzKVGX8hZRhQ/dIdbuURiKMQZJAiwW8ZM89fxDcMwPPiZMbSWxwV6dFZ4KXf/3eF6eLcgMC3GdTCOVQZhBjSXWdrdzoQPrEC/c+i6e4XmipN0DbdZhkTNkmjDnOAYNhI7Ldp6hYaptXMnh4BcI1dq3Norh5Y8ErpcJqkVAd9pElZmg5FVcJsqEB+iHXR6wBsvFQw= X-Forefront-PRVS: 0067A8BA2A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0701MB1999; 23:HvAbjo4dh1R4ZTd+ZFmWBx2tOB2KuckT/09SPse?= =?us-ascii?Q?+6dOU05zxvJpV8znvOZ07ltzqVLzEwVlRBg6A+lMYGktuASPqiVdPaBaLlSC?= =?us-ascii?Q?5uNSBJEvSfbm6cgxH0yhsFkwYvMnSWPMewPQOHGwfuNnSozCEeV/q6wA1mJe?= =?us-ascii?Q?Ldm6wJVJm+BHjJ4ccRzjG7WgqogGp1wT7FIUdOT+2CAzzY4tHWgn6T45XDLd?= =?us-ascii?Q?IVQDDUHU+/DDeSjH29rpKOgDAIK1DG3A58DxS/kEFe+A7ckMjt8L0TipXLvj?= =?us-ascii?Q?XZxVOTnJ9tYcZbAPmBi643blFEXlIG9pBnsE1sWTg1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-Diagnostics: 1; VI1PR0701MB1999; 6:sH6QSzdfwP5mOaO5CoSSoQtXhGRrnHU5RWK+FNnQS4LJrs7DFJVLoXw9hE8p0gt/wFxLnMyxrgzYk4J3Obo1b0f1cd6sZZfkt9GyCQ7TVxOTnX1NX7dhY+AmwFkDpAUAvhA/gr+j6JRTBCgjdNKMykh52tU+5+JegXMIAIr+Y8Mw5BRr9x4dhPy17pdprIj9XDHDCeGBUAKsXVvAi4b/JdS9jnFA+f/LStM9LG2mBDC7oI4P5p+NvHQJhtVNl/zhYOF2a2sxil6xNaAr0ujrSyJWclUDR1DeVA66EI+/YoTYnb1fc/6VbRDgHzXMfSE9zHyit1ns1ixTtNgcA3Zw0Q==; 5:bUSH69NNay9ZeJwWm2f+NxN0VEzCdDfKYEoeSr7SHRRBHpZspbSjz6bh1Ftc2OzgpH+Ye0xABjcu9iPqTDGsmOXQzTw1hvoyU4fzLE9u5nc+KDNfA1Mu5NiHCLtXsSyKlIj7sZTiytoIKsThiGDP3Q==; 24:6HMUrikMyWGClC92rF36sI0vvd05tzPn+MurB9/KUCQXJchNls2G8sfbOH93e9OMhRpvY1LNnAci4zODM2AQfxRO96lWzlqbW7kfEOud4Jo=; 7:Ct18droeI/PLVlNY2cdvU7WSlKRBvx+L1fYzW522mUg8IhMaDQM0WSudM86kOAOcHScGzgUWUVu1koZlTgwpS0YdOH/U6MNzT/JSoCqTI6ye8fp52fnxDlQsZ2zDU4eYWjSwg+1rKvBOGIwb8/Ifo97IZQtd/v9dx4+g5miCI7oVbbTT6CuYz2gHq/Ii4pOKkyAO9uhX9UAb0S4y4DEIvNF+T6dg6I3GCbjD4gdjl0X9ko/WRj3+y9HKNvqP6QRH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2016 07:13:54.3327 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.240]; Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0701MB1999 X-Topics: patch Subject: [lng-odp] [PATCH v2 3/5] example: l3fwd: make packet error check optional X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Make packet error check optional as it forces full packet parse. Signed-off-by: Matias Elo --- example/l3fwd/odp_l3fwd.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/example/l3fwd/odp_l3fwd.c b/example/l3fwd/odp_l3fwd.c index 95c3d85..f767fb4 100644 --- a/example/l3fwd/odp_l3fwd.c +++ b/example/l3fwd/odp_l3fwd.c @@ -80,6 +80,7 @@ typedef struct { uint32_t duration; /* seconds to run */ uint8_t hash_mode; /* 1:hash, 0:lpm */ uint8_t dest_mac_changed[MAX_NB_PKTIO]; /* 1: dest mac from cmdline */ + int error_check; /* Check packets for errors */ } app_args_t; struct { @@ -241,10 +242,10 @@ static int l3fwd_pkt_lpm(odp_packet_t pkt, int sif) } /** - * Drop packets which input parsing marked as containing errors. + * Drop unsupported packets and packets containing errors. * - * Frees packets with error and modifies pkt_tbl[] to only contain packets with - * no detected errors. + * Frees packets with errors or unsupported protocol and modifies pkt_tbl[] to + * only contain valid packets. * * @param pkt_tbl Array of packets * @param num Number of packets in pkt_tbl[] @@ -256,12 +257,16 @@ static inline int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned num) odp_packet_t pkt; unsigned dropped = 0; unsigned i, j; + int err; for (i = 0, j = 0; i < num; ++i) { pkt = pkt_tbl[i]; + err = 0; - if (odp_unlikely(odp_packet_has_error(pkt) || - !odp_packet_has_ipv4(pkt))) { + if (global.cmd_args.error_check) + err = odp_packet_has_error(pkt); + + if (odp_unlikely(err || !odp_packet_has_ipv4(pkt))) { odp_packet_free(pkt); dropped++; } else if (odp_unlikely(i != j++)) { @@ -475,6 +480,8 @@ static void print_usage(char *progname) " -q, --queue Configure rx queue(s) for port\n" " optional, format: [(port, queue, thread),...]\n" " for example: -q '(0, 0, 1),(1,0,2)'\n" + " -e, --error_check 0: Don't check packet errors (default)\n" + " 1: Check packet errors\n" " -h, --help Display help and exit.\n\n" "\n", NO_PATH(progname), NO_PATH(progname) ); @@ -495,12 +502,13 @@ static void parse_cmdline_args(int argc, char *argv[], app_args_t *args) {"duration", optional_argument, NULL, 'd'}, /* return 'd' */ {"thread", optional_argument, NULL, 't'}, /* return 't' */ {"queue", optional_argument, NULL, 'q'}, /* return 'q' */ + {"error_check", required_argument, NULL, 'e'}, {"help", no_argument, NULL, 'h'}, /* return 'h' */ {NULL, 0, NULL, 0} }; while (1) { - opt = getopt_long(argc, argv, "+s:t:d:i:r:q:h", + opt = getopt_long(argc, argv, "+s:t:d:i:r:q:e:h", longopts, &long_index); if (opt == -1) @@ -585,6 +593,10 @@ static void parse_cmdline_args(int argc, char *argv[], app_args_t *args) args->route_str[route_index++] = local; break; + case 'e': + args->error_check = atoi(optarg); + break; + case 'h': print_usage(argv[0]); exit(EXIT_SUCCESS);