From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0062.outbound.protection.outlook.com [104.47.41.62]) by dpdk.org (Postfix) with ESMTP id C34D7D1BC for ; Fri, 24 Mar 2017 14:36:44 +0100 (CET) Received: from BN6PR03CA0016.namprd03.prod.outlook.com (10.168.230.154) by MWHPR03MB2799.namprd03.prod.outlook.com (10.168.208.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.977.11; Fri, 24 Mar 2017 13:36:42 +0000 Received: from BY2FFO11OLC015.protection.gbl (2a01:111:f400:7c0c::172) by BN6PR03CA0016.outlook.office365.com (2603:10b6:404:23::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14 via Frontend Transport; Fri, 24 Mar 2017 13:36:42 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none; caviumnetworks.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 BY2FFO11OLC015.mail.protection.outlook.com (10.1.15.59) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 24 Mar 2017 13:36:41 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2ODZhg5005481; Fri, 24 Mar 2017 06:36:38 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 24 Mar 2017 19:05:34 +0530 Message-ID: <1490362538-20854-19-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490362538-20854-1-git-send-email-hemant.agrawal@nxp.com> References: <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> <1490362538-20854-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131348362015854528; (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)(39400400002)(39850400002)(39380400002)(39840400002)(39860400002)(39450400003)(39410400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(9170700003)(81166006)(2351001)(110136004)(8676002)(54906002)(50466002)(36756003)(356003)(47776003)(5890100001)(48376002)(8936002)(305945005)(85426001)(38730400002)(50226002)(104016004)(6916009)(4326008)(2950100002)(76176999)(189998001)(105606002)(5003940100001)(33646002)(6666003)(50986999)(53936002)(2906002)(77096006)(8656002)(5660300001)(106466001)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2799; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC015; 1:ppUFP15eSQescAVFSompMM9Gn+lWdTTstwhW7f2eynzrrwa+f5VNX08+sNE5oyYtYK7hAZZyUWQqNQIsQIgo3lvRCDliEL6NiRIKOgYtu8Q8wv4BUcZdHuAbsqzemWT7n+XmsUHF+i4sdBMBIgj5RTbzRDZe+mLtC+owkF9agQbyShW5h12H8k55LTOAHDpPUZH20iMqeg4I9o3QV3gEVYMI91qMknhCo20iFlCyFzciuVp9003f9aRlo3kgLce1sNMcOasYqJzLND9knI8yPqp9MV5I5YcBu3CXSlL2kl3/et8SBcdG0hPAEb8gE20/E1VlLGWk4/cwLLO0WtFz3zgJOq3M3owBh62B8xtuYWHzOBZw0TphayvMepy5HCjH2HBlX1r9miuuBVGZ3+6nwRjDW1Z3Yblh3gkjpst49i7zZ4X8mLTkoq292F3rwihSi9cESkg6w7oEjFGxuhLsYHVj7CxxQa4k0702zZnebF1Ww+oY0vS5oKR3f9nmYyIl9n2Hr2oGJn5zY6tR43R6nkHu1mcIb17Y3PvnlWTk3sEckpcSEtDIskZvPpYjeExANpNmkaNTYyD+fccEFYZr2kcs/3nvoZLlD5iRoqlFJzUU3llO3e2CzAnWEc52wERQlN7a87pJwAxjnddwbsVhMw== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 5276ef83-323c-4630-c4d8-08d472bace2c X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2799; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2799; 3:I4lco9e201/+2JbZM9Pv+H3jz0QjbYtQKA4MOTEyOoT+rU+KpdxKBA+nLe9h4pytN9vod0cj+ndaoaLTGD1504YHHLAt77VnMjBGWkfctH6+jrTuIYLwMN6X/HzU6fLAJ7w1GRUtCPXt2fluLCe4dP5uTPwT4WTqiyAZEUAE1OZht5Duw+QGaY4jrItkiHbu7lk4Kty6u0+24PM3KOV5QUlUU13wGZxwgjZHH7s6/2wJdh4pAS/IIJy7tqycBJOo1xbkSF1wG+XYl4sR147mNQROXSsuW07E9uBv/rXbJljoUJsxk9UqYCeQ++px1PA3O/KBrMAI76O/6pDbn9YgLARh0H7ZKosgZV8R5qSmXjuLJJUpHkH4+MHbFexpV6h+; 25:Ngs+hGkNIDn4kDOei7CIEmMM8Zidy1nsY4arWbCtPCs871M98bxxrWd6GHz8m2ptX/NSfhXDWGZE7YBUON8uVZVNMlBEpFXBc2muZ0ioNy9sYDxIJ3X+UZsEOo9nIYUVTAzvWB/UAeapeuczZaGStxoApz/Ic/wsqNsE/KWXFMQnBNgC+iOqF8HHq96aA7BuCIGyTRcP/PotKB9EGGq+axqqxsO7jOeY5tpZN0oWkH+pD8tC9zBMO6IdxoR9nYQgsjIZmWRaTpKped2Mj10P0GgOJN0WY2SMjhBVwlGdyu/RxQBa0ZgkV3Xdvlxv4+zqm3Bi+3IudP6qpHTlN2TDjo7TPIzMRlcWzhMNEwE4cZ+i5RBvixzgcx1DTk7Vl8r47+aQxOx7NCffrBY8RFRhTCftMTYqHVtEclO7KhDirkQwhJl6XTjLiwHba0LW+We8CmUf3aN8C0qTwTYvrX2+qQ== X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2799; 31:SpJh6Is+1B1X/Nd6D2t3jS4ZRNS++x3yFkZHmAv0G+45OGFSfY6hBmjPP1DI1ZrZDwhMk94SheBtcEBicst7AODaU+lF5PcjO/fYFL7KwrjgDwLRAE11sY6D/Oa4k/OZOnjj6FcytOdJnK4b8DEaObL4f2uJ6B4+/skSJsxfwJAVEISDdz3Cq1YV2gDtfai0w6Ru+GO8Bp2G52+4jQVkX5f8HeSMa4D4iNh5lsBqe8e4eeLF7f9oKjYsdf/GPNRNqNAwG4L3F0tILxTV+W6N7dm1qovYCc47wWd4mvc51AQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(5005006)(13017025)(13018025)(13023025)(13024025)(8121501046)(13015025)(10201501046)(3002001)(6055026)(6096035)(20161123556025)(20161123561025)(20161123559025)(20161123565025)(20161123563025); SRVR:MWHPR03MB2799; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2799; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2799; 4:GGbxOZB9DnHMnosvKi1PuHqiVdSw2cgt+U205D2m35aUShTkCqIU9eOyslj4GQxFUmJgpD4/QYgqB3TW7BnTfdLzbpQbYylnuFOdepFgr7zLkWeo4jCEGc81+T17hcEPvx3jH7OYY8ZfHDyyRce0HT4G/0a/GwbrmRgaTnlVSvmoNHqtvahFKnf/Ytt+BhaItz678TY9Fuo09cG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tu3rr8suEV51bU43bs=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2799; 6:WWSakrE1vaOTG+3QgXNck/tSQlZypcZksu395BpPRAt7WG9jwPB6UecoUMi4apX+GRTnDiqM5enJTEnRxM1/P61eo4z/R5ULWtToZqm2oTMo9fOucUNBpd11kSxenJw19qTuO8ZzWuX+WfrHCyLVM1utkRKsMLFbo5ddhn9xWcr1XEGetnc+f66AN/5uyLWShQ5MJ9OkB03/39VrvaXiPG1fqK3MYtw/2DSimXWJ0I4LOtL/gq131h50Fj8xBl8M4TEfZNqxBfnnIPHu+4aY9PpPJku/zxlDIyLp2nWo+VvZ4g2pMQYmtoorYyAJQ2xoJQC5Hsp9HSOUymFf9TH2FdTXisgUdiw3X9lKbPNQfYMFjUDo0UrZ4c/wS9/28XUUDn3ypl3Of7ZH073pvO2fGHAOJp3zcqguaeM3W4OCkmQ=; 5:Iy9jFsX4/oH3J93rZC3IIdqyGbJnIBOtqX9yoIqSwTO0OPWPAPL4awDvR3X8P/GdwVckFETrTDmOL5hiIBBvdwcRRqUBADMUvbjbGXz7CzdfGu7dTYz/TDF4MFHCcRGvzQ+ZZdQ3EaVpPuDYcIIaqOAeeagpd8eB6XOuE1DbX1h4smeJiR5eei39jyy+skUb; 24:FREYh+0AHHjauoHpDfkxLWRohWmG/hVGH4eTHNMnclA3jWk6p7mvmhVrHXUNjdBHqeQEw+GsppeiQcY1GClzQfy+5M7jRLRjHsqnUReKY9I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2799; 7:5cnn4Qlco/F8fFf1l2+NHD634VMezBJVWcXH5yxqp1QIYLgHOw++JfH2KrxDrxwiNCrHzqkxSw4uaY7HqU+sweWbMvJo7hqWTemasJdD7Dy/y3dA0ISzE8txqkCg8yBK1AmG6splzwQrV7zNMKRb6lDHVZf/VYXmqRLec0esXdpvOhrnBSoVbCWfHO4BOlOXB/A4czAMeCodL/9MUK+78uGJYge8j+b3yIrpnOkSzZE2m+WlieFz+k/ynZlL8M/Zl8UpFCZVsdt7vCLXuqPlF4oAbKUNB0Q/rd5jsSWmgm8VrLI+rNoTtxeTONS9JA1i8+eW2a9ZGhufkmJye9RLiA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2017 13:36:41.2578 (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: MWHPR03MB2799 Subject: [dpdk-dev] [PATCH v10 18/22] net/dpaa2: handle non-hardware backed buffer pool 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: , X-List-Received-Date: Fri, 24 Mar 2017 13:36:45 -0000 Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_rxtx.c | 75 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index c1ea33a..a94761c 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -191,6 +191,55 @@ static void __attribute__ ((noinline)) __attribute__((hot)) DPAA2_GET_FD_BPID(fd), DPAA2_GET_FD_LEN(fd)); } + +static inline int __attribute__((hot)) +eth_copy_mbuf_to_fd(struct rte_mbuf *mbuf, + struct qbman_fd *fd, uint16_t bpid) +{ + struct rte_mbuf *m; + void *mb = NULL; + + if (rte_dpaa2_mbuf_alloc_bulk( + rte_dpaa2_bpid_info[bpid].bp_list->buf_pool.mp, &mb, 1)) { + PMD_TX_LOG(WARNING, "Unable to allocated DPAA2 buffer"); + rte_pktmbuf_free(mbuf); + return -1; + } + m = (struct rte_mbuf *)mb; + memcpy((char *)m->buf_addr + mbuf->data_off, + (void *)((char *)mbuf->buf_addr + mbuf->data_off), + mbuf->pkt_len); + + /* Copy required fields */ + m->data_off = mbuf->data_off; + m->ol_flags = mbuf->ol_flags; + m->packet_type = mbuf->packet_type; + m->tx_offload = mbuf->tx_offload; + + /*Resetting the buffer pool id and offset field*/ + fd->simple.bpid_offset = 0; + + DPAA2_SET_FD_ADDR(fd, (m->buf_addr)); + DPAA2_SET_FD_LEN(fd, mbuf->data_len); + DPAA2_SET_FD_BPID(fd, bpid); + DPAA2_SET_FD_OFFSET(fd, mbuf->data_off); + DPAA2_SET_FD_ASAL(fd, DPAA2_ASAL_VAL); + + PMD_TX_LOG(DEBUG, " mbuf %p BMAN buf addr %p", + (void *)mbuf, mbuf->buf_addr); + + PMD_TX_LOG(DEBUG, " fdaddr =%lx bpid =%d meta =%d off =%d, len =%d", + DPAA2_GET_FD_ADDR(fd), + DPAA2_GET_FD_BPID(fd), + 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; +} + uint16_t dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { @@ -331,8 +380,29 @@ static void __attribute__ ((noinline)) __attribute__((hot)) DPAA2_RESET_FD_CTRL((&fd_arr[loop])); DPAA2_SET_FD_FLC((&fd_arr[loop]), NULL); mp = (*bufs)->pool; - bpid = mempool_to_bpid(mp); - eth_mbuf_to_fd(*bufs, &fd_arr[loop], bpid); + /* Not a hw_pkt pool allocated frame */ + if (mp && !(mp->flags & MEMPOOL_F_HW_PKT_POOL)) { + 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, "errr: why no bpool" + " attached"); + num_tx = 0; + goto skip_tx; + } + if (eth_copy_mbuf_to_fd(*bufs, + &fd_arr[loop], bpid)) { + bufs++; + continue; + } + } else { + bpid = mempool_to_bpid(mp); + eth_mbuf_to_fd(*bufs, &fd_arr[loop], bpid); + } bufs++; } loop = 0; @@ -345,5 +415,6 @@ static void __attribute__ ((noinline)) __attribute__((hot)) dpaa2_q->tx_pkts += frames_to_send; nb_pkts -= frames_to_send; } +skip_tx: return num_tx; } -- 1.9.1