[v2] net/bonding: fix segfault when creating bonded device
Checks
Commit Message
After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
from probe() segfaults; there is no need to call the function, just set
the mode directly.
Also, reverted 1620175b400e.
Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
Fixes: 1620175b400e ("net/bonding: fix invalid port id")
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
v2: reverted earlier patch
drivers/net/bonding/rte_eth_bond_pmd.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
Comments
31/10/2018 16:50, Radu Nicolau:
> After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
> from probe() segfaults; there is no need to call the function, just set
> the mode directly.
> Also, reverted 1620175b400e.
>
> Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
> Fixes: 1620175b400e ("net/bonding: fix invalid port id")
>
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
I cannot ack because I do not master this PMD,
but it looks good to me.
On 10/31/2018 11:50 AM, Radu Nicolau wrote:
> After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
> from probe() segfaults; there is no need to call the function, just set
> the mode directly.
> Also, reverted 1620175b400e.
>
> Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
> Fixes: 1620175b400e ("net/bonding: fix invalid port id")
>
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Chas Williams <chas3@att.com>
> ---
> v2: reverted earlier patch
>
> drivers/net/bonding/rte_eth_bond_pmd.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index 156f31c..1a6d8e4 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -3216,8 +3216,6 @@ bond_probe(struct rte_vdev_device *dev)
> internals = rte_eth_devices[port_id].data->dev_private;
> internals->kvlist = kvlist;
>
> - rte_eth_dev_probing_finish(&rte_eth_devices[port_id]);
> -
> if (rte_kvargs_count(kvlist, PMD_BOND_AGG_MODE_KVARG) == 1) {
> if (rte_kvargs_process(kvlist,
> PMD_BOND_AGG_MODE_KVARG,
> @@ -3230,12 +3228,12 @@ bond_probe(struct rte_vdev_device *dev)
> }
>
> if (internals->mode == BONDING_MODE_8023AD)
> - rte_eth_bond_8023ad_agg_selection_set(port_id,
> - agg_mode);
> + internals->mode4.agg_selection = agg_mode;
> } else {
> - rte_eth_bond_8023ad_agg_selection_set(port_id, AGG_STABLE);
> + internals->mode4.agg_selection = AGG_STABLE;
> }
>
> + 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);
> return 0;
>
On 10/31/2018 4:14 PM, Chas Williams wrote:
>
>
> On 10/31/2018 11:50 AM, Radu Nicolau wrote:
>> After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
>> from probe() segfaults; there is no need to call the function, just set
>> the mode directly.
>> Also, reverted 1620175b400e.
>>
>> Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
>> Fixes: 1620175b400e ("net/bonding: fix invalid port id")
>>
>> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
>
> Acked-by: Chas Williams <chas3@att.com>
Applied to dpdk-next-net/master, thanks.
@@ -3216,8 +3216,6 @@ bond_probe(struct rte_vdev_device *dev)
internals = rte_eth_devices[port_id].data->dev_private;
internals->kvlist = kvlist;
- rte_eth_dev_probing_finish(&rte_eth_devices[port_id]);
-
if (rte_kvargs_count(kvlist, PMD_BOND_AGG_MODE_KVARG) == 1) {
if (rte_kvargs_process(kvlist,
PMD_BOND_AGG_MODE_KVARG,
@@ -3230,12 +3228,12 @@ bond_probe(struct rte_vdev_device *dev)
}
if (internals->mode == BONDING_MODE_8023AD)
- rte_eth_bond_8023ad_agg_selection_set(port_id,
- agg_mode);
+ internals->mode4.agg_selection = agg_mode;
} else {
- rte_eth_bond_8023ad_agg_selection_set(port_id, AGG_STABLE);
+ internals->mode4.agg_selection = AGG_STABLE;
}
+ 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);
return 0;