net/bonding: fix MTU set for slaves
Checks
Commit Message
ethdev requires device to be configured before setting MTU.
In bonding PMD, while configuring slaves, bonding first sets MTU later
configures them, which causes failure if slaves are not configured in
advance.
Fixing by changing the order in slave configure as requested in ethdev
layer, configure first and set MTU later.
Bugzilla ID: 864
Fixes: b26bee10ee37 ("ethdev: forbid MTU set before device configure")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Andrew Rybchenko <arybchenko@solarflare.com>
Cc: yux.jiang@intel.com
---
drivers/net/bonding/rte_eth_bond_pmd.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
Comments
> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Wednesday, January 26, 2022 9:11 PM
> To: Chas Williams <chas3@att.com>; Min Hu (Connor)
> <humin29@huawei.com>; Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>;
> Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; stable@dpdk.org;
> Andrew Rybchenko <arybchenko@solarflare.com>; Jiang, YuX
> <yux.jiang@intel.com>
> Subject: [PATCH] net/bonding: fix MTU set for slaves
>
> ethdev requires device to be configured before setting MTU.
>
> In bonding PMD, while configuring slaves, bonding first sets MTU later
> configures them, which causes failure if slaves are not configured in advance.
>
> Fixing by changing the order in slave configure as requested in ethdev layer,
> configure first and set MTU later.
>
> Bugzilla ID: 864
> Fixes: b26bee10ee37 ("ethdev: forbid MTU set before device configure")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
Tested-by: Yu Jiang <YuX.Jiang@intel.com>
> Cc: Andrew Rybchenko <arybchenko@solarflare.com>
> Cc: yux.jiang@intel.com
> ---
Verified patchset https://patches.dpdk.org/project/dpdk/patch/20220126131037.2403369-1-ferruh.yigit@intel.com/ on baseline v22.03-rc0's 8a5a91401d .
Tested pass on nic Ethernet Connection X722 for 10GbE SFP+ 37d0/Ubuntu21.10,5.13.0-19-generic
Acked-by: Min Hu (Connor) <humin29@huawei.com>
在 2022/1/26 21:10, Ferruh Yigit 写道:
> ethdev requires device to be configured before setting MTU.
>
> In bonding PMD, while configuring slaves, bonding first sets MTU later
> configures them, which causes failure if slaves are not configured in
> advance.
>
> Fixing by changing the order in slave configure as requested in ethdev
> layer, configure first and set MTU later.
>
> Bugzilla ID: 864
> Fixes: b26bee10ee37 ("ethdev: forbid MTU set before device configure")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: Andrew Rybchenko <arybchenko@solarflare.com>
> Cc: yux.jiang@intel.com
> ---
> drivers/net/bonding/rte_eth_bond_pmd.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index 9607141b393e..6fd52035c9a8 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -1741,14 +1741,6 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
> }
> }
>
> - errval = rte_eth_dev_set_mtu(slave_eth_dev->data->port_id,
> - bonded_eth_dev->data->mtu);
> - if (errval != 0 && errval != -ENOTSUP) {
> - RTE_BOND_LOG(ERR, "rte_eth_dev_set_mtu: port %u, err (%d)",
> - slave_eth_dev->data->port_id, errval);
> - return errval;
> - }
> -
> /* Configure device */
> errval = rte_eth_dev_configure(slave_eth_dev->data->port_id,
> nb_rx_queues, nb_tx_queues,
> @@ -1759,6 +1751,14 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
> return errval;
> }
>
> + errval = rte_eth_dev_set_mtu(slave_eth_dev->data->port_id,
> + bonded_eth_dev->data->mtu);
> + if (errval != 0 && errval != -ENOTSUP) {
> + RTE_BOND_LOG(ERR, "rte_eth_dev_set_mtu: port %u, err (%d)",
> + slave_eth_dev->data->port_id, errval);
> + return errval;
> + }
> +
> /* Setup Rx Queues */
> for (q_id = 0; q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
> bd_rx_q = (struct bond_rx_queue *)bonded_eth_dev->data->rx_queues[q_id];
>
On 1/27/2022 9:18 AM, Min Hu (Connor) wrote:
<...>
> 在 2022/1/26 21:10, Ferruh Yigit 写道:
>> ethdev requires device to be configured before setting MTU.
>>
>> In bonding PMD, while configuring slaves, bonding first sets MTU later
>> configures them, which causes failure if slaves are not configured in
>> advance.
>>
>> Fixing by changing the order in slave configure as requested in ethdev
>> layer, configure first and set MTU later.
>>
>> Bugzilla ID: 864
>> Fixes: b26bee10ee37 ("ethdev: forbid MTU set before device configure")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> Tested-by: Yu Jiang <YuX.Jiang@intel.com>
>
> Acked-by: Min Hu (Connor) <humin29@huawei.com>
>
Applied to dpdk-next-net/main, thanks.
@@ -1741,14 +1741,6 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
}
}
- errval = rte_eth_dev_set_mtu(slave_eth_dev->data->port_id,
- bonded_eth_dev->data->mtu);
- if (errval != 0 && errval != -ENOTSUP) {
- RTE_BOND_LOG(ERR, "rte_eth_dev_set_mtu: port %u, err (%d)",
- slave_eth_dev->data->port_id, errval);
- return errval;
- }
-
/* Configure device */
errval = rte_eth_dev_configure(slave_eth_dev->data->port_id,
nb_rx_queues, nb_tx_queues,
@@ -1759,6 +1751,14 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
return errval;
}
+ errval = rte_eth_dev_set_mtu(slave_eth_dev->data->port_id,
+ bonded_eth_dev->data->mtu);
+ if (errval != 0 && errval != -ENOTSUP) {
+ RTE_BOND_LOG(ERR, "rte_eth_dev_set_mtu: port %u, err (%d)",
+ slave_eth_dev->data->port_id, errval);
+ return errval;
+ }
+
/* Setup Rx Queues */
for (q_id = 0; q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) {
bd_rx_q = (struct bond_rx_queue *)bonded_eth_dev->data->rx_queues[q_id];