Skip to content

Commit

Permalink
net/bonding: fix startup when NUMA is not supported
Browse files Browse the repository at this point in the history
[ upstream commit 85e6be63dfa8bff9c42ab0b4dea6fcbba7d680b2 ]

After the mainline Linux kernel commit
"fe205d984e7730f4d21f6f8ebc60f0698404ac31" (ACPI: Remove side effect
of partly creating a node in acpi_map_pxm_to_online_node) by
Jonathan Cameron. When the system does not support NUMA architecture,
the "socket_id" is expected to be -1. The valid "socket_id" in
BOND PMD is greater than or equal to zero. So it will cause an error
when DPDK checks the validity of the "socket_id" when starting the
bond. This commit can fix this bug.

Fixes: f294e04 ("net/bonding: fix socket ID check")

Signed-off-by: Zerun Fu <zerun.fu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
  • Loading branch information
zerun-fu authored and kevintraynor committed Jul 12, 2023
1 parent da6cad7 commit b11127d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions drivers/net/bonding/rte_eth_bond_args.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ bond_ethdev_parse_socket_id_kvarg(const char *key __rte_unused,
if (*endptr != 0 || errno != 0)
return -1;

/* SOCKET_ID_ANY also consider a valid socket id */
if ((int8_t)socket_id == SOCKET_ID_ANY) {
*(int *)extra_args = SOCKET_ID_ANY;
return 0;
}

/* validate socket id value */
if (socket_id >= 0 && socket_id < RTE_MAX_NUMA_NODES) {
*(int *)extra_args = (int)socket_id;
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/bonding/rte_eth_bond_pmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3322,7 +3322,7 @@ static int
bond_alloc(struct rte_vdev_device *dev, uint8_t mode)
{
const char *name = rte_vdev_device_name(dev);
uint8_t socket_id = dev->device.numa_node;
int socket_id = dev->device.numa_node;
struct bond_dev_private *internals = NULL;
struct rte_eth_dev *eth_dev = NULL;
uint32_t vlan_filter_bmp_size;
Expand Down Expand Up @@ -3522,7 +3522,7 @@ bond_probe(struct rte_vdev_device *dev)
port_id = bond_alloc(dev, bonding_mode);
if (port_id < 0) {
RTE_BOND_LOG(ERR, "Failed to create socket %s in mode %u on "
"socket %u.", name, bonding_mode, socket_id);
"socket %d.", name, bonding_mode, socket_id);
goto parse_error;
}
internals = rte_eth_devices[port_id].data->dev_private;
Expand All @@ -3547,7 +3547,7 @@ bond_probe(struct rte_vdev_device *dev)

rte_eth_dev_probing_finish(&rte_eth_devices[port_id]);
RTE_BOND_LOG(INFO, "Create bonded device %s on port %d in mode %u on "
"socket %u.", name, port_id, bonding_mode, socket_id);
"socket %d.", name, port_id, bonding_mode, socket_id);
return 0;

parse_error:
Expand Down

0 comments on commit b11127d

Please sign in to comment.