From patchwork Fri May 19 02:59:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chaoyong He X-Patchwork-Id: 127057 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1307742B42; Fri, 19 May 2023 05:00:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1DCED42D32; Fri, 19 May 2023 05:00:19 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2090.outbound.protection.outlook.com [40.107.92.90]) by mails.dpdk.org (Postfix) with ESMTP id D4796406B5 for ; Fri, 19 May 2023 05:00:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HE7h9ZX5sslabhY6oc58d2j1ub3IZiBuaKHXOFfFC6M2HK+8tnu0Rs3g9V4OxHoU4lqT1VdGbDLJ5ubDq1Jj/J4JLfkErpGQWEdOkZ3kvm8ebfxzZkgyC+YDaoRIalJytd2pWy7ljlDrrx3JlFevodxCxJiSqSUvJ7oTD95u69ZG+C4e4WS/SfpoQ+4N9AayptrmEpNKMnVZGta53fC+nxJzhh0agtoOxCWnyjM+GGvpxZADQxB7UV9azC1bl0yBDzS4zpukLzMrmspsh49y/qHAUPCr+fiH592VSMh4buRgEQ4gmn4PEIOtotszqrntGqz69/bFgHPPD9UObKjKtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=u9dUCnza3ys6HQVn1b9dJahywzGPk8OipyrP16oFxcI=; b=jMPIu3bGehch3jG7w5IILwoKccHCJjMy+CtbxXH285i0GWZLXM7f1guu6raAKPioKc7EH3h7/j+/msugQTIwofuCKE8U+6S1Oy6C15dGgr6oCc4pwmVb3KuOMms71OcNI+9h6FGBQXFA/wR2mGeVn/RMAxyDQ9zB+Tb0xGL50ma7crzT43Ip/93d7ziWbmuijs1v47o14pS78zvmMbiqzBBARbNQnfhNYtJ+iw3io9OWBHt28AHNxvNZ2GvqfEpuWeSEenNXsen3T2yempBpIp6esOfWdmO8S1TrUJO8v9sAQkSK89kMS8zMU8BKZV0bSTsa45xwDf9yDNt1HEY36g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u9dUCnza3ys6HQVn1b9dJahywzGPk8OipyrP16oFxcI=; b=jo3GX7r/eWKSPcQuUL/9KOJV6truVwV1msRZRgaK2vbSHhy8ZXflsx72+PzzsfmhM5mhSBuCvzvqDZDygal7XecfPkWZw93OglS5uv83hfGnGLy2OXJloxYyU56lgrwf8k0oI3PUJqJv/d7cOGGwqKsmfKymeBIJsANgntSXge0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by SJ0PR13MB5769.namprd13.prod.outlook.com (2603:10b6:a03:40c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Fri, 19 May 2023 03:00:15 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ac2e:52b6:82ec:4994]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ac2e:52b6:82ec:4994%3]) with mapi id 15.20.6411.017; Fri, 19 May 2023 03:00:15 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH 2/8] net/nfp: modify the rxq struct Date: Fri, 19 May 2023 10:59:44 +0800 Message-Id: <20230519025950.1642943-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230519025950.1642943-1-chaoyong.he@corigine.com> References: <20230519025950.1642943-1-chaoyong.he@corigine.com> X-ClientProxiedBy: SI2PR01CA0005.apcprd01.prod.exchangelabs.com (2603:1096:4:191::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SJ0PR13MB5769:EE_ X-MS-Office365-Filtering-Correlation-Id: 293e75cc-d401-4309-65a7-08db58152b7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y7ETmPrncc9BH2pWSNyv12nUkKankpFfdfiadWq2N7NC9K5htnyaGGMvSM2yBboSPw8nciQ41d2oLwX764LQLoGnJNEYjzKbB/LV/fc4azHBLmTFs/KOQxWRGmWINLCJnnwFL004fYV1al6+qFt7UK2SXHK8yPCrBisrLd5xGrZwbuJIF/hcPDJal6nxJ7Faqj5OS66Zd+JdTsvKNZO2qa8V6uLS5T3B8eQP5rtkpKgpVGDdG6eAML8LfM60NiJ3NUpP1PrZwATQDJBKFzxOwgRR9Z2ZhR51KF1avyL+hfDGVy1QwZojK1nOMyQK6u1TsGU7Prkse3NGlhXT9yY/qmeplo0Oi4CGvLFslgUj9qiTn7m3nAEX5MNFxVCrDqubdlbBZA+Ufmppruyj+h35hQBnHbM6eBSou7u9EQvnqPxyx9+iVEeHArWOkyJA3HC7IfIS7V0Y/oUp3rMAmmtf09fEeHUdMTxzPMZ47Jkfz3GSlKHFHftYb3rs2euZpSbEoIedRQ2TUWSvN9pxW70vL5Wm0Ue87QAAs4Kj+8kLTZcdE8tZR4QG86DHyTlGM3TPK1GOkVBiCOFCM/sI6pXGztS8g8Opm2AIw6E7+9891qrwfZW2aOLZL5CsmRc197R1 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(366004)(346002)(136003)(376002)(39840400004)(396003)(451199021)(6916009)(30864003)(66476007)(2616005)(6666004)(6512007)(41300700001)(2906002)(6486002)(83380400001)(478600001)(66556008)(107886003)(52116002)(66946007)(26005)(6506007)(1076003)(186003)(5660300002)(4326008)(316002)(8676002)(8936002)(44832011)(86362001)(38100700002)(36756003)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?K6Z9toQrH3E07b9GEK9IreUnHxYW?= =?utf-8?q?9nGBeRWSyec7AyFPZq1Z/cgXsJrnEWhiqODox06Hz5jWUhMyZz3sTZgpbmwj6DXWB?= =?utf-8?q?Lp5J0ImA+HybadTPkdrjic8r4uX24U1ApybOsOpbnB8IO6cKrEFUbhMLCdtVuMqFF?= =?utf-8?q?zEE5hDeVrUozyQfpkIF2OADrHMzqLCYvE1Lbl0NsflWmDESP9du+oEz6jhJg3pJFn?= =?utf-8?q?tryH6LUhDFljcAqICIOwjpNkAvYxBUoPiqQs+HLDdgIjmTOHkO8UBIeGwqu5OekCX?= =?utf-8?q?e83uzUmjMkdB++aJAPlfhQXhUgt90d3rKGyWYT9GZ1f4vT6cxcSBUzIkQ9bmSqbJQ?= =?utf-8?q?8pKmredMlcKS/m7tEi0Q6XXPNi5nOq94Mh9tgqtpts02oJNumDdQ8I7qtOxB2wKmD?= =?utf-8?q?fFi6Kuyvmy+iwz/W3aqgxEYC8NanUzkQAc1hnTEzwhq6IPaJmCf1ntynOOLKZD+mI?= =?utf-8?q?gM02GNZUHzISs8e1Z4IbkJRxfGO3fnzn4vzVE4O5wT1cz1HDTC+dxe9ftvoAirmnC?= =?utf-8?q?7FXMiAyAgrgVJjM4X0a1gV/OakLH+2/Yt77wJTv9Y+AERgnhRc5ibIpWK4QtMWiNO?= =?utf-8?q?RSuCzA4Y0ffYe9v9tCSNkVxyLJBDSOBxf/I6nsTtJ3DU91ra0R7Kfej14/Iq9S/MR?= =?utf-8?q?VXkFQ/Nkx6DKe35hJIKgMdWBDdvYTfamPzIP0iLwb5u7CD+yC2PsrmY191LzH4Uaj?= =?utf-8?q?8DabOh+0breFbGBfI4dCYwPnLd1q8ZaaPDjd/pce/w4qf1v6Wfsta+VtR+yWoBHBB?= =?utf-8?q?6PbKaadqEl2GNrflhenfe0IyZeU9F3bnLd/sVZOR3C2TUlGKIbRjFjGJGIjUc8kIT?= =?utf-8?q?hqCgvr4rZowONEQTtN9md684OvRSmDG2IUlsBvx7zPrh3+pE6TSqnOjSB1sUn5ikx?= =?utf-8?q?ae4LO1EANxuKQjzDcyG1SXTgGXQB3eLFpBjhM4i8KmGBsVQT5jYFI60vI7/w6tKf7?= =?utf-8?q?MMXsyVIyEW7dBXQxIVjPmz9xfPALxLTZGxriVKEHUZY4LJt71EvmSGiD6OtUqGvAf?= =?utf-8?q?vaPKhiyHOjteWgtqHcDNfpU7aCfmQv6oSbGsf7f/kSylXrLmfCx1UVr3/Bb0hcnWg?= =?utf-8?q?Ix6sAANCGFbGpYrs7jY+z7qFgK9THQSNHSoEKNUFh1VcakRTdqE2OGO80GXsIYaA1?= =?utf-8?q?xj4duqkP06Ytjz+qY/sxkVdEJyUbKV86F+2N3vRGzcpTSv7CgpX25Y4xyMvxBk6fC?= =?utf-8?q?cCWl2R+dZTHgszIh6eAz8n/czN6h2sjkURT2+8FouL/fxemMI8tUcQ7eZZF0sfzdU?= =?utf-8?q?hWjy86tKDU3gnv/Xu/1bOyBhpFlJv+JKlaxJ65BQNInOEM3bdUibNQdBp9LCNo5mA?= =?utf-8?q?fXh+TXeErNFMvTlw2xBfOiGqy/faE3l8h4kJGP/h9XnFrNORpcvQtkjQYEhvoiBrS?= =?utf-8?q?Q0LIpVGM4N0BKv0mMTNVlrvf5huRsob/tJk9QcNrweB9OLJK4yIk4Q8/tMI7VB1My?= =?utf-8?q?GIpptX4HLFqXfZVoSI/OXsZu4WrfBrKUOVY7ARC6/eLzkUGr0zqyWMhPntDOjze/q?= =?utf-8?q?R8Sy/9FKNcX5Hj/PI0HtZVTdDriDQ6gCSQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 293e75cc-d401-4309-65a7-08db58152b7c X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 03:00:15.3691 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LKIFKjhSkYeOGYlxc+bBRBcqi7LKwtVo/Eaqp6FJaE8xILC0ybn5NtPQvsuKJWC7LoUH1f1F5JYHoIeFoKR5c7n032JNQ1D9NtW6tkRjrG4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR13MB5769 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Modify the struct nfp_net_rxq, remove the unused fields, change the type of some fields and make the comment message more suitable. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/flower/nfp_flower.c | 13 ++- drivers/net/nfp/flower/nfp_flower_ctrl.c | 6 +- .../net/nfp/flower/nfp_flower_representor.c | 3 - drivers/net/nfp/nfp_rxtx.c | 26 +++--- drivers/net/nfp/nfp_rxtx.h | 80 +++++++++---------- 5 files changed, 55 insertions(+), 73 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 4d60660a77..8847849adc 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -311,8 +311,8 @@ nfp_flower_pf_recv_pkts(void *rx_queue, * We need different counters for packets given to the caller * and packets sent to representors */ - int avail = 0; - int avail_multiplexed = 0; + uint16_t avail = 0; + uint16_t avail_multiplexed = 0; uint64_t dma_addr; uint32_t meta_portid; uint16_t nb_hold = 0; @@ -364,7 +364,7 @@ nfp_flower_pf_recv_pkts(void *rx_queue, new_mb = rte_pktmbuf_alloc(rxq->mem_pool); if (unlikely(new_mb == NULL)) { PMD_RX_LOG(DEBUG, - "RX mbuf alloc failed port_id=%u queue_id=%d", + "RX mbuf alloc failed port_id=%hu queue_id=%hu", rxq->port_id, rxq->qidx); nfp_net_mbuf_alloc_failed(rxq); break; @@ -464,7 +464,7 @@ nfp_flower_pf_recv_pkts(void *rx_queue, if (nb_hold == 0) return nb_hold; - PMD_RX_LOG(DEBUG, "RX port_id=%u queue_id=%d, %d packets received", + PMD_RX_LOG(DEBUG, "RX port_id=%hu queue_id=%hu, %hu packets received", rxq->port_id, rxq->qidx, nb_hold); nb_hold += rxq->nb_rx_hold; @@ -475,7 +475,7 @@ nfp_flower_pf_recv_pkts(void *rx_queue, */ rte_wmb(); if (nb_hold > rxq->rx_free_thresh) { - PMD_RX_LOG(DEBUG, "port=%u queue=%d nb_hold=%u avail=%d", + PMD_RX_LOG(DEBUG, "port=%hu queue=%hu nb_hold=%hu avail=%hu", rxq->port_id, rxq->qidx, nb_hold, avail); nfp_qcp_ptr_add(rxq->qcp_fl, NFP_QCP_WRITE_PTR, nb_hold); nb_hold = 0; @@ -783,9 +783,7 @@ nfp_flower_init_ctrl_vnic(struct nfp_net_hw *hw) /* Hw queues mapping based on firmware configuration */ rxq->qidx = i; rxq->fl_qcidx = i * hw->stride_rx; - rxq->rx_qcidx = rxq->fl_qcidx + (hw->stride_rx - 1); rxq->qcp_fl = hw->rx_bar + NFP_QCP_QUEUE_OFF(rxq->fl_qcidx); - rxq->qcp_rx = hw->rx_bar + NFP_QCP_QUEUE_OFF(rxq->rx_qcidx); /* * Tracking mbuf size for detecting a potential mbuf overflow due to @@ -798,7 +796,6 @@ nfp_flower_init_ctrl_vnic(struct nfp_net_hw *hw) rxq->rx_count = CTRL_VNIC_NB_DESC; rxq->rx_free_thresh = DEFAULT_RX_FREE_THRESH; - rxq->drop_en = 1; /* * Allocate RX ring hardware descriptors. A memzone large enough to diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c index 1855e73c14..72c0d5e7d9 100644 --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c @@ -68,8 +68,8 @@ nfp_flower_ctrl_vnic_recv(void *rx_queue, new_mb = rte_pktmbuf_alloc(rxq->mem_pool); if (unlikely(new_mb == NULL)) { PMD_RX_LOG(ERR, - "RX mbuf alloc failed port_id=%u queue_id=%u", - rxq->port_id, (unsigned int)rxq->qidx); + "RX mbuf alloc failed port_id=%u queue_id=%hu", + rxq->port_id, rxq->qidx); nfp_net_mbuf_alloc_failed(rxq); break; } @@ -143,7 +143,7 @@ nfp_flower_ctrl_vnic_recv(void *rx_queue, */ rte_wmb(); if (nb_hold >= rxq->rx_free_thresh) { - PMD_RX_LOG(DEBUG, "port=%hu queue=%d nb_hold=%hu avail=%hu", + PMD_RX_LOG(DEBUG, "port=%hu queue=%hu nb_hold=%hu avail=%hu", rxq->port_id, rxq->qidx, nb_hold, avail); nfp_qcp_ptr_add(rxq->qcp_fl, NFP_QCP_WRITE_PTR, nb_hold); nb_hold = 0; diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 3eb76cb489..94a04e6235 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -46,9 +46,7 @@ nfp_pf_repr_rx_queue_setup(struct rte_eth_dev *dev, /* Hw queues mapping based on firmware configuration */ rxq->qidx = queue_idx; rxq->fl_qcidx = queue_idx * hw->stride_rx; - rxq->rx_qcidx = rxq->fl_qcidx + (hw->stride_rx - 1); rxq->qcp_fl = hw->rx_bar + NFP_QCP_QUEUE_OFF(rxq->fl_qcidx); - rxq->qcp_rx = hw->rx_bar + NFP_QCP_QUEUE_OFF(rxq->rx_qcidx); /* * Tracking mbuf size for detecting a potential mbuf overflow due to @@ -62,7 +60,6 @@ nfp_pf_repr_rx_queue_setup(struct rte_eth_dev *dev, rxq->rx_count = nb_desc; rxq->port_id = dev->data->port_id; rxq->rx_free_thresh = rx_conf->rx_free_thresh; - rxq->drop_en = rx_conf->rx_drop_en; /* * Allocate RX ring hardware descriptors. A memzone large enough to diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 190498abc7..b34a9b9374 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -40,8 +40,8 @@ nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq) struct rte_mbuf *mbuf = rte_pktmbuf_alloc(rxq->mem_pool); if (mbuf == NULL) { - PMD_DRV_LOG(ERR, "RX mbuf alloc failed queue_id=%u", - (unsigned int)rxq->qidx); + PMD_DRV_LOG(ERR, "RX mbuf alloc failed queue_id=%hu", + rxq->qidx); return -ENOMEM; } @@ -379,7 +379,6 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) uint64_t dma_addr; uint16_t avail; - avail = 0; rxq = rx_queue; if (unlikely(rxq == NULL)) { /* @@ -387,12 +386,13 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) * enabled. But the queue needs to be configured */ PMD_RX_LOG(ERR, "RX Bad queue"); - return avail; + return 0; } hw = rxq->hw; - nb_hold = 0; + avail = 0; + nb_hold = 0; while (avail < nb_pkts) { rxb = &rxq->rxbufs[rxq->rd_p]; if (unlikely(rxb == NULL)) { @@ -417,8 +417,8 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) new_mb = rte_pktmbuf_alloc(rxq->mem_pool); if (unlikely(new_mb == NULL)) { PMD_RX_LOG(DEBUG, - "RX mbuf alloc failed port_id=%u queue_id=%u", - rxq->port_id, (unsigned int)rxq->qidx); + "RX mbuf alloc failed port_id=%u queue_id=%hu", + rxq->port_id, rxq->qidx); nfp_net_mbuf_alloc_failed(rxq); break; } @@ -495,8 +495,8 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) if (nb_hold == 0) return nb_hold; - PMD_RX_LOG(DEBUG, "RX port_id=%u queue_id=%u, %d packets received", - rxq->port_id, (unsigned int)rxq->qidx, nb_hold); + PMD_RX_LOG(DEBUG, "RX port_id=%hu queue_id=%hu, %hu packets received", + rxq->port_id, rxq->qidx, avail); nb_hold += rxq->nb_rx_hold; @@ -506,9 +506,8 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) */ rte_wmb(); if (nb_hold > rxq->rx_free_thresh) { - PMD_RX_LOG(DEBUG, "port=%u queue=%u nb_hold=%u avail=%u", - rxq->port_id, (unsigned int)rxq->qidx, - (unsigned int)nb_hold, (unsigned int)avail); + PMD_RX_LOG(DEBUG, "port=%hu queue=%hu nb_hold=%hu avail=%hu", + rxq->port_id, rxq->qidx, nb_hold, avail); nfp_qcp_ptr_add(rxq->qcp_fl, NFP_QCP_WRITE_PTR, nb_hold); nb_hold = 0; } @@ -605,9 +604,7 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev, /* Hw queues mapping based on firmware configuration */ rxq->qidx = queue_idx; rxq->fl_qcidx = queue_idx * hw->stride_rx; - rxq->rx_qcidx = rxq->fl_qcidx + (hw->stride_rx - 1); rxq->qcp_fl = hw->rx_bar + NFP_QCP_QUEUE_OFF(rxq->fl_qcidx); - rxq->qcp_rx = hw->rx_bar + NFP_QCP_QUEUE_OFF(rxq->rx_qcidx); /* * Tracking mbuf size for detecting a potential mbuf overflow due to @@ -621,7 +618,6 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev, rxq->rx_count = nb_desc; rxq->port_id = dev->data->port_id; rxq->rx_free_thresh = rx_conf->rx_free_thresh; - rxq->drop_en = rx_conf->rx_drop_en; /* * Allocate RX ring hardware descriptors. A memzone large enough to diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h index 235f083dcf..c433e084c5 100644 --- a/drivers/net/nfp/nfp_rxtx.h +++ b/drivers/net/nfp/nfp_rxtx.h @@ -213,81 +213,73 @@ struct nfp_net_rx_desc { }; struct nfp_net_rxq { - struct nfp_net_hw *hw; /* Backpointer to nfp_net structure */ + /** Backpointer to nfp_net structure */ + struct nfp_net_hw *hw; - /* - * @qcp_fl and @qcp_rx are pointers to the base addresses of the - * freelist and RX queue controller peripheral queue structures on the - * NFP - */ + /** + * Point to the base addresses of the freelist queue + * controller peripheral queue structures on the NFP. + */ uint8_t *qcp_fl; - uint8_t *qcp_rx; - /* - * Read and Write pointers. @wr_p and @rd_p are host side - * pointer, they are free running and have little relation to - * the QCP pointers. @wr_p is where the driver adds new - * freelist descriptors and @rd_p is where the driver start - * reading descriptors for newly arrive packets from. + /** + * Host side read pointer, free running and have little relation + * to the QCP pointers. It is where the driver start reading + * descriptors for newly arrive packets from. */ uint32_t rd_p; - /* + /** + * The index of the QCP queue relative to the RX queue BAR + * used for the freelist. + */ + uint32_t fl_qcidx; + + /** * For each buffer placed on the freelist, record the - * associated SKB + * associated mbuf. */ struct nfp_net_dp_buf *rxbufs; - /* - * Information about the host side queue location. @rxds is - * the virtual address for the queue + /** + * Information about the host side queue location. + * It is the virtual address for the queue. */ struct nfp_net_rx_desc *rxds; - /* + /** * The mempool is created by the user specifying a mbuf size. * We save here the reference of the mempool needed in the RX * path and the mbuf size for checking received packets can be - * safely copied to the mbuf using the NFP_NET_RX_OFFSET + * safely copied to the mbuf using the NFP_NET_RX_OFFSET. */ struct rte_mempool *mem_pool; uint16_t mbuf_size; - /* + /** * Next two fields are used for giving more free descriptors - * to the NFP + * to the NFP. */ uint16_t rx_free_thresh; uint16_t nb_rx_hold; - /* the size of the queue in number of descriptors */ + /** The size of the queue in number of descriptors */ uint16_t rx_count; - /* - * Fields above this point fit in a single cache line and are all used - * in the RX critical path. Fields below this point are just used - * during queue configuration or not used at all (yet) - */ - - /* referencing dev->data->port_id */ + /** Referencing dev->data->port_id */ uint16_t port_id; - uint8_t crc_len; /* Not used by now */ - uint8_t drop_en; /* Not used by now */ - - /* DMA address of the queue */ - __le64 dma; + /** The queue index from Linux's perspective */ + uint16_t qidx; - /* - * Queue information: @qidx is the queue index from Linux's - * perspective. @fl_qcidx is the index of the Queue - * Controller peripheral queue relative to the RX queue BAR - * used for the freelist and @rx_qcidx is the Queue Controller - * Peripheral index for the RX queue. + /** + * At this point 60 bytes have been used for all the fields in the + * RX critical path. We have room for 4 bytes and still all placed + * in a cache line. */ - int qidx; - int fl_qcidx; - int rx_qcidx; + + /** DMA address of the queue */ + uint64_t dma; } __rte_aligned(64); static inline void