11/10/2021 11:28, Min Hu (Connor):
> From: Huisong Li <lihuis...@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: sta...@dpdk.org
> 
> Signed-off-by: Huisong Li <lihuis...@huawei.com>
> Signed-off-by: Min Hu (Connor) <humi...@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.

Another comment,
If we remove the duplicate, we may have to copy to previous default one
to avoid completely deleting the previous default address.
Not sure what should be the behaviour.


Reply via email to