DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] enhance bonding PMD to support the LACP negotiation
@ 2023-02-16  7:15 Chaoyong He
  2023-02-16  7:15 ` [PATCH 1/2] net/bonding: add independent LACP sending function Chaoyong He
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Chaoyong He @ 2023-02-16  7:15 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Chaoyong He

App may not support the LACP negotiation in some cases.
This patch series solves this problem and add logics to
testpmd app to support the forward of bonding port in
mode 4 with the disabled dedicated queue.

Long Wu (2):
  net/bonding: add independent LACP sending function
  app/testpmd: add support for bonding port's LACP negotiation

 app/test-pmd/config.c                     | 23 +++++++++
 app/test-pmd/parameters.c                 | 10 ++++
 app/test-pmd/testpmd.c                    | 43 ++++++++++++++++-
 app/test-pmd/testpmd.h                    |  9 ++++
 doc/guides/testpmd_app_ug/run_app.rst     |  4 ++
 drivers/net/bonding/rte_eth_bond_8023ad.c | 58 +++++++++++++++++++++++
 drivers/net/bonding/rte_eth_bond_8023ad.h | 19 ++++++++
 7 files changed, 165 insertions(+), 1 deletion(-)

-- 
2.29.3


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

* [PATCH 1/2] net/bonding: add independent LACP sending function
  2023-02-16  7:15 [PATCH 0/2] enhance bonding PMD to support the LACP negotiation Chaoyong He
@ 2023-02-16  7:15 ` Chaoyong He
  2023-02-16 19:47   ` Stephen Hemminger
  2023-02-16  7:15 ` [PATCH 2/2] app/testpmd: add support for bonding port's LACP negotiation Chaoyong He
  2023-02-16  8:32 ` [PATCH v2 0/2] enhance bonding PMD to support the " Chaoyong He
  2 siblings, 1 reply; 22+ messages in thread
From: Chaoyong He @ 2023-02-16  7:15 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Long Wu, Chaoyong He

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

Sending LACP control packets depends on calling the bonding port's
sending function if we disable dedicated queue. In some cases app
would not call the bonding port's sending function if there are
only LACP control packets and the negotiation between the two
bonding ports will fail.

We add the independent LACP sending function for app. App can call
it by itself and let the negotiation succeed.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 58 +++++++++++++++++++++++
 drivers/net/bonding/rte_eth_bond_8023ad.h | 19 ++++++++
 2 files changed, 77 insertions(+)

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index 4a266bb2ca..4c3b142f6d 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -1757,3 +1757,61 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
 
 	return retval;
 }
+
+int
+rte_eth_bond_8023ad_dedicated_queues_get(uint16_t port_id)
+{
+	struct rte_eth_dev *dev;
+	struct bond_dev_private *internals;
+
+	if (valid_bonded_port_id(port_id) != 0)
+		return -EINVAL;
+
+	dev = &rte_eth_devices[port_id];
+	internals = dev->data->dev_private;
+
+	if (internals->mode != BONDING_MODE_8023AD)
+		return -EINVAL;
+
+	return internals->mode4.dedicated_queues.enabled;
+}
+
+void
+rte_eth_bond_8023ad_lacp_send_one(void *queue)
+{
+	uint32_t i;
+	uint16_t slave_tx_count;
+	uint16_t active_slave_count;
+	uint16_t active_slave_ids[RTE_MAX_ETHPORTS];
+	struct bond_tx_queue *bd_tx_q = queue;
+	struct bond_dev_private *internals = bd_tx_q->dev_private;
+
+	active_slave_count = internals->active_slave_count;
+	if (unlikely(active_slave_count == 0))
+		return;
+
+	rte_memcpy(active_slave_ids, internals->active_slaves,
+		sizeof(active_slave_ids[0]) * active_slave_count);
+
+	/* Check for LACP control packets and send if available */
+	for (i = 0; i < active_slave_count; i++) {
+		struct rte_mbuf *ctrl_pkt = NULL;
+		struct port *port = &bond_mode_8023ad_ports[active_slave_ids[i]];
+
+		if (likely(rte_ring_empty(port->tx_ring)))
+			continue;
+
+		if (rte_ring_dequeue(port->tx_ring, (void **)&ctrl_pkt) == 0) {
+			slave_tx_count = rte_eth_tx_prepare(active_slave_ids[i],
+					bd_tx_q->queue_id, &ctrl_pkt, 1);
+			slave_tx_count = rte_eth_tx_burst(active_slave_ids[i],
+					bd_tx_q->queue_id, &ctrl_pkt, slave_tx_count);
+			/*
+			 * Re-enqueue LAG control plane packets to buffering
+			 * ring if transmission fails so the packet won't lost.
+			 */
+			if (slave_tx_count != 1)
+				rte_ring_enqueue(port->tx_ring, ctrl_pkt);
+		}
+	}
+}
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h
index 7eb392f8c8..92b980b825 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.h
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.h
@@ -331,4 +331,23 @@ rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id);
 int
 rte_eth_bond_8023ad_agg_selection_set(uint16_t port_id,
 		enum rte_bond_8023ad_agg_selection agg_selection);
+
+/**
+ * Get LACP dedicated queues enable/disable for 8023ad
+ * @param port_id Bonding device id
+ * @return
+ *   0 - the port is a bonding mode 4 port with disabled dedicated queue
+ *   1 - the port is a bonding mode 4 port with enabled dedicated queue
+ *   -EINVAL - the port is not a bonding port or the bonding port's mode is not 4
+ */
+int
+rte_eth_bond_8023ad_dedicated_queues_get(uint16_t port_id);
+
+/**
+ * Send one LACP packet for bonding port in mode 4 with disabled dedicated queue
+ * @param queue Bonding port's tx queue
+ */
+void
+rte_eth_bond_8023ad_lacp_send_one(void *queue);
+
 #endif /* RTE_ETH_BOND_8023AD_H_ */
-- 
2.29.3


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

* [PATCH 2/2] app/testpmd: add support for bonding port's LACP negotiation
  2023-02-16  7:15 [PATCH 0/2] enhance bonding PMD to support the LACP negotiation Chaoyong He
  2023-02-16  7:15 ` [PATCH 1/2] net/bonding: add independent LACP sending function Chaoyong He
@ 2023-02-16  7:15 ` Chaoyong He
  2023-02-16  8:32 ` [PATCH v2 0/2] enhance bonding PMD to support the " Chaoyong He
  2 siblings, 0 replies; 22+ messages in thread
From: Chaoyong He @ 2023-02-16  7:15 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Long Wu, Chaoyong He

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

If bonding port is mode4 with disabling dedicated queue and there
are no other packets, forward loop will not call port's TX function
and bonding port will not send LACP packets.

Add sending LACP packets periodically in forward loop to avoid
LACP negotiation failed.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 app/test-pmd/config.c                 | 23 ++++++++++++++
 app/test-pmd/parameters.c             | 10 +++++++
 app/test-pmd/testpmd.c                | 43 ++++++++++++++++++++++++++-
 app/test-pmd/testpmd.h                |  9 ++++++
 doc/guides/testpmd_app_ug/run_app.rst |  4 +++
 5 files changed, 88 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 41484c3dde..4b7be9cc25 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -53,6 +53,11 @@
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
 #endif
+#ifdef RTE_NET_BOND
+#include <rte_eth_bond.h>
+#include <rte_eth_bond_8023ad.h>
+#endif
+
 #include <rte_hexdump.h>
 
 #include "testpmd.h"
@@ -4401,6 +4406,12 @@ simple_fwd_config_setup(void)
 		fwd_streams[i]->tx_queue  = 0;
 		fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
 		fwd_streams[i]->retry_enabled = retry_enabled;
+#ifdef RTE_NET_BOND
+		if (rte_eth_bond_8023ad_dedicated_queues_get(fwd_streams[i]->tx_port) == 0)
+			fwd_streams[i]->bond4_send_periodical_lacp = true;
+		else
+			fwd_streams[i]->bond4_send_periodical_lacp = false;
+#endif
 	}
 }
 
@@ -4462,6 +4473,12 @@ rss_fwd_config_setup(void)
 		fs->tx_queue = rxq;
 		fs->peer_addr = fs->tx_port;
 		fs->retry_enabled = retry_enabled;
+#ifdef RTE_NET_BOND
+		if (rte_eth_bond_8023ad_dedicated_queues_get(fs->tx_port) == 0)
+			fs->bond4_send_periodical_lacp = true;
+		else
+			fs->bond4_send_periodical_lacp = false;
+#endif
 		rxp++;
 		if (rxp < nb_fwd_ports)
 			continue;
@@ -4577,6 +4594,12 @@ dcb_fwd_config_setup(void)
 				fs->tx_queue = txq + j % nb_tx_queue;
 				fs->peer_addr = fs->tx_port;
 				fs->retry_enabled = retry_enabled;
+#ifdef RTE_NET_BOND
+				if (rte_eth_bond_8023ad_dedicated_queues_get(fs->tx_port) == 0)
+					fs->bond4_send_periodical_lacp = true;
+				else
+					fs->bond4_send_periodical_lacp = false;
+#endif
 			}
 			fwd_lcores[lc_id]->stream_nb +=
 				rxp_dcb_info.tc_queue.tc_rxq[i][tc].nb_queue;
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index e734ad9a02..5952b05b57 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -205,6 +205,9 @@ usage(char* progname)
 	printf("  --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n"
 	       "    0x10 - explicit Tx rule, 0x02 - hairpin ports paired\n"
 	       "    0x01 - hairpin ports loop, 0x00 - hairpin port self\n");
+#ifdef RTE_NET_BOND
+	printf("  --bond4-lacp-fwd: enable lacp update in fwd main loop\n");
+#endif
 }
 
 #ifdef RTE_LIB_CMDLINE
@@ -705,6 +708,9 @@ launch_args_parse(int argc, char** argv)
 		{ "rx-mq-mode",                 1, 0, 0 },
 		{ "record-core-cycles",         0, 0, 0 },
 		{ "record-burst-stats",         0, 0, 0 },
