[dpdk-dev] [PATCH v5 5/6] ethdev: unify MTU checks
Ferruh Yigit
ferruh.yigit at intel.com
Mon Oct 11 21:50:16 CEST 2021
On 10/8/2021 5:51 PM, Ananyev, Konstantin wrote:
>
>
>> Both 'rte_eth_dev_configure()' & 'rte_eth_dev_set_mtu()' sets MTU but
>> have slightly different checks. Like one checks min MTU against
>> RTE_ETHER_MIN_MTU and other RTE_ETHER_MIN_LEN.
>>
>> Checks moved into common function to unify the checks. Also this has
>> benefit to have common error logs.
>>
>> Suggested-by: Huisong Li <lihuisong at huawei.com>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
>> ---
>> lib/ethdev/rte_ethdev.c | 82 ++++++++++++++++++++++++++---------------
>> lib/ethdev/rte_ethdev.h | 2 +-
>> 2 files changed, 54 insertions(+), 30 deletions(-)
>>
>> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
>> index c2b624aba1a0..0a6e952722ae 100644
>> --- a/lib/ethdev/rte_ethdev.c
>> +++ b/lib/ethdev/rte_ethdev.c
>> @@ -1336,6 +1336,47 @@ eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu)
>> return overhead_len;
>> }
>>
>> +/* rte_eth_dev_info_get() should be called prior to this function */
>> +static int
>> +eth_dev_validate_mtu(uint16_t port_id, struct rte_eth_dev_info *dev_info,
>> + uint16_t mtu)
>> +{
>> + uint16_t overhead_len;
>
> Again, I would just always use 32-bit arithmetic - safe and easy.
ack
> Apart from that:
> Acked-by: Konstantin Ananyev <konstantin.ananyev at intel.com>
>
<...>
More information about the dev
mailing list