From patchwork Wed Aug 31 14:24:06 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: 75099 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp364949qga; Wed, 31 Aug 2016 07:24:33 -0700 (PDT) X-Received: by 10.36.73.195 with SMTP id e64mr12859784itd.80.1472653473160; Wed, 31 Aug 2016 07:24:33 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 138si13031267ith.124.2016.08.31.07.24.31; Wed, 31 Aug 2016 07:24:33 -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 5516560E91; Wed, 31 Aug 2016 14:24:31 +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_H4, 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 C7B0960D23; Wed, 31 Aug 2016 14:24:26 +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 1D70D60D36; Wed, 31 Aug 2016 14:24:24 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0126.outbound.protection.outlook.com [104.47.2.126]) by lists.linaro.org (Postfix) with ESMTPS id 1B3A860CF8 for ; Wed, 31 Aug 2016 14:24:20 +0000 (UTC) Received: from AM3PR07CA0011.eurprd07.prod.outlook.com (10.141.45.139) by VI1PR07MB1534.eurprd07.prod.outlook.com (10.165.238.152) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Wed, 31 Aug 2016 14:24:17 +0000 Received: from DB3FFO11FD011.protection.gbl (2a01:111:f400:7e04::181) by AM3PR07CA0011.outlook.office365.com (2a01:111:e400:882c::11) 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; Wed, 31 Aug 2016 14:24:17 +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 DB3FFO11FD011.mail.protection.outlook.com (10.47.216.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.587.6 via Frontend Transport; Wed, 31 Aug 2016 14:24:17 +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 u7VEO9VH020837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 31 Aug 2016 17:24:09 +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 u7VEO933020834 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Wed, 31 Aug 2016 17:24:09 +0300 X-HPESVCS-Source-Ip: 10.144.104.92 From: Matias Elo To: Date: Wed, 31 Aug 2016 17:24:06 +0300 Message-ID: <1472653448-23947-1-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 2.7.4 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)(19580405001)(11100500001)(5003940100001)(92566002)(19580395003)(87936001)(47776003)(2351001)(229853001)(107886002)(8676002)(626004)(5660300001)(16796002)(110136002)(81166006)(8936002)(50986999)(33646002)(97736004)(189998001)(356003)(50226002)(81156014)(106466001)(77096005)(450100001)(68736007)(48376002)(2906002)(586003)(36756003)(7846002)(50466002)(305945005)(42882005); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR07MB1534; H:fihe3nok0734.emea.nsn-net.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD011; 1:+oPfWeYRrFYYbCxe5rxp8lAEdRwe+t7FAX4qiD1DbQbK5lPMK1xdQIi4faw15sFmSKf1MfXx8TbELLwkbhCn6g3fIemN81vfdD5p/FJLPyoip+HGid9aVHBz98k1r1rAJLOyXeM4i2a1fi/Ao3fO12U8bLruO7hpr5D5DeCd9QGAA2C0DQdL2aa7zovbjsUXOQ9KPeP0rpiJ2dt/AxSqDxBDWvHc6/9J4tNrn7luVF+Xbms8JC23TziAO0WKylIcoNnkoLMTYE/WegEL3YkmmmbByHhPx1CjFbLC44LKlQOuT4eEvWIAmbSgGLL0l7udaHbCczUGRDeIkpOmTUZtS7GcncTn7BBuxOCcDX5nm/g1RoahljOArRaSV4+qKEDcV1xi1MVDe4b3jQ8+alJ17JaMqskQr9ITO+Z+KqmSn3Iw20TgkVjw3+W9ABTnTqWtyAhDH9O3BG1a2XVOjsYDgWjbHBfihfcOKMKi2EgoozwHqzHLGA4a+Nt0B5al2P/2 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 1f2ad613-628e-401b-d020-08d3d1aa7e00 X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1534; 2:gt6qZvkNu3Qo8yuOoTV18+c9+gdSVQC4w+cAFlAz9isB8Cjafn+IWqVYuFbHJ05vFS09tHsjL+TKfYlaWLsU7ACq0ufiLBIl4zPtbDsv2JLLs6ccCfd4WAAtS7D4RTxfoRVt/Z3nXvWE1fMxTspIsmfpVuTpEaw1teQbfresafArk8nOhbiY1mdU6/UNhvUu; 3:3tgm7vaXxo3X03RtObySodfVUwVonMzLGclde7O+UjL6ztiTZsJkOuwTIDK5SHF/2IH7rfIdARiwa/q6QxUmkWEtNdkbv3nWDFW4AS+1xBe3fBBVau5vwo7MYqazvrKX8It6WKdUZvyaYGuDIBBaMxhotKRAGMin56P4f/1CBHtm4zXwS1erepI2AQD0iR9q26Q/Ujq5iRqvCiXoLCvJ/MXbj8JcOe5zC2jQql6t94jD/Rlwp1VJq2yIcJRMPyRVsWMxukfZqwfkPftjkfG4XQ==; 25:P5tgxgztfgkBe+RtH8fQoXe+SL1poP0WKZiIErFUu8mR8f28sVL/DJGeV54SDp9JJdmXROYtNpxV5ZYgDXn0q/Fp+62xRdcdzsdxRg7/30jTTuyyH5KSUHRMHmCMwba/RpckL4cW2P/MbLeUqCUOvSjN2/vobG2KRVJnolIx8hPQ/X/EDXOHVgEjCTklvLNDdbfI38Nga5JEDg1HDJvHlgcmnrjPB0W1LL98SdeY8Sx6w3KRn/hDsDc8fKViAx5KGzdC6o9RizNq47w/JljHxV2tIq24qf9ZyMnNfEY8jgaUYGDGRkojpRLaXaThxIQdbZddAAoiz0hRmldZpsr4SvO7DDRVieupML1ezbzh1AyfOwq51AgzQ5Xn8xsYpwq7mhUVjshS9Qk3CaAXeFY+iMkVY73uTmOoWBzv2rAR/sY= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:VI1PR07MB1534; X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1534; 31:zT4iD9Wt82Lf5orOAGdM1upo0XL7B+/BcwRSoC9zJbTTEDHC6/FXV+elYw+S35t2yNnrAMEsZiSZ+I6PfYFie7v067Liy+0wsm+mSTz9DNxs/D6gHiCkdomKJfLqDj45CeXTEfNCxu7XgzpaCyudE8YVv71Re3BRAoYH9QaswGB7hb+oVCdNC8jtjzfbTG1EzvoDYpCAdpsmhQiOWe5NlJpX0CEcdZTa1FZL6fqQO9I=; 20:NYmWTHbBRDmxZuczau1kvsU1fQf9d+hlCiJIAJzxIrkqhaKDK/+VtqN8hw4DsbtBJ6co4Az07xoI8zxFIzqJFZxulsL7xXObFpJe4dr07wwu+DJt8hVwWUw2ytAHZcaGY4SgcOk+SVc/23ku+5ptQ1e3pp3f8P5APBZj7H8HkrZ7ZPtnZpnn2X10dnkRg/FRWnwl0k6SaXfKVlimyJMQ0hVXV8ckyxbMZwDPBQcTx3pZc/6kBDhbK4UcN8S/XR9UjJMZhzAuqanIsNmYopGMiobAXkPQAGt24npUIpVJYlo7dhsuc2ME0klj1c3jce0JO9Mj9oBf3fN2vGTY51pDZdSyXpCt7esYvBcAHxmEbJ3gqu1586l02VHDtjjWWk9Pk6vFQlJ9tdLwns/KQVh2zu7bf066IkmZNgCPxEpnrNo+ItV6EhTsOLqKRPRCbEpxQm+JnIYDag5+zVmNwwin1yz/5yYMVQgyN82wXZ/+aaRwzYGMFNy698jZGbGO24imbSE3wrznmREiFZlg1QZn+IHxwEqV2a7yeClcens036ie/ZZM5El8nyLBtbuyHx5ddFZUExm8tHubttt/wrhnLg89wmQK2j83eI00KG3Q0/U= 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)(3002001)(10201501046)(6055026); SRVR:VI1PR07MB1534; BCL:0; PCL:0; RULEID:; SRVR:VI1PR07MB1534; X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1534; 4:AfhWtWJbagslhmEm9pNXQLmJSnxKaIqew7zrCws8DV4Msyuue4C+gWnWBg1FMUrJ+PBc+v7GCW+z8P1ZdPy5mOX343a5j/3s0OumJkDP+piGhwSpVxOVf1AIJOZxdZ+aaF+04MYfr+A4fWlyG14xTvkhEJ+irm0HxVDgfnCEx13SP3y9VUw16y7MSiDdTJ3OGUMpjPTdoFjjbCuJyx6hXCqnyp1DNeIyPswA13b9egpvyxLwx4IgW2QTHP1upaK4pgVn9ca26RB9G2RBzwubyOjQcgiqZXHA2sxA3JqkOxgkC6c1HLfcU8IdFoDlRtNtJmHJlrFvmIBcV7MnRg4zBwpehe6XSKtnhdBNi61hvVmwwllpsU2Hc5T4np33YHX7ilJXK8tx0ORGXO/uqv+V+gLwsIi5NkTlSmlw3zOII39nNzQdlPCyy9kGnZb64zDdmn1zaCmDtqqBUrGxopMOS9EFhaWgL+iIUhWaztmKNX8= X-Forefront-PRVS: 00514A2FE6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR07MB1534; 23:OEBQRyT7C/BsSP7ZtNrKXkRJvKMwE6JO/pocDj8mY?= =?us-ascii?Q?GmTEQHdN4s+w224pxCFMImBFjw0k0BR9LNo2xkWoR/KLa7zVtS4iv/FWax0M?= =?us-ascii?Q?3N+tlJlFmux8uawcKGat6/ZFnsiNrtqk+NxjbE0jaFDBa0/8KJgPIcY78rxU?= =?us-ascii?Q?v5TgZXxFu6sbZJTR65ugUM59JIwoSSfGuPX7r2PJc6D/R2YGVvW082+wOpz+?= =?us-ascii?Q?TppR7B6uHRcpIqaJVCuE4LUCHyuUiNB/DUSISja49aFLclGcYhiScmwUSuqK?= =?us-ascii?Q?0cMSVmwmAmrZNc6MUrs2DwRmRrbBckbr531mmQt5oleNUhcvCa2LVA1v48QI?= =?us-ascii?Q?GSm8I6JdRWUTTCAgFTcjFfkinoHmk37q4QCiBakfdNpuyhMiKHvnSgXD9IcY?= =?us-ascii?Q?wWVRSsr4PSE+Pxy9gmidExbe/dLDSCBMl9ZoPl01bLtE54K9/DN1S3zQYYJW?= =?us-ascii?Q?FH8R7uP/zaxs35WxFadOkphT00FRBDnjKyNlkJ2bQsRQSZWJdwqy4eARGUhA?= =?us-ascii?Q?6f9qp89CmEFjGRlcKEfudMxTZC4MSDgeOy8Iqtf/WruUbVFHjkFb7+wJCpGg?= =?us-ascii?Q?8DJzYr+IG1it8lgwvuRnziuKoTZqIKMYLzBj2qLe3InvQ6grphsAklFnP6Z7?= =?us-ascii?Q?i6DRK0k348u9PS0OQMDVcW818GbugFOEhKKmUFhcvy5MSJoWSedXYE9NVjcs?= =?us-ascii?Q?+dWIYLMmObm/obMjnBLyPrW71bZPFhnZMa79ti7XS5KB/1USvIdLg8a6/IIU?= =?us-ascii?Q?CH6cFRKU5sETmde8DPZVRVQLugXXwsvyNa1hE60dakoFZRSibbE9RyDDS7a7?= =?us-ascii?Q?Y+IthfdLFNN/m9f8x/fRH8MsYR2/QKR6RDXVZKavsygA3bRgU2wH/xrHE9zz?= =?us-ascii?Q?4EkLIEgMS/jKj9x4WiygNS6xIAdSsinCAkeYIz1YWbkNzCY6gai5q5093BGl?= =?us-ascii?Q?T6Xj0WcDs4h+vzUk4rgwy/WOlX9ycwTMg8uGs6OsIvL2lRx796xPbiechMRT?= =?us-ascii?Q?oOZKAi3f0hSNIIoCB04eMFqGBykQWdn8arBIjdN28lLx96dgOy4OVIHxtOQP?= =?us-ascii?Q?rkQIDfK9gf7qfZ/3Byi+2120zmp?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1534; 6:BqfdaudDEdZ+lICNC8WtxAeseFunYxgqLBalNETjN2cahWqThyWkYqsnSBXgl+RRma2N1keXDAx4NgHGw20BymwL+f6k03i+Y6G6N/PvwPR93KNdjxRDvBRRDnfzKiXGgsCUogvtmS9DJDGJbXfMrgwG/OB9EhcMzZmrg9okGUFK2zifmOnpKb1rdJyE+dAODCuThrgcSezYSc02D2WE7YdodtMcPBKWc28LS9294ALNNv80yI8DXFT5zs4SVeQxxILj+cxmG/J48dnzGs/+H2KUTDVF34z7JbDEOsUBmlrUBb90S8Dorgv/t9v1FYAnRuaunzRCdRdJhfjR9KkZXQ==; 5:cuh5keDlSXGnkw/kYEfl8SpgRvCNCKrY35VpvX70Cx/hl+eWlkhVH+JC+OlzH1cBT9vUSgBXai07VeiHbjV6lO6N3cNrky9FcxtsxnzPvDosthbtqiPdUunPZbyMOdeXYJ4+SzDGMMBT7xKUCD4suA==; 24:sXjgQpNm782FKeKwdQLsoD+J4KUQeTjWZvs33kLleQI/IQbeOTLPvpMZ44mBN+a052fKl3NDSG5w9PrQwKFCBIPKzm9zqtX7/nQxGPPeGs4=; 7:AXe5F7XeWsiKcY5nVD7yXnKZ/8LixveE8Ap6uRm6lZ7YKUXzInvF2vev4pCwmK2jobCMbTNFsWBwhGvGMUGvMEosYXu9kn7xNjawRnFOqPx+o7XI7Q6NZ1gPYEgeFtxreK+Xm7lO0SSULVDV9o6n4IDI29NtRt1Vby/atZCGC0MiKVJFvFIR3kEIliP+tu/f4vA7VJOUTXnzuDKoD81ZB9pKxF6SG+MQtNeVp1jkunkl2b/4e7s29IvzcsZ/nyMo SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2016 14:24:17.6127 (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: VI1PR07MB1534 X-Topics: patch Subject: [lng-odp] [PATCH 1/3] linux-gen: dpdk: fix buffer freeing in mbuf_to_pkt() 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" Free dpdk mbufs and odp packets correctly when packet_alloc_multi() isn't able to allocate all requested packets. Signed-off-by: Matias Elo --- platform/linux-generic/pktio/dpdk.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index b45c9a8..0a800b7 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -755,6 +755,12 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, alloc_len = pktio_entry->s.pkt_dpdk.data_room; num = packet_alloc_multi(pool, alloc_len, pkt_table, mbuf_num); + if (num != mbuf_num) { + ODP_DBG("packet_alloc_multi() unable to allocate all packets: " + "%d/%" PRIu16 " allocated\n", num, mbuf_num); + for (i = num; i < mbuf_num; i++) + rte_pktmbuf_free(mbuf_table[i]); + } for (i = 0; i < num; i++) { odp_packet_hdr_t parsed_hdr; @@ -807,9 +813,9 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, return nb_pkts; fail: - odp_packet_free_multi(&pkt_table[i], mbuf_num - i); + odp_packet_free_multi(&pkt_table[i], num - i); - for (j = i; j < mbuf_num; j++) + for (j = i; j < num; j++) rte_pktmbuf_free(mbuf_table[j]); return (i > 0 ? i : -1);