+#ifdef RTE_NET_BOND
+		{ "bond4-lacp-fwd",             0, 0, 0 },
+#endif
 		{ PARAM_NUM_PROCS,              1, 0, 0 },
 		{ PARAM_PROC_ID,                1, 0, 0 },
 		{ 0, 0, 0, 0 },
@@ -1462,6 +1468,10 @@ launch_args_parse(int argc, char** argv)
 				num_procs = atoi(optarg);
 			if (!strcmp(lgopts[opt_idx].name, PARAM_PROC_ID))
 				proc_id = atoi(optarg);
+#ifdef RTE_NET_BOND
+			if (!strcmp(lgopts[opt_idx].name, "bond4-lacp-fwd"))
+				bond4_lacp_fwd = 1;
+#endif
 			break;
 		case 'h':
 			usage(argv[0]);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index a6c5dec4c0..732137d5ce 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -68,6 +68,7 @@
 #endif
 #ifdef RTE_NET_BOND
 #include <rte_eth_bond.h>
+#include <rte_eth_bond_8023ad.h>
 #endif
 #ifdef RTE_NET_MLX5
 #include "mlx5_testpmd.h"
@@ -519,6 +520,11 @@ struct gro_status gro_ports[RTE_MAX_ETHPORTS];
 uint8_t gro_flush_cycles = GRO_DEFAULT_FLUSH_CYCLES;
 #endif
 
+#ifdef RTE_NET_BOND
+uint8_t bond4_lacp_fwd;
+#define LACP_UPDATE_PERIOD 10000
+#endif
+
 /*
  * hexadecimal bitmask of RX mq mode can be enabled.
  */
@@ -2252,6 +2258,25 @@ flush_fwd_rx_queues(void)
 	}
 }
 
+#ifdef RTE_NET_BOND
+static inline void
+try_lacp_send_in_fwd(struct fwd_stream **fsm, streamid_t nb_fs)
+{
+	void *qd;
+	streamid_t sm_id;
+	struct rte_eth_fp_ops *p;
+
+	for (sm_id = 0; sm_id < nb_fs; sm_id++) {
+		/* Update bond4 LACP if dedicated queues disabled. */
+		if (fsm[sm_id]->bond4_send_periodical_lacp) {
+			p = &rte_eth_fp_ops[fsm[sm_id]->tx_port];
+			qd = p->txq.data[fsm[sm_id]->tx_queue];
+			rte_eth_bond_8023ad_lacp_send_one(qd);
+		}
+	}
+}
+#endif
+
 static void
 run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)
 {
@@ -2268,6 +2293,11 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)
 	cnt_ports = nb_ports;
 	tics_datum = rte_rdtsc();
 	tics_per_1sec = rte_get_timer_hz();
+#endif
+#ifdef RTE_NET_BOND
+	uint64_t before_tsc = rte_rdtsc();
+	const uint64_t bond4_lacp_period = (rte_get_tsc_hz() + US_PER_S - 1) /
+			US_PER_S * LACP_UPDATE_PERIOD;
 #endif
 	fsm = &fwd_streams[fc->stream_idx];
 	nb_fs = fc->stream_nb;
@@ -2300,6 +2330,15 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)
 			fc->total_cycles += tsc - prev_tsc;
 			prev_tsc = tsc;
 		}
+#ifdef RTE_NET_BOND
+		if (bond4_lacp_fwd != 0) {
+			uint64_t current_tsc = rte_rdtsc();
+			if (unlikely((current_tsc - before_tsc) > bond4_lacp_period)) {
+				try_lacp_send_in_fwd(fsm, nb_fs);
+				before_tsc = current_tsc;
+			}
+		}
+#endif
 	} while (! fc->stopped);
 }
 
@@ -4462,7 +4501,9 @@ main(int argc, char** argv)
 #ifdef RTE_LIB_LATENCYSTATS
 	latencystats_enabled = 0;
 #endif
-
+#ifdef RTE_NET_BOND
+	bond4_lacp_fwd = 0;
+#endif
 	/* on FreeBSD, mlockall() is disabled by default */
 #ifdef RTE_EXEC_ENV_FREEBSD
 	do_mlockall = 0;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index b9c77a7a96..5d6673214f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -175,6 +175,11 @@ struct fwd_stream {
 	unsigned int gro_times;	/**< GRO operation times */
 #endif
 	uint64_t busy_cycles; /**< used with --record-core-cycles */
+	uint64_t     core_cycles; /**< used for RX and TX processing */
+#ifdef RTE_NET_BOND
+	bool bond4_send_periodical_lacp;
+	/**< Send LACP packets periodically in forward loop */
+#endif
 	struct pkt_burst_stats rx_burst_stats;
 	struct pkt_burst_stats tx_burst_stats;
 	struct fwd_lcore *lcore; /**< Lcore being scheduled. */
@@ -582,6 +587,10 @@ extern lcoreid_t bitrate_lcore_id;
 extern uint8_t bitrate_enabled;
 #endif
 
+#ifdef RTE_NET_BOND
+extern uint8_t bond4_lacp_fwd;
+#endif
+
 extern uint32_t max_rx_pkt_len;
 
 /*
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index 3ec3d4f5e6..24aaa9d229 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -538,6 +538,10 @@ The command line options are:
 
     Enable display of RX and TX burst stats.
 
+*   ``--bond4-lacp-fwd``
+
+    Enable LACP packets sending in main forward loop to avoid LACP negotiation failed.
+
 *   ``--hairpin-mode=0xXXXX``
 
     Set the hairpin port configuration with bitmask, only valid when hairpin queues number is set::
-- 
2.29.3


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

* [PATCH v2 0/2] enhance bonding PMD to support the LACP negotiation
  2023-02-16  7:15 [PATCH 0/2] enhance bonding PMD to support the LACP negotiation Chaoyong He
  2023-02-16  7:15 ` [PATCH 1/2] net/bonding: add independent LACP sending function Chaoyong He
  2023-02-16  7:15 ` [PATCH 2/2] app/testpmd: add support for bonding port's LACP negotiation Chaoyong He
@ 2023-02-16  8:32 ` Chaoyong He
  2023-02-16  8:32   ` [PATCH v2 1/2] net/bonding: add independent LACP sending function Chaoyong He
                     ` (2 more replies)
  2 siblings, 3 replies; 22+ messages in thread
From: Chaoyong He @ 2023-02-16  8:32 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Chaoyong He

App may not support the LACP negotiation in some cases.
This patch series solves this problem and add logics to
testpmd app to support the forward of bonding port in
mode 4 with the disabled dedicated queue.

---
v2:
* Export symbol to solve the link problem.
---

Long Wu (2):
  net/bonding: add independent LACP sending function
  app/testpmd: add support for bonding port's LACP negotiation

 app/test-pmd/config.c                     | 23 +++++++++
 app/test-pmd/parameters.c                 | 10 ++++
 app/test-pmd/testpmd.c                    | 43 ++++++++++++++++-
 app/test-pmd/testpmd.h                    |  9 ++++
 doc/guides/testpmd_app_ug/run_app.rst     |  4 ++
 drivers/net/bonding/rte_eth_bond_8023ad.c | 58 +++++++++++++++++++++++
 drivers/net/bonding/rte_eth_bond_8023ad.h | 19 ++++++++
 drivers/net/bonding/version.map           |  2 +
 8 files changed, 167 insertions(+), 1 deletion(-)

-- 
2.29.3


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

* [PATCH v2 1/2] net/bonding: add independent LACP sending function
  2023-02-16  8:32 ` [PATCH v2 0/2] enhance bonding PMD to support the " Chaoyong He
@ 2023-02-16  8:32   ` Chaoyong He
  2023-02-16  8:32   ` [PATCH v2 2/2] app/testpmd: add support for bonding port's LACP negotiation Chaoyong He
  2023-03-01  2:48   ` [PATCH v3 0/2] enhance bonding PMD to support the " Chaoyong He
  2 siblings, 0 replies; 22+ messages in thread
From: Chaoyong He @ 2023-02-16  8:32 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Long Wu, Chaoyong He

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

Sending LACP control packets depends on calling the bonding port's
sending function if we disable dedicated queue. In some cases app
would not call the bonding port's sending function if there are
only LACP control packets and the negotiation between the two
bonding ports will fail.

We add the independent LACP sending function for app. App can call
it by itself and let the negotiation succeed.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 58 +++++++++++++++++++++++
 drivers/net/bonding/rte_eth_bond_8023ad.h | 19 ++++++++
 drivers/net/bonding/version.map           |  2 +
 3 files changed, 79 insertions(+)

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index 4a266bb2ca..4c3b142f6d 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -1757,3 +1757,61 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
 
 	return retval;
 }
+
+int
+rte_eth_bond_8023ad_dedicated_queues_get(uint16_t port_id)
+{
+	struct rte_eth_dev *dev;
+	struct bond_dev_private *internals;
+
+	if (valid_bonded_port_id(port_id) != 0)
+		return -EINVAL;
+
+	dev = &rte_eth_devices[port_id];
+	internals = dev->data->dev_private;
+
+	if (internals->mode != BONDING_MODE_8023AD)
+		return -EINVAL;
+
+	return internals->mode4.dedicated_queues.enabled;
+}
+
+void
+rte_eth_bond_8023ad_lacp_send_one(void *queue)
+{
+	uint32_t i;
+	uint16_t slave_tx_count;
+	uint16_t active_slave_count;
+	uint16_t active_slave_ids[RTE_MAX_ETHPORTS];
+	struct bond_tx_queue *bd_tx_q = queue;
+	struct bond_dev_private *internals = bd_tx_q->dev_private;
+
+	active_slave_count = internals->active_slave_count;
+	if (unlikely(active_slave_count == 0))
+		return;
+
+	rte_memcpy(active_slave_ids, internals->active_slaves,
+		sizeof(active_slave_ids[0]) * active_slave_count);
+
+	/* Check for LACP control packets and send if available */
+	for (i = 0; i < active_slave_count; i++) {
+		struct rte_mbuf *ctrl_pkt = NULL;
+		struct port *port = &bond_mode_8023ad_ports[active_slave_ids[i]];
+
+		if (likely(rte_ring_empty(port->tx_ring)))
+			continue;
+
+		if (rte_ring_dequeue(port->tx_ring, (void **)&ctrl_pkt) == 0) {
+			slave_tx_count = rte_eth_tx_prepare(active_slave_ids[i],
+					bd_tx_q->queue_id, &ctrl_pkt, 1);
+			slave_tx_count = rte_eth_tx_burst(active_slave_ids[i],
+					bd_tx_q->queue_id, &ctrl_pkt, slave_tx_count);
+			/*
+			 * Re-enqueue LAG control plane packets to buffering
+			 * ring if transmission fails so the packet won't lost.
+			 */
+			if (slave_tx_count != 1)
+				rte_ring_enqueue(port->tx_ring, ctrl_pkt);
+		}
+	}
+}
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h
index 7eb392f8c8..92b980b825 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.h
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.h
@@ -331,4 +331,23 @@ rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id);
 int
 rte_eth_bond_8023ad_agg_selection_set(uint16_t port_id,
 		enum rte_bond_8023ad_agg_selection agg_selection);
