From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0041.outbound.protection.outlook.com [104.47.36.41]) by dpdk.org (Postfix) with ESMTP id D92AE5A44 for ; Wed, 15 Feb 2017 20:07:31 +0100 (CET) Received: from CY4PR03CA0021.namprd03.prod.outlook.com (10.168.162.31) by BY2PR0301MB0727.namprd03.prod.outlook.com (10.160.63.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Wed, 15 Feb 2017 19:07:29 +0000 Received: from BL2FFO11FD026.protection.gbl (2a01:111:f400:7c09::181) by CY4PR03CA0021.outlook.office365.com (2603:10b6:903:33::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16 via Frontend Transport; Wed, 15 Feb 2017 19:07:29 +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;caviumnetworks.com; dkim=none (message not signed) header.d=none; 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 BL2FFO11FD026.mail.protection.outlook.com (10.173.161.105) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.904.16 via Frontend Transport; Wed, 15 Feb 2017 19:07:27 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v1FJ5fM4020023; Wed, 15 Feb 2017 12:07:22 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Thu, 16 Feb 2017 06:09:33 +0530 Message-ID: <1487205586-6785-35-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> References: <1485172803-17288-1-git-send-email-hemant.agrawal@nxp.com> <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131316592493540297; (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)(39380400002)(39850400002)(39860400002)(39450400003)(39840400002)(39410400002)(39400400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(48376002)(5660300001)(6666003)(110136004)(50466002)(8676002)(2950100002)(5003940100001)(38730400002)(76176999)(47776003)(50226002)(81156014)(8936002)(389900002)(85426001)(97736004)(33646002)(50986999)(2906002)(189998001)(356003)(5890100001)(68736007)(4326007)(305945005)(86362001)(104016004)(6916009)(81166006)(36756003)(575784001)(92566002)(2351001)(53936002)(105606002)(54906002)(77096006)(8656002)(626004)(106466001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB0727; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD026; 1:32ARh9kW6QOcBBVSTMvCkv4QPXf1qc7EDsAxeiBBCT0uynq/QrUQFuqvlJqcgr6H5b3KT7u8Czs1Gb68t4eRsY81bi2hB8gfBLL0ES+6RTbWHDH6tgNZRuDAovW6505JNhzXAJK2ovI/fy2YEcQxNO2KGwizJDPy7l/m7XgStloZQC0g+msmP3bWXe9JULJoWg/eov3WaFrNyQJb3ac0jAIM2ZmO4gG9hHgtdte5ACBtAujoh81LWaQ+fdqX5YDgQwu4zQlWsEK0oZbjozreczinM1LVYvWsDWKvhdJizZGT8MWMKpJ5lKZZ6Askaix4/vo4MVWFN99t4uSygiMaP/okG8l+8BGMyfi8jVRhr6q9RN5hOa4mSLyOGCkeSibNaWs4ltadd0f+ByngA5UyNHI6Gwo/RHukVXiIo0cX59uckXi1PHa492+4IBHNjVmF5sWIJbzBr0rixCbMhMeKlqn9FY1DW3HRdkfxriaw817NcJ8lP2VAIwE+tSlT4AsMS+bQNazaGTS7UfJ4gCefQQEchkntOKiiGuNBgEUVspex00j1RGXZlK5n4hpZew8ANUtj2mHv9yxph2TTbszlng3FLOGHSIniwd3BY2RhJumrudJfqU1+4WYxy631bpq8vKxl1Rgg3TUtZO2AVm4ubA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 6991acad-c881-416a-33c9-08d455d5e328 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY2PR0301MB0727; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0727; 3:lbzMiaovb5HhbnCzbRJiSAVEYV+ht3AiEwkWaljF9ObneMNUl5XxrQ5CIL9LgQyPbp4Ur64ZTcV1Ryx6lbHKmKp8AWfMX0zOGEf7YQESd4mysxuV3pVDaM0Sp+tQKc2VtQh2R8vLkiNdacUR/yFxSEGH6Af3mDP0mnr0OPJuO0rj76TQBb4DWwIEuhjfBe7imAgrPv5S14m+msfpohMKupMXSs4wTuGcSJXCvy5J/KewFZravAvN7fNWDs5V8RRnlachtD0BB9E5peJ2oh25XigyvQKBU7pau6+oAmo6SVQT4aH39HCjEsCSXQnXe54XZwIISvwz5ht1tse9juA6uaPFOSMruuO1lJrAhSKGd1URldm+GjOu2Pv2hTZrF0EF; 25:3nY/L988iyRKdQunrvPIN69mKKxt80wdy6pG7OYfZp1d+wxHubuE2HJ49ubSnoyFui68YpGo0BNmGW3BZzJDzcT+9k+EIAValObfXMzgazNGAx86CVbnTbhW4E1PHpPOQAxBtX2aqTnRAHwQBIiPlCV1ubHUZsnjYBYBT05SFKHsDa5X2rwu4VwcP7/UfvajuOL8PG+YGE4uZ3fo9Uyu2AJWgoJD9Rk+sqYAlnu5MjeaihR+qYTzpQXuv5hGrbfkc+HPcEHmYrM5+jjOsFtGW00/TqoHimTHG1ps+rfkCV7XqCFKUTA7o2LCkRXZsJ/6xgV/vEQi8vi6L35oObnAE49hFKuT8p4wrJjlhNyI9V9x+7CRSkFfvvqFbCBaLWIGd/XFovZgSbVKDYX5dZqNQcDN68LzfaTO3ytb4OEQEut1WHdrugAjiBv8A4OG4FCRRSPB+j9cNaJLU1DIfg4D4A== X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0727; 31:LDh02jjU6E0O1Axbg4kZ8rA13GAYvP+wjixRsixZUnDOO6cYiYOyFYpZfthadCqjBbHvfN63YOKA07fGHxtm32qG92oEkNU8ExgnCOXYZ4iEBbzH/rCmpqtRqDy80StlIPLCyPwQn3UX+lNppajoVnjvMNMgkVuaOXgoGvHAyorBWtDEWu6W1d9son4HTENNEnMWfGShRfo0OhH/U1xhUOmTUDWpIyiV0ind9RzwEZQWoriCUZhNDTp9f52TLIZt9wq46sXhT6CrUxV4CQm3oA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13017025)(13018025)(13023025)(13015025)(13024025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123565025)(20161123556025)(20161123561025)(20161123559025)(20161123563025); SRVR:BY2PR0301MB0727; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB0727; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0727; 4:mZ5HMQjl8WRz7VHREmfn4+zR1wWm411BGinLzCbRZ2prYx9yTHJAIBoIWMpDA/Dmct2YdpEVhjmkmhyGCeAsEtvp/DHb433Lgn3Y2YWPHXnSP3+HFFzxB9MN/6bgmgUtcILt2VPO+92FeG3ZFIPp9rOUWs/27Wv7xeIVy7fP+sidA61asAx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pKWAFmAwfUTYia5wY68SFVjuN5U4PN?= =?us-ascii?Q?9VMvkQZ67iEfZ35Qi0a/Nwawz+VYfYrGpIvITCkobbL9xDJO8j2f+fOxcMWH?= =?us-ascii?Q?VlmgI0D59OmT0lDXr6/89S11FUu6+luRiapPXoOnugrmaz2wQxXnwURXpnzL?= =?us-ascii?Q?AGn/QsSDQlbFlOjtSLd6zZF5h0e8=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0727; 6:ML/oMCRdmsaP1vJ7RX7IxcfWBDwlIcXwOdbtBUAt7yhgzLEZ3EQFc9YkpTRvd5z1nEzb/f2ImRbo4u4jr4Fq5CTvEC2osz62VXGsfHejwewEZrwm/ZTeALh2+daOKOzmEdrEcn9SPxTOI/Znc8Fw5/hvf6LRmGOJSxzUdoJy7ddtcHOU+CT6Lan4DpFRAH4zqMfv462APZ331cMdlPhjjoZJLia4ThZYoA9rMhS3uCGQ8YjQUQtEuD2T0wbk9/PSWBeg86aq+tFi4eFHjdfB53nhN/Gx4CKFFlzh83kulr37CVNVAvhDiYK0Ss51qhFdns8kxscE8dUIUJGzauDMZUe8Dk1MPXjJH9CEdMkiOvH8gcKLX+i2cLRtuGmaCLuqbsQrMZy2qQWswrgDq1fZF/gFgLfHpG27L5CGIFvtogo=; 5:+nisR8ps3scjYmFdzmFO0Gm6KCSNoS1MHfp/+lQ6xLvXduBQXz7CCBnh/47g0xjLEv2QI9vuWQTozRVsxAltVzY3G4Xtz2qbNIM90w05uwHHzf4f64CkbI+LDKpWAnjbfEE2dOE3L/GtfgcUBna31xfxacsybg0erTqzRuDL2Myi8Q61CLCLdWkeJARKisRE; 24:SvsxhlBt5GhptoYVXDnwvrSxc66jYTuZqPuzQ3DksAYYnj5pBbeHShT5iyJzEK6XYM09EUTKL+OosuoEtfoljxFp+gLmsC1eJmtqEa1AmPw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0727; 7:8JPo/PhDxpskhjkIhq3LPFD22zeY7XwGaiUyD+VV6QLUbmIZYFa1hBkliwfpfJDNTBhj5M14HFPM6LBvBdj9M12DxaKO8+2aw7uweQwJEy+sMEHVyAa5/nE9SUFHUOQcHsgrn64ZaIfE1ZTz3w2b/ALIJm/kTnMgxpvciD2icyfzla86BRcVQlAPlioVZGm0q6VSs0KeMgzvUK+/aiISoKua7dptSNLYfWwX0UDjvubVQnd07hq/GmxipipXeYOM2AJTFP3O/9BDiMtdVkVLXhNunN4/1s8kWr775TSMaluagutK6TdS4imID0mHfQAJT7AVk2iOBBCgJtBYJE7XHA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2017 19:07:27.3884 (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: BY2PR0301MB0727 Subject: [dpdk-dev] [PATCHv7 34/47] 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: Wed, 15 Feb 2017 19:07:32 -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 dc4d98a..5b1613c 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -59,6 +59,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 # library dependencies diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 53987cf..93ca0fa 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