From patchwork Tue Sep 13 08:25:11 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: 76042 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1246843qgf; Tue, 13 Sep 2016 01:25:57 -0700 (PDT) X-Received: by 10.200.39.176 with SMTP id w45mr24982187qtw.81.1473755157868; Tue, 13 Sep 2016 01:25:57 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 91si14537415qkz.220.2016.09.13.01.25.56; Tue, 13 Sep 2016 01:25:57 -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 B956761650; Tue, 13 Sep 2016 08:25:56 +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=-2.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, 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 5C9CC61643; Tue, 13 Sep 2016 08:25:52 +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 AA41D61645; Tue, 13 Sep 2016 08:25:49 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0122.outbound.protection.outlook.com [104.47.2.122]) by lists.linaro.org (Postfix) with ESMTPS id 3844661642 for ; Tue, 13 Sep 2016 08:25:48 +0000 (UTC) Received: from DB5PR07CA0036.eurprd07.prod.outlook.com (10.167.223.46) by HE1PR0701MB1993.eurprd07.prod.outlook.com (10.167.189.143) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Tue, 13 Sep 2016 08:25:46 +0000 Received: from DB3FFO11FD053.protection.gbl (2a01:111:f400:7e04::180) by DB5PR07CA0036.outlook.office365.com (2603:10a6:0:2d::46) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9 via Frontend Transport; Tue, 13 Sep 2016 08:25:46 +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 DB3FFO11FD053.mail.protection.outlook.com (10.47.217.125) 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; Tue, 13 Sep 2016 08:25:45 +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 u8D8PB2B012638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 13 Sep 2016 11:25:11 +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 u8D8PBXl012632 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Tue, 13 Sep 2016 11:25:11 +0300 X-HPESVCS-Source-Ip: 10.144.104.92 From: Matias Elo To: Date: Tue, 13 Sep 2016 11:25:11 +0300 Message-ID: <1473755111-26746-2-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473755111-26746-1-git-send-email-matias.elo@nokia.com> References: <1473755111-26746-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)(50986999)(5003940100001)(189998001)(356003)(50226002)(76176999)(8676002)(626004)(305945005)(107886002)(7846002)(81166006)(77096005)(19580395003)(8936002)(110136003)(97736004)(81156014)(19580405001)(2950100001)(450100001)(33646002)(87936001)(36756003)(229853001)(2351001)(2906002)(586003)(106466001)(11100500001)(92566002)(47776003)(68736007)(48376002)(16796002)(5660300001)(50466002)(334744003)(32563001)(42882005); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0701MB1993; H:fihe3nok0734.emea.nsn-net.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD053; 1:gTsm3JQ+hwc1OByST/G3e20NJfP4gxmjjQd97gtHIavpSoatABVpOP1FjdMrxFxgu0/3pQM/ekKiYkPIh+r/TXCDfmikCyOSgsmxRPTYQeiQLICy6fHNFlVN+F8uv7FxclrFiOjN5JnhAqBUZd7kaTQ7/HYULFBxP4wxVrbQ1a8KGpRtjzdIJUKBOFccQOlS1wxpR4wgamzk/sCMXoF3kGyEWGZZCwYT33qDrKg9tqQ4l+xvCa+JTZauPaMsCIlR4xtMWN96aBBi1JxmeQaCg3hkep8cEfqozblh2MYZ8GS5TxL0Hip0hvq9H3u5ANXfvLzYqS/SjrRS1lPGCmmDSs3ghGqShloGtj2HwYQHLbHcKcluzUfFwOLq5epS2TB0TV1E4y+qDKfWz8lJf0OqpJQJbSCh0dmau94J8qEI+YaFryoXi3qpaUX9/3ML3lz4vlXGUubJW6tQAVZz0gVdTFwerseDJUDJmg0MNNp071Y= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 87d3afbc-3a8a-4186-836d-08d3dbaf8f69 X-Microsoft-Exchange-Diagnostics: 1; HE1PR0701MB1993; 2:+bSK2Yit9GyV+R5fw1qdY8GZ+iZpZZMPDAcn5lGqZA0mHKe/aiUGOQmpXUOEVmV+EzXLjso0aUSqqsGFl6539bwfADYcGQGK/53iYldCeDF7t8y9KEtJigl04WAj36lD8EtBCtNyMuVQoyYPe2BlaZp7jbG50duUZsfw+QttaRhfpF0qrm8JsZbuxP8D9PJg; 3:oeUoLWSaxSBZJwom8YH9c0A11bc8QxBliNMBG6daV61BzVqCfm1clxmk6BVULTZ6HAAckfuct6YdWv78IVFzXDd08bwfns3aCR6eZHbbXHNa5IOkJthBi/sCeWOjRvkEyrl7NloU93+SjQhsdD5aECuUgZElBVWbTU8MNfloEgHx7GBv3ul6Jz2+lSjH+0w6CbRB5HZxrNiBh7d3d8V9XzkQ4xvqIBchiXaRYaQmogfJDv+8TGAdWOIzG/qHFRLZxrVK4lAjRW34z9GmIabtkw==; 25:bNAw+o3ndZs+s/k329o5dstFN/CfwtqdlCu4acHo5JdugLnPPz00T6FaQHIKz4aLD3r/aqnoocRKa80sTeApz7fcP2XYhoqSbvznOF2+Dd0rJ4e+L98K7Ke8lbQnSmx7oO5+Zt8ABKqDRG2RJSBmQo5fgBkfmBwT0pejEGTPJsdDjfNB7vYsXBxUMD4k7Re1ml2nHrLpoFJCZSJ4fD+9S4NAjEUczcmZVXEMDKvO7FWCkU3KKyUl/IQ9A3TTYNvRzMYJZLopxIe03WIA2GekBCAGN/oaDyUUDOE5UmpbBzVtjyMmeUDmsZpkJ9TVfb+ZhgGmBY/NPGlirqFSFFUqr5EQsD3RGQXEfB46328sD1ek1eAuRnP+FS5zDjY7bhIZNp9hhZzrxviiCaNxSxNrcAzA0I5QWLzFeX2crVuyobQ= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:HE1PR0701MB1993; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0701MB1993; 31:yexzHpQtwUGUCRoDdvu8AdUkiteOCAZxSLCQCMMU2odBAiz8QG7ozAlBDqs6TUw1m+y91OyeDBbgaOpNCNfGqBrOV2Atp/OXjU7T+Voc5HquV/b0DYPoGZaKZtbI6Kbe9WkZw+zOHaJ5JYat8US4oltynt1GP/re/SUn4y0v+GrAr0G7GURbl/WBDQpTD1MM0T8xYISAHJxoWLce1ASxVxNHp99AsTfNtYifg6gZBnw=; 20:0FBcoD9UaqWrIK4PIg/Z9ei8HaRkzQduVjVdtR53RnQA0F80s0DKcHozd69OfzUEWTjG8wtMDwhqTY5calj8ur/boLdOVPHaBZk5PE1IaJ+kBpLK4gDs5OrpAK1oa9AWfWAcyl7YL1TD3ery5vRMuknOy5vASbkdsahuptTyCzXfKXukQSaQ1BJVKWeRtcomWUqUOkqzVFgXSgWcxNm3kN12875V2LXiJiOr0v+q6jY9Fu8bQyr5MVF5DBWg/Ip6r/dRdTbVLFgSPHEd2MMR8seqgio1hv2Rfq9jntl6GKOrpeLdfk6fp6W2lfHg7Bmz3uAZg1VEcUmFkragA2+xjbonA5mfo8YAt5d4ZcyGZm6U5AtZguPoPVlCtQdNxnLthg0p0vOZQeoQQnLVvelcp+U6TB57lzym5o+4P7464rdSAwInBSlTdD0sf+/5Oz4OMJO8PLYsoW0g3DnikbrQZ+od1I5n6+XZ7Kkls/9yZqHOdSrydtu67fXuBSheAu/hD4lCe7iSPT6eRprU0uHWgRy4OS3FbqC2rB67mT43unRrlSQvALUQV2QyrFYRQRv2YtAij5loMFFjYKbyo64/KoQ7Aq0gbUruHNq/K0Ix9NQ= 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)(13016025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:HE1PR0701MB1993; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0701MB1993; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0701MB1993; 4:cZCA467qT3VkLaNs7Sne3/+AMzkqmFR2dWTOS65zccZCdSpCVBm6DVGue2Hw0fFhiibvlxYz96XfQim6W7ZydWmCJQY2H5hlYPeNlaCOlL5HM7f9RaC7xYy64mVjIgIg/djSICAnr0iDAv+NOZcpPSoxsKmqnQi7c9+Tm9usGkhbtYoLUY6I7ReBTZ+kdUYSTTOTOXrN70b0FX95k9uP6opUtY3XMNjtiHjBv8od/4puKr7CVbMYU5Nb87RlajJwbiOiXYOP/NlI0CLsps8SFRfk2PH2vsyw4Icbx0oTr8XqiInVSAGCoJxe9Mj3KwmzZ2udITTjZby/Cbe6Lz3LvKiqoMUbYWHNN38+q3ZZ8QNGsBV0G68PrXnnSH7Gw3iprpDtE6IlpiV8y323bkoVQHYBkkt9R2HZ9Icr1+au0zCJE4Yc7NP5+Csgd8sYLhNwYxIRRCAEkqnFlVQUYjhXT5Xu4SfaH7EvNe98HVVUo5s= X-Forefront-PRVS: 0064B3273C X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0701MB1993; 23:SRKMROZ1MC8yB47ZZKfN8o4Fb99bh3hud8NG59Y?= =?us-ascii?Q?dONUQ+d8zx/Bhcq4gKeysx8o9lKSsJIruSQWndsPQ7QoJCgVbSFO/j7R77c2?= =?us-ascii?Q?SS90jU16rEGxEUCk9aXFA2NPZr53CmyCbvCo6pp2a5GGZ/rnvlrs2k0cGZDO?= =?us-ascii?Q?aI9rMeqPJvSsoVFDSyXXHprZJRGo9FARuo3o4FBCFKLDKOyVMsrDGIddiSfE?= =?us-ascii?Q?cvaAI9Q35seYmKt7B4WzuMJnKuVSyBdlT/59+BWJBWgyygOzXEhniDmv4DR8?= =?us-ascii?Q?I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3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0701MB1993; 6:SSEL7XknJLTyhcAs0Ah42D0tN/OtvWINRViHT2l+tCh4grqIGYl9nq1/2DlVF2wR9F/anqITyNQePN35KkWCrnJOxO7j/D/KnjtYIkMaN6SmNu/L1cB64HxkPJ4gAk63WTpeM4ZS1nC9KNfMTSgmBZj62suJuDbQkkijZQvFwc49kWQjCKObzZ3pMPMscoMgCmpzijuBRgQ00TfRBjPceKY71tZyqhQedml/eXAycRp2JXVN7EVJwY7HMlsDPRxPPx+8FwAswU/PrhUnIfH88/Q915Ty25phw+Bqblrvz141jS9WbIuKUrzp3tDuHtXSFtmgusnKJLk+kaAxVE77iA==; 5:jS+m/B4eCnd/G7cBmxTNWfg0rBzrKN390rdGtZhve0ntIjiAFHufKjKykL65Z2SUWiIaIyuCCO3evEokjKiJcgNCfbBpi5wbgkguF9FbOvTfOWaSbCLz73b6lj9hgl3GI7tWqJpCEJoxIp4eQeRcQA==; 24:rb2Fq3cB/jHLx9+pL/ftXTMmC25zTN8vpReBTB4GcM6M2SnLyUTGOXRN7xXHHY3y29MzOsr5JRRj3fyhunfSUYl62irqi3O+3gHvVqUGQmU=; 7:isppQWrlOWT3vl7G5U/nZYJ5t2NfLUdrerfnqab/EGNjdLKxKfSntG3LIGVZEGu93e1RjD9buU8i9/kU07iOnr/ZS9A92uVNV8dQu6g7ORSvKsX+c2WNv05fXisEpK/eA4aC89dp9hNtmhixLIOuX5+1ji1qcvggrAMZBzE/yvh2vNj4mltym7lvvFJ0Gg2aKBNZ6o//u28/jwAq8aLz4/k9rAf5NyZezgTYFOER99e2vxyWeD3fwPrnkySiUN2v SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2016 08:25:45.9160 (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: HE1PR0701MB1993 X-Topics: patch Subject: [lng-odp] [PATCH 2/2] 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);