+
+/**
+ * Get LACP dedicated queues enable/disable for 8023ad
+ * @param port_id Bonding device id
+ * @return
+ *   0 - the port is a bonding mode 4 port with disabled dedicated queue
+ *   1 - the port is a bonding mode 4 port with enabled dedicated queue
+ *   -EINVAL - the port is not a bonding port or the bonding port's mode is not 4
+ */
+int
+rte_eth_bond_8023ad_dedicated_queues_get(uint16_t port_id);
+
+/**
+ * Send one LACP packet for bonding port in mode 4 with disabled dedicated queue
+ * @param queue Bonding port's tx queue
+ */
+void
+rte_eth_bond_8023ad_lacp_send_one(void *queue);
+
 #endif /* RTE_ETH_BOND_8023AD_H_ */
diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map
index 9333923b4e..0284b11a6a 100644
--- a/drivers/net/bonding/version.map
+++ b/drivers/net/bonding/version.map
@@ -6,11 +6,13 @@ DPDK_23 {
 	rte_eth_bond_8023ad_conf_get;
 	rte_eth_bond_8023ad_dedicated_queues_disable;
 	rte_eth_bond_8023ad_dedicated_queues_enable;
+	rte_eth_bond_8023ad_dedicated_queues_get;
 	rte_eth_bond_8023ad_ext_collect;
 	rte_eth_bond_8023ad_ext_collect_get;
 	rte_eth_bond_8023ad_ext_distrib;
 	rte_eth_bond_8023ad_ext_distrib_get;
 	rte_eth_bond_8023ad_ext_slowtx;
+	rte_eth_bond_8023ad_lacp_send_one;
 	rte_eth_bond_8023ad_setup;
 	rte_eth_bond_8023ad_slave_info;
 	rte_eth_bond_active_slaves_get;
-- 
2.29.3


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

* [PATCH v2 2/2] app/testpmd: add support for bonding port's LACP negotiation
  2023-02-16  8:32 ` [PATCH v2 0/2] enhance bonding PMD to support the " Chaoyong He
  2023-02-16  8:32   ` [PATCH v2 1/2] net/bonding: add independent LACP sending function Chaoyong He
@ 2023-02-16  8:32   ` Chaoyong He
  2023-02-16 17:05     ` Ferruh Yigit
  2023-03-01  2:48   ` [PATCH v3 0/2] enhance bonding PMD to support the " Chaoyong He
  2 siblings, 1 reply; 22+ messages in thread
From: Chaoyong He @ 2023-02-16  8:32 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Long Wu, Chaoyong He

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

If bonding port is mode4 with disabling dedicated queue and there
are no other packets, forward loop will not call port's TX function
and bonding port will not send LACP packets.

Add sending LACP packets periodically in forward loop to avoid
LACP negotiation failed.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 app/test-pmd/config.c                 | 23 ++++++++++++++
 app/test-pmd/parameters.c             | 10 +++++++
 app/test-pmd/testpmd.c                | 43 ++++++++++++++++++++++++++-
 app/test-pmd/testpmd.h                |  9 ++++++
 doc/guides/testpmd_app_ug/run_app.rst |  4 +++
 5 files changed, 88 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 41484c3dde..4b7be9cc25 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -53,6 +53,11 @@
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
 #endif
+#ifdef RTE_NET_BOND
+#include <rte_eth_bond.h>
+#include <rte_eth_bond_8023ad.h>
+#endif
+
 #include <rte_hexdump.h>
 
 #include "testpmd.h"
@@ -4401,6 +4406,12 @@ simple_fwd_config_setup(void)
 		fwd_streams[i]->tx_queue  = 0;
 		fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
 		fwd_streams[i]->retry_enabled = retry_enabled;
+#ifdef RTE_NET_BOND
+		if (rte_eth_bond_8023ad_dedicated_queues_get(fwd_streams[i]->tx_port) == 0)
+			fwd_streams[i]->bond4_send_periodical_lacp = true;
+		else
+			fwd_streams[i]->bond4_send_periodical_lacp = false;
+#endif
 	}
 }
 
@@ -4462,6 +4473,12 @@ rss_fwd_config_setup(void)
 		fs->tx_queue = rxq;
 		fs->peer_addr = fs->tx_port;
 		fs->retry_enabled = retry_enabled;
+#ifdef RTE_NET_BOND
+		if (rte_eth_bond_8023ad_dedicated_queues_get(fs->tx_port) == 0)
+			fs->bond4_send_periodical_lacp = true;
+		else
+			fs->bond4_send_periodical_lacp = false;
+#endif
 		rxp++;
 		if (rxp < nb_fwd_ports)
 			continue;
@@ -4577,6 +4594,12 @@ dcb_fwd_config_setup(void)
 				fs->tx_queue = txq + j % nb_tx_queue;
 				fs->peer_addr = fs->tx_port;
 				fs->retry_enabled = retry_enabled;
+#ifdef RTE_NET_BOND
+				if (rte_eth_bond_8023ad_dedicated_queues_get(fs->tx_port) == 0)
+					fs->bond4_send_periodical_lacp = true;
+				else
+					fs->bond4_send_periodical_lacp = false;
+#endif
 			}
 			fwd_lcores[lc_id]->stream_nb +=
 				rxp_dcb_info.tc_queue.tc_rxq[i][tc].nb_queue;
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index e734ad9a02..5952b05b57 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -205,6 +205,9 @@ usage(char* progname)
 	printf("  --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n"
 	       "    0x10 - explicit Tx rule, 0x02 - hairpin ports paired\n"
 	       "    0x01 - hairpin ports loop, 0x00 - hairpin port self\n");
+#ifdef RTE_NET_BOND
+	printf("  --bond4-lacp-fwd: enable lacp update in fwd main loop\n");
+#endif
 }
 
 #ifdef RTE_LIB_CMDLINE
@@ -705,6 +708,9 @@ launch_args_parse(int argc, char** argv)
 		{ "rx-mq-mode",                 1, 0, 0 },
 		{ "record-core-cycles",         0, 0, 0 },
 		{ "record-burst-stats",         0, 0, 0 },
+#ifdef RTE_NET_BOND
+		{ "bond4-lacp-fwd",             0, 0, 0 },
+#endif
 		{ PARAM_NUM_PROCS,              1, 0, 0 },
 		{ PARAM_PROC_ID,                1, 0, 0 },
 		{ 0, 0, 0, 0 },
@@ -1462,6 +1468,10 @@ launch_args_parse(int argc, char** argv)
 				num_procs = atoi(optarg);
 			if (!strcmp(lgopts[opt_idx].name, PARAM_PROC_ID))
 				proc_id = atoi(optarg);
+#ifdef RTE_NET_BOND
+			if (!strcmp(lgopts[opt_idx].name, "bond4-lacp-fwd"))
+				bond4_lacp_fwd = 1;
+#endif
 			break;
 		case 'h':
 			usage(argv[0]);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index a6c5dec4c0..732137d5ce 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -68,6 +68,7 @@
 #endif
 #ifdef RTE_NET_BOND
 #include <rte_eth_bond.h>
+#include <rte_eth_bond_8023ad.h>
 #endif
 #ifdef RTE_NET_MLX5
 #include "mlx5_testpmd.h"
@@ -519,6 +520,11 @@ struct gro_status gro_ports[RTE_MAX_ETHPORTS];
 uint8_t gro_flush_cycles = GRO_DEFAULT_FLUSH_CYCLES;
 #endif
 
+#ifdef RTE_NET_BOND
+uint8_t bond4_lacp_fwd;
+#define LACP_UPDATE_PERIOD 10000
+#endif
+
 /*
  * hexadecimal bitmask of RX mq mode can be enabled.
  */
@@ -2252,6 +2258,25 @@ flush_fwd_rx_queues(void)
 	}
 }
 
+#ifdef RTE_NET_BOND
+static inline void
+try_lacp_send_in_fwd(struct fwd_stream **fsm, streamid_t nb_fs)
+{
+	void *qd;
+	streamid_t sm_id;
+	struct rte_eth_fp_ops *p;
+
+	for (sm_id = 0; sm_id < nb_fs; sm_id++) {
+		/* Update bond4 LACP if dedicated queues disabled. */
+		if (fsm[sm_id]->bond4_send_periodical_lacp) {
+			p = &rte_eth_fp_ops[fsm[sm_id]->tx_port];
+			qd = p->txq.data[fsm[sm_id]->tx_queue];
+			rte_eth_bond_8023ad_lacp_send_one(qd);
+		}
+	}
+}
+#endif
+
 static void
 run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)
 {
@@ -2268,6 +2293,11 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)
 	cnt_ports = nb_ports;
 	tics_datum = rte_rdtsc();
 	tics_per_1sec = rte_get_timer_hz();
+#endif
+#ifdef RTE_NET_BOND
+	uint64_t before_tsc = rte_rdtsc();
+	const uint64_t bond4_lacp_period = (rte_get_tsc_hz() + US_PER_S - 1) /
+			US_PER_S * LACP_UPDATE_PERIOD;
 #endif
 	fsm = &fwd_streams[fc->stream_idx];
 	nb_fs = fc->stream_nb;
@@ -2300,6 +2330,15 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)
 			fc->total_cycles += tsc - prev_tsc;
 			prev_tsc = tsc;
 		}
+#ifdef RTE_NET_BOND
+		if (bond4_lacp_fwd != 0) {
+			uint64_t current_tsc = rte_rdtsc();
+			if (unlikely((current_tsc - before_tsc) > bond4_lacp_period)) {
+				try_lacp_send_in_fwd(fsm, nb_fs);
+				before_tsc = current_tsc;
+			}
+		}
+#endif
 	} while (! fc->stopped);
 }
 
@@ -4462,7 +4501,9 @@ main(int argc, char** argv)
 #ifdef RTE_LIB_LATENCYSTATS
 	latencystats_enabled = 0;
 #endif
-
+#ifdef RTE_NET_BOND
+	bond4_lacp_fwd = 0;
+#endif
 	/* on FreeBSD, mlockall() is disabled by default */
 #ifdef RTE_EXEC_ENV_FREEBSD
 	do_mlockall = 0;
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index b9c77a7a96..5d6673214f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -175,6 +175,11 @@ struct fwd_stream {
 	unsigned int gro_times;	/**< GRO operation times */
 #endif
 	uint64_t busy_cycles; /**< used with --record-core-cycles */
+	uint64_t     core_cycles; /**< used for RX and TX processing */
+#ifdef RTE_NET_BOND
+	bool bond4_send_periodical_lacp;
+	/**< Send LACP packets periodically in forward loop */
+#endif
 	struct pkt_burst_stats rx_burst_stats;
 	struct pkt_burst_stats tx_burst_stats;
 	struct fwd_lcore *lcore; /**< Lcore being scheduled. */
@@ -582,6 +587,10 @@ extern lcoreid_t bitrate_lcore_id;
 extern uint8_t bitrate_enabled;
 #endif
 
+#ifdef RTE_NET_BOND
+extern uint8_t bond4_lacp_fwd;
+#endif
+
 extern uint32_t max_rx_pkt_len;
 
 /*
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index 3ec3d4f5e6..24aaa9d229 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -538,6 +538,10 @@ The command line options are:
 
     Enable display of RX and TX burst stats.
 
+*   ``--bond4-lacp-fwd``
+
+    Enable LACP packets sending in main forward loop to avoid LACP negotiation failed.
+
 *   ``--hairpin-mode=0xXXXX``
 
     Set the hairpin port configuration with bitmask, only valid when hairpin queues number is set::
-- 
2.29.3


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

* Re: [PATCH v2 2/2] app/testpmd: add support for bonding port's LACP negotiation
  2023-02-16  8:32   ` [PATCH v2 2/2] app/testpmd: add support for bonding port's LACP negotiation Chaoyong He
@ 2023-02-16 17:05     ` Ferruh Yigit
  2023-02-22  6:47       ` Chaoyong He
  0 siblings, 1 reply; 22+ messages in thread
From: Ferruh Yigit @ 2023-02-16 17:05 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, niklas.soderlund, Long Wu

On 2/16/2023 8:32 AM, Chaoyong He wrote:
> From: Long Wu <long.wu@corigine.com>
> 
> If bonding port is mode4 with disabling dedicated queue and there
> are no other packets, forward loop will not call port's TX function
> and bonding port will not send LACP packets.
> 
> Add sending LACP packets periodically in forward loop to avoid
> LACP negotiation failed.
> 
> Signed-off-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> ---
>  app/test-pmd/config.c                 | 23 ++++++++++++++
>  app/test-pmd/parameters.c             | 10 +++++++
>  app/test-pmd/testpmd.c                | 43 ++++++++++++++++++++++++++-
>  app/test-pmd/testpmd.h                |  9 ++++++
>  doc/guides/testpmd_app_ug/run_app.rst |  4 +++
>  5 files changed, 88 insertions(+), 1 deletion(-)

Is it possible to have this support in
'drivers/net/bonding/bonding_testpmd.c', to not add PMD specific ifdefs
to the generic testpmd code. Like having a bonding specific command etc..

btw, I didn't check the details, just a high level question.

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

* Re: [PATCH 1/2] net/bonding: add independent LACP sending function
  2023-02-16  7:15 ` [PATCH 1/2] net/bonding: add independent LACP sending function Chaoyong He
@ 2023-02-16 19:47   ` Stephen Hemminger
  2023-02-20  9:46     ` Simon Horman
  0 siblings, 1 reply; 22+ messages in thread
From: Stephen Hemminger @ 2023-02-16 19:47 UTC (permalink / raw)
  To: Chaoyong He; +Cc: dev, oss-drivers, niklas.soderlund, Long Wu

On Thu, 16 Feb 2023 15:15:13 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:

> +void
> +rte_eth_bond_8023ad_lacp_send_one(void *queue)
> +{
> +	uint32_t i;
> +	uint16_t slave_tx_count;
> +	uint16_t active_slave_count;
> +	uint16_t active_slave_ids[RTE_MAX_ETHPORTS];

Thinking ahead, all of bonding driver should remove the usage of the
terms master and slave.  Perhaps you don't want to introduce new
usages that will have to be fixed.

FYI - there is no usage of master/slave in any of the IEEE standards,
or operating systems other than Linux.

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

* Re: [PATCH 1/2] net/bonding: add independent LACP sending function
  2023-02-16 19:47   ` Stephen Hemminger
@ 2023-02-20  9:46     ` Simon Horman
  2023-02-20 16:31       ` Stephen Hemminger
  0 siblings, 1 reply; 22+ messages in thread
From: Simon Horman @ 2023-02-20  9:46 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Chaoyong He, dev, oss-drivers, niklas.soderlund, Long Wu

On Thu, Feb 16, 2023 at 11:47:27AM -0800, Stephen Hemminger wrote:
> On Thu, 16 Feb 2023 15:15:13 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
> 
> > +void
> > +rte_eth_bond_8023ad_lacp_send_one(void *queue)
> > +{
> > +     uint32_t i;
> > +     uint16_t slave_tx_count;
> > +     uint16_t active_slave_count;
> > +     uint16_t active_slave_ids[RTE_MAX_ETHPORTS];
> 
> Thinking ahead, all of bonding driver should remove the usage of the
> terms master and slave.  Perhaps you don't want to introduce new
> usages that will have to be fixed.
> 
> FYI - there is no usage of master/slave in any of the IEEE standards,
> or operating systems other than Linux.

Thanks Stephen,

could we agree on alternative language?

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

* Re: [PATCH 1/2] net/bonding: add independent LACP sending function
  2023-02-20  9:46     ` Simon Horman
@ 2023-02-20 16:31       ` Stephen Hemminger
  2023-02-22  6:47         ` Chaoyong He
  0 siblings, 1 reply; 22+ messages in thread
From: Stephen Hemminger @ 2023-02-20 16:31 UTC (permalink / raw)
  To: Simon Horman; +Cc: Chaoyong He, dev, oss-drivers, niklas.soderlund, Long Wu

On Mon, 20 Feb 2023 10:46:16 +0100
Simon Horman <simon.horman@corigine.com> wrote:

> On Thu, Feb 16, 2023 at 11:47:27AM -0800, Stephen Hemminger wrote:
> > On Thu, 16 Feb 2023 15:15:13 +0800
> > Chaoyong He <chaoyong.he@corigine.com> wrote:
> >   
> > > +void
> > > +rte_eth_bond_8023ad_lacp_send_one(void *queue)
> > > +{
> > > +     uint32_t i;
> > > +     uint16_t slave_tx_count;
> > > +     uint16_t active_slave_count;
> > > +     uint16_t active_slave_ids[RTE_MAX_ETHPORTS];  
> > 
> > Thinking ahead, all of bonding driver should remove the usage of the
> > terms master and slave.  Perhaps you don't want to introduce new
> > usages that will have to be fixed.
> > 
> > FYI - there is no usage of master/slave in any of the IEEE standards,
> > or operating systems other than Linux.  
> 
> Thanks Stephen,
> 
> could we agree on alternative language?

I did a little looking around and did not come to a great answer.
Looking at FreeBSD (and Solaris) they use lagg for the aggregating device
and laggport for the devices associated with it.  Applying same logic
to DPDK would be awkward because it already uses the term "port"
in multiple ways.

Cisco uses the term "port channel group" when configuring link aggregation.
Going that way maybe use channels as the replacement for slave in code like this.




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

* RE: [PATCH v2 2/2] app/testpmd: add support for bonding port's LACP negotiation
  2023-02-16 17:05     ` Ferruh Yigit
@ 2023-02-22  6:47       ` Chaoyong He
  0 siblings, 0 replies; 22+ messages in thread
From: Chaoyong He @ 2023-02-22  6:47 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: oss-drivers, Niklas Soderlund, Long Wu

> On 2/16/2023 8:32 AM, Chaoyong He wrote:
> > From: Long Wu <long.wu@corigine.com>
> >
> > If bonding port is mode4 with disabling dedicated queue and there are
> > no other packets, forward loop will not call port's TX function and
> > bonding port will not send LACP packets.
> >
> > Add sending LACP packets periodically in forward loop to avoid LACP
> > negotiation failed.
> >
> > Signed-off-by: Long Wu <long.wu@corigine.com>
> > Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> > Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> > ---
> >  app/test-pmd/config.c                 | 23 ++++++++++++++
> >  app/test-pmd/parameters.c             | 10 +++++++
> >  app/test-pmd/testpmd.c                | 43 ++++++++++++++++++++++++++-
> >  app/test-pmd/testpmd.h                |  9 ++++++
> >  doc/guides/testpmd_app_ug/run_app.rst |  4 +++
> >  5 files changed, 88 insertions(+), 1 deletion(-)
> 
> Is it possible to have this support in
> 'drivers/net/bonding/bonding_testpmd.c', to not add PMD specific ifdefs to
> the generic testpmd code. Like having a bonding specific command etc..
> 
> btw, I didn't check the details, just a high level question.

The logic in this patch depends on the initial and forward process of testpmd app.
I think the file 'drivers/net/bonding/bonding_testpmd.c' aims to configure the bonding port, 
but what we really want to do is configure testpmd app.
So, I think it is not very good to move it. 

Long also have a try, and seems it's impossible to avoid modify the logic in 'testpmd.c'.

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

* RE: [PATCH 1/2] net/bonding: add independent LACP sending function
  2023-02-20 16:31       ` Stephen Hemminger
@ 2023-02-22  6:47         ` Chaoyong He
  0 siblings, 0 replies; 22+ messages in thread
From: Chaoyong He @ 2023-02-22  6:47 UTC (permalink / raw)
  To: Stephen Hemminger, Simon Horman
  Cc: dev, oss-drivers, Niklas Soderlund, Long Wu

> On Mon, 20 Feb 2023 10:46:16 +0100
> Simon Horman <simon.horman@corigine.com> wrote:
> 
> > On Thu, Feb 16, 2023 at 11:47:27AM -0800, Stephen Hemminger wrote:
> > > On Thu, 16 Feb 2023 15:15:13 +0800
> > > Chaoyong He <chaoyong.he@corigine.com> wrote:
> > >
> > > > +void
> > > > +rte_eth_bond_8023ad_lacp_send_one(void *queue) {
> > > > +     uint32_t i;
> > > > +     uint16_t slave_tx_count;
> > > > +     uint16_t active_slave_count;
> > > > +     uint16_t active_slave_ids[RTE_MAX_ETHPORTS];
> > >
> > > Thinking ahead, all of bonding driver should remove the usage of the
> > > terms master and slave.  Perhaps you don't want to introduce new
> > > usages that will have to be fixed.
> > >
> > > FYI - there is no usage of master/slave in any of the IEEE
> > > standards, or operating systems other than Linux.
> >
> > Thanks Stephen,
> >
> > could we agree on alternative language?
> 
> I did a little looking around and did not come to a great answer.
> Looking at FreeBSD (and Solaris) they use lagg for the aggregating device and
> laggport for the devices associated with it.  Applying same logic to DPDK
> would be awkward because it already uses the term "port"
> in multiple ways.
> 
> Cisco uses the term "port channel group" when configuring link aggregation.
> Going that way maybe use channels as the replacement for slave in code like
> this.
> 

How about we use 'main' and 'member' ?


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

* [PATCH v3 0/2] enhance bonding PMD to support the LACP negotiation
  2023-02-16  8:32 ` [PATCH v2 0/2] enhance bonding PMD to support the " Chaoyong He
  2023-02-16  8:32   ` [PATCH v2 1/2] net/bonding: add independent LACP sending function Chaoyong He
  2023-02-16  8:32   ` [PATCH v2 2/2] app/testpmd: add support for bonding port's LACP negotiation Chaoyong He
@ 2023-03-01  2:48   ` Chaoyong He
  2023-03-01  2:48     ` [PATCH v3 1/2] net/bonding: add independent LACP sending function Chaoyong He
                       ` (3 more replies)
  2 siblings, 4 replies; 22+ messages in thread
From: Chaoyong He @ 2023-03-01  2:48 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Chaoyong He

App may not support the LACP negotiation in some cases.
This patch series solves this problem and add logics to
testpmd app to support the forward of bonding port in
mode 4 with the disabled dedicated queue.

---
v2:
* Export symbol to solve the link problem.
v3:
* Add 'rte_experimental' flags to new add API.
* Move '#ifdef RTE_NET_BOND' into function.
* Replace 'slave' with 'member' in new add logic.
---

Long Wu (2):
  net/bonding: add independent LACP sending function
  app/testpmd: add support for bonding port's LACP negotiation

 app/test-pmd/config.c                     | 19 ++++++++
 app/test-pmd/parameters.c                 |  4 ++
 app/test-pmd/testpmd.c                    | 37 +++++++++++++++
 app/test-pmd/testpmd.h                    |  4 ++
 doc/guides/testpmd_app_ug/run_app.rst     |  4 ++
 drivers/net/bonding/rte_eth_bond_8023ad.c | 58 +++++++++++++++++++++++
 drivers/net/bonding/rte_eth_bond_8023ad.h | 21 ++++++++
 drivers/net/bonding/version.map           |  8 ++++
 8 files changed, 155 insertions(+)

-- 
2.39.1


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

* [PATCH v3 1/2] net/bonding: add independent LACP sending function
  2023-03-01  2:48   ` [PATCH v3 0/2] enhance bonding PMD to support the " Chaoyong He
@ 2023-03-01  2:48     ` Chaoyong He
  2023-03-01  2:48     ` [PATCH v3 2/2] app/testpmd: add support for bonding port's LACP negotiation Chaoyong He
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 22+ messages in thread
From: Chaoyong He @ 2023-03-01  2:48 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Long Wu, Chaoyong He

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

Sending LACP control packets depends on calling the bonding port's
sending function if we disable dedicated queue. In some cases app
would not call the bonding port's sending function if there are
only LACP control packets and the negotiation between the two
bonding ports will fail.

We add the independent LACP sending function for app. App can call
it by itself and let the negotiation succeed.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 58 +++++++++++++++++++++++
 drivers/net/bonding/rte_eth_bond_8023ad.h | 21 ++++++++
 drivers/net/bonding/version.map           |  8 ++++
 3 files changed, 87 insertions(+)

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index 4a266bb2ca..bedfe89663 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -1757,3 +1757,61 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
 
 	return retval;
 }
+
+int
+rte_eth_bond_8023ad_dedicated_queues_get(uint16_t port_id)
+{
+	struct rte_eth_dev *dev;
+	struct bond_dev_private *internals;
+
+	if (valid_bonded_port_id(port_id) != 0)
+		return -EINVAL;
+
+	dev = &rte_eth_devices[port_id];
+	internals = dev->data->dev_private;
+
+	if (internals->mode != BONDING_MODE_8023AD)
+		return -EINVAL;
+
+	return internals->mode4.dedicated_queues.enabled;
+}
+
+void
+rte_eth_bond_8023ad_lacp_send_one(void *queue)
+{
+	uint32_t i;
+	uint16_t member_tx_count;
+	uint16_t active_member_count;
+	uint16_t active_member_ids[RTE_MAX_ETHPORTS];
+	struct bond_tx_queue *bd_tx_q = queue;
+	struct bond_dev_private *internals = bd_tx_q->dev_private;
+
+	active_member_count = internals->active_slave_count;
+	if (unlikely(active_member_count == 0))
+		return;
+
+	for (i = 0; i < active_member_count; i++)
+		active_member_ids[i] = internals->active_slaves[i];
+
+	/* Check for LACP control packets and send if available */
+	for (i = 0; i < active_member_count; i++) {
+		struct rte_mbuf *ctrl_pkt = NULL;
+		struct port *port = &bond_mode_8023ad_ports[active_member_ids[i]];
+
+		if (likely(rte_ring_empty(port->tx_ring)))
+			continue;
+
+		if (rte_ring_dequeue(port->tx_ring, (void **)&ctrl_pkt) == 0) {
+			member_tx_count = rte_eth_tx_prepare(active_member_ids[i],
+					bd_tx_q->queue_id, &ctrl_pkt, 1);
+			member_tx_count = rte_eth_tx_burst(active_member_ids[i],
+					bd_tx_q->queue_id, &ctrl_pkt, member_tx_count);
+			/*
+			 * Re-enqueue LAG control plane packets to buffering
+			 * ring if transmission fails so the packet won't lost.
+			 */
+			if (member_tx_count != 1)
+				rte_ring_enqueue(port->tx_ring, ctrl_pkt);
+		}
+	}
+}
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h
index 7eb392f8c8..29a1610650 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.h
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.h
@@ -331,4 +331,25 @@ rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id);
 int
 rte_eth_bond_8023ad_agg_selection_set(uint16_t port_id,
 		enum rte_bond_8023ad_agg_selection agg_selection);
