From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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?B?SzZaOXRvUXJIM0UwN2I5R0VLOUlyZVVuSHhZVzluR0JlUldTeWVjN0F5RlBa?= =?utf-8?B?cTFaL2NnWHNKcm5FV2hpcU9Eb3gwNkh6NWpXVWhNeVp6M3NUWmdwYm13ajZE?= =?utf-8?B?WFdCTHA1SjBJbUErSHliYWRUUGtkcmppYzhyNHVYMjRVMUFweWJPc09wYm5C?= =?utf-8?B?OElPNmNLckVGVWJoTUxDZHRWdU1xRkZ6RUU1aERlVnJVb3p5UWZwa0lGMk9B?= =?utf-8?B?RHJITXpxTENZdkUxTGJsME5zZmxXbURFU1A5ZHUrb0V6NmpoSmczcEpGbnRy?= =?utf-8?B?eUg2TFVoREZsamNBcUlDSU93anBOa0F2WXhCVW9QaXFRcytITERkZ0lqbVRP?= =?utf-8?B?SGtPOFVCSWVHd3F1NU9la0NYZTgzdXpVbWpNa2RCKythSkFQbGZoUVhoVWd0?= =?utf-8?B?OTBkM3JLR3lXWVQ5R1oxZjR2VDZjeGNTQlV6SWtROWJtU3FiSlE4cEttcmVk?= =?utf-8?B?TWxjS1MvbTd0RWkwUTZYWFBOaTVuT3E5NE1oOXRncXRwdHMwMm9KTnVtRGRR?= =?utf-8?B?OEk3cXRPeEIyd0ttRGZGaTZLdXl2bXkraXd6L1czYXFneEVZQzhOYW5VemtR?= =?utf-8?B?QWMxaG5URXp3aHE2SVBhSm1DZjFudHluT09MS1pEK21JZ00wMkdOWlVIeklT?= =?utf-8?B?czhlMVo0SWJrSlJ4ZkdPM2Zuem40dnpWRTRPNXdUMWN6MUhEVEMrZHhlOWZ0?= =?utf-8?B?dm9BaXJtbkM3RlhNaUF5QWdyZ1ZKak00WDBhMWdWL09ha0xIKzIvWXQ3N3dK?= =?utf-8?B?VHY5WStBRVJnbmhSYzVpYklwV0s0UXRNV2lOT1JTdUN6QTRZMGZmWWU5djl0?= =?utf-8?B?Q1NOa1Z4eUxKQkRTT0J4Zi9JNm5zVHRKM0RVOTFyYTBSN0tmZWoxNC9JcTlT?= =?utf-8?B?L01SVlhrRlEvTmt4NkRLZTM1aEpJS2dNZFdCRGR2WVRmYW1QeklQMGlMd2I1?= =?utf-8?B?dTdDRCt5QzJQc3JtWTE5MUx6SDRVYWo4RGFiT2grMGJyZUZiR0JmSTRkQ1l3?= =?utf-8?B?UG5MZDFxOFphYVBEamQvcGNlL3c0cWYxdjZXZnN0YStWdFIreVdvQkhCQjZQ?= =?utf-8?B?YkthYWRxRWwyR05yZmxoZW5mZTBJeVplVTlGM2JuTGQvc1ZaT1IzQzJUVWxH?= =?utf-8?B?S0liUmpGakdKR0lqVWM4a0lUaHFDZ3ZyNHJab3dPTkVRVHROOW1kNjg0T3ZS?= =?utf-8?B?U21ERzJJVWxzQnZ4N3pQcmgzK3BFNlRTcW5PalNCMXNVbjVpa3hhZTRMTzFF?= =?utf-8?B?QU54dUtRanpEY3lHMVNYVGdHWFFCM2VMRnBCamhNNGk4S21HQnNWUVQ1allG?= =?utf-8?B?STYwdkk3L3c2dEtmN01NWHN5Vkl5RVc3ZEJYUXhJVmpQbXo5eGZQQUx4TFRa?= =?utf-8?B?R3hyaVZLRUhVWlk0TEp0NzFFdm1TR2lENk90VXFHdkFmdmFQS2hpeUhPanRl?= =?utf-8?B?V2d0cUhjRE5mcFU3YUNmbVF2Nm9TYkdzZjdmL2tTeWxYckxtZkN4MVVWcjMv?= =?utf-8?B?QmIwaGNuV2dJeDZzQUFOQ0dGYkdwWXJzN2pZK3o3cUZnSzlUSFFTTkhTb0VL?= =?utf-8?B?TlVGaDFWY2FrUlRkcUUyT0dPODBHWHNJWWFBMXhqNGR1cWtQMDZZdGp6K3FZ?= =?utf-8?B?L3N4a1ZkRUp5VWJLVjg2RisyTjN2Ukd6Y3BUU3Y3Q2dwWDI1WTR4eU12eEJr?= =?utf-8?B?NmZDY0NXbDJSK2RaVEhnc3pJaDZlQXo4bi9jek42aDJzamtVUlQyKzhGb3VM?= =?utf-8?B?L2Z4ZW1NSTh0VWNRN2VaWkYwc2Z6ZFVoV2p5ODZ0S0RVM2dudi9YdS8xYk95?= =?utf-8?B?QmhwRmxKditKS2xheEo2NUJRTkluT0VNM2JkVWliTlFkQnA5TENObzVtQWZY?= =?utf-8?B?aCtUWGVFck5GTXZUbHcyeEJmT2lHcXkvZmFFM2w4aDRrSkdQL2g5WG5Gck5P?= =?utf-8?B?UnBjdlF0a2pRWUVodm9pQnJTUTBMSXBWR000TjBCS3YwbU1UTlZscnZmNWh1?= =?utf-8?B?UnNvYi90Sms5UWNOcndlQjlPTEpLNHlJazRROC90TUk3VkIxTXlHSXBwdFg0?= =?utf-8?B?SExGcVhmWlZvU0kvT1hzWnU0V3JmQnJLVU9WWTdBUkM2L2VMemtVR3IwenF5?= =?utf-8?B?V01oUG50RE9qemUvcVI4U3kvOUZLTmNYNUhqL1BJMEh0WlZUZERyaURRNmdD?= =?utf-8?B?U1E9PQ==?= 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 -- 2.39.1