patch 'net/ngbe: fix Rx by initializing packet buffer early' has been queued to stable release 21.11.1

Kevin Traynor ktraynor at redhat.com
Mon Feb 21 16:36:08 CET 2022


Hi,

FYI, your patch has been queued to stable release 21.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/26/22. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/cacbd7e4f7b4563fd62f4dd0c3ecdd1ea20bc2e8

Thanks.

Kevin

---
>From cacbd7e4f7b4563fd62f4dd0c3ecdd1ea20bc2e8 Mon Sep 17 00:00:00 2001
From: Jiawen Wu <jiawenwu at trustnetic.com>
Date: Wed, 9 Feb 2022 18:42:02 +0800
Subject: [PATCH] net/ngbe: fix Rx by initializing packet buffer early

[ upstream commit ccdeca8e98afa33721a70b90cb208472c39d3c77 ]

Initialize Rx packet buffer before starting RxTx, ensure to receive
packets.

Fixes: 62fc35e63d0e ("net/ngbe: support Rx queue start/stop")

Signed-off-by: Jiawen Wu <jiawenwu at trustnetic.com>
---
 drivers/net/ngbe/base/ngbe_dummy.h |  4 ++++
 drivers/net/ngbe/base/ngbe_hw.c    | 27 +++++++++++++++++++++++++++
 drivers/net/ngbe/base/ngbe_hw.h    |  2 ++
 drivers/net/ngbe/base/ngbe_type.h  |  7 +++++++
 drivers/net/ngbe/ngbe_ethdev.c     |  1 +
 5 files changed, 41 insertions(+)

diff --git a/drivers/net/ngbe/base/ngbe_dummy.h b/drivers/net/ngbe/base/ngbe_dummy.h
index 61b0d82bfb..d74c9f7b54 100644
--- a/drivers/net/ngbe/base/ngbe_dummy.h
+++ b/drivers/net/ngbe/base/ngbe_dummy.h
@@ -115,4 +115,7 @@ static inline s32 ngbe_mac_get_link_capabilities_dummy(struct ngbe_hw *TUP0,
 	return NGBE_ERR_OPS_DUMMY;
 }
+static inline void ngbe_setup_pba_dummy(struct ngbe_hw *TUP0)
+{
+}
 static inline s32 ngbe_mac_led_on_dummy(struct ngbe_hw *TUP0, u32 TUP1)
 {
@@ -299,4 +302,5 @@ static inline void ngbe_init_ops_dummy(struct ngbe_hw *hw)
 	hw->mac.check_link = ngbe_mac_check_link_dummy;
 	hw->mac.get_link_capabilities = ngbe_mac_get_link_capabilities_dummy;
+	hw->mac.setup_pba = ngbe_setup_pba_dummy;
 	hw->mac.led_on = ngbe_mac_led_on_dummy;
 	hw->mac.led_off = ngbe_mac_led_off_dummy;
diff --git a/drivers/net/ngbe/base/ngbe_hw.c b/drivers/net/ngbe/base/ngbe_hw.c
index 0716357725..0b22ea0fb3 100644
--- a/drivers/net/ngbe/base/ngbe_hw.c
+++ b/drivers/net/ngbe/base/ngbe_hw.c
@@ -1610,4 +1610,28 @@ void ngbe_set_mac_anti_spoofing(struct ngbe_hw *hw, bool enable, int vf)
 }
 
+/**
+ * ngbe_set_pba - Initialize Rx packet buffer
+ * @hw: pointer to hardware structure
+ * @headroom: reserve n KB of headroom
+ **/
+void ngbe_set_pba(struct ngbe_hw *hw)
+{
+	u32 rxpktsize = hw->mac.rx_pb_size;
+	u32 txpktsize, txpbthresh;
+
+	/* Reserve 256 KB of headroom */
+	rxpktsize -= 256;
+
+	rxpktsize <<= 10;
+	wr32(hw, NGBE_PBRXSIZE, rxpktsize);
+
+	/* Only support an equally distributed Tx packet buffer strategy. */
+	txpktsize = NGBE_PBTXSIZE_MAX;
+	txpbthresh = (txpktsize / 1024) - NGBE_TXPKT_SIZE_MAX;
+
+	wr32(hw, NGBE_PBTXSIZE, txpktsize);
+	wr32(hw, NGBE_PBTXDMATH, txpbthresh);
+}
+
 /**
  *  ngbe_set_vlan_anti_spoofing - Enable/Disable VLAN anti-spoofing
@@ -1908,4 +1932,6 @@ s32 ngbe_init_ops_pf(struct ngbe_hw *hw)
 	mac->setup_link = ngbe_setup_mac_link_em;
 
+	mac->setup_pba = ngbe_set_pba;
+
 	/* Manageability interface */
 	mac->init_thermal_sensor_thresh = ngbe_init_thermal_sensor_thresh;