+
+/**
+ * Get LACP dedicated queues enable/disable for 8023ad
+ * @param port_id Bonding device id
+ * @return
+ *   0 - the port is a bonding mode 4 port with disabled dedicated queue
+ *   1 - the port is a bonding mode 4 port with enabled dedicated queue
+ *   -EINVAL - the port is not a bonding port or the bonding port's mode is not 4
+ */
+__rte_experimental
+int
+rte_eth_bond_8023ad_dedicated_queues_get(uint16_t port_id);
+
+/**
+ * Send one LACP packet for bonding port in mode 4 with disabled dedicated queue
+ * @param queue Bonding port's tx queue
+ */
+__rte_experimental
+void
+rte_eth_bond_8023ad_lacp_send_one(void *queue);
+
 #endif /* RTE_ETH_BOND_8023AD_H_ */
diff --git a/drivers/net/bonding/version.map b/drivers/net/bonding/version.map
index 9333923b4e..d5db1d15e0 100644
--- a/drivers/net/bonding/version.map
+++ b/drivers/net/bonding/version.map
@@ -31,3 +31,11 @@ DPDK_23 {
 
 	local: *;
 };
+
+EXPERIMENTAL {
+	global:
+
+	# added in 22.11
+	rte_eth_bond_8023ad_dedicated_queues_get;
+	rte_eth_bond_8023ad_lacp_send_one;
+};
-- 
2.39.1


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

