net/bonding: fix socket id check
Subsystems (2)
PATCH 1/1 net/bonding: fix socket id check
Caught by code review, rte_eth_dev_socket_id() returns -1 on error. The code should behave the same, but still, do not use LCORE_ID_ANY for something that is not a lcore id.
--- drivers/net/bonding/rte_eth_bond_8023ad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bonding/rte_eth_bond_8023ad.c +1 -1
@@ -1043,7 +1043,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev,RTE_ASSERT (port->tx_ring ==NULL ); socket_id =rte_eth_dev_socket_id (slave_id); -if (socket_id == (int )LCORE_ID_ANY ) +if (socket_id ==-1 ) socket_id =rte_socket_id (); element_size = sizeof(struct slow_protocol_frame) +
Signature · 1 line
2.23.0
Quoted 17 lines · David Marchand
Caught by code review,
rte_eth_dev_socket_id()returns -1 on error. The code should behave the same, but still, do not useLCORE_ID_ANYfor something that is not a lcore id.Fixes c15c5897340d ("net/bonding: avoid allocating mempool on unknown socket")Signed-off-by David Marchand <[email protected]>--- drivers/net/bonding/rte_eth_bond_8023ad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/bonding/rte_eth_bond_8023ad.c +0
-0
drivers/net/bonding/rte_eth_bond_8023ad.c bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, · line 1046
Quoted 5 lines
drivers/net/bonding/rte_eth_bond_8023ad.c +1
-1@@ -1043,7 +1043,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev,RTE_ASSERT (port->tx_ring ==NULL ); socket_id =rte_eth_dev_socket_id (slave_id); -if (socket_id == (int )LCORE_ID_ANY ) +if (socket_id ==-1 )
Testing against < 0 would probably be more future proof. But if someone decides to update rte_eth_dev_socket_id they will hopefully update callers as well.
Quoted 4 lines
drivers/net/bonding/rte_eth_bond_8023ad.c +0
-0socket_id =rte_socket_id (); element_size = sizeof(struct slow_protocol_frame) +
Ferruh Yigit
AppliedQuoted 5 lines · Chas Williams
Quoted 4 lines · David Marchand
Caught by code review,
rte_eth_dev_socket_id()returns -1 on error. The code should behave the same, but still, do not useLCORE_ID_ANYfor something that is not a lcore id.
Quoted 7 lines
Quoted 4 lines
Fixes c15c5897340d ("net/bonding: avoid allocating mempool on unknown socket")Signed-off-by David Marchand <[email protected]>Acked-by Chas Williams <[email protected]>
Applied to dpdk-next-net/master, thanks.
Quoted 23 lines
Quoted 9 lines
--- drivers/net/bonding/rte_eth_bond_8023ad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/bonding/rte_eth_bond_8023ad.c +0
-0drivers/net/bonding/rte_eth_bond_8023ad.c bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, · line 1046
Quoted 5 lines
drivers/net/bonding/rte_eth_bond_8023ad.c +1
-1@@ -1043,7 +1043,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev,RTE_ASSERT (port->tx_ring ==NULL ); socket_id =rte_eth_dev_socket_id (slave_id); -if (socket_id == (int )LCORE_ID_ANY ) +if (socket_id ==-1 )Testing against < 0 would probably be more future proof. But if someone decides to update
rte_eth_dev_socket_idthey will hopefully update callers as well.Quoted 4 lines
drivers/net/bonding/rte_eth_bond_8023ad.c +0
-0socket_id =rte_socket_id (); element_size = sizeof(struct slow_protocol_frame) +