From patchwork Thu Jun 16 13:07:31 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: 70185 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp252908qgy; Thu, 16 Jun 2016 06:08:13 -0700 (PDT) X-Received: by 10.55.186.193 with SMTP id k184mr4792540qkf.184.1466082493326; Thu, 16 Jun 2016 06:08:13 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id o77si2792746qka.265.2016.06.16.06.08.12; Thu, 16 Jun 2016 06:08:13 -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 C3A75687A5; Thu, 16 Jun 2016 13:08:12 +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,URIBL_BLOCKED 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 176B96810C; Thu, 16 Jun 2016 13:08:06 +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 CE0BE6810E; Thu, 16 Jun 2016 13:08:03 +0000 (UTC) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0135.outbound.protection.outlook.com [104.47.1.135]) by lists.linaro.org (Postfix) with ESMTPS id DB506680FA for ; Thu, 16 Jun 2016 13:07:58 +0000 (UTC) Received: from DB5PR07CA0042.eurprd07.prod.outlook.com (10.167.223.52) by VI1PR07MB1069.eurprd07.prod.outlook.com (10.163.168.17) with Microsoft SMTP Server (TLS) id 15.1.517.8; Thu, 16 Jun 2016 13:07:55 +0000 Received: from AM1FFO11FD001.protection.gbl (2a01:111:f400:7e00::150) by DB5PR07CA0042.outlook.office365.com (2603:10a6:0:2d::52) with Microsoft SMTP Server (TLS) id 15.1.517.8 via Frontend Transport; Thu, 16 Jun 2016 13:07:56 +0000 Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.241 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.241; helo=mailrelay.int.nokia.com; Received: from mailrelay.int.nokia.com (131.228.2.241) by AM1FFO11FD001.mail.protection.outlook.com (10.174.64.83) with Microsoft SMTP Server (TLS) id 15.1.511.7 via Frontend Transport; Thu, 16 Jun 2016 13:07:56 +0000 Received: from fihe3nok0735.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u5GD7VvS028925 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 16 Jun 2016 16:07:31 +0300 Received: from 10.144.19.15 ([10.144.104.92]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u5GD7Vhf028909 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Thu, 16 Jun 2016 16:07:31 +0300 X-HPESVCS-Source-Ip: 10.144.104.92 From: Matias Elo To: Date: Thu, 16 Jun 2016 16:07:31 +0300 Message-ID: <1466082451-11314-3-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466082451-11314-1-git-send-email-matias.elo@nokia.com> References: <1466082451-11314-1-git-send-email-matias.elo@nokia.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:131.228.2.241; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(979002)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(586003)(189998001)(81166006)(16796002)(8676002)(106466001)(81156014)(47776003)(2351001)(229853001)(50986999)(6806005)(76176999)(22756006)(5008740100001)(356003)(87936001)(97736004)(33646002)(107886002)(110136002)(92566002)(68736007)(2906002)(450100001)(2950100001)(36756003)(77096005)(48376002)(50466002)(11100500001)(50226002)(19580405001)(5003940100001)(19580395003)(8936002)(42882005)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR07MB1069; H:mailrelay.int.nokia.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; CAT:NONE; LANG:en; CAT:NONE; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD001; 1:rGqGNPkVw2i5jwaay6f4vwP3LnG/XgsGSfXrJDaeInsRmxxN2noTNMkn/f4/BG0dQgmu45SCGIPR8OwWXAinUbtBVMjteZvXba3hYVBtjah3nbwhEnwW7IyLYrlQG9L349rQNesF01qoHvJJxTkJWHvivyAYIl4pbtnyD9X/jrx11eJCQ5XjGSj6aN2AOiQtIa/539FwjcI9Lq6SIucUE1CjSPD/6YmVCNDRUIoOLhX9j0X8ohAKHGuty2uXm9jqvLNnvzx9L6HE0MqMCanePl09IgkmuiQoTgKGKY3CVXwIEIyEB4M2Sldazer/sbb+YWj6/q5qqld6hWCN3QX2j8S4yJNzokAtPtPy+hz3hftejs6XgWgXAy5eqDXP7H4cKb7/BC/WFqLQ8KM6gomkpz8XlWtpEcMprZG6SdOzeF0= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: c5352d18-f4a0-4789-c789-08d395e73bbf X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1069; 2:+jv45EMeJmuRsqgicFbdRSCf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Ey8cR6bZeNN6jltaCGilEnI2iLdHPd9arNTiK+/njowEH9v2SCK4wOe6X0qFvmInf0+M2vCg158JJl+zlyV7LxcIQdQD7hHZGAY2nKsQERRfHZ5BbImLAM8e5vTdIGnPGE/4tOKfgbFbrY7g2k5KDAKkJIVBIHwFeWFAM86OjDbYzkRu3iZL/t6y2xaPU7prz2GX9BW4sBJleCj2fIGRnA9XDqn9cUM0uNj0lsM6q1FiA1Bwmm4xiLtQVrmTegJgBHQ4kWAutumedNAeQXbOy59GgdCYiyFcRfr7wpGcUGt0jxG4KWA7rYk5soBPk+R9X1YS+0W1DByxrNkqekikFjZpXcc5ln+ZDLPSKfey9m3oz5Ia/s4OEo1XBSpBNvDaFx1+CeTZeWKwGOQjrgpNMujT47RxFo7tX/6BGxO/azYJ70F6iJCm8sf+zUqITXB8lloQS9oqyCT/XE83Wxsc29an4iRvc4+QR/3pMrsrqvpfg6ooAmPsz1srLD4txCW1u8nTjPH8b3j4C0k= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(82608151540597); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(13018025)(13016025)(10201501046)(3002001); SRVR:VI1PR07MB1069; BCL:0; PCL:0; RULEID:; SRVR:VI1PR07MB1069; X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1069; 4:wDXaMSD7AoK2hJX6h8E7rcsmy5ycaYTeB7zjYd+UYWC+WF/U1MeZt4RWZw4d1ItxtvVkMRMQSobaSAdxoSGalfecivn6D56A/zBtFQwhEWpPEYG4WWR2yZ9xMulfk5KvXXfxYcPGnrEbDpLUNX7hOM7upkIEtSUTH691j7IIkGneRtDS4fluP+Wjf8uQZxrqwxzqIntoNbQcbt4vcoLpJREmAUDSwmg7E8dql5cclBw89GdXM6jQcXSmSbB9kBX2BA8VjHKfup4RTQa6XeWAUu/MQFb9bSgHvfdEADyfdKeybedbcShMQIi6d77MNN6QixRCMPLS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rMLD8ob7RyyN5t+hVNH2tmwk4licAh0mGPt1em57EYKSN1uadjv5CMHXCw==; 24:2540fIxjOQpCxGQ3UOAjPnRqE5ZTsSvvXlqM9fglkObynEqkF3qO9ZjWdx5lA8bs5pHM9ULbCMqOmZ0swdFlpscU6Tsr1dzHVc/KGf6AjVc=; 7:PRSeN453leSfXWgRi2b4NnsLv0V+gqOLQibHSAa7D9a1/lptz8FKiX6JpB867YNX03k66IcvQ+DZkIqJJV1OYMk6Hw0GSqEA6KBOeAazvCJUC5YVqWB6B/ucLJI3WKReuO0acXMCdFuuqBhohtGv4f3cmw72pxznMyI1ofZKp2uzpTJIuP0jq+OCIqu3fC7c0iRWHZ/fh25dti+k+YQmUg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2016 13:07:56.0220 (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.241]; Helo=[mailrelay.int.nokia.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB1069 X-Topics: patch Subject: [lng-odp] [PATCH v3 3/3] linux-gen: loop: improve classifying segmented packets 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 sure there is enough data for the packet parser in the case of a segmented packet. Signed-off-by: Matias Elo Reviewed-and-tested-by: Bill Fischofer --- platform/linux-generic/pktio/loop.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 645521a..dce33e5 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -87,12 +87,24 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED, odp_packet_t new_pkt; odp_pool_t new_pool; uint8_t *pkt_addr; + uint8_t buf[PACKET_PARSE_SEG_LEN]; int ret; + uint32_t seg_len = odp_packet_seg_len(pkt); - pkt_addr = odp_packet_data(pkt); + /* Make sure there is enough data for the packet + * parser in the case of a segmented packet. */ + if (odp_unlikely(seg_len < PACKET_PARSE_SEG_LEN && + pkt_len > PACKET_PARSE_SEG_LEN)) { + odp_packet_copy_to_mem(pkt, 0, + PACKET_PARSE_SEG_LEN, + buf); + seg_len = PACKET_PARSE_SEG_LEN; + pkt_addr = buf; + } else { + pkt_addr = odp_packet_data(pkt); + } ret = cls_classify_packet(pktio_entry, pkt_addr, - pkt_len, - odp_packet_seg_len(pkt), + pkt_len, seg_len, &new_pool, &parsed_hdr); if (ret) { failed++;