From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0068.outbound.protection.outlook.com [157.56.111.68]) by dpdk.org (Postfix) with ESMTP id F368E9AD0 for ; Tue, 7 Jun 2016 18:42:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=E+PwRgcm0Bir9C3R6cehmdj3+KAnZCuiqoBRTllJVOg=; b=J+GkgHRlkbg5uSyREnOnoMEDDgd57T/9IhnO+pHt4vJDFcSIDB48RHDQcnKmK8TMsql/t/F9DLj0iilZFpZqLXXTcI8rmrhX2FAq/NFrzkgi0jGIb2QXUrPeYxpJZER/RyoUG9hMVNAdJfBcrg1FuzDB3iXE4qIeb/9lsamSXYM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) with Microsoft SMTP Server (TLS) id 15.1.511.8; Tue, 7 Jun 2016 16:42:18 +0000 From: Jerin Jacob To: CC: , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Tue, 7 Jun 2016 22:10:27 +0530 Message-ID: <1465317632-11471-16-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465317632-11471-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1464540424-12631-1-git-send-email-jerin.jacob@caviumnetworks.com> <1465317632-11471-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MAXPR01CA0054.INDPRD01.PROD.OUTLOOK.COM (10.164.146.154) To BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) X-MS-Office365-Filtering-Correlation-Id: 86e33348-b15d-4075-c49e-08d38ef2b256 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 2:Yn1zK9H9soNHzGpvGeHr7CcK1MVPXeKA7xNJglip75fh1N3l0KV9rbdHLDij1Pki6OEovMb6cx/ZmeBKgLs8eB9vPZwxfhy8FsBga5aq+Zen8LTMNGXK/uyqWkMSMKT7luCRMs3ArDR3QyeE7iUx5BGwDh3SR60gl7wnh2iGd8deNIbTgKM7mjlQRvqiSQuE; 3:vUDZmNtg7PWxqFTzYf0K0lU1yNPwyNKKu64rtuJdSUywI3KCrWNfG86TpC+QkzQad8G68hyztyxLaP5XidnA8bzzGHz2OBT2nfX19jvdiFMTVwx3pEvM1FXduoBr0QUT X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 25:XGY0MV9ll1zPhLeBMSujr/ykn18b5M6Mfp5OONi5OzSAlm47vCtPFvOSO09hzt7OPtFIizDiGg+PdKGRupiRONJJ+bW2P/9M9rmQFWkgXuuyTGU4fJNWe1qCZvCGy3A/UcvpDZR3CC1JoaCrg6XTCJDcjGkb10HgxSfb+wfXVE3JWR6naj/bk85Xipc3P4AykHreMhzdnzg09i2zmJ4wAMut+kBP9dkktT0SXZUlVLgd9iLGH+1bTos9Rc9K2c8AF8iAZCE3sfVvv/Qomw1/uf9mjpLTYIXmR+u/VGHay665Mos5Cgb9zZFBcFrhVhh+n0ZBZF5OiFSyaSd+A5qFbPIgSgxuCxJh3m415OI/OZrU4WUHkF7RRcU5NZ3qFRAEaui6e+SOvhtTuP/r1ea7XXOOBSaqbJwvtIClYeMKosj8WAmsiZfR+WmmuRXx0ojG8Bbq2KKLAoxnZwmQZzEFN7UcSlpYL6uGaHNv3cETf6npC87wBF7vk6MchHSuzRMKx/eiSgQxNPraZX/WvY40T4tbB/v5FbRQfVuik7Y2u9E1QWKugyg7aisKXcSoqPIsNorxVcd+uxmZ/ja6u+szLt8Of5zagDpqtcVQkM7nXeD+hHtMLDCfESUJ0P6M45o0FCzaMZ7oSM7mTjJSi4IQRoi++OtVFwlvxXc7jncR7UxzRniyjMQXe6oYP8KaK3ZupS8mpV39+DF81eSEAfLMl8ehCSTLgk4T9AFF4Tlah+GChu7cWDMZsIewMzsbUj9h X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 20:KpFIQjXYP2Ito0hZqMSjk/VZ4ISij4QMPxSvpKfuagQwBlxTm228la6EJxp81DMyPeWRmehB1jC6hzqri5F5CqZUExVoMrxOPvny/d8tajscrLqP4T8dVpEqcSke1L9n3DymVpCH8XVvOx3wQ2QJ+U1tGReZifLF/bFweL9JPeAa/A4OZhrZ56xA9vIjswg4lDRD8Z9W30VuFI+Gd0kKMAcTo9ZVR1y3N5o4rimbN5bKzRzfe+dlgVCh5HUEYaAJabNTcfHcoWPwmK8c96EaCuu4U5ytrz/4Hw2KEreSRbqQTySEfSYMxIn/rS/2pltDOO4lUNYbinwSfBIptmadMjMUdpZ3r8jFzUjwNpWA21SAtH7NA3oJBx/+bcJ18Jheo8LmSMSlVy7LBHbEFnMCDYuxdTaz4RQwGs/N8VcdXt4w/onN7VgNBHLMpqwh4zsx2wYYk2JQSgkEx9G3c5oK0Uh/iWIe8v5mM1NZYTbaQXNHLCjfUUY65CCxv7MLFOXMYihYlDGZQq2rNhb1iHmISfLaJTOe1sovOzMemfhc99RZGKdO8ld3Z09IYemGQG4ppxBYWqXnwwMVUIm3o7n97jZ/I68VpanCEsPnqpf7DJc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:BN3PR0701MB1719; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 4:HJCs5/H2yYeZwcFKpxw4aLBo+cTiqY3CoDOPkP1g8UpIsEEjg959HlvEEm1/v4VCGef4DINKunGHXiHdXu0og6Yztj2tmDEfsUv1Vh4kvehChQTaIiZ/5d+727vfn0we2SKdT04oN7IRNZC3p5Cabixy9fhS7IzCMvj7qVW7+oSWO1/M7q2AE0liEvHK9F1oNdoN8nvU2iCV2YmH/uE8AxyX/BB8yTTgM1Xw1ZqkrGqAxvVQkmA1hpCL7b8fzabSpl8QwlR4yGNM63qffjWVHtBhuBTMm8gam1GF1iGWdbcDzpin/dL42CGW06rRNpsbnaqP7PsNffPSF9w7Mb9/+uq2Hqt+qeLkrOoZhcTxuHNc7quISToEP+WF+WB8kq1v X-Forefront-PRVS: 09669DB681 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(199003)(189002)(81166006)(8676002)(81156014)(47776003)(66066001)(36756003)(92566002)(2950100001)(586003)(2351001)(48376002)(76506005)(42186005)(50466002)(4326007)(77096005)(3846002)(6116002)(5003940100001)(53416004)(5004730100002)(105586002)(97736004)(2906002)(5008740100001)(106356001)(189998001)(19580395003)(69596002)(101416001)(110136002)(19580405001)(68736007)(33646002)(76176999)(50986999)(229853001)(50226002)(5009440100003)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1719; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0701MB1719; 23:BfcBnNSaDDnyuwpfQEQaQuD1ALUkycv4WVBCqdk?= =?us-ascii?Q?tYHMgNUGeoIsBgSXAlB4NNRJ1llVHAfYhVZy1aNG6ugH/ABslCPvCss+btNo?= =?us-ascii?Q?L0JoDh3JTh+TH4f7I+FghYnm8x7rRIexA7OjIXsC1VLFPokc5UCZNvCfYSe9?= =?us-ascii?Q?Hsc1NjNAK+IGctXbLmHM0uxdOtLpQrg/ghtX008364uBUwFtxKmUZ0AtbjFj?= =?us-ascii?Q?Ei6parDueMn1I2NJc0EtVaZNhnvBCFvMSq1r69DRu4pmMi8zeDi8asPLzamV?= =?us-ascii?Q?A9oL+dDjjDUeiZ1nO/k18E3b1OKlWZC2+0dkz6OdCOaz2Byl51ZGR9B8yzhl?= =?us-ascii?Q?8FX5T2hQEj+6tEdl8DDxz9vl/bGVrlKHd/5GTUhmpQzZxdtDbGXO7E916Vde?= =?us-ascii?Q?FIDInMelq8ZfkUQKdO20E17+7bzS5qxK7WvcCGGJIgTNo/CPlj1S5JJYnYub?= =?us-ascii?Q?ePB/OkD8Z3pKgNem2UOYuZqxePs7YW5t3v3C7MxA8HbzTU5uAZmNlJI5aLwn?= =?us-ascii?Q?AbgiAdd10CXFyO2uTpZbzd2vVAfh6oAUFbxBUSS7ipbiBZMXrLIiLf2ZM+EY?= =?us-ascii?Q?Mq90ilR669oQVouJuJkgyJpQP5EkV8/vKc2CFYClfWboKbRK4nkcZtRLwyUF?= =?us-ascii?Q?3+GWDudePmp8eeia9f+mn4pDxltIXpovWro1QOqfhvS1FvXBOD3Cah3zWw6i?= =?us-ascii?Q?j52NMAzMwJ1BSXcDXnpFy/qh7EbvP067QHr1mhr+3NqSdUh30lxk1wmenQGQ?= =?us-ascii?Q?Hb585ITB8hQ6edgDTzz3qxjNSxCEpg18K5sP3tEjAAhVDIPRjbq5e2URZjtg?= =?us-ascii?Q?PvHapQm0XtUmCfR3zeFkE1wWGObwygyeLX+/UwZGFh34K92JTxMnIJxBkgI7?= =?us-ascii?Q?qKZ8WiiPWeeaj7G4gVK30Qja5tWCzE+2RaTEQexTOAImTTPnCQ75JthMf3/c?= =?us-ascii?Q?WHXn0bk+HKESOJfNCXoWgjr+AHFBlqRUXt0b6lm8hkTxsdAF96Iu1kXMisXx?= =?us-ascii?Q?0kerTEm+egoHLFWVPQDp9IGJvD219Sl/GVVo6I8LbP22q3N0JtkFUNRA6IV0?= =?us-ascii?Q?CCopft82RBx98fm3/LM24o0iL6wGyoHTU+3wNtBmaCCITkNDxfwVOLGw2Sis?= =?us-ascii?Q?0/uXT5iBDXSNI44TQD8bmT7B12+55/PTPt73I5mQ3rgQNL8sDFQy26Q=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 5:cB5Aos1EqeFPMhWjlMgt361jy7byHEKSUnsFEG6kP/sLVRxt9vkNYf06Lw24jZMoyjNooojp9Ym2AFyWVGbFn6RB9B17S5KFFUMdKFCUNAUuQHIZ90/3vh4ZPiv0K34gqJ3vEvrc5nQEmVmUNERh7A==; 24:dXvXKXxgMwpN2A9zdfd/STeIaywID2Eoe6TmxyOa+C/h00vvz52oRi2KX2BJVJQlQCcHp7lfaMpkU1FELH+xY1w6ARE3LHdoWFirkR58Qb8=; 7:f1q1For5SX9rMMDP0qUAoNV+/exYOT+g6RMdwr4RoM7cjXRWkIF6JAn3Wm7t6Lwj9kKd0s4yKYb10oGo1B8+HQt3vj8Z2wmMWCqin3JzhYvKWTMtM4SZO3NeyO9hRxMkKSWnHERAl4nJD34H/MnlgSqNaPqlD3ujsGZJr1q44J0s5WvoRzecpV+oIGXLy1YvrCUOn/Oevw0sZj7vaxF4QZOPnu/mcbqMr7NX8l5IDqs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2016 16:42:18.6021 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1719 Subject: [dpdk-dev] [PATCH v3 15/20] thunderx/nicvf: add rx queue start and stop support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2016 16:42:23 -0000 Signed-off-by: Jerin Jacob Signed-off-by: Maciej Czekaj Signed-off-by: Kamil Rytarowski Signed-off-by: Zyta Szpak Signed-off-by: Slawomir Rosek Signed-off-by: Radoslaw Biernacki --- drivers/net/thunderx/nicvf_ethdev.c | 175 ++++++++++++++++++++++++++++++++++++ drivers/net/thunderx/nicvf_rxtx.c | 18 ++++ drivers/net/thunderx/nicvf_rxtx.h | 1 + 3 files changed, 194 insertions(+) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 5da07da..ba32803 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -88,6 +88,8 @@ static int nicvf_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int nicvf_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); +static int nicvf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx); +static int nicvf_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx); static int nicvf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, @@ -594,6 +596,54 @@ nicvf_tx_queue_reset(struct nicvf_txq *txq) txq->xmit_bufs = 0; } + +static inline int +nicvf_configure_cpi(struct rte_eth_dev *dev) +{ + struct nicvf *nic = nicvf_pmd_priv(dev); + uint16_t qidx, qcnt; + int ret; + + /* Count started rx queues */ + for (qidx = qcnt = 0; qidx < nic->eth_dev->data->nb_rx_queues; qidx++) + if (dev->data->rx_queue_state[qidx] == + RTE_ETH_QUEUE_STATE_STARTED) + qcnt++; + + nic->cpi_alg = CPI_ALG_NONE; + ret = nicvf_mbox_config_cpi(nic, qcnt); + if (ret) + PMD_INIT_LOG(ERR, "Failed to configure CPI %d", ret); + + return ret; +} + +static int +nicvf_configure_rss_reta(struct rte_eth_dev *dev) +{ + struct nicvf *nic = nicvf_pmd_priv(dev); + unsigned int idx, qmap_size; + uint8_t qmap[RTE_MAX_QUEUES_PER_PORT]; + uint8_t default_reta[NIC_MAX_RSS_IDR_TBL_SIZE]; + + if (nic->cpi_alg != CPI_ALG_NONE) + return -EINVAL; + + /* Prepare queue map */ + for (idx = 0, qmap_size = 0; idx < dev->data->nb_rx_queues; idx++) { + if (dev->data->rx_queue_state[idx] == + RTE_ETH_QUEUE_STATE_STARTED) + qmap[qmap_size++] = idx; + } + + /* Update default RSS RETA */ + for (idx = 0; idx < NIC_MAX_RSS_IDR_TBL_SIZE; idx++) + default_reta[idx] = qmap[idx % qmap_size]; + + return nicvf_rss_reta_update(nic, default_reta, + NIC_MAX_RSS_IDR_TBL_SIZE); +} + static void nicvf_dev_tx_queue_release(void *sq) { @@ -719,6 +769,33 @@ nicvf_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, return 0; } +static inline void +nicvf_rx_queue_release_mbufs(struct nicvf_rxq *rxq) +{ + uint32_t rxq_cnt; + uint32_t nb_pkts, released_pkts = 0; + uint32_t refill_cnt = 0; + struct rte_eth_dev *dev = rxq->nic->eth_dev; + struct rte_mbuf *rx_pkts[NICVF_MAX_RX_FREE_THRESH]; + + if (dev->rx_pkt_burst == NULL) + return; + + while ((rxq_cnt = nicvf_dev_rx_queue_count(dev, rxq->queue_id))) { + nb_pkts = dev->rx_pkt_burst(rxq, rx_pkts, + NICVF_MAX_RX_FREE_THRESH); + PMD_DRV_LOG(INFO, "nb_pkts=%d rxq_cnt=%d", nb_pkts, rxq_cnt); + while (nb_pkts) { + rte_pktmbuf_free_seg(rx_pkts[--nb_pkts]); + released_pkts++; + } + } + + refill_cnt += nicvf_dev_rbdr_refill(dev, rxq->queue_id); + PMD_DRV_LOG(INFO, "free_cnt=%d refill_cnt=%d", + released_pkts, refill_cnt); +} + static void nicvf_rx_queue_reset(struct nicvf_rxq *rxq) { @@ -727,6 +804,69 @@ nicvf_rx_queue_reset(struct nicvf_rxq *rxq) rxq->recv_buffers = 0; } +static inline int +nicvf_start_rx_queue(struct rte_eth_dev *dev, uint16_t qidx) +{ + struct nicvf *nic = nicvf_pmd_priv(dev); + struct nicvf_rxq *rxq; + int ret; + + if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STARTED) + return 0; + + /* Update rbdr pointer to all rxq */ + rxq = dev->data->rx_queues[qidx]; + rxq->shared_rbdr = nic->rbdr; + + ret = nicvf_qset_rq_config(nic, qidx, rxq); + if (ret) { + PMD_INIT_LOG(ERR, "Failed to configure rq %d %d", qidx, ret); + goto config_rq_error; + } + ret = nicvf_qset_cq_config(nic, qidx, rxq); + if (ret) { + PMD_INIT_LOG(ERR, "Failed to configure cq %d %d", qidx, ret); + goto config_cq_error; + } + + dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED; + return 0; + +config_cq_error: + nicvf_qset_cq_reclaim(nic, qidx); +config_rq_error: + nicvf_qset_rq_reclaim(nic, qidx); + return ret; +} + +static inline int +nicvf_stop_rx_queue(struct rte_eth_dev *dev, uint16_t qidx) +{ + struct nicvf *nic = nicvf_pmd_priv(dev); + struct nicvf_rxq *rxq; + int ret, other_error; + + if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) + return 0; + + ret = nicvf_qset_rq_reclaim(nic, qidx); + if (ret) + PMD_INIT_LOG(ERR, "Failed to reclaim rq %d %d", qidx, ret); + + other_error = ret; + rxq = dev->data->rx_queues[qidx]; + nicvf_rx_queue_release_mbufs(rxq); + nicvf_rx_queue_reset(rxq); + + ret = nicvf_qset_cq_reclaim(nic, qidx); + if (ret) + PMD_INIT_LOG(ERR, "Failed to reclaim cq %d %d", qidx, ret); + + other_error |= ret; + dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED; + return other_error; +} + static void nicvf_dev_rx_queue_release(void *rx_queue) { @@ -739,6 +879,39 @@ nicvf_dev_rx_queue_release(void *rx_queue) } static int +nicvf_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx) +{ + int ret; + + if (qidx >= nicvf_pmd_priv(dev)->eth_dev->data->nb_rx_queues) + return -EINVAL; + + ret = nicvf_start_rx_queue(dev, qidx); + if (ret) + return ret; + + ret = nicvf_configure_cpi(dev); + if (ret) + return ret; + + return nicvf_configure_rss_reta(dev); +} + +static int +nicvf_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx) +{ + int ret; + + if (qidx >= nicvf_pmd_priv(dev)->eth_dev->data->nb_rx_queues) + return -EINVAL; + + ret = nicvf_stop_rx_queue(dev, qidx); + ret |= nicvf_configure_cpi(dev); + ret |= nicvf_configure_rss_reta(dev); + return ret; +} + +static int nicvf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, @@ -965,6 +1138,8 @@ static const struct eth_dev_ops nicvf_eth_dev_ops = { .reta_query = nicvf_dev_reta_query, .rss_hash_update = nicvf_dev_rss_hash_update, .rss_hash_conf_get = nicvf_dev_rss_hash_conf_get, + .rx_queue_start = nicvf_dev_rx_queue_start, + .rx_queue_stop = nicvf_dev_rx_queue_stop, .rx_queue_setup = nicvf_dev_rx_queue_setup, .rx_queue_release = nicvf_dev_rx_queue_release, .rx_queue_count = nicvf_dev_rx_queue_count, diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c index 8031685..e8c605d 100644 --- a/drivers/net/thunderx/nicvf_rxtx.c +++ b/drivers/net/thunderx/nicvf_rxtx.c @@ -580,3 +580,21 @@ nicvf_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx) rxq = (struct nicvf_rxq *)dev->data->rx_queues[queue_idx]; return nicvf_addr_read(rxq->cq_status) & NICVF_CQ_CQE_COUNT_MASK; } + +uint32_t +nicvf_dev_rbdr_refill(struct rte_eth_dev *dev, uint16_t queue_idx) +{ + struct nicvf_rxq *rxq; + uint32_t to_process; + uint32_t rx_free; + + rxq = (struct nicvf_rxq *)dev->data->rx_queues[queue_idx]; + to_process = rxq->recv_buffers; + while (rxq->recv_buffers > 0) { + rx_free = RTE_MIN(rxq->recv_buffers, NICVF_MAX_RX_FREE_THRESH); + rxq->recv_buffers -= nicvf_fill_rbdr(rxq, rx_free); + } + + assert(rxq->recv_buffers == 0); + return to_process; +} diff --git a/drivers/net/thunderx/nicvf_rxtx.h b/drivers/net/thunderx/nicvf_rxtx.h index 44cef06..3484928 100644 --- a/drivers/net/thunderx/nicvf_rxtx.h +++ b/drivers/net/thunderx/nicvf_rxtx.h @@ -85,6 +85,7 @@ fill_sq_desc_gather(union sq_entry_t *entry, struct rte_mbuf *pkt) #endif uint32_t nicvf_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx); +uint32_t nicvf_dev_rbdr_refill(struct rte_eth_dev *dev, uint16_t queue_idx); uint16_t nicvf_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts, uint16_t pkts); uint16_t nicvf_recv_pkts_multiseg(void *rx_queue, struct rte_mbuf **rx_pkts, -- 2.5.5