net/bonding: fix slave tx burst for mode 4
Subsystems (2)
PATCH 1/1 net/bonding: fix slave tx burst for mode 4
From: Yunjian Wang <[email protected]>
Now sending 0 packet it doesn't consider for LACPDUs, but the LACPDUs should be checked and sended.
--- drivers/net/bonding/rte_eth_bond_pmd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +4 -3
@@ -1298,9 +1298,6 @@ struct bwg_slave {uint16_t i; -if (unlikely (nb_bufs ==0 )) -return 0 ; -/* Copy slave list to protect against slave up/down changes during tx * bursting */ slave_count = internals->active_slave_count;
@@ -1310,6 +1307,9 @@ struct bwg_slave {memcpy (slave_port_ids, internals->active_slaves,sizeof (slave_port_ids[0 ]) * slave_count); +if (unlikely (nb_bufs ==0 )) + goto lacp_send; + dist_slave_count =0 ;for (i =0 ; i < slave_count; i++) {struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]];
@@ -1365,6 +1365,7 @@ struct bwg_slave { } } +lacp_send:/* Check for LACP control packets and send if available */ for (i =0 ; i < slave_count; i++) {struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]];
Signature · 1 line
1.8.3.1
How strange. I was just looking at this issue this weekend. I think we can just move the control packet handling before the data packet handling. That avoids the goto and is a little more sensible -- we should try to prioritize control traffic (even if we can't guarantee there will be space it's better than nothing). Something like this:
drivers/net/bonding/rte_eth_bond_pmd.c +24 -24
@@ -1298,9 +1298,6 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,uint16_t i; -if (unlikely (nb_bufs ==0 )) -return 0 ; -/* Copy slave list to protect against slave up/down changes during tx * bursting */ slave_count = internals->active_slave_count;
@@ -1310,6 +1307,30 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,memcpy (slave_port_ids, internals->active_slaves,sizeof (slave_port_ids[0 ]) * slave_count); +/* Check for LACP control packets and send if available */ +for (i =0 ; i < slave_count; i++) { +struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]]; +struct rte_mbuf *ctrl_pkt =NULL ; + +if (likely (rte_ring_empty (port->tx_ring))) +continue ; + +if (rte_ring_dequeue (port->tx_ring, + (void **)&ctrl_pkt) != -ENOENT ) { + slave_tx_count =rte_eth_tx_burst (slave_port_ids[i], + bd_tx_q->queue_id, &ctrl_pkt,1 ); +/* +* re-enqueue LAG control plane packets to buffering +* ring if transmission fails so the packet isn't lost. +*/ +if (slave_tx_count !=1 ) +rte_ring_enqueue (port->tx_ring, ctrl_pkt); + } + } + +if (unlikely (nb_bufs ==0 )) +return 0 ; + dist_slave_count =0 ;for (i =0 ; i < slave_count; i++) {struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]];
@@ -1365,27 +1386,6 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs, } } -/* Check for LACP control packets and send if available */ -for (i =0 ; i < slave_count; i++) { -struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]]; -struct rte_mbuf *ctrl_pkt =NULL ; - -if (likely (rte_ring_empty (port->tx_ring))) -continue ; - -if (rte_ring_dequeue (port->tx_ring, - (void **)&ctrl_pkt) != -ENOENT ) { - slave_tx_count =rte_eth_tx_burst (slave_port_ids[i], - bd_tx_q->queue_id, &ctrl_pkt,1 ); -/* -* re-enqueue LAG control plane packets to buffering -* ring if transmission fails so the packet isn't lost. -*/ -if (slave_tx_count !=1 ) -rte_ring_enqueue (port->tx_ring, ctrl_pkt); - } - } -return total_tx_count; }
Quoted 47 lines · wangyunjian
From: Yunjian Wang <[email protected]>
Now sending 0 packet it doesn't consider for LACPDUs, but the LACPDUs should be checked and sended.
Fixes 09150784a776 ("net/bonding: burst mode hash calculation")Reported-by Hui Zhao <[email protected]>Signed-off-by Yunjian Wang <[email protected]>--- drivers/net/bonding/rte_eth_bond_pmd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/net/bonding/rte_eth_bond_pmd.c +4
-3@@ -1298,9 +1298,6 @@ struct bwg_slave {uint16_t i; -if (unlikely (nb_bufs ==0 )) -return 0 ; -/* Copy slave list to protect against slave up/down changes during tx * bursting */ slave_count = internals->active_slave_count;@@ -1310,6 +1307,9 @@ struct bwg_slave {memcpy (slave_port_ids, internals->active_slaves,sizeof (slave_port_ids[0 ]) * slave_count); +if (unlikely (nb_bufs ==0 )) + goto lacp_send; + dist_slave_count =0 ;for (i =0 ; i < slave_count; i++) {struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]];@@ -1365,6 +1365,7 @@ struct bwg_slave { } } +lacp_send:/* Check for LACP control packets and send if available */ for (i =0 ; i < slave_count; i++) {struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]];
I agree with you. Can you fix it?
Thanks
Yunjian
Quoted 147 lines
-----Original Message-----
From: Chas Williams [mailto:[email protected]]
Sent: Monday, February 11, 2019 11:35 PM
To: wangyunjian <[email protected]>; [email protected]
Cc: [email protected]; xudingke <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/bonding: fix slave tx burst for mode 4How strange. I was just looking at this issue this weekend. I think we can just move the control packet handling before the data packet handling. That avoids the goto and is a little more sensible -- we should try to prioritize control traffic (even if we can't guarantee there will be space it's better than nothing). Something like this:
drivers/net/bonding/rte_eth_bond_pmd.c +0
-3@@ -1298,9 +1298,6 @@ bond_ethdev_tx_burst_8023ad(void *queue,struct rte_mbuf **bufs, uint16_t i; -if (unlikely (nb_bufs ==0 )) -return 0 ; -/* Copy slave list to protect against slave up/down changes during tx * bursting */
slave_count=internals->active_slave_count; @@ -1310,6 +1307,30
@@ bond_ethdev_tx_burst_8023ad(void *queue, structrte_mbuf**bufs,
memcpy(slave_port_ids,internals->active_slaves,
sizeof(slave_port_ids[0])*slave_count);drivers/net/bonding/rte_eth_bond_pmd.c +3
-0+/* Check for LACP control packets and send if available */ +for (i =0 ; i < slave_count; i++) { + struct port *port =&bond_mode_8023ad_ports[slave_port_ids[i]];
drivers/net/bonding/rte_eth_bond_pmd.c +15
-0+struct rte_mbuf *ctrl_pkt =NULL ; + +if (likely (rte_ring_empty (port->tx_ring))) +continue ; + +if (rte_ring_dequeue (port->tx_ring, + (void **)&ctrl_pkt) != -ENOENT ) { + slave_tx_count =rte_eth_tx_burst (slave_port_ids[i], + bd_tx_q->queue_id, &ctrl_pkt,1 ); +/* +* re-enqueue LAG control plane packets to buffering +* ring if transmission fails so the packet isn't lost. +*/ +if (slave_tx_count !=1 ) + rte_ring_enqueue(port->tx_ring,ctrl_pkt);drivers/net/bonding/rte_eth_bond_pmd.c +6
-0+ } + } + +if (unlikely (nb_bufs ==0 )) +return 0 ; + dist_slave_count =0 ;for (i =0 ; i < slave_count; i++) { struct port *port =&bond_mode_8023ad_ports[slave_port_ids[i]];
drivers/net/bonding/rte_eth_bond_pmd.c +0
-21@@ -1365,27 +1386,6 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs, } } -/* Check for LACP control packets and send if available */ -for (i =0 ; i < slave_count; i++) { -struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]]; -struct rte_mbuf *ctrl_pkt =NULL ; - -if (likely (rte_ring_empty (port->tx_ring))) -continue ; - -if (rte_ring_dequeue (port->tx_ring, - (void **)&ctrl_pkt) != -ENOENT ) { - slave_tx_count =rte_eth_tx_burst (slave_port_ids[i], - bd_tx_q->queue_id, &ctrl_pkt,1 ); -/* -* re-enqueue LAG control plane packets to buffering -* ring if transmission fails so the packet isn't lost. -*/ -if (slave_tx_count !=1 ) -rte_ring_enqueue (port->tx_ring, ctrl_pkt); - } - } -return total_tx_count; }Quoted 20 lines · wangyunjian
From: Yunjian Wang <[email protected]>
Now sending 0 packet it doesn't consider for LACPDUs, but the LACPDUs should be checked and sended.
Fixes 09150784a776 ("net/bonding: burst mode hash calculation")Reported-by Hui Zhao <[email protected]>Signed-off-by Yunjian Wang <[email protected]>--- drivers/net/bonding/rte_eth_bond_pmd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/net/bonding/rte_eth_bond_pmd.c +0
-0drivers/net/bonding/rte_eth_bond_pmd.c struct bwg_slave { · line 1303
Quoted 9 lines
drivers/net/bonding/rte_eth_bond_pmd.c +0
-3@@ -1298,9 +1298,6 @@ struct bwg_slave {uint16_t i; -if (unlikely (nb_bufs ==0 )) -return 0 ; -/* Copy slave list to protect against slave up/down changes during tx * bursting */ slave_count = internals->active_slave_count; @@ -1310,6 +1307,9@@
drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,
Quoted 10 lines
struct
bwg_slave{
memcpy(slave_port_ids,internals->active_slaves,
sizeof(slave_port_ids[0])*slave_count);drivers/net/bonding/rte_eth_bond_pmd.c +3
-0+if (unlikely (nb_bufs ==0 )) + goto lacp_send; + dist_slave_count =0 ;for (i =0 ; i < slave_count; i++) { struct port *port =&bond_mode_8023ad_ports[slave_port_ids[i]];
drivers/net/bonding/rte_eth_bond_pmd.c struct bwg_slave { · line 1371
Quoted 8 lines
drivers/net/bonding/rte_eth_bond_pmd.c +1
-0@@ -1365,6 +1365,7 @@ struct bwg_slave { } } +lacp_send:/* Check for LACP control packets and send if available */ for (i =0 ; i < slave_count; i++) { struct port *port =&bond_mode_8023ad_ports[slave_port_ids[i]];
Quoted 1 line
PATCH v2 1/1 net/bonding: fix slave tx burst for mode 4
From: Chas Williams <[email protected]>
The tx burst routine always needs to check for pending LACPDUs and send them if available. Do this first to prioritize the control traffic. We can still early exit, before calculating the distribution slaves, if there isn't any data packets.
--- drivers/net/bonding/rte_eth_bond_pmd.c | 48 +++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +24 -24
@@ -1298,9 +1298,6 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,uint16_t i; -if (unlikely (nb_bufs ==0 )) -return 0 ; -/* Copy slave list to protect against slave up/down changes during tx * bursting */ slave_count = internals->active_slave_count;
@@ -1310,6 +1307,30 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs,memcpy (slave_port_ids, internals->active_slaves,sizeof (slave_port_ids[0 ]) * slave_count); +/* Check for LACP control packets and send if available */ +for (i =0 ; i < slave_count; i++) { +struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]]; +struct rte_mbuf *ctrl_pkt =NULL ; + +if (likely (rte_ring_empty (port->tx_ring))) +continue ; + +if (rte_ring_dequeue (port->tx_ring, + (void **)&ctrl_pkt) != -ENOENT ) { + slave_tx_count =rte_eth_tx_burst (slave_port_ids[i], + bd_tx_q->queue_id, &ctrl_pkt,1 ); +/* +* re-enqueue LAG control plane packets to buffering +* ring if transmission fails so the packet isn't lost. +*/ +if (slave_tx_count !=1 ) +rte_ring_enqueue (port->tx_ring, ctrl_pkt); + } + } + +if (unlikely (nb_bufs ==0 )) +return 0 ; + dist_slave_count =0 ;for (i =0 ; i < slave_count; i++) {struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]];
@@ -1365,27 +1386,6 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs, } } -/* Check for LACP control packets and send if available */ -for (i =0 ; i < slave_count; i++) { -struct port *port = &bond_mode_8023ad_ports[slave_port_ids[i]]; -struct rte_mbuf *ctrl_pkt =NULL ; - -if (likely (rte_ring_empty (port->tx_ring))) -continue ; - -if (rte_ring_dequeue (port->tx_ring, - (void **)&ctrl_pkt) != -ENOENT ) { - slave_tx_count =rte_eth_tx_burst (slave_port_ids[i], - bd_tx_q->queue_id, &ctrl_pkt,1 ); -/* -* re-enqueue LAG control plane packets to buffering -* ring if transmission fails so the packet isn't lost. -*/ -if (slave_tx_count !=1 ) -rte_ring_enqueue (port->tx_ring, ctrl_pkt); - } - } -return total_tx_count; }
Signature · 1 line
2.17.2
Ferruh Yigit
AppliedQuoted 7 lines · Chas Williams
From: Chas Williams <[email protected]>
The tx burst routine always needs to check for pending LACPDUs and send them if available. Do this first to prioritize the control traffic. We can still early exit, before calculating the distribution slaves, if there isn't any data packets.
Quoted 5 lines
Fixes 09150784a776 ("net/bonding: burst mode hash calculation")Reported-by Hui Zhao <[email protected]>Cc Yunjian Wang <[email protected]>Signed-off-by Chas Williams <[email protected]>
Applied to dpdk-next-net/master, thanks.