From patchwork Fri Aug 25 10:49:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 111008 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp814744qge; Fri, 25 Aug 2017 03:55:47 -0700 (PDT) X-Received: by 10.223.178.2 with SMTP id u2mr5078406wra.150.1503658547823; Fri, 25 Aug 2017 03:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503658547; cv=none; d=google.com; s=arc-20160816; b=cJxaVC1N6nXAVq2FhBW0nKRVmVlQpkLsQfBf2aOxa03aQuQlABV1tEdcNRUdFrMeoj rhiFSevNTMje/lrgskpeHr5ENzalINmWVnkVk66RTb7QZnnN6rlAQrASSUHxU9PwBffV PSOOVri03c/9V5nHa0iLf1VVMPZLg4pJl6Gy4GWS3nPye/ouirBBtH6oC7z61SeGu9Dl FiHNUOrVBZNYzosFyaDiwSStp1NuUROoP7/vOcRIzfrpJ9zQHw3+C8kHhRd5zuhqP10q 0rCtPj1IKInWKJHSUKlSaF8wms5zeHgSC7M2Cm3BUSLTDRr60KznQySv7SUB/uESnUxS e5Qw== 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=drStGw3HNy3QTBgOsIZosheiqQFFRc87nTC9O0Ee5OY=; b=M87USKr7hviFrtfxDBCS5Noss1kOUDrPK0NNN3jEjARfGa246AFUSBENAX25TQCMDL ojCO+Q9q1R2J12cUxrM5jF6HjxuTuk6n0FIjBE+SpMafuSEtmMlQK0Vr+p06X7y0qZ4X +UlkkcLxzbVIt+f95HleXUaT8Ne8jcUrbJgWr8dYpWT6+4KjV4h4tYYQ9f94rMx/yMiJ B55QpS9Y4Gxqq5S+zK+DrKj/f04FtQoNfd7Gp5h3OQIIoEf5TBiW4oVeIxKDSB+RxRTa 74Uyr46B1MLprzLwi4KjouK3cj2vsOEmT8ryi/WcZgBKzcvbp1Yt06JTbwZt+C1Rk9l7 b+dA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 2001:4b98:dc0:41:216:3eff:fe72:dd13 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 ([2001:4b98:dc0:41:216:3eff:fe72:dd13]) by mx.google.com with ESMTP id 130si1040856wmx.82.2017.08.25.03.55.47; Fri, 25 Aug 2017 03:55:47 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 2001:4b98:dc0:41:216:3eff:fe72:dd13 as permitted sender) client-ip=2001:4b98:dc0:41:216:3eff:fe72:dd13; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 2001:4b98:dc0:41:216:3eff:fe72:dd13 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 [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 22C3B99E0; Fri, 25 Aug 2017 12:50:54 +0200 (CEST) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0063.outbound.protection.outlook.com [104.47.33.63]) by dpdk.org (Postfix) with ESMTP id A8C3499D0 for ; Fri, 25 Aug 2017 12:50:49 +0200 (CEST) Received: from BN6PR03CA0088.namprd03.prod.outlook.com (10.164.122.154) by CY1PR03MB2265.namprd03.prod.outlook.com (10.166.207.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1362.18; Fri, 25 Aug 2017 10:50:48 +0000 Received: from BL2FFO11FD034.protection.gbl (2a01:111:f400:7c09::133) by BN6PR03CA0088.outlook.office365.com (2603:10b6:405:6f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9 via Frontend Transport; Fri, 25 Aug 2017 10:50:48 +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 BL2FFO11FD034.mail.protection.outlook.com (10.173.161.130) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1341.15 via Frontend Transport; Fri, 25 Aug 2017 10:50:47 +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 v7PAnw6T032070; Fri, 25 Aug 2017 03:50:45 -0700 From: Hemant Agrawal To: CC: , Date: Fri, 25 Aug 2017 16:19:41 +0530 Message-ID: <1503658183-4078-26-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503658183-4078-1-git-send-email-hemant.agrawal@nxp.com> References: <1503658183-4078-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131481318477829181; (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)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(33646002)(4326008)(5890100001)(47776003)(50986999)(76176999)(626005)(105606002)(106466001)(2351001)(8656003)(6916009)(77096006)(189998001)(5003940100001)(104016004)(2906002)(2950100002)(48376002)(68736007)(6666003)(97736004)(81166006)(50466002)(53936002)(8676002)(356003)(36756003)(498600001)(85426001)(81156014)(54906002)(5660300001)(86362001)(305945005)(50226002)(8936002)(110136004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2265; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD034; 1:KECJZheR2fodc0n5QMUpLgGtEENwumLY2BfMv+jlJykSgIupxUJbqMTSJnO3WHn4ptcPoAJHxOtF1Vf1l11iJZgW2agf871fkgacc7if7bg3E1q744mm2j4WWBI3qTSG MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0ae44218-38a7-488f-32dc-08d4eba724ed 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:CY1PR03MB2265; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2265; 3:Sg5AzmheCSbgrP3DLOIJb4JDRc+RDZ3nDnOrnBGCZ49m7zAXPsY8rhmlez/KjsKQD/SaARjXqINjB7qoigcgj+uAfur2tqugAchaFxQwUGWJFbx5Q9RlnEXwQjC07I4MQeZfEIC9Eh+vWeYZihlYZjXeZXrf3dYzUnlEhWcRuEXiRNMXE65MmnvUGU7lPwusHBPM16x2ydE3yRregvHO/KswUwZZC7z9MsgTx024HNPQZ4Z67nrkaEeUwf2xmAAgAQ7hqnPPm+ihUZA6KnfESPEuL9a9tvOhfvv/6y0gPiS8I1XT+3+r3H+kBD8gQwN05upWufRq+FVDkek9TG0Gf4FONZuVmg+soIGN1WzogEE=; 25:mDVCZP0hQGRjzbajXSm2sjOIuywVToN9T8stMI+1hdE/e5PLCpsC8JeEQXoEO3zil2tlQgA+VB+D2vRvLz+grVrN/EcUb82OQAqdsD400Xd6ZXNbljAlOuE3thqoU+AZzyRn7qVr3c1+ibb9rs8s4xwCMvHm081oGx7nCD/CpbSgAlM2rzsQmcRGFv/8eKomwVbrPmohMhtHi0cGLl82QLtiJiqxpodPWODGdOXIqVGypp32CnLm4KrXMuBPzHt2SjRzp/ux6qn0hmwBy1rGGlBAOiNbwkNZ8mRgyokuhGhy10afCaF6fvUyh0KVHV0N8G3+U36ueHtnmCXOXjKduA== X-MS-TrafficTypeDiagnostic: CY1PR03MB2265: X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2265; 31:zaioe4V/p1rP8RL3CPZYjsdl3Lzod+cJDjnuaIYkzeOKdh8eadpAt5nAa6Zn8Fw1Bf2Yr3dPikHxubHHVKtDQ1tbMoYJw6enXTwTGu+aEAWJhvYBG6AtYj/h5Y/rcuksYwFG5BJFQy4ejJ/ryTDRIz8N/Rq5Bqu8PM2GEpCs/biBQWPT+4VQU79VMQLyiLMxpSs0R51ckakxiD35yGDenXyMTrqbtASm3gff906Wkrg=; 4:CASIlbaQFLOTK+u1yGtVPNz/+9p43s1Z7pEESDk4sTW35nMScovy+wIs3ylHibRQisWuFhbPii9qyl3AQz8AWUzamywY3eVbPLmJnuGLTsQ9LaNI5lrEQ3UTQG5cKTxyn1t1K44Kbunh3DEP6ddwZHhW02myP3jMmaUz5l/nPThA47CBcB48iP/gEk+vgR9t8j7GeEXfVFOnL4Q03dHrdyTHxyQ2F1Nr6B2KtvWD8pEacKUt1eLuAiy1nCyxSLVpopTipTVvE7Q2pxGASetOtTzQQ/RJZ10cN7LD17L0Ru0= 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)(601004)(2401047)(5005006)(13018025)(13016025)(8121501046)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123556025)(20161123561025)(20161123565025)(20161123559100)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR03MB2265; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR03MB2265; X-Forefront-PRVS: 041032FF37 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB2265; 23:Ekjab8foaabRBaUY8kRF8NYooLad4LUhA1zcIaNy4?= LhzUJC1s7YHtSlLkZdKvDD9c6Cx/RwHIvFAhw6Ngv5KVoNBCws6eqlTgUZBZbcLspQ8l+ttBf2hmXvdlSt0E8A7JaNdqUDEtlnjCSxU6QMhvLc5gcIwFAZqHxEDiHGMu6ai6jQxFa9fGAiSmj/zje1JvvmImDTTkeVApEk9VmPVT0nJFFxhPPnguwITS9hrYtvorCfrordn86Y92rZwP0pUjKOsN1ePrwgQmCCJBZYrAdbxxeoXFyFlmU+hvz22WN1Vmry3c9I9nA+l03eDfdfIfqxMPcC2ZqDkwDyRKpodG8sa0YHci9hpEJKIdfSa2KCYlJ0HyMZspSVIQMzCAmwkSP3NxWO4oK4gF0ET7ii0NBya0VNWShiBIz06SiPX/w27O6576ng/MsbP3AxNV8eYwxWmT7aSJ/1XJUbcvIWNQvm/BHfKiAgnja/4OYh9faWzd3bVS17mmfXyNrL8Qd+A4OR1ktKCz9kthvxq2lVa75JLIGQwliNOjtF/2VytDWUafulvdUAPJ2OQC79hFgojHSOfcf+Txv2GUl8vdNcRhSFfcPPe7MAKyi8rBV3v3b5Upzrk4vela2/Q/TpCcupjPWulLTM13e6+gRrpMiHVfrWVDG/qpSBp0On/FNiCzPK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rec75brKpRBF2+dLdkrYfbuyYXYrlXbzLn2znDqfGEI9oaa1Uz1AIapTUv4ogpnys=; 7:QxWgfWu5M2FOybgrT09iHmKLTF7UBq66/mUFSlQ7ri4qq6RBa2gUp0JGgg8tS+Jt/plbbwqtmLX8nBEdPvEQheONEZTQsYowdx5PpyEmYhRneIk2ZMVezcXHVUs1XT4ZIMYaM6TVs0yNdgm+LLMDtaWLq3oXkAdlbFeI4aOqDmxy7Q3NK3DE7AK1vA7xNUoSD3ZzvnTZ+Q66c3JpEZ11JMdiFIMLmbllJylbrMAS6r0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2017 10:50:47.6113 (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: CY1PR03MB2265 Subject: [dpdk-dev] [PATCH 25/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 | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 75a06f5..8611d2e 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; } @@ -582,7 +579,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) /* Not a hw_pkt pool allocated frame */ if (!mp) { 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 "); @@ -595,24 +592,25 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) PMD_TX_LOG(ERR, "err: no bpool attached"); num_tx = 0; - goto skip_tx; + goto send_n_return; } 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 +628,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; }