* [PATCH v3 2/2] app/testpmd: add support for bonding port's LACP negotiation
  2023-03-01  2:48   ` [PATCH v3 0/2] enhance bonding PMD to support the " Chaoyong He
  2023-03-01  2:48     ` [PATCH v3 1/2] net/bonding: add independent LACP sending function Chaoyong He
@ 2023-03-01  2:48     ` Chaoyong He
  2023-03-15 12:03     ` [PATCH v3 0/2] enhance bonding PMD to support the " Niklas Söderlund
  2023-05-12  1:50     ` Chaoyong He
  3 siblings, 0 replies; 22+ messages in thread
From: Chaoyong He @ 2023-03-01  2:48 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, niklas.soderlund, Long Wu, Chaoyong He

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

If bonding port is mode4 with disabling dedicated queue and there
are no other packets, forward loop will not call port's TX function
and bonding port will not send LACP packets.

Add sending LACP packets periodically in forward loop to avoid
LACP negotiation failed.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 app/test-pmd/config.c                 | 19 ++++++++++++++
 app/test-pmd/parameters.c             |  4 +++
 app/test-pmd/testpmd.c                | 37 +++++++++++++++++++++++++++
 app/test-pmd/testpmd.h                |  4 +++
 doc/guides/testpmd_app_ug/run_app.rst |  4 +++
 5 files changed, 68 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 4121c5c9bb..02757f34de 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -53,6 +53,11 @@
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
 #endif
+#ifdef RTE_NET_BOND
+#include <rte_eth_bond.h>
+#include <rte_eth_bond_8023ad.h>
+#endif
+
 #include <rte_hexdump.h>
 
 #include "testpmd.h"
@@ -4439,6 +4444,17 @@ fwd_topology_tx_port_get(portid_t rxp)
 	}
 }
 
+static inline void
+fwd_config_bond4_send_periodical_lacp(struct fwd_stream *fwd_stream)
+{
+#ifdef RTE_NET_BOND
+	if (rte_eth_bond_8023ad_dedicated_queues_get(fwd_stream->tx_port) == 0)
+		fwd_stream->bond4_send_periodical_lacp = true;
+#else
+	RTE_SET_USED(fwd_stream);
+#endif
+}
+
 static void
 simple_fwd_config_setup(void)
 {
@@ -4469,6 +4485,7 @@ simple_fwd_config_setup(void)
 		fwd_streams[i]->tx_queue  = 0;
 		fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
 		fwd_streams[i]->retry_enabled = retry_enabled;
+		fwd_config_bond4_send_periodical_lacp(fwd_streams[i]);
 	}
 }
 
@@ -4530,6 +4547,7 @@ rss_fwd_config_setup(void)
 		fs->tx_queue = rxq;
 		fs->peer_addr = fs->tx_port;
 		fs->retry_enabled = retry_enabled;
+		fwd_config_bond4_send_periodical_lacp(fs);
 		rxp++;
 		if (rxp < nb_fwd_ports)
 			continue;
@@ -4645,6 +4663,7 @@ dcb_fwd_config_setup(void)
 				fs->tx_queue = txq + j % nb_tx_queue;
 				fs->peer_addr = fs->tx_port;
 				fs->retry_enabled = retry_enabled;
+				fwd_config_bond4_send_periodical_lacp(fs);
 			}
 			fwd_lcores[lc_id]->stream_nb +=
 				rxp_dcb_info.tc_queue.tc_rxq[i][tc].nb_queue;
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index e734ad9a02..0fee5c5c94 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -205,6 +205,7 @@ usage(char* progname)
 	printf("  --hairpin-mode=0xXX: bitmask set the hairpin port mode.\n"
 	       "    0x10 - explicit Tx rule, 0x02 - hairpin ports paired\n"
 	       "    0x01 - hairpin ports loop, 0x00 - hairpin port self\n");
+	printf("  --bond4-lacp-fwd: enable LACP update in fwd main loop\n");
 }
 
 #ifdef RTE_LIB_CMDLINE
@@ -705,6 +706,7 @@ launch_args_parse(int argc, char** argv)
 		{ "rx-mq-mode",                 1, 0, 0 },
 		{ "record-core-cycles",         0, 0, 0 },
 		{ "record-burst-stats",         0, 0, 0 },
+		{ "bond4-lacp-fwd",             0, 0, 0 },
 		{ PARAM_NUM_PROCS,              1, 0, 0 },
 		{ PARAM_PROC_ID,                1, 0, 0 },
 		{ 0, 0, 0, 0 },
@@ -1462,6 +1464,8 @@ launch_args_parse(int argc, char** argv)
 				num_procs = atoi(optarg);
 			if (!strcmp(lgopts[opt_idx].name, PARAM_PROC_ID))
 				proc_id = atoi(optarg);
+			if (!strcmp(lgopts[opt_idx].name, "bond4-lacp-fwd"))
+				bond4_lacp_fwd = 1;
 			break;
 		case 'h':
 			usage(argv[0]);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 0c14325b8d..7755243cd6 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -68,6 +68,7 @@
 #endif
 #ifdef RTE_NET_BOND
 #include <rte_eth_bond.h>
+#include <rte_eth_bond_8023ad.h>
 #endif
 #ifdef RTE_NET_MLX5
 #include "mlx5_testpmd.h"
@@ -519,6 +520,9 @@ struct gro_status gro_ports[RTE_MAX_ETHPORTS];
 uint8_t gro_flush_cycles = GRO_DEFAULT_FLUSH_CYCLES;
 #endif
 
+uint8_t bond4_lacp_fwd;
+#define LACP_UPDATE_PERIOD 10000
+
 /*
  * hexadecimal bitmask of RX mq mode can be enabled.
  */
@@ -2252,6 +2256,28 @@ flush_fwd_rx_queues(void)
 	}
 }
 
+static inline void
+try_lacp_send_in_fwd(struct fwd_stream **fsm, streamid_t nb_fs)
+{
+#ifdef RTE_NET_BOND
+	void *qd;
+	streamid_t sm_id;
+	struct rte_eth_fp_ops *p;
+
+	for (sm_id = 0; sm_id < nb_fs; sm_id++) {
+		/* Update bond4 LACP if dedicated queues disabled. */
+		if (fsm[sm_id]->bond4_send_periodical_lacp) {
+			p = &rte_eth_fp_ops[fsm[sm_id]->tx_port];
+			qd = p->txq.data[fsm[sm_id]->tx_queue];
+			rte_eth_bond_8023ad_lacp_send_one(qd);
+		}
+	}
+#else
+	RTE_SET_USED(fsm);
+	RTE_SET_USED(nb_fs);
+#endif
+}
+
 static void
 run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)
 {
@@ -2269,6 +2295,9 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)
 	tics_datum = rte_rdtsc();
 	tics_per_1sec = rte_get_timer_hz();
 #endif
+	uint64_t before_tsc = rte_rdtsc();
+	const uint64_t bond4_lacp_period = (rte_get_tsc_hz() + US_PER_S - 1) /
+			US_PER_S * LACP_UPDATE_PERIOD;
 	fsm = &fwd_streams[fc->stream_idx];
 	nb_fs = fc->stream_nb;
 	prev_tsc = rte_rdtsc();
@@ -2300,6 +2329,13 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd)
 			fc->total_cycles += tsc - prev_tsc;
 			prev_tsc = tsc;
 		}
+		if (bond4_lacp_fwd != 0) {
+			uint64_t current_tsc = rte_rdtsc();
+			if (unlikely((current_tsc - before_tsc) > bond4_lacp_period)) {
+				try_lacp_send_in_fwd(fsm, nb_fs);
+				before_tsc = current_tsc;
+			}
+		}
 	} while (! fc->stopped);
 }
 
@@ -4462,6 +4498,7 @@ main(int argc, char** argv)
 #ifdef RTE_LIB_LATENCYSTATS
 	latencystats_enabled = 0;
 #endif
+	bond4_lacp_fwd = 0;
 
 	/* on FreeBSD, mlockall() is disabled by default */
 #ifdef RTE_EXEC_ENV_FREEBSD
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 329a6378a1..8f88223069 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -175,6 +175,8 @@ struct fwd_stream {
 	unsigned int gro_times;	/**< GRO operation times */
 #endif
 	uint64_t busy_cycles; /**< used with --record-core-cycles */
+	bool bond4_send_periodical_lacp;
+	/**< Send LACP packets periodically in forward loop */
 	struct pkt_burst_stats rx_burst_stats;
 	struct pkt_burst_stats tx_burst_stats;
 	struct fwd_lcore *lcore; /**< Lcore being scheduled. */
@@ -583,6 +585,8 @@ extern lcoreid_t bitrate_lcore_id;
 extern uint8_t bitrate_enabled;
 #endif
 
+extern uint8_t bond4_lacp_fwd;
+
 extern uint32_t max_rx_pkt_len;
 
 /*
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index f85f323033..8ea8aefde6 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -538,6 +538,10 @@ The command line options are:
 
     Enable display of RX and TX burst stats.
 
+*   ``--bond4-lacp-fwd``
+
+    Enable LACP packets sending in main forward loop to avoid LACP negotiation failed.
+
 *   ``--hairpin-mode=0xXXXX``
 
     Set the hairpin port configuration with bitmask, only valid when hairpin queues number is set::
-- 
2.39.1


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

* Re: [PATCH v3 0/2] enhance bonding PMD to support the LACP negotiation
  2023-03-01  2:48   ` [PATCH v3 0/2] enhance bonding PMD to support the " Chaoyong He
  2023-03-01  2:48     ` [PATCH v3 1/2] net/bonding: add independent LACP sending function Chaoyong He
  2023-03-01  2:48     ` [PATCH v3 2/2] app/testpmd: add support for bonding port's LACP negotiation Chaoyong He
