bond: avoid allocating mempool on socket LCORE_ID_ANY
Subsystems (2)
PATCH 1/2 bond: avoid allocating mempool on socket LCORE_ID_ANY
If the numa node is unknown, use the value from rte_socket_id() to avoid an allocation failure.
--- drivers/net/bonding/rte_eth_bond_8023ad.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/bonding/rte_eth_bond_8023ad.c +2 -0
@@ -887,6 +887,8 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)RTE_ASSERT (port->rx_ring ==NULL );RTE_ASSERT (port->tx_ring ==NULL ); socket_id = rte_eth_devices[slave_id].data->numa_node; +if (socket_id == (uint8_t )LCORE_ID_ANY ) + socket_id =0 ; element_size =sizeof (struct slow_protocol_frame ) +RTE_PKTMBUF_HEADROOM ;
Signature · 1 line
2.7.4
PATCH 2/2 bond: use rte_eth_dev_socket_id()
The bonded device does not have to be a PCI device. Use the rte_ethdev functions instead.
--- 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
@@ -886,7 +886,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)RTE_ASSERT (port->rx_ring ==NULL );RTE_ASSERT (port->tx_ring ==NULL ); - socket_id = rte_eth_devices[slave_id].data->numa_node; + socket_id =rte_eth_dev_socket_id (slave_id);if (socket_id == (uint8_t )LCORE_ID_ANY ) socket_id =0 ;
Signature · 1 line
2.7.4
Re: [PATCH 2/2] bond: use rte_eth_dev_socket_id()
Quoted 16 lines · Jan Blunck
The bonded device does not have to be a PCI device. Use the
rte_ethdevfunctions instead.Signed-off-by Wen Chiu <[email protected]>Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by Jan Blunck <[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, uint8_t slave_id) · line 892
Quoted 8 lines
drivers/net/bonding/rte_eth_bond_8023ad.c +1
-1@@ -886,7 +886,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)RTE_ASSERT (port->rx_ring ==NULL );RTE_ASSERT (port->tx_ring ==NULL ); - socket_id = rte_eth_devices[slave_id].data->numa_node; + socket_id =rte_eth_dev_socket_id (slave_id);if (socket_id == (uint8_t )LCORE_ID_ANY ) socket_id =0 ;
Quoted 14 lines · Jan Blunck
If the numa node is unknown, use the value from
rte_socket_id()to avoid an allocation failure.Signed-off-by Eric Kinzie <[email protected]>CC Eric Kinzie <[email protected]>--- drivers/net/bonding/rte_eth_bond_8023ad.c | 2 ++ 1 file changed, 2 insertions(+)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, uint8_t slave_id) · line 890
Quoted 4 lines
drivers/net/bonding/rte_eth_bond_8023ad.c +1
-0@@ -887,6 +887,8 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)RTE_ASSERT (port->rx_ring ==NULL );RTE_ASSERT (port->tx_ring ==NULL ); socket_id = rte_eth_devices[slave_id].data->numa_node; +if (socket_id == (uint8_t )LCORE_ID_ANY )
socket_id is an integer so we shouldn't be casting LCORE_ID_ANY to an uint8_t as this condition would never match as LCORE_ID_ANY wouldn't be UINT32_MAX after casting
drivers/net/bonding/rte_eth_bond_8023ad.c bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id) · line 891
Quoted 1 line
drivers/net/bonding/rte_eth_bond_8023ad.c +1
-0+ socket_id =0 ;
Should this not be socket_id = rte_socket_id(); as we don't know we are running on
Quoted 4 lines
drivers/net/bonding/rte_eth_bond_8023ad.c +0
-0element_size =sizeof (struct slow_protocol_frame ) +RTE_PKTMBUF_HEADROOM ;
Quoted 11 lines · Declan Doherty
Quoted 10 lines · Jan Blunck
If the numa node is unknown, use the value from
rte_socket_id()to avoid an allocation failure.Signed-off-by Eric Kinzie <[email protected]>CC Eric Kinzie <[email protected]>--- drivers/net/bonding/rte_eth_bond_8023ad.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 17 lines
drivers/net/bonding/rte_eth_bond_8023ad.c bond_mode_8023ad_activate_slave(struct rte_eth_dev · line 891
Quoted 11 lines
drivers/net/bonding/rte_eth_bond_8023ad.c +1
-0@@ -887,6 +887,8 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)RTE_ASSERT (port->rx_ring ==NULL );RTE_ASSERT (port->tx_ring ==NULL ); socket_id = rte_eth_devices[slave_id].data->numa_node; +if (socket_id == (uint8_t )LCORE_ID_ANY )
socket_idis an integer so we shouldn't be castingLCORE_ID_ANYto anuint8_tas this condition would never match asLCORE_ID_ANYwouldn't beUINT32_MAXafter casting
Ouch ... let me fix this.
Quoted 11 lines
drivers/net/bonding/rte_eth_bond_8023ad.c bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id) · line 891
Quoted 1 line
drivers/net/bonding/rte_eth_bond_8023ad.c +1
-0+ socket_id =0 ;Should this not be
socket_id=rte_socket_id(); as we don't know we are running onQuoted 3 lines
drivers/net/bonding/rte_eth_bond_8023ad.c +0
-0element_size =sizeof (struct slow_protocol_frame ) +RTE_PKTMBUF_HEADROOM ;
PATCH v2 1/2 bond: avoid allocating mempool on socket LCORE_ID_ANY
From: Jan Blunck <[email protected]>
If the numa node is unknown, use the value from rte_socket_id() to avoid an allocation failure.
--- drivers/net/bonding/rte_eth_bond_8023ad.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/bonding/rte_eth_bond_8023ad.c +3 -0
@@ -886,7 +886,10 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)RTE_ASSERT (port->rx_ring ==NULL );RTE_ASSERT (port->tx_ring ==NULL ); + socket_id = rte_eth_devices[slave_id].data->numa_node; +if (socket_id == (int )LCORE_ID_ANY ) + socket_id =rte_socket_id (); element_size =sizeof (struct slow_protocol_frame ) +RTE_PKTMBUF_HEADROOM ;
Signature · 1 line
2.9.4
PATCH v2 2/2 bond: use rte_eth_dev_socket_id()
From: Jan Blunck <[email protected]>
The bonded device does not have to be a PCI device. Use the rte_ethdev functions instead.
--- 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
@@ -887,7 +887,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)RTE_ASSERT (port->rx_ring ==NULL );RTE_ASSERT (port->tx_ring ==NULL ); - socket_id = rte_eth_devices[slave_id].data->numa_node; + socket_id =rte_eth_dev_socket_id (slave_id);if (socket_id == (int )LCORE_ID_ANY ) socket_id =rte_socket_id ();
Signature · 1 line
2.9.4
Quoted 8 lines · Declan Doherty
From: Jan Blunck <[email protected]>
If the numa node is unknown, use the value from
rte_socket_id()to avoid an allocation failure.Signed-off-by Eric Kinzie <[email protected]>Signed-off-by Declan Doherty <[email protected]>
Series applied to dpdk-next-net/master, thanks.
(patch subjects updated slightly)