From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0050.outbound.protection.outlook.com [104.47.33.50]) by dpdk.org (Postfix) with ESMTP id B5D9FD004 for ; Tue, 11 Apr 2017 15:50:32 +0200 (CEST) Received: from BN6PR03CA0006.namprd03.prod.outlook.com (10.168.230.144) by CO2PR03MB2280.namprd03.prod.outlook.com (10.166.92.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17; Tue, 11 Apr 2017 13:50:31 +0000 Received: from BN1AFFO11FD027.protection.gbl (2a01:111:f400:7c10::165) by BN6PR03CA0006.outlook.office365.com (2603:10b6:404:23::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17 via Frontend Transport; Tue, 11 Apr 2017 13:50:31 +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 BN1AFFO11FD027.mail.protection.outlook.com (10.58.52.87) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1019.14 via Frontend Transport; Tue, 11 Apr 2017 13:50:31 +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 v3BDnjG2000706; Tue, 11 Apr 2017 06:50:28 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Tue, 11 Apr 2017 19:19:29 +0530 Message-ID: <1491918578-4902-14-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491918578-4902-1-git-send-email-hemant.agrawal@nxp.com> References: <1491725483-6619-1-git-send-email-hemant.agrawal@nxp.com> <1491918578-4902-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131363922313251950; (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)(39410400002)(39860400002)(39450400003)(39840400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(76176999)(104016004)(77096006)(54906002)(356003)(33646002)(2906002)(110136004)(8936002)(86362001)(575784001)(53936002)(47776003)(8656002)(38730400002)(50986999)(50226002)(8676002)(81166006)(2351001)(2950100002)(6916009)(97736004)(5003940100001)(85426001)(5660300001)(36756003)(4326008)(5890100001)(106466001)(305945005)(48376002)(105606002)(189998001)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2280; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD027; 1:G+xBnIfS23p3DkeJFBflYMh/qzqjck+0QJcLOx1iKzmKMX6HkwLoyI+JaDxP+SqX1CmiCtyz3T6oZULFq3ljQ2LxRoiCjuw/hFxx9HgC9VLYYhHULG3afR2zdPuAh5ozyj9LRDv7MiRqtl86k6heCk2ZenRquYmBba2/6hmH3sSm0b3SS5wPxbuJZ+5GB5/6NF9E26g2luxRb48m0kwN67Q3KczHTO/OEneK6K5kVqvqxp1gRxisA8Etw+OYIsnf+wFrKGDtPygAJVWnrB/PPdNK0WEoxK1xbs39/4sYdTU7YMQxoi36FrX6UoCpYMyo3RgPKG3yL9h7Crfmev45hv7eo858PSpXBGso6IjULFdJi5cPZBSZyhmKbhTtK3yu4y87Gdzimqu9ccdVILV0CVw64bZhMJ2Bpmwr/HdxP3WtgVO/qB7A21LWt7V6kDbTkmdwDTA2U4U6h4jizcArVN9FphSMp/sAIgKJ3WhnXkfBRD5RgOIzX9eCpw71/5LgqcHRwc5sfRRp2PSyRK3HW40Jpyz+e+DcDbEwaShE0uCLizglZA4oD3p2i1Vq/l4wxWGI56Zt3b8fWxyWw+ingPcDrUrh+rnPTKjXpcG4IEPO3w7h6WpjDBjUsfXK4qNTcam7Ob+cpuXoDweh1PI76rdbCyvkGPKkeHOuc5hjsu8= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: f6b0563d-7bc0-4040-2b0d-08d480e1b83d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030255120)(201703131430075)(201703131517081); SRVR:CO2PR03MB2280; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2280; 3:QkUxliE/wBVp6sLVC9dRB5mIDijP1W3MmZnDtEEPP8SQfv2PSLdCZ0O6L4HFn9pvKSUIs3HjOnWayaoZ/pwg/+1+m4PgGz52A10DkdrOnhDGar+klfJ7PKbEWcNWeM5CGgNJYj1YSNr2TRpBZcGJsBe93BjmkDR9uKhZ6abS9WUnxNhVmilmWUZ8q3e2ABKFeld5JIwCYhcF6U3E6Xf/cBfjgCT/hJ4as2X0Uke3Ty5YrFgiyeYlPC5IYckcXZ2PULIJi6m7C6PWX2j8h1ZWJvmLtu8+97Wy5iY9eYoCsfSBcWjsucE6k+pQNMpBMUBpvc5tdW+d4NIHCT3w3/bui4UJqpUW6NcOyPqkFQ6DAr4B9G1WwchXKOgim8d4h8vh8IT+mIS0va8eY/6YvTy3M2zdSUvLS1iNDTS6RhOmkwJ653Xpp6PNloDaKLYyHCW5ABbcVuGXF6BqWHAcsNx23Q==; 25:slNru0vSgRzHnR84usRIi6CQPGU3hs7gcaJCvFOsV2qEK20z70YJ7BSaten53OtY2YcyxW4DHi0TsLFrdPINQRE0cn6XDaj907qzA2uPNJVr3v5jFlFRqMcDFP7NUGTOBw7asrzdYE5w4BzRSQOQCtzXGxcviRWRHVH2SQYmO9rXFPCjyv0AbrgKHfaH/8hoN1pvJSez7Rs1xKvK6yHnH8+kfi+MxO3rXFe/3eg6Pdc7mjTBLBmuaB6ZTcFEFy7qjjdjOBTiZOVTZG+nrFxncXPTYqCIZyjDaYker1Uhd69jvXrg9zvDT59EdwnM47imk77+1W7z6v+QaHkXWH3iMDoBd+91JM9GEOHpzTOOLaRFBXuRoelTcinwVZad7BKpGB1Kz4QQPN6uI25VA1p3cnZZTXPfJtJVVYy96dfBJo7TElNgXyzWhrVuypkMpGkgzsVV2XB10HK3hIoG+sZLTA== X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2280; 31:va07aKdxUXgFvI77TMQGatm66cxHQwhRhPYUjgos1k/x0TetQhcq1TbhzFUbkVVoXzBe5ul3EUzxPHuMlbrDb+PK+EHNKvYI+AR/EBpqKVUDmoEHu3IEmbCdGU0cdmfMwFJPJK2Ql3sh4TV6crpvcoTJi5MPiyQ2eXXi8DuFpmOtbXTjd6wFEXjMN6aU1KUuMwweKVvENLS4i8F9bctgsNfD5u3lGsOtIH6neYugnX4KjGXMHG/m13PPq+T2ikOY0t9Zlgv9Si0+DoHl5ZeLpbtQ86ZGVLtb+3I4BYqm37s= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13015025)(8121501046)(5005006)(13017025)(13024025)(13023025)(13018025)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(20161123563025)(20161123561025)(201703131430075)(201703131448075)(201703131433075)(201703161259075)(20161123556025)(20161123565025); SRVR:CO2PR03MB2280; BCL:0; PCL:0; RULEID:(400006); SRVR:CO2PR03MB2280; X-Microsoft-Exchange-Diag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zMzv3+Cve5h0HFUAc6SY8mq14IbYcl1Mv3EluJZltJrugcjlmk5vMU7ZjA2X01RRlG52d; 24:V2yoStxMbnqy7PovCzQAeH9WzK4tinBcmDULrH29dnVzInRr/jMoJ7/XE1eyCRfR6u2PJwy/ZTf7LsZZAEc4AmGhGiuwCQnI0BO/jZqfKSI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2280; 7:wIT+B2sciAdR4rb/hik9BY7O6CfONN+XPid16Bm9n/F4h059SXXrwgqt9dbeYYwZRJICBERoKCR2RUT8hbFbrx2tgzDmYdUFTi0u5EOdZ/0uAhtqbYASCgnNWQQJ7Vf7BD3eTMzmLFgcCoDtKB53bH7XWlefk6nB368qoXie1PSX83WXxfGABAd9hkmbqt6t/wXqblqRFEDmfY/kQGGHU7vbycRIOVCr0Ajn+m9vxhBe8MqX+pPa2KXySFCcaSaXrwMyd+pdUMnreLE16cwpDpbGiI3ngU9Qv6wnjaUgEBRBTYorxV1V4oQuWfkDylfHrG4gwYadG4+qMk8o8SC2Ig== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2017 13:50:31.1379 (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: CO2PR03MB2280 Subject: [dpdk-dev] [PATCH v12 13/22] net/dpaa2: enable packet Rx and Tx operations 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: Tue, 11 Apr 2017 13:50:33 -0000 Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/Makefile | 1 + drivers/net/dpaa2/dpaa2_ethdev.c | 4 + drivers/net/dpaa2/dpaa2_ethdev.h | 3 + drivers/net/dpaa2/dpaa2_rxtx.c | 260 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 268 insertions(+) create mode 100644 drivers/net/dpaa2/dpaa2_rxtx.c diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile index 1f66c0b..ce65542 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -60,6 +60,7 @@ EXPORT_MAP := rte_pmd_dpaa2_version.map LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += base/dpaa2_hw_dpni.c +SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.c diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index e037bdb..9c47c69 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -679,6 +679,8 @@ eth_dev->dev_ops = &dpaa2_ethdev_ops; eth_dev->data->drv_name = rte_dpaa2_pmd.driver.name; + eth_dev->rx_pkt_burst = dpaa2_dev_rx; + eth_dev->tx_pkt_burst = dpaa2_dev_tx; return 0; } @@ -732,6 +734,8 @@ free(dpni); eth_dev->dev_ops = NULL; + eth_dev->rx_pkt_burst = NULL; + eth_dev->tx_pkt_burst = NULL; return 0; } diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index a56b525..7196398 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -77,4 +77,7 @@ int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev, int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist); +uint16_t dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts); +uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts); + #endif /* _DPAA2_ETHDEV_H */ diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c new file mode 100644 index 0000000..25574c0 --- /dev/null +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -0,0 +1,260 @@ +/*- + * BSD LICENSE + * + * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. + * Copyright (c) 2016 NXP. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Freescale Semiconductor, Inc nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "dpaa2_ethdev.h" + +static inline struct rte_mbuf *__attribute__((hot)) +eth_fd_to_mbuf(const struct qbman_fd *fd) +{ + struct rte_mbuf *mbuf = DPAA2_INLINE_MBUF_FROM_BUF( + DPAA2_GET_FD_ADDR(fd), + rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size); + + /* need to repopulated some of the fields, + * as they may have changed in last transmission + */ + mbuf->nb_segs = 1; + mbuf->ol_flags = 0; + mbuf->data_off = DPAA2_GET_FD_OFFSET(fd); + mbuf->data_len = DPAA2_GET_FD_LEN(fd); + mbuf->pkt_len = mbuf->data_len; + + mbuf->packet_type = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4; + + mbuf->next = NULL; + rte_mbuf_refcnt_set(mbuf, 1); + + PMD_RX_LOG(DEBUG, "to mbuf - mbuf =%p, mbuf->buf_addr =%p, off = %d," + "fd_off=%d fd =%lx, meta = %d bpid =%d, len=%d\n", + mbuf, mbuf->buf_addr, mbuf->data_off, + DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_ADDR(fd), + rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size, + DPAA2_GET_FD_BPID(fd), DPAA2_GET_FD_LEN(fd)); + + return mbuf; +} + +static void __attribute__ ((noinline)) __attribute__((hot)) +eth_mbuf_to_fd(struct rte_mbuf *mbuf, + struct qbman_fd *fd, uint16_t bpid) +{ + /*Resetting the buffer pool id and offset field*/ + fd->simple.bpid_offset = 0; + + DPAA2_SET_FD_ADDR(fd, (mbuf->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, mbuf->buf_addr =%p, off = %d," + "fd_off=%d fd =%lx, meta = %d bpid =%d, len=%d\n", + mbuf, mbuf->buf_addr, mbuf->data_off, + DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_ADDR(fd), + rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size, + DPAA2_GET_FD_BPID(fd), DPAA2_GET_FD_LEN(fd)); +} + +uint16_t +dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) +{ + /* Function is responsible to receive frames for a given device and VQ*/ + struct dpaa2_queue *dpaa2_q = (struct dpaa2_queue *)queue; + struct qbman_result *dq_storage; + uint32_t fqid = dpaa2_q->fqid; + int ret, num_rx = 0; + uint8_t is_last = 0, status; + struct qbman_swp *swp; + const struct qbman_fd *fd; + struct qbman_pull_desc pulldesc; + struct rte_eth_dev *dev = dpaa2_q->dev; + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + RTE_LOG(ERR, PMD, "Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + dq_storage = dpaa2_q->q_storage->dq_storage[0]; + + qbman_pull_desc_clear(&pulldesc); + qbman_pull_desc_set_numframes(&pulldesc, + (nb_pkts > DPAA2_DQRR_RING_SIZE) ? + DPAA2_DQRR_RING_SIZE : nb_pkts); + qbman_pull_desc_set_fq(&pulldesc, fqid); + /* todo optimization - we can have dq_storage_phys available*/ + qbman_pull_desc_set_storage(&pulldesc, dq_storage, + (dma_addr_t)(dq_storage), 1); + + /*Issue a volatile dequeue command. */ + while (1) { + if (qbman_swp_pull(swp, &pulldesc)) { + PMD_RX_LOG(ERR, "VDQ command is not issued." + "QBMAN is busy\n"); + /* Portal was busy, try again */ + continue; + } + break; + }; + + /* Receive the packets till Last Dequeue entry is found with + * respect to the above issues PULL command. + */ + while (!is_last) { + struct rte_mbuf *mbuf; + /*Check if the previous issued command is completed. + * Also seems like the SWP is shared between the + * Ethernet Driver and the SEC driver. + */ + while (!qbman_check_command_complete(swp, dq_storage)) + ; + /* Loop until the dq_storage is updated with + * new token by QBMAN + */ + while (!qbman_result_has_new_result(swp, dq_storage)) + ; + /* Check whether Last Pull command is Expired and + * setting Condition for Loop termination + */ + if (qbman_result_DQ_is_pull_complete(dq_storage)) { + is_last = 1; + /* Check for valid frame. */ + status = (uint8_t)qbman_result_DQ_flags(dq_storage); + if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) + continue; + } + + fd = qbman_result_DQ_fd(dq_storage); + mbuf = (struct rte_mbuf *)(DPAA2_GET_FD_ADDR(fd) + - rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size); + /* Prefeth mbuf */ + rte_prefetch0(mbuf); + /* Prefetch Annotation address for the parse results */ + rte_prefetch0((void *)((uint64_t)DPAA2_GET_FD_ADDR(fd) + + DPAA2_FD_PTA_SIZE + 16)); + + bufs[num_rx] = eth_fd_to_mbuf(fd); + bufs[num_rx]->port = dev->data->port_id; + + num_rx++; + dq_storage++; + } /* End of Packet Rx loop */ + + dpaa2_q->rx_pkts += num_rx; + + /*Return the total number of packets received to DPAA2 app*/ + return num_rx; +} + +/* + * Callback to handle sending packets through WRIOP based interface + */ +uint16_t +dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) +{ + /* Function to transmit the frames to given device and VQ*/ + uint32_t loop; + int32_t ret; + struct qbman_fd fd_arr[MAX_TX_RING_SLOTS]; + uint32_t frames_to_send; + struct rte_mempool *mp; + struct qbman_eq_desc eqdesc; + struct dpaa2_queue *dpaa2_q = (struct dpaa2_queue *)queue; + struct qbman_swp *swp; + uint16_t num_tx = 0; + uint16_t bpid; + struct rte_eth_dev *dev = dpaa2_q->dev; + struct dpaa2_dev_priv *priv = dev->data->dev_private; + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + RTE_LOG(ERR, PMD, "Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + PMD_TX_LOG(DEBUG, "===> dev =%p, fqid =%d", dev, dpaa2_q->fqid); + + /*Prepare enqueue descriptor*/ + qbman_eq_desc_clear(&eqdesc); + qbman_eq_desc_set_no_orp(&eqdesc, DPAA2_EQ_RESP_ERR_FQ); + qbman_eq_desc_set_response(&eqdesc, 0, 0); + qbman_eq_desc_set_qd(&eqdesc, priv->qdid, + dpaa2_q->flow_id, dpaa2_q->tc_index); + + /*Clear the unused FD fields before sending*/ + while (nb_pkts) { + frames_to_send = (nb_pkts >> 3) ? MAX_TX_RING_SLOTS : nb_pkts; + + for (loop = 0; loop < frames_to_send; loop++) { + fd_arr[loop].simple.frc = 0; + 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); + bufs++; + } + loop = 0; + while (loop < frames_to_send) { + loop += qbman_swp_send_multiple(swp, &eqdesc, + &fd_arr[loop], frames_to_send - loop); + } + + num_tx += frames_to_send; + dpaa2_q->tx_pkts += frames_to_send; + nb_pkts -= frames_to_send; + } + return num_tx; +} -- 1.9.1