@ 2023-03-15 12:03     ` Niklas Söderlund
  2023-05-12  1:50     ` Chaoyong He
  3 siblings, 0 replies; 22+ messages in thread
From: Niklas Söderlund @ 2023-03-15 12:03 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers

Hi all,

A gentle ping on this series.

On 2023-03-01 10:48:24 +0800, Chaoyong He wrote:
> App may not support the LACP negotiation in some cases.
> This patch series solves this problem and add logics to
> testpmd app to support the forward of bonding port in
> mode 4 with the disabled dedicated queue.
> 
> ---
> v2:
> * Export symbol to solve the link problem.
> v3:
> * Add 'rte_experimental' flags to new add API.
> * Move '#ifdef RTE_NET_BOND' into function.
> * Replace 'slave' with 'member' in new add logic.
> ---
> 
> Long Wu (2):
>   net/bonding: add independent LACP sending function
>   app/testpmd: add support for bonding port's LACP negotiation
> 
>  app/test-pmd/config.c                     | 19 ++++++++
>  app/test-pmd/parameters.c                 |  4 ++
>  app/test-pmd/testpmd.c                    | 37 +++++++++++++++
>  app/test-pmd/testpmd.h                    |  4 ++
>  doc/guides/testpmd_app_ug/run_app.rst     |  4 ++
>  drivers/net/bonding/rte_eth_bond_8023ad.c | 58 +++++++++++++++++++++++
>  drivers/net/bonding/rte_eth_bond_8023ad.h | 21 ++++++++
>  drivers/net/bonding/version.map           |  8 ++++
>  8 files changed, 155 insertions(+)
> 
> -- 
> 2.39.1
> 

