[dpdk-dev] [PATCH] ethdev: forbid MTU set before device configure

Ferruh Yigit ferruh.yigit at intel.com
Fri Oct 29 11:22:05 CEST 2021


On 10/29/2021 7:19 AM, Andrew Rybchenko wrote:
> On 10/29/21 8:58 AM, Jiang, YuX wrote:
>>> -----Original Message-----
>>> From: dev <dev-bounces at dpdk.org> On Behalf Of Andrew Rybchenko
>>> Sent: Friday, October 22, 2021 6:18 PM
>>> To: Thomas Monjalon <thomas at monjalon.net>; Yigit, Ferruh
>>> <ferruh.yigit at intel.com>; Ajit Khaparde <ajit.khaparde at broadcom.com>;
>>> Huisong Li <lihuisong at huawei.com>; Ananyev, Konstantin
>>> <konstantin.ananyev at intel.com>; Xu, Rosen <rosen.xu at intel.com>
>>> Cc: dev at dpdk.org; Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
>>> Subject: [dpdk-dev] [PATCH] ethdev: forbid MTU set before device
>>> configure
>>>
>>> From: Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
>>>
>>> rte_eth_dev_configure() always sets MTU to either dev_conf.rxmode.mtu
>>> or RTE_ETHER_MTU if application doesn't provide the value.
>>> So, there is no point to allow rte_eth_dev_set_mtu() before since set value
>>> will be overwritten on configure anyway.
>>>
>>> Fixes: 1bb4a528c41f ("ethdev: fix max Rx packet length")
>>>
>>> Signed-off-by: Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
>>> Signed-off-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
>>> ---
>>>   lib/ethdev/rte_ethdev.c | 7 +++++++
>>>   1 file changed, 7 insertions(+)
>>>
>>> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index
>>> 4ea5a657e0..0d7dd68dc1 100644
>>> --- a/lib/ethdev/rte_ethdev.c
>>> +++ b/lib/ethdev/rte_ethdev.c
>>> @@ -3728,6 +3728,13 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t
>>> mtu)
>>>               return ret;
>>>       }
>>>
>>> +    if (dev->data->dev_configured == 0) {
>>> +        RTE_ETHDEV_LOG(ERR,
>>> +            "Port %u must be configured before MTU set\n",
>>> +            port_id);
>>> +        return -EINVAL;
>>> +    }
>>> +
>>>       ret = (*dev->dev_ops->mtu_set)(dev, mtu);
>>>       if (ret == 0)
>>>           dev->data->mtu = mtu;
>>> -- 
>>> 2.30.2
>> Hi Ivan,
>>
>> We meet an issue based on this patch when test dpdk21.11-rc1.
>> BugID: https://bugs.dpdk.org/show_bug.cgi?id=864, could you pls have a look?
>>
> 
> Hi, I think the problem is fixed by [1].
> 
> [1] https://patches.dpdk.org/project/dpdk/patch/20211024164237.2116166-1-andrew.rybchenko@oktetlabs.ru/

That patch is merged to next-net, Yu can you please verify the issue
with latest next-net?


More information about the dev mailing list