[PATCH] net/bonding: fix bond startup failure when NUMA is -1

Chaoyong He chaoyong.he at corigine.com
Fri Jun 16 08:08:44 CEST 2023


> 在 2023/6/16 11:20, Chaoyong He 写道:
> > From: Zerun Fu <zerun.fu at corigine.com>
> >
> > 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: f294e04851fd ("net/bonding: fix socket ID check")
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: Zerun Fu <zerun.fu at corigine.com>
> > Reviewed-by: Peng Zhang <peng.zhang at corigine.com>
> > Reviewed-by: Chaoyong He <chaoyong.he at corigine.com>
> > Reviewed-by: Long Wu <long.wu at corigine.com>
> > ---
> >   drivers/net/bonding/rte_eth_bond_args.c | 6 ++++++
> >   drivers/net/bonding/rte_eth_bond_pmd.c  | 2 +-
> >   2 files changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/bonding/rte_eth_bond_args.c
> > b/drivers/net/bonding/rte_eth_bond_args.c
> > index 6553166f5c..c137efd55f 100644
> > --- a/drivers/net/bonding/rte_eth_bond_args.c
> > +++ b/drivers/net/bonding/rte_eth_bond_args.c
> > @@ -212,6 +212,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; diff --git
> > a/drivers/net/bonding/rte_eth_bond_pmd.c
> > b/drivers/net/bonding/rte_eth_bond_pmd.c
> > index f0c4f7d26b..390a5b4271 100644
> > --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> > @@ -3604,7 +3604,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;
> 
> Well,  other point should be also modified, like :
> 
> ***
> 
> "socket %u.",    name, bonding_mode, socket_id);
> 
> ***
> 
> %u -- > %d.

Okay, I will send a v2 patch fix this.

> 
> BTW,  I think  there is  no need  to add args like "socket_id=-1..." if we know
> this server does not support NUMA.
> 
> Default socket id is -1, so this is meaningless.
> 

We found this bug when running 'dperf' app, and it is the 'dperf' app add this 'socket_id=-1' args.
Maybe the 'dperf' app should change its logic?
Please help correct me if I misunderstood, thanks.

> >       struct bond_dev_private *internals = NULL;
> >       struct rte_eth_dev *eth_dev = NULL;
> >       uint32_t vlan_filter_bmp_size;


More information about the stable mailing list