@@ -1929,4 +1955,5 @@ s32 ngbe_init_ops_pf(struct ngbe_hw *hw)
 	mac->vft_size		= NGBE_EM_VFT_TBL_SIZE;
 	mac->num_rar_entries	= NGBE_EM_RAR_ENTRIES;
+	mac->rx_pb_size		= NGBE_EM_RX_PB_SIZE;
 	mac->max_rx_queues	= NGBE_EM_MAX_RX_QUEUES;
 	mac->max_tx_queues	= NGBE_EM_MAX_TX_QUEUES;
diff --git a/drivers/net/ngbe/base/ngbe_hw.h b/drivers/net/ngbe/base/ngbe_hw.h
index ad7e8fc2d9..b32cf87ff4 100644
--- a/drivers/net/ngbe/base/ngbe_hw.h
+++ b/drivers/net/ngbe/base/ngbe_hw.h
@@ -14,4 +14,5 @@
 #define NGBE_EM_MC_TBL_SIZE   32
 #define NGBE_EM_VFT_TBL_SIZE  128
+#define NGBE_EM_RX_PB_SIZE    42 /*KB*/
 
 s32 ngbe_init_hw(struct ngbe_hw *hw);
@@ -45,4 +46,5 @@ s32 ngbe_update_mc_addr_list(struct ngbe_hw *hw, u8 *mc_addr_list,
 s32 ngbe_disable_sec_rx_path(struct ngbe_hw *hw);
 s32 ngbe_enable_sec_rx_path(struct ngbe_hw *hw);
+void ngbe_set_pba(struct ngbe_hw *hw);
 
 s32 ngbe_setup_fc_em(struct ngbe_hw *hw);
diff --git a/drivers/net/ngbe/base/ngbe_type.h b/drivers/net/ngbe/base/ngbe_type.h
index 12847b7272..269e087d50 100644
--- a/drivers/net/ngbe/base/ngbe_type.h
+++ b/drivers/net/ngbe/base/ngbe_type.h
@@ -12,4 +12,7 @@
 #define NGBE_FRAME_SIZE_DFT       (1522) /* Default frame size, +FCS */
 #define NGBE_NUM_POOL             (32)
+#define NGBE_PBRXSIZE_MAX         0x00080000 /* 512KB Packet Buffer */
+#define NGBE_PBTXSIZE_MAX         0x00005000 /* 20KB Packet Buffer */
+#define NGBE_TXPKT_SIZE_MAX       0xA /* Max Tx Packet size */
 #define NGBE_MAX_QP               (8)
 #define NGBE_MAX_UTA              128
@@ -270,4 +273,7 @@ struct ngbe_mac_info {
 				      u32 *speed, bool *autoneg);
 
+	/* Packet Buffer manipulation */
+	void (*setup_pba)(struct ngbe_hw *hw);
+
 	/* LED */
 	s32 (*led_on)(struct ngbe_hw *hw, u32 index);
@@ -312,4 +318,5 @@ struct ngbe_mac_info {
 	u32 vft_size;
 	u32 num_rar_entries;
+	u32 rx_pb_size;
 	u32 max_tx_queues;
 	u32 max_rx_queues;
diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c
index 0d66c32551..180489ce38 100644
--- a/drivers/net/ngbe/ngbe_ethdev.c
+++ b/drivers/net/ngbe/ngbe_ethdev.c
@@ -1005,4 +1005,5 @@ ngbe_dev_start(struct rte_eth_dev *dev)
 	}
 
+	hw->mac.setup_pba(hw);
 	ngbe_configure_port(dev);
 
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-02-21 15:22:48.418091256 +0000
+++ 0179-net-ngbe-fix-Rx-by-initializing-packet-buffer-early.patch	2022-02-21 15:22:44.353704716 +0000
@@ -1 +1 @@
-From ccdeca8e98afa33721a70b90cb208472c39d3c77 Mon Sep 17 00:00:00 2001
+From cacbd7e4f7b4563fd62f4dd0c3ecdd1ea20bc2e8 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit ccdeca8e98afa33721a70b90cb208472c39d3c77 ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org



More information about the stable mailing list