Skip to contentSkip to conversation

net/bonding: fix link status callback stop

PATCH Applied David Marchand 4 participants 4 messages Oct 16, 2023

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

PATCH 1/1 net/bonding: fix link status callback stop

If a bonding port gets released, a link status alarm callback still referenced the ethdev port that may be reused later. Cancel this callback when stopping the port.

Bugzilla ID: 1301

Fixes a45b288ef21a ("bond: support link status polling")

---
Note: this issue was made apparent now that we release the ethdev port shared mem, see 36c46e738120 ("ethdev: cleanup shared data with ...").

---
 drivers/net/bonding/rte_eth_bond_pmd.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/bonding/rte_eth_bond_pmd.c +4 -0
index 122b1187fd..b8ee8be50f 100644
@@ -2159,6 +2159,10 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev)
 	eth_dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN;
 	eth_dev->data->dev_started = 0;
 
+	if (internals->link_status_polling_enabled) {
+		rte_eal_alarm_cancel(bond_ethdev_member_link_status_change_monitor,
+			(void *)&rte_eth_devices[internals->port_id]);
+	}
 	internals->link_status_polling_enabled = 0;
 	for (i = 0; i < internals->member_count; i++) {
 		uint16_t member_id = internals->members[i].port_id;
Signature · 1 line
2.41.0
Acked-by on v1 1/1
#1 lore raw
Quoted 22 lines · David Marchand

If a bonding port gets released, a link status alarm callback still referenced the ethdev port that may be reused later. Cancel this callback when stopping the port.

Bugzilla ID: 1301

Fixes a45b288ef21a ("bond: support link status polling")

---
Note: this issue was made apparent now that we release the ethdev port shared mem, see 36c46e738120 ("ethdev: cleanup shared data with ...").

---
 drivers/net/bonding/rte_eth_bond_pmd.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/bonding/rte_eth_bond_pmd.c +0 -0
index 122b1187fd..b8ee8be50f 100644

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_stop(struct rte_eth_dev *eth_dev) · line 2166

Quoted 8 lines
drivers/net/bonding/rte_eth_bond_pmd.c +4 -0
@@ -2159,6 +2159,10 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev)
 	eth_dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN;
 	eth_dev->data->dev_started = 0;
 
+	if (internals->link_status_polling_enabled) {
+		rte_eal_alarm_cancel(bond_ethdev_member_link_status_change_monitor,
+			(void *)&rte_eth_devices[internals->port_id]);
+	}
 	internals->link_status_polling_enabled = 0;

How about move this line in above {}.

Anyway, both OK for me

Quoted 3 lines
drivers/net/bonding/rte_eth_bond_pmd.c +0 -0
 	for (i = 0; i < internals->member_count; i++) {
 		uint16_t member_id = internals->members[i].port_id;
Acked-by Applied
#2 lore raw
Quoted 5 lines · fengchengwen
Quoted 4 lines · David Marchand

If a bonding port gets released, a link status alarm callback still referenced the ethdev port that may be reused later. Cancel this callback when stopping the port.

Quoted 8 lines
Quoted 5 lines

Bugzilla ID: 1301

Fixes a45b288ef21a ("bond: support link status polling")

Applied to dpdk-next-net/main, thanks.

#3 lore raw
In reply to fengchengwen
Quoted 3 lines · On Mon, 16 Oct 2023 18:33:01 +0800 fengchengwen <[email protected]> wrote:

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_stop(struct rte_eth_dev *eth_dev) · line 2164

Quoted 3 lines
drivers/net/bonding/rte_eth_bond_pmd.c +3 -0
+	if (internals->link_status_polling_enabled) {
+		rte_eal_alarm_cancel(bond_ethdev_member_link_status_change_monitor,
+			(void *)&rte_eth_devices[internals->port_id]);

Is the cast to void * actually necessary?