From patchwork Sat Sep 16 10:52:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 112804 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1617654qgf; Sat, 16 Sep 2017 03:58:17 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDzRrmnAaGA1/2H4mSsUaOd/IUmEGkOHOHcCeOfnCqoqkKtw+anbFd2t+wZuilQLotrasFl X-Received: by 10.28.54.3 with SMTP id d3mr4811112wma.56.1505559497441; Sat, 16 Sep 2017 03:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505559497; cv=none; d=google.com; s=arc-20160816; b=K2seEyMOnsuvi8c2WfyLPDWvz6kjo/bYsr5u4EaPu+T+qdBArlmhCqSCyt0Dji+ZCl v7JqT/tmPsms9fIMWAzXvgbix12rKx7z09JAvicOk6P0m894Tmguq0dJAR5GDDz7Zf4O Z8Yb68AL8gjYJk16EPwAdy3yqgvuOq0TRIyAbq7LdRKl0/M48BHYNMPbyaSlLjaC8un2 Bju38/c5j/BuG11eo2DdlR89MzpVa33sHqwHBKBQPygGQwRUVlRjoCYfHmnvQIwAFuW9 +SNxcFKsoXurDAj4vABdZYISI59Y3uZWerHXYAP3YnThDVgNO3Ev8CLE/jtC+XgZT/gS UuxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=9qeXslbXR0YMS2nDe2XXIBgnYuW68HDv+fIC4O2jVi8=; b=FzVUq0x3AKHPLXFogN3tj9sTbTw7xD/5ssxGT9bcd1R1gtpfSnyaqtCwaBzqwBjTXJ i8sFlhWaXSbd77Veo1MSBQQu3BpcpPgorLYb7NkRepG54SC4IQB2/PYWw/FPvimXvTe3 K5lV4BrCSBp1eiRaKGZZ4/rDmuo1n44c1iIfyUBmJZ6bb9oJY/EV0lFU2FfjH7bPASNv 1yl/twMgqKAAr1sr4/J4OgBNrM+E46Efi6igh+zf8l5ZBGT7VhHnXKj5ovYkSeZNOVm7 q8MAfKNmH9NLiU6y5GFx1gMfCOcXehalgDwDZaFGPU9MGoKax4T7r7WkuJuLez/W+qtv pwZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id 29si2466946wrz.280.2017.09.16.03.58.17; Sat, 16 Sep 2017 03:58:17 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 320AE1B231; Sat, 16 Sep 2017 12:54:12 +0200 (CEST) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0064.outbound.protection.outlook.com [104.47.40.64]) by dpdk.org (Postfix) with ESMTP id A18DA1B219 for ; Sat, 16 Sep 2017 12:53:51 +0200 (CEST) Received: from CY4PR03CA0003.namprd03.prod.outlook.com (10.168.162.13) by CY1PR03MB2361.namprd03.prod.outlook.com (10.166.207.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Sat, 16 Sep 2017 10:53:49 +0000 Received: from BL2FFO11FD044.protection.gbl (2a01:111:f400:7c09::130) by CY4PR03CA0003.outlook.office365.com (2603:10b6:903:33::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.8 via Frontend Transport; Sat, 16 Sep 2017 10:53:49 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD044.mail.protection.outlook.com (10.173.161.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.13.11 via Frontend Transport; Sat, 16 Sep 2017 10:53:48 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v8GAr6v9028328; Sat, 16 Sep 2017 03:53:47 -0700 From: Hemant Agrawal To: CC: , Date: Sat, 16 Sep 2017 16:22:36 +0530 Message-ID: <1505559161-29222-23-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505559161-29222-1-git-send-email-hemant.agrawal@nxp.com> References: <1504860327-18451-1-git-send-email-hemant.agrawal@nxp.com> <1505559161-29222-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131500328291548909; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39860400002)(376002)(346002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(50466002)(498600001)(2351001)(8656003)(16586007)(110136004)(2906002)(53936002)(47776003)(5003940100001)(8676002)(5660300001)(2950100002)(54906002)(68736007)(6916009)(97736004)(105606002)(50226002)(316002)(81166006)(81156014)(86362001)(5890100001)(50986999)(77096006)(76176999)(189998001)(85426001)(106466001)(36756003)(4326008)(356003)(305945005)(104016004)(8936002)(48376002)(6666003)(33646002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2361; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD044; 1:HjwInJOcvwUSjL6UYG+mNgHuAGtcf30EXyEFbLztePHYgBjsAYWOYjhwTUd+5TUhXWC1+XkIot8WUBcc8l8TV2yDbTcI7AB109nyu4Kc/Oz/IhEZ0rGDGUh0jwPUilwb MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8c8f31ad-8429-4830-dd8c-08d4fcf1361e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY1PR03MB2361; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2361; 3:wH63OIWM0M2A9gt75GS61hdIhs6VqGLS4QDr4RBg+RuMwFlmImxA2E/L7oBh9sWVi/GZOMAgk5l3uERFPG9XjcGGGtty7NB4nic/g0qR8b69mm253Ij8Zxg3kxv6xGY2bK0B9YJIUihY12e05SFwTwsRXvha7wxALTmD6lMM/avzCratDV/SyYUBx9oA3c/B651gFkRfqENUOCWKxYuR5HS6tsKc2vcFNRwb+SFeKHdzpQwpvWKWsNpD/FdtxEBGzU/K6pW2KtSXnDoQ7FUPKHXRyC+WN9ciJWt14F4f81hc4o4iWPWvHDGcdOdEUGQkcbgwYU+EDCLmCyA+0b86EqAnPX+/z2SKiR62/zEFQMo=; 25:WYIq7+oRRZjZlHClYdqS3R0+IIeigTzwx/SnXIbmMHwsTo6sZrXG2G+h4FLenAbV69zWm9hKDy/GOmasycIT8DiCN0z9dzk7M3f0KzaC0DA9ZHK+WK/DwZoEAY1YIDQXO77KOj3B7nhxCeKcIvCTzEMFYw+Pm2xOZ0kzzy/tvgZijEw3v8wN5HIVcwKtnyFqZAB79BMI3Aik16mRqe1lfo9G+SDswXJUW6dlyV1KpSlYhX6wosddOTW/7l1Hvh5yLR24jcKyMnvue2HQZtsaNTb6z1WJOVIWKa4o+Del9y159OPya67fQgl0QSrvjnwbpsMiTHwc614taqdST5QJjQ== X-MS-TrafficTypeDiagnostic: CY1PR03MB2361: X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2361; 31:u25aCVqtH4+VXiWsQDbkumZzVAbftW9m6Pu3OULBCFa7LZYyxXHv0lBENrcI1tTJIgZ5jLGb70uDuHEDWj029fN930sYLlyvOWR/Bp82u68TzE1JPNA2g6ldvR6uE7SW9Gr2OV1gRK0VQMRhBZI0llAfHF6vU1DAqpfRpayx4K/HVGPDFjLCgbl0+WVZ2/KhAeEkmFA74oVMgHAfMWz5AfZ7k84IR++ykGuLvG45Wx8=; 4:YKmUEpR2Xfy/Fps4LJxjERcVydpeksYlgBPrMzG4Gc1FB/08Pn5QamnvQtHjxdkBCJWQiI8fDdIxLO1cNwigHk7YfF3ypeDo6WOJx8ACkqNqTtNDdn1WJ1mz2gri8SiSbJ3gSl+3aHdsEYSaiC6FEpj5xGg2tMbPRpRqeJPVuK+aGvwBrYUiNsruBhk/KLKds+Kk8MnJBYNQFiAHx98X/w6pegjk1QxyOhWssu1tZtCADV+zyzhc/ndzfiHVupZ4pZs50hehiKo4j5qzz2LZkNCtmE7sU5da1VTCEFFnEU4= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(8121501046)(5005006)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(20161123561025)(20161123556025)(20161123563025)(20161123559100)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123565025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR03MB2361; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR03MB2361; X-Forefront-PRVS: 0432A04947 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB2361; 23:V1CFAHen79kaW7/RRmH6wbR2PEVUSVTYimgxgpSot?= Ottszw94EleetacfMmUBFweDSvjAXUB2uayMsp/ajqh+AYpuluv5SSiBceheDBAcBZry4UWr+cjaU8uheMymgBjoWzBArufU+bTVguxfXOtM5BhXrk+uExIJ3Jh016kArQIar8uJW6tJPycnoNBbA+bvZ50RyI/CIg0fWF4hEpfSv4nr7a/GLZRMtsNU9exbFjPp7lzxuaedJnAqKMtMhe9UwxeBAOq68j0YvFGtftv7q0u0tIBn3B0M15OsyJ5Ual9jPanJPmHR3OkZQ6J80OKA/0ZYQ9QTpMrN++ODNTPga4eDjB+ChjtQOSog8c30JyEeVbElX7IE6u6tyhVEvp0IGJj9bqMkxeyr4fkjeKACJNvemYUa5xzqUOPTP+caZ8yjqox8qvzEKJsGsYmziaztRpl+NlLYn7p6ju9VH5mC8liIFuJjF3XSLwbNa686oMnivXLZr7YQPekJnkT85VfTeQXk+vZYlbSkugmc5yTvoNj7kOLfnux5UjMujXiLkfWL3TWmVcj1r1dMl91ytTnCMxyuWZ8eiB5YSRp3X2O6a3NI3veHkyFy/0uOMMRbXtrh6ofNYvzSzfaHxNIBtfoijbysaSAkS5ltUV8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rMZ2fpF5fKzWWHik+YKzf1TTnpB5Bww0ch8TRY=; 24:BCFz80JQfhOcZa9JuyPff9nWgMB07e9ESZlaCsrM9xe5DtJbvPIiYyZzR4DMoTnCEOPAn+FrcMA54TdhDhrI8R9L2IpvXxhFZcDfNRczJWM=; 7:wCDb+iB103VVsjl+6EAQqh1n2jcprriM+/kNo1aqBzHBi9jYPp94CUM7O5/sNXq5Fmj1DjXlHi+4K6ekXz4ibRjgieJBnJYvDgiQVaZQTWfyFN46F5ETv3IFWUESYH8rNTelj97N6FfryIKuTCUT9ZB4xia0ippIIP8veV87OonqnxbvuGoGc4MfEpApDjmvBMPyXRI0aK1zrGTyw0Kji3kAOTD1c1iVeb4ERfyq/pw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2017 10:53:48.9832 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2361 Subject: [dpdk-dev] [PATCH v3 22/27] net/dpaa2: fix the Tx handling of non HW pool bufs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The current code is sending 8 packet in each internal loop. In some of the conditions, mbuf is being allocated or freed. In case of error, the code is returning without taking care of such buffer. It is better to send already prepared buffer and err for the current failure only. Fixes: 9e5f3e6d3658 ("net/dpaa2: handle non-hardware backed buffer pool") Cc: stable@dpdk.org Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_rxtx.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) -- 2.7.4 diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 75a06f5..7cfa73a 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -350,7 +350,6 @@ eth_copy_mbuf_to_fd(struct rte_mbuf *mbuf, if (rte_dpaa2_mbuf_alloc_bulk( rte_dpaa2_bpid_info[bpid].bp_list->mp, &mb, 1)) { PMD_TX_LOG(WARNING, "Unable to allocated DPAA2 buffer"); - rte_pktmbuf_free(mbuf); return -1; } m = (struct rte_mbuf *)mb; @@ -382,8 +381,6 @@ eth_copy_mbuf_to_fd(struct rte_mbuf *mbuf, rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size, DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd)); - /*free the original packet */ - rte_pktmbuf_free(mbuf); return 0; } @@ -580,39 +577,35 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) mp = mi->pool; } /* Not a hw_pkt pool allocated frame */ - if (!mp) { + if (unlikely(!mp || !priv->bp_list)) { PMD_TX_LOG(ERR, "err: no bpool attached"); - goto skip_tx; + goto send_n_return; } + if (mp->ops_index != priv->bp_list->dpaa2_ops_index) { PMD_TX_LOG(ERR, "non hw offload bufffer "); /* alloc should be from the default buffer pool * attached to this interface */ - if (priv->bp_list) { - bpid = priv->bp_list->buf_pool.bpid; - } else { - PMD_TX_LOG(ERR, - "err: no bpool attached"); - num_tx = 0; - goto skip_tx; - } + bpid = priv->bp_list->buf_pool.bpid; + if (unlikely((*bufs)->nb_segs > 1)) { PMD_TX_LOG(ERR, "S/G support not added" " for non hw offload buffer"); - goto skip_tx; + goto send_n_return; } if (eth_copy_mbuf_to_fd(*bufs, &fd_arr[loop], bpid)) { - bufs++; - continue; + goto send_n_return; } + /* free the original packet */ + rte_pktmbuf_free(*bufs); } else { bpid = mempool_to_bpid(mp); if (unlikely((*bufs)->nb_segs > 1)) { if (eth_mbuf_to_sg_fd(*bufs, &fd_arr[loop], bpid)) - goto skip_tx; + goto send_n_return; } else { eth_mbuf_to_fd(*bufs, &fd_arr[loop], bpid); @@ -630,6 +623,20 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) dpaa2_q->tx_pkts += frames_to_send; nb_pkts -= frames_to_send; } + return num_tx; + +send_n_return: + /* send any already prepared fd */ + if (loop) { + unsigned int i = 0; + + while (i < loop) { + i += qbman_swp_enqueue_multiple(swp, &eqdesc, + &fd_arr[i], loop - i); + } + num_tx += loop; + dpaa2_q->tx_pkts += loop; + } skip_tx: return num_tx; }