From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0058.outbound.protection.outlook.com [104.47.33.58]) by dpdk.org (Postfix) with ESMTP id 70CAFFADC for ; Fri, 3 Mar 2017 08:15:06 +0100 (CET) Received: from CY1PR03CA0031.namprd03.prod.outlook.com (10.174.128.41) by CY1PR0301MB0730.namprd03.prod.outlook.com (10.160.159.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12; Fri, 3 Mar 2017 07:15:03 +0000 Received: from BN1AFFO11FD037.protection.gbl (2a01:111:f400:7c10::127) by CY1PR03CA0031.outlook.office365.com (2603:10b6:600::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12 via Frontend Transport; Fri, 3 Mar 2017 07:15:02 +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 BN1AFFO11FD037.mail.protection.outlook.com (10.58.52.241) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.933.11 via Frontend Transport; Fri, 3 Mar 2017 07:15:02 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v237D50f005035; Fri, 3 Mar 2017 00:14:59 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 3 Mar 2017 18:16:55 +0530 Message-ID: <1488545223-25739-39-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> References: <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131329989024543211; (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)(7916002)(336005)(39840400002)(39850400002)(39860400002)(39380400002)(39400400002)(39410400002)(39450400003)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(9170700003)(626004)(104016004)(105606002)(4326008)(50466002)(48376002)(5003940100001)(110136004)(85426001)(2351001)(86362001)(38730400002)(54906002)(53936002)(81166006)(92566002)(106466001)(8676002)(33646002)(305945005)(50986999)(189998001)(8656002)(36756003)(6916009)(2950100002)(2906002)(76176999)(77096006)(5890100001)(6666003)(356003)(50226002)(47776003)(8936002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB0730; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD037; 1:OYA4crYO44+6qqMbxMXeVS0cfyzsLfhMsUaG4xnV/MUuyqmnTsQdnasgsh8/Qj0I1DMiGfUVHyWSd7qX87OK4qaxD5MemDA1IYevGxzXFzpX+jlwOoNUb/6sFgNjEXjplo7Mz96sKuxwItsq17RoqRXHbcmN4cZv2Rg5+QIvvOxGPQqmcdInfbXXkQ0wDMMaLyW+Lbq9rlHJBl2pWTHKRS2mb1yOSp9AI/XOPFy9C/dbs6woezaXMl1UA3IH8FwlHKKSP0m2F6XiNjdHuz2xIIinq7f6EuzE9E1UVF3hujugq2EtQBDAhcB/2MbXTPGN42eGEQ9yc6DVqPzyeSQQw1QerwAvmVyRySSiHmLYWMQnjC2FNMhiopLBudSZCTxMzvDlkuwTxWlRb8MHmoVdires3MykFZm/5QFo1vMKrLeayFdHVkrbxBsF2KA4bUXMnt30hsJMi7HeVYseP03ymV3Jl+Tb+3YHJtVb/08i2lRxZsPKzMsBu1se1AYhxR69d8C7GttFN3T4XKlhsYoBfegu/x+YGO7zqKcYl5/j+F9iZAqGx3s4fRpQF/01xXWvTLvXi28u6cINQE+FUtdDKUxEEWit6CUTVuKfdAhfTWmGxHobCFaSTnd60FouFfhaVhtx7aYBmn+KSSjjKicFkg== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 312f4107-bd62-496f-908a-08d46205029e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0301MB0730; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0730; 3:d71t86jn1zZ7AwMjMeDBQEzNij25WfV5iLZXrfrQoErdpSRMLzChOhB/99U1o7fB7PwhPHsc+bqAgNTY0cnTzhtg9j7jY7RMVmcfysHv2WuxNSXtrEUiRQK8uzxJH+0lJ2A0eH8yzcrCwXPNUjxOKQjgb0qUlokO6xGeC80rSEw+UF8+RAUYVwYDtev+V9U8jY+SFHDywUULbZLbzvK0ktOU51PHtoEsPl648oqVB5wZoOwDhC0SkNHgszO6GvH/AoQuGXWcCSpjZpuqCwPiQ0Le9M2SPa0dMCqZk4DyMdINnAtUbx+Yl+0BvioyH2hjrC50l0lgGE6zQhgS14Zv1/K8HSMYdgOPDM23846fcEAoH5k30I4x3SRDiFFOCKAe; 25:3UtTFEeCLfnn7IGXizoYJLoHh7tUjINNtSO7SPlSHIf0DL/3+u3TQd2pUK82NxxFkw7uAsOZQzQbI/nCsXkdYfp0J2qgwhk5D0CIa0domzZaGYtM1CN6x9iaWfFLMvaFGC4DeBw3aMoex1gA+VWyHiNl0KG7Rq+5AzArBhiIf09628W0Ihxs0NLPFWSL+WIcI7URRora+hNXfsJB9RI9jbkWD4JS4H+OwFkuYc9AZdoto+O/VV7oWl22KoB/zOc1DJDV3RPs9Jij9NHX5SmieBahLQKmuoUftfhjrLf/5dksYjlXvY5DjZUBazP60RrKOXcsd5amX9U9vt5Dld0R3N9bb4Ku2zAZ0olv6oOft5nFCaqfUHugtOrn1X9jROaIkyh09lpMmTmEJk1dc+FFH0EDSdPjUC39KI2a2BbBqYg1Q/B0jMtLM2B1Y0b2AU1ph65VUmDNTeDRYkrYJBnn/g== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0730; 31:H8s0EwJNV5dnLpFlKrqBwmitl23fl/iS20CWMox7ZmAmVPcdcE2WcDi3cObCrRnCJaK8PtZMJqKysFz/DhXGrSU+x2eRc+K+pWUSTPL6Sj8hz7QSdnXwDssjhQlngdAPfwNFm+qyStSkTTU1XDD0OwdqMxYeXrjqakkIO/VFhcre8t+faxw0N+vKg15HNw1YQP4CBAo3Fpk0yuOakYstqTFKH1fH18F/DwOuUjiqEBhg1PLV1+19aJ3pri1NOr5CYW19G+bAw0cjCNGfmEjNog== 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)(8121501046)(5005006)(13015025)(13017025)(13024025)(13018025)(13023025)(10201501046)(3002001)(6055026)(6096035)(20161123559025)(20161123565025)(20161123561025)(20161123556025)(20161123563025); SRVR:CY1PR0301MB0730; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB0730; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0730; 4:LFKHz+tF0A4q9ScP/QCRyZQ83/Jh5c8ELfJQijtt9EHHO8SJX1bnNBk4sjp1DIkCDiP9UeSAQBjEH16s2JPXHkP2gVQQBlByorpSejBZChSiF8zJlfWHHPKh5MSADrQKrn/q5NPi6EIeMCsTlNGgm1w+j89jGRd/4QM9hWTvgtcpC90ZfD2NfJtm600z3UjFrfLQA8VkxFLJ3K9N+bGPUowG/Oemkan+ERmQ4NjRgK/8HtQvPCNulypAhnuX5JSGKY5i5v7eGwhtyofz4A2QDys5qjGwk9GaywEOw9XTaRoLXozea8HCnx/MY3+EGwJzRXKIY9loWY0zHFqlAe4rjsDzS1secleLz6YBTL4Lwjx1BnbMss7kZsTRt2Dwc/Qw6wdAFnfUII2ti81g6qDye817Z107n8bE0gnyhfBU7GYtqP6SkwsbDyYVTKHtQ70I/9LKCmbPl7GOnZ0pwhQcyRiDTew802pWbNNadHJzIccF1KNVmucGzILlZ9MjWFHFBUg+CcCob8yVZJRWt5QNPDNos30ii2rSCCF+bZgMGLrRRjWdp9SRvbGzo3RXOzR8rQkfOQgc0m2tSAs3vK0uuzvE95K3r1JYTwt7chY8GPpKH9JMMsfNabuMpRT8ff6cItK26+G6BAN9ebliUxnLpzbvv4P/aA6DuFlzWCyb7sRJLkaaIdp/rrN+ECrkCJB2SNy7mrOKGriku4w3MLdu6s8USvm7D+zlk3i1VBHFzjglHyyKRDHlyDVHxHEO4lYP X-Forefront-PRVS: 0235CBE7D0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB0730; 23:Jweu4z7d9mb/vA+wgq5u01JMuVCzyWLFfoZ/kQP?= =?us-ascii?Q?rmwg21OdifoUw8v7mg4y8v0aqM43FQMQxGKroYVtRjd/7NE7i4LovmsWlaHz?= =?us-ascii?Q?1qbCiMJyADWqWWLHlinna/SXuWELMGV/7ht27AdkrqoRogjxWR+7+OEoMqXL?= =?us-ascii?Q?36m+YdZ1d8AaV9cXQDBgjnXPtaR4PWE7cKtZ7EbceWkU073C5viZ3VTab4BA?= =?us-ascii?Q?ZaOFF3eLeNb1COepnoJQsRO9PvV6/v7/sLKR/lNB3Se9qOCi5GaG8U/I8TCH?= =?us-ascii?Q?qzC00rorjqfh6zhVUUEESKvbqtTdt7115GEKpTgA5pNg1qL+7ZP13GVwOTcK?= =?us-ascii?Q?HEcjbw7R802s78Hn5ja/Yvgnh4JDmh+CMl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MU4W0a4gK1/WiuNod+5YjYa+7kWVccJENWiYIGi2nZzTeSRoRLCpHtuvXIL37/FCMVvEkyjcsw+4AejG6zLoO+nCbPqDoe1dypWsy25F3KjDDcXFeFfg3PNxMyG8j1sueVQxwMyMC1V04l8nN7TC17kENnf8dnTj4jum7zYL2TvBQB//xQUgoUxn9h+u3YmJ92np/hOQA8vYVxMNp2oqVsmAEo3r/uZug== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2017 07:15:02.2515 (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: CY1PR0301MB0730 Subject: [dpdk-dev] [PATCHv8 38/46] 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, 03 Mar 2017 07:15:06 -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