-- 
Kind Regards,
Niklas Söderlund

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

* RE: [PATCH v3 0/2] enhance bonding PMD to support the LACP negotiation
  2023-03-01  2:48   ` [PATCH v3 0/2] enhance bonding PMD to support the " Chaoyong He
                       ` (2 preceding siblings ...)
  2023-03-15 12:03     ` [PATCH v3 0/2] enhance bonding PMD to support the " Niklas Söderlund
@ 2023-05-12  1:50     ` Chaoyong He
  2023-06-06  1:23       ` Chaoyong He
  3 siblings, 1 reply; 22+ messages in thread
From: Chaoyong He @ 2023-05-12  1:50 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Niklas Soderlund

A gentle ping on this series.

There has a large patch series enhance the bonding PMD depends on this series is waiting for send out, it would be kind if this could be looked at early in this release cycle.

> -----Original Message-----
> From: Chaoyong He
> Sent: Wednesday, March 1, 2023 10:49 AM
> To: dev@dpdk.org
> Cc: oss-drivers <oss-drivers@corigine.com>; Niklas Soderlund
> <niklas.soderlund@corigine.com>; Chaoyong He
> <chaoyong.he@corigine.com>
> Subject: [PATCH v3 0/2] enhance bonding PMD to support the LACP
> negotiation
> 
> App may not support the LACP negotiation in some cases.
> This patch series solves this problem and add logics to testpmd app to support
> the forward of bonding port in mode 4 with the disabled dedicated queue.
> 
> ---
> v2:
> * Export symbol to solve the link problem.
> v3:
> * Add 'rte_experimental' flags to new add API.
> * Move '#ifdef RTE_NET_BOND' into function.
> * Replace 'slave' with 'member' in new add logic.
> ---
> 
> Long Wu (2):
>   net/bonding: add independent LACP sending function
>   app/testpmd: add support for bonding port's LACP negotiation
> 
>  app/test-pmd/config.c                     | 19 ++++++++
>  app/test-pmd/parameters.c                 |  4 ++
>  app/test-pmd/testpmd.c                    | 37 +++++++++++++++
>  app/test-pmd/testpmd.h                    |  4 ++
>  doc/guides/testpmd_app_ug/run_app.rst     |  4 ++
>  drivers/net/bonding/rte_eth_bond_8023ad.c | 58
> +++++++++++++++++++++++  drivers/net/bonding/rte_eth_bond_8023ad.h
> | 21 ++++++++
>  drivers/net/bonding/version.map           |  8 ++++
>  8 files changed, 155 insertions(+)
> 
> --
> 2.39.1


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

* RE: [PATCH v3 0/2] enhance bonding PMD to support the LACP negotiation
  2023-05-12  1:50     ` Chaoyong He
@ 2023-06-06  1:23       ` Chaoyong He
  2023-06-06 16:48         ` Ferruh Yigit
  0 siblings, 1 reply; 22+ messages in thread
From: Chaoyong He @ 2023-06-06  1:23 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: oss-drivers, Niklas Soderlund, dev

A gentle ping on this series.

> -----Original Message-----
> From: Chaoyong He
> Sent: Friday, May 12, 2023 9:51 AM
> To: dev@dpdk.org
> Cc: oss-drivers <oss-drivers@corigine.com>; Niklas Soderlund
> <niklas.soderlund@corigine.com>
> Subject: RE: [PATCH v3 0/2] enhance bonding PMD to support the LACP
> negotiation
> 
> A gentle ping on this series.
> 
> There has a large patch series enhance the bonding PMD depends on this
> series is waiting for send out, it would be kind if this could be looked at early in
> this release cycle.
> 
> > -----Original Message-----
> > From: Chaoyong He
> > Sent: Wednesday, March 1, 2023 10:49 AM
> > To: dev@dpdk.org
> > Cc: oss-drivers <oss-drivers@corigine.com>; Niklas Soderlund
> > <niklas.soderlund@corigine.com>; Chaoyong He
> > <chaoyong.he@corigine.com>
> > Subject: [PATCH v3 0/2] enhance bonding PMD to support the LACP
> > negotiation
> >
> > App may not support the LACP negotiation in some cases.
> > This patch series solves this problem and add logics to testpmd app to
> > support the forward of bonding port in mode 4 with the disabled dedicated
> queue.
> >
> > ---
> > v2:
> > * Export symbol to solve the link problem.
> > v3:
> > * Add 'rte_experimental' flags to new add API.
> > * Move '#ifdef RTE_NET_BOND' into function.
> > * Replace 'slave' with 'member' in new add logic.
> > ---
> >
> > Long Wu (2):
> >   net/bonding: add independent LACP sending function
> >   app/testpmd: add support for bonding port's LACP negotiation
> >
> >  app/test-pmd/config.c                     | 19 ++++++++
> >  app/test-pmd/parameters.c                 |  4 ++
> >  app/test-pmd/testpmd.c                    | 37 +++++++++++++++
> >  app/test-pmd/testpmd.h                    |  4 ++
> >  doc/guides/testpmd_app_ug/run_app.rst     |  4 ++
> >  drivers/net/bonding/rte_eth_bond_8023ad.c | 58
> > +++++++++++++++++++++++
> drivers/net/bonding/rte_eth_bond_8023ad.h
> > | 21 ++++++++
> >  drivers/net/bonding/version.map           |  8 ++++
> >  8 files changed, 155 insertions(+)
> >
> > --
> > 2.39.1


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

* Re: [PATCH v3 0/2] enhance bonding PMD to support the LACP negotiation
  2023-06-06  1:23       ` Chaoyong He
@ 2023-06-06 16:48         ` Ferruh Yigit
  2023-06-07  3:10           ` Chaoyong He
  0 siblings, 1 reply; 22+ messages in thread
From: Ferruh Yigit @ 2023-06-06 16:48 UTC (permalink / raw)
  To: Chaoyong He, Chas Williams, Min Hu (Connor)
  Cc: oss-drivers, Niklas Soderlund, dev, Aman Singh, Thomas Monjalon

On 6/6/2023 2:23 AM, Chaoyong He wrote:
> A gentle ping on this series.
> 
>> -----Original Message-----
>> From: Chaoyong He
>> Sent: Friday, May 12, 2023 9:51 AM
>> To: dev@dpdk.org
>> Cc: oss-drivers <oss-drivers@corigine.com>; Niklas Soderlund
>> <niklas.soderlund@corigine.com>
>> Subject: RE: [PATCH v3 0/2] enhance bonding PMD to support the LACP
>> negotiation
>>
>> A gentle ping on this series.
>>
>> There has a large patch series enhance the bonding PMD depends on this
>> series is waiting for send out, it would be kind if this could be looked at early in
>> this release cycle.
>>
>>> -----Original Message-----
>>> From: Chaoyong He
>>> Sent: Wednesday, March 1, 2023 10:49 AM
>>> To: dev@dpdk.org
>>> Cc: oss-drivers <oss-drivers@corigine.com>; Niklas Soderlund
>>> <niklas.soderlund@corigine.com>; Chaoyong He
>>> <chaoyong.he@corigine.com>
>>> Subject: [PATCH v3 0/2] enhance bonding PMD to support the LACP
>>> negotiation
>>>
>>> App may not support the LACP negotiation in some cases.
>>> This patch series solves this problem and add logics to testpmd app to
>>> support the forward of bonding port in mode 4 with the disabled dedicated
>> queue.
>>>
>>> ---
>>> v2:
>>> * Export symbol to solve the link problem.
>>> v3:
>>> * Add 'rte_experimental' flags to new add API.
>>> * Move '#ifdef RTE_NET_BOND' into function.
>>> * Replace 'slave' with 'member' in new add logic.
>>> ---
>>>
>>> Long Wu (2):
>>>   net/bonding: add independent LACP sending function
>>>   app/testpmd: add support for bonding port's LACP negotiation
>>>
>>>  app/test-pmd/config.c                     | 19 ++++++++
>>>  app/test-pmd/parameters.c                 |  4 ++
>>>  app/test-pmd/testpmd.c                    | 37 +++++++++++++++
>>>  app/test-pmd/testpmd.h                    |  4 ++
>>>  doc/guides/testpmd_app_ug/run_app.rst     |  4 ++
>>>  drivers/net/bonding/rte_eth_bond_8023ad.c | 58
>>> +++++++++++++++++++++++
>> drivers/net/bonding/rte_eth_bond_8023ad.h
>>> | 21 ++++++++
>>>  drivers/net/bonding/version.map           |  8 ++++
>>>  8 files changed, 155 insertions(+)
>>>
>>> --
>>> 2.39.1
> 

Hi Chaoyong,

Sorry for the delay, bonding maintainers are cc'ed.

I can see this set adds new bonding specific APIs, instead can't
application (in this case testpmd) call bonding Tx function explicitly
to handle LACP packets?

Or should we have a special forwarding mode for bonding, as we have one
for ICMP echo?


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

* RE: [PATCH v3 0/2] enhance bonding PMD to support the LACP negotiation
  2023-06-06 16:48         ` Ferruh Yigit
@ 2023-06-07  3:10           ` Chaoyong He
  2023-06-23 13:32             ` Ferruh Yigit
  0 siblings, 1 reply; 22+ messages in thread
