[dpdk-dev] [PATCH v2] ethdev: fix one MAC address occupies two index in mac addrs

lihuisong (C) lihuisong at huawei.com
Tue Oct 12 04:58:04 CEST 2021


在 2021/10/11 18:35, Thomas Monjalon 写道:
> 11/10/2021 11:28, Min Hu (Connor):
>> From: Huisong Li <lihuisong at huawei.com>
>>
>> The dev->data->mac_addrs[0] will be changed to a new MAC address when
>> applications modify the default MAC address by
>> rte_eth_dev_default_mac_addr_set() API. However, If the new default
>> MAC address has been added as a non-default MAC address by
>> rte_eth_dev_mac_addr_add() API, the rte_eth_dev_default_mac_addr_set()
>> API doesn't remove it from dev->data->mac_addrs[]. As a result, one MAC
>> address occupies two index capacities in dev->data->mac_addrs[].
>>
>> This patch adds the logic of removing MAC addresses for this scenario.
>>
>> Fixes: 854d8ad4ef68 ("ethdev: add default mac address modifier")
>> Cc: stable at dpdk.org
>>
>> Signed-off-by: Huisong Li <lihuisong at huawei.com>
>> Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
>> ---
>> +	/*
>> +	 * If the address has been added as a non-default MAC address by
>> +	 * rte_eth_dev_mac_addr_add API, it should be removed from
>> +	 * dev->data->mac_addrs[].
>> +	 */
> This is the definition of mac_addrs:
>
>      struct rte_ether_addr *mac_addrs;
>              /**< Device Ethernet link address.
>               *   @see rte_eth_dev_release_port()
>               */
>
> I feel we need to explain there can be multiple addresses,
> the first one being the default.

Do you mean that the problem mentioned in this patch is not a problem?

Should we accept this scenario?

>
> Another comment,
> If we remove the duplicate, we may have to copy to previous default one
> to avoid completely deleting the previous default address.

That's not necessary.

Because the previous default address has been removed from hardware.

After the default MAC address is modified, the previous default one is 
invalid.

> Not sure what should be the behaviour.
>
>
> .


More information about the dev mailing list