Skip to contentSkip to conversation

Bugfixes for bonding

PATCH In review Min Hu (Connor) 2 participants 4 messages Sep 22, 2021 – Oct 8, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Bugfixes for bonding

This patchset contains two bugfixes for bonding.

Chengchang Tang (2):
net/bonding: fix dedicated queue mode in vector burst net/bonding: fix RSS key length

 drivers/net/bonding/rte_eth_bond_8023ad.c | 32 ++++++++++++-----
 drivers/net/bonding/rte_eth_bond_api.c    |  6 ++++
 drivers/net/bonding/rte_eth_bond_pmd.c    | 44 ++++++++++++++---------
 3 files changed, 56 insertions(+), 26 deletions(-)
Signature · 1 line
2.33.0
#1 lore raw

PATCH 1/2 net/bonding: fix dedicated queue mode in vector burst

From: Chengchang Tang <[email protected]>

If the vector burst mode is selected, the dedicated queue mode will not take effect on some PMDs because these PMDs may have some limitaions in vector burst mode. For example, the limit on burst size. Currently, both hns3 and intel I40E require four alignments when receiving packets in vector mode. As a result, they cannt accept packets if burst size below four. However, in dedicated queue mode, the burst size of periodic packets processing is one.

This patch fixes the above problem by modifying the burst size to 32. This approach also makes the packet processing of the dedicated queue mode more reasonable. Currently, if multiple lacp protocol packets are received in the hardware queue in a cycle, only one lacp packet will be processed in this cycle, and the left packets will be processed in the following cycle. After the modification, all the lacp packets will be processed at one time, which seems more reasonable and closer to the behavior of the bonding driver when the dedicated queue is not turned on.

Fixes 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP control")
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 32 ++++++++++++++++-------
 1 file changed, 23 insertions(+), 9 deletions(-)
drivers/net/bonding/rte_eth_bond_8023ad.c +23 -9
index 8b5b32fcaf..fc8ebd6320 100644
@@ -838,6 +838,27 @@ rx_machine_update(struct bond_dev_private *internals, uint16_t slave_id,
 		rx_machine(internals, slave_id, NULL);
 }
 
+static void
+bond_mode_8023ad_dedicated_rxq_process(struct bond_dev_private *internals,
+			uint16_t slave_id)
+{
+#define DEDICATED_QUEUE_BURST_SIZE 32
+	struct rte_mbuf *lacp_pkt[DEDICATED_QUEUE_BURST_SIZE];
+	uint16_t rx_count = rte_eth_rx_burst(slave_id,
+				internals->mode4.dedicated_queues.rx_qid,
+				lacp_pkt, DEDICATED_QUEUE_BURST_SIZE);
+
+	if (rx_count) {
+		uint16_t i;
+
+		for (i = 0; i < rx_count; i++)
+			bond_mode_8023ad_handle_slow_pkt(internals, slave_id,
+					lacp_pkt[i]);
+	} else {
+		rx_machine_update(internals, slave_id, NULL);
+	}
+}
+
 static void
 bond_mode_8023ad_periodic_cb(void *arg)
 {
@@ -926,15 +947,8 @@ bond_mode_8023ad_periodic_cb(void *arg)
 
 			rx_machine_update(internals, slave_id, lacp_pkt);
 		} else {
-			uint16_t rx_count = rte_eth_rx_burst(slave_id,
-					internals->mode4.dedicated_queues.rx_qid,
-					&lacp_pkt, 1);
-
-			if (rx_count == 1)
-				bond_mode_8023ad_handle_slow_pkt(internals,
-						slave_id, lacp_pkt);
-			else
-				rx_machine_update(internals, slave_id, NULL);
+			bond_mode_8023ad_dedicated_rxq_process(internals,
+					slave_id);
 		}
 
 		periodic_machine(internals, slave_id);
Signature · 1 line
2.33.0
#2 lore raw

PATCH 2/2 net/bonding: fix RSS key length

In reply to Min Hu (Connor)

From: Chengchang Tang <[email protected]>

Now the hash_key_size information has not been set. So, apps can not get the key size from dev_info(), this make some problem.

e.g, in testpmd, the hash_key_size will be checked before configure or get the hash key:
testpmd> show port 4 rss-hash
dev_info did not provide a valid hash key size
testpmd> show port 4 rss-hash key
dev_info did not provide a valid hash key size
testpmd> port config 4 rss-hash-key ipv4 (hash key) dev_info did not provide a valid hash key size

In this patch, the meaning of rss_key_len has been modified. It only indicated the length of the configured hash key before. Therefore, its value depends on the user's configuration. This seems unreasonable. And now, it indicates the minimum hash key length required by the bonded device. Its value will be the shortest hash key among all slave drivers.

Fixes 734ce47f71e0 ("bonding: support RSS dynamic configuration")
---
 drivers/net/bonding/rte_eth_bond_api.c |  6 ++++
 drivers/net/bonding/rte_eth_bond_pmd.c | 44 ++++++++++++++++----------
 2 files changed, 33 insertions(+), 17 deletions(-)
drivers/net/bonding/rte_eth_bond_api.c +6 -0
index eb8d15d160..5140ef14c2 100644
@@ -290,6 +290,7 @@ eth_bond_slave_inherit_dev_info_rx_first(struct bond_dev_private *internals,
 	struct rte_eth_rxconf *rxconf_i = &internals->default_rxconf;
 
 	internals->reta_size = di->reta_size;
+	internals->rss_key_len = di->hash_key_size;
 
 	/* Inherit Rx offload capabilities from the first slave device */
 	internals->rx_offload_capa = di->rx_offload_capa;
@@ -385,6 +386,11 @@ eth_bond_slave_inherit_dev_info_rx_next(struct bond_dev_private *internals,
 	 */
 	if (internals->reta_size > di->reta_size)
 		internals->reta_size = di->reta_size;
+	if (internals->rss_key_len > di->hash_key_size) {
+		RTE_BOND_LOG(WARNING, "slave has different rss key size, "
+				"configuring rss may fail");
+		internals->rss_key_len = di->hash_key_size;
+	}
 
 	if (!internals->max_rx_pktlen &&
 	    di->max_rx_pktlen < internals->candidate_max_rx_pktlen)
drivers/net/bonding/rte_eth_bond_pmd.c +27 -17

74 lines not on this page · raw message

Signature · 1 line
2.33.0
#3 lore raw
In reply to Min Hu (Connor)
Quoted 6 lines · Min Hu (Connor)

This patchset contains two bugfixes for bonding.

Chengchang Tang (2):
net/bonding: fix dedicated queue mode in vector burst net/bonding: fix RSS key length

Series applied to dpdk-next-net/main, thanks.