From: Chaoyong He @ 2023-06-07  3:10 UTC (permalink / raw)
  To: Ferruh Yigit, Chas Williams, Min Hu (Connor)
  Cc: oss-drivers, Niklas Soderlund, dev, Aman Singh, Thomas Monjalon

> On 6/6/2023 2:23 AM, Chaoyong He wrote:
> > A gentle ping on this series.
...
> >>> Long Wu (2):
> >>>   net/bonding: add independent LACP sending function
> >>>   app/testpmd: add support for bonding port's LACP negotiation
> >>>
> >>>  app/test-pmd/config.c                     | 19 ++++++++
> >>>  app/test-pmd/parameters.c                 |  4 ++
> >>>  app/test-pmd/testpmd.c                    | 37 +++++++++++++++
> >>>  app/test-pmd/testpmd.h                    |  4 ++
> >>>  doc/guides/testpmd_app_ug/run_app.rst     |  4 ++
> >>>  drivers/net/bonding/rte_eth_bond_8023ad.c | 58
> >>> +++++++++++++++++++++++
> >> drivers/net/bonding/rte_eth_bond_8023ad.h
> >>> | 21 ++++++++
> >>>  drivers/net/bonding/version.map           |  8 ++++
> >>>  8 files changed, 155 insertions(+)
> >>>
> >>> --
> >>> 2.39.1
> >
> 
> Hi Chaoyong,
> 
> Sorry for the delay, bonding maintainers are cc'ed.
> 
> I can see this set adds new bonding specific APIs, instead can't application (in
> this case testpmd) call bonding Tx function explicitly to handle LACP packets?

Actually, I think apps should not aware of LACP packets because these packets are stored by bonding pmd(port->tx_ring). 

> Or should we have a special forwarding mode for bonding, as we have one for
> ICMP echo?

Yes, both ICMP and LACP are protocol. But LACP is related to a type of port (bonding port in mode4).
Of course, we can add a special forwarding mode for bonding, but that will make it valid in very narrow situation.

What I really want is to support mode4 bonding port on every forward mode of testpmd, and I also want to treat dpdk bonding port as a regular NIC.


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

* Re: [PATCH v3 0/2] enhance bonding PMD to support the LACP negotiation
  2023-06-07  3:10           ` Chaoyong He
@ 2023-06-23 13:32             ` Ferruh Yigit
  2023-06-25  1:32               ` humin (Q)
  0 siblings, 1 reply; 22+ messages in thread
From: Ferruh Yigit @ 2023-06-23 13:32 UTC (permalink / raw)
  To: Chaoyong He, Chas Williams, Min Hu (Connor)
  Cc: oss-drivers, Niklas Soderlund, dev, Aman Singh, Thomas Monjalon

On 6/7/2023 4:10 AM, Chaoyong He wrote:
>> On 6/6/2023 2:23 AM, Chaoyong He wrote:
>>> A gentle ping on this series.
> ...
>>>>> Long Wu (2):
>>>>>   net/bonding: add independent LACP sending function
>>>>>   app/testpmd: add support for bonding port's LACP negotiation
>>>>>
>>>>>  app/test-pmd/config.c                     | 19 ++++++++
>>>>>  app/test-pmd/parameters.c                 |  4 ++
>>>>>  app/test-pmd/testpmd.c                    | 37 +++++++++++++++
>>>>>  app/test-pmd/testpmd.h                    |  4 ++
>>>>>  doc/guides/testpmd_app_ug/run_app.rst     |  4 ++
>>>>>  drivers/net/bonding/rte_eth_bond_8023ad.c | 58
>>>>> +++++++++++++++++++++++
>>>> drivers/net/bonding/rte_eth_bond_8023ad.h
>>>>> | 21 ++++++++
>>>>>  drivers/net/bonding/version.map           |  8 ++++
>>>>>  8 files changed, 155 insertions(+)
>>>>>
>>>>> --
>>>>> 2.39.1
>>>
>>
>> Hi Chaoyong,
>>
>> Sorry for the delay, bonding maintainers are cc'ed.
>>
>> I can see this set adds new bonding specific APIs, instead can't application (in
>> this case testpmd) call bonding Tx function explicitly to handle LACP packets?
> 
> Actually, I think apps should not aware of LACP packets because these packets are stored by bonding pmd(port->tx_ring). 
> 
>> Or should we have a special forwarding mode for bonding, as we have one for
>> ICMP echo?
> 
> Yes, both ICMP and LACP are protocol. But LACP is related to a type of port (bonding port in mode4).
> Of course, we can add a special forwarding mode for bonding, but that will make it valid in very narrow situation.
> 
> What I really want is to support mode4 bonding port on every forward mode of testpmd, and I also want to treat dpdk bonding port as a regular NIC.
> 

It makes sense to make bonding work as regular NIC and supported by all
forwarding modes.
But current patch adds bonding specific check to the shared forwarding
function, that is not good I think.

If application doesn't need to know about LACP packages, or if there is
no decision making required by application, can we handle LACP packets
within bonding PMD, transparent to application?

Chas, Connor, what do you think?


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

* Re: [PATCH v3 0/2] enhance bonding PMD to support the LACP negotiation
  2023-06-23 13:32             ` Ferruh Yigit
@ 2023-06-25  1:32               ` humin (Q)
  0 siblings, 0 replies; 22+ messages in thread
From: humin (Q) @ 2023-06-25  1:32 UTC (permalink / raw)
  To: Ferruh Yigit, Chaoyong He, Chas Williams
  Cc: oss-drivers, Niklas Soderlund, dev, Aman Singh, Thomas Monjalon

Hi, Ferruh,

在 2023/6/23 21:32, Ferruh Yigit 写道:
> On 6/7/2023 4:10 AM, Chaoyong He wrote:
>>> On 6/6/2023 2:23 AM, Chaoyong He wrote:
>>>> A gentle ping on this series.
>> ...
>>>>>> Long Wu (2):
>>>>>>    net/bonding: add independent LACP sending function
>>>>>>    app/testpmd: add support for bonding port's LACP negotiation
>>>>>>
>>>>>>   app/test-pmd/config.c                     | 19 ++++++++
>>>>>>   app/test-pmd/parameters.c                 |  4 ++
>>>>>>   app/test-pmd/testpmd.c                    | 37 +++++++++++++++
>>>>>>   app/test-pmd/testpmd.h                    |  4 ++
>>>>>>   doc/guides/testpmd_app_ug/run_app.rst     |  4 ++
>>>>>>   drivers/net/bonding/rte_eth_bond_8023ad.c | 58
>>>>>> +++++++++++++++++++++++
>>>>> drivers/net/bonding/rte_eth_bond_8023ad.h
>>>>>> | 21 ++++++++
>>>>>>   drivers/net/bonding/version.map           |  8 ++++
>>>>>>   8 files changed, 155 insertions(+)
>>>>>>
>>>>>> --
>>>>>> 2.39.1
>>> Hi Chaoyong,
>>>
>>> Sorry for the delay, bonding maintainers are cc'ed.
>>>
>>> I can see this set adds new bonding specific APIs, instead can't application (in
>>> this case testpmd) call bonding Tx function explicitly to handle LACP packets?
>> Actually, I think apps should not aware of LACP packets because these packets are stored by bonding pmd(port->tx_ring).
>>
>>> Or should we have a special forwarding mode for bonding, as we have one for
>>> ICMP echo?
>> Yes, both ICMP and LACP are protocol. But LACP is related to a type of port (bonding port in mode4).
>> Of course, we can add a special forwarding mode for bonding, but that will make it valid in very narrow situation.
>>
>> What I really want is to support mode4 bonding port on every forward mode of testpmd, and I also want to treat dpdk bonding port as a regular NIC.
>>
> It makes sense to make bonding work as regular NIC and supported by all
> forwarding modes.
> But current patch adds bonding specific check to the shared forwarding
> function, that is not good I think.
>
> If application doesn't need to know about LACP packages, or if there is
> no decision making required by application, can we handle LACP packets
> within bonding PMD, transparent to application?
>
> Chas, Connor, what do you think?

Agree with you, Currently testpmd is too "big" to add specific check.

Also, private APIs should be restricted to add because we want to make

bonding device as a  regular NIC device.


>

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

end of thread, other threads:[~2023-06-25  1:32 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-16  7:15 [PATCH 0/2] enhance bonding PMD to support the LACP negotiation Chaoyong He
2023-02-16  7:15 ` [PATCH 1/2] net/bonding: add independent LACP sending function Chaoyong He
2023-02-16 19:47   ` Stephen Hemminger
2023-02-20  9:46     ` Simon Horman
2023-02-20 16:31       ` Stephen Hemminger
2023-02-22  6:47         ` Chaoyong He
2023-02-16  7:15 ` [PATCH 2/2] app/testpmd: add support for bonding port's LACP negotiation Chaoyong He
2023-02-16  8:32 ` [PATCH v2 0/2] enhance bonding PMD to support the " Chaoyong He
2023-02-16  8:32   ` [PATCH v2 1/2] net/bonding: add independent LACP sending function Chaoyong He
2023-02-16  8:32   ` [PATCH v2 2/2] app/testpmd: add support for bonding port's LACP negotiation Chaoyong He
2023-02-16 17:05     ` Ferruh Yigit
2023-02-22  6:47       ` Chaoyong He
2023-03-01  2:48   ` [PATCH v3 0/2] enhance bonding PMD to support the " Chaoyong He
2023-03-01  2:48     ` [PATCH v3 1/2] net/bonding: add independent LACP sending function Chaoyong He
2023-03-01  2:48     ` [PATCH v3 2/2] app/testpmd: add support for bonding port's LACP negotiation Chaoyong He
2023-03-15 12:03     ` [PATCH v3 0/2] enhance bonding PMD to support the " Niklas Söderlund
2023-05-12  1:50     ` Chaoyong He
2023-06-06  1:23       ` Chaoyong He
2023-06-06 16:48         ` Ferruh Yigit
2023-06-07  3:10           ` Chaoyong He
2023-06-23 13:32             ` Ferruh Yigit
2023-06-25  1:32               ` humin (Q)

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).