DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/nfp: modify Rx buffer size setting logic
@ 2024-10-16  8:15 Chaoyong He
  2024-10-17  0:53 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Chaoyong He @ 2024-10-16  8:15 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Long Wu, Chaoyong He

From: Long Wu <long.wu@corigine.com>

In the previous logic, NFP driver would modify hardware Rx buffer size
every time rxq was set. This will cause the setting of one Rx queue
to affect all Rx queues, resulting in the card being unable to receive
packets properly in some cases.

Modify this logic so that after the first initialization, only when
the Rx queue buffer size is greater than the current hardware set size
will it be modified.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/nfp_net_common.h |  1 +
 drivers/net/nfp/nfp_rxtx.c       | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index d4fe8338b9..6291a794b2 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -239,6 +239,7 @@ struct nfp_net_hw {
 	uint32_t max_tx_queues;
 	uint32_t max_rx_queues;
 	uint16_t flbufsz;
+	bool flbufsz_set_flag;
 	uint16_t device_id;
 	uint16_t vendor_id;
 	uint16_t subsystem_device_id;
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index d101477161..740cc6eac7 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -591,6 +591,20 @@ nfp_net_reset_rx_queue(struct nfp_net_rxq *rxq)
 	rxq->nb_rx_hold = 0;
 }
 
+static void
+nfp_rx_queue_setup_flbufsz(struct nfp_net_hw *hw,
+		struct nfp_net_rxq *rxq)
+{
+	if (!hw->flbufsz_set_flag) {
+		hw->flbufsz_set_flag = true;
+		hw->flbufsz = rxq->mbuf_size;
+		return;
+	}
+
+	if (hw->flbufsz < rxq->mbuf_size)
+		hw->flbufsz = rxq->mbuf_size;
+}
+
 int
 nfp_net_rx_queue_setup(struct rte_eth_dev *dev,
 		uint16_t queue_idx,
@@ -649,7 +663,7 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev,
 	rxq->mem_pool = mp;
 	rxq->mbuf_size = rxq->mem_pool->elt_size;
 	rxq->mbuf_size -= (sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM);
-	hw->flbufsz = rxq->mbuf_size;
+	nfp_rx_queue_setup_flbufsz(hw, rxq);
 
 	rxq->rx_count = nb_desc;
 	rxq->port_id = dev->data->port_id;
-- 
2.39.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-17  0:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-16  8:15 [PATCH] net/nfp: modify Rx buffer size setting logic Chaoyong He
2024-10-17  0:53 ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).