在 2023/2/1 18:42, Thomas Monjalon 写道:
31/01/2023 07:41, Huisong Li:
The dev->data->mac_addrs[0] will be changed to a new MAC address when
applications modify the default MAC address by .mac_addr_set(). However,
if the new default one has been added as a non-default MAC address by
.mac_addr_add(), the .mac_addr_set() doesn't remove it from the mac_addrs
list. As a result, one MAC address occupies two entries in the list. Like:
add(MAC1)
add(MAC2)
add(MAC3)
add(MAC4)
set_default(MAC3)
default=MAC3, the rest of list=MAC1, MAC2, MAC3, MAC4
Note: MAC3 occupies two entries.
In addition, some PMDs, such as i40e, ice, hns3 and so on, do remove the
old default MAC when set default MAC. If user continues to do
set_default(MAC5), and the mac_addrs list is default=MAC5, filters=(MAC1,
MAC2, MAC3, MAC4). At this moment, user can still see MAC3 from the list,
but packets with MAC3 aren't actually received by the PMD.
So need to ensure that the new default address is removed from the rest of
the list.
Fixes: 854d8ad4ef68 ("ethdev: add default mac address modifier")
Cc: sta...@dpdk.org
Signed-off-by: Huisong Li <lihuis...@huawei.com>
Acked-by: Chengwen Feng <fengcheng...@huawei.com>
---
lib/ethdev/ethdev_driver.h | 6 +++++-
lib/ethdev/rte_ethdev.c | 35 +++++++++++++++++++++++++++++++++--
2 files changed, 38 insertions(+), 3 deletions(-)
This is a behavior change.
It must be noted in the release notes in the API section.
ok. I will add an announcement.
- /** Device Ethernet link address. @see rte_eth_dev_release_port() */
+ /**
+ * Device Ethernet link addresses. The first entry (index zero) is the
+ * default address. The rest of list cannot be the same as the default
+ * address.
+ */
Please split the lines after a dot.
rest of "the" list
Maybe better for this field:
All entries are unique.
The first entry (index zero) is the default address.
It's more simpler. Thank you for your suggestion.
struct rte_ether_addr *mac_addrs;
and for the function rte_eth_dev_default_mac_addr_set:
Set the default MAC address.
It replaces the address at index 0 of the address list.
If the address was already in the MAC address list,
it is removed from the rest of the list.
Indeed, It's better to document it.
.