This helper is exposing internals of net/mlx5 for no good reason. All this code does is calling the remove helper. Walk through the list in Linux implementation like the Windows implementation.
Signed-off-by: David Marchand <[email protected]> --- drivers/common/mlx5/linux/mlx5_nl.c | 40 ----------------------------- drivers/common/mlx5/linux/mlx5_nl.h | 5 ---- drivers/net/mlx5/linux/mlx5_os.c | 13 +++++++--- 3 files changed, 10 insertions(+), 48 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c index 8b19838a7e..85736738ac 100644 --- a/drivers/common/mlx5/linux/mlx5_nl.c +++ b/drivers/common/mlx5/linux/mlx5_nl.c @@ -825,46 +825,6 @@ mlx5_nl_mac_addr_sync(int nlsk_fd, unsigned int iface_idx, } } -/** - * Flush all added MAC addresses. - * - * @param[in] nlsk_fd - * Netlink socket file descriptor. - * @param[in] iface_idx - * Net device interface index. - * @param[in] mac_addrs - * Mac addresses array to flush. - * @param n - * @p mac_addrs array size. - * @param mac_own - * BITFIELD_DECLARE array to store the mac. - * @param vf - * Flag for a VF device. - */ -RTE_EXPORT_INTERNAL_SYMBOL(mlx5_nl_mac_addr_flush) -void -mlx5_nl_mac_addr_flush(int nlsk_fd, unsigned int iface_idx, - struct rte_ether_addr *mac_addrs, int n, - uint64_t *mac_own, bool vf) -{ - int i; - - if (n <= 0 || n > MLX5_MAX_MAC_ADDRESSES) - return; - - for (i = n - 1; i >= 0; --i) { - struct rte_ether_addr *m = &mac_addrs[i]; - - if (BITFIELD_ISSET(mac_own, i)) { - if (vf) - mlx5_nl_mac_addr_remove(nlsk_fd, - iface_idx, - m, i); - BITFIELD_RESET(mac_own, i); - } - } -} - /** * Enable promiscuous / all multicast mode through Netlink. * diff --git a/drivers/common/mlx5/linux/mlx5_nl.h b/drivers/common/mlx5/linux/mlx5_nl.h index 3f79a73c85..256ed7e2b7 100644 --- a/drivers/common/mlx5/linux/mlx5_nl.h +++ b/drivers/common/mlx5/linux/mlx5_nl.h @@ -65,11 +65,6 @@ __rte_internal void mlx5_nl_mac_addr_sync(int nlsk_fd, unsigned int iface_idx, struct rte_ether_addr *mac_addrs, int n); __rte_internal -void mlx5_nl_mac_addr_flush(int nlsk_fd, unsigned int iface_idx, - struct rte_ether_addr *mac_addrs, int n, - uint64_t *mac_own, - bool vf); -__rte_internal int mlx5_nl_promisc(int nlsk_fd, unsigned int iface_idx, int enable); __rte_internal int mlx5_nl_allmulti(int nlsk_fd, unsigned int iface_idx, int enable); diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index adc5878296..9fd366b10a 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -3495,10 +3495,17 @@ mlx5_os_mac_addr_flush(struct rte_eth_dev *dev) { struct mlx5_priv *priv = dev->data->dev_private; const int vf = priv->sh->dev_cap.vf; + int i; - mlx5_nl_mac_addr_flush(priv->nl_socket_route, mlx5_ifindex(dev), - dev->data->mac_addrs, - MLX5_MAX_MAC_ADDRESSES, priv->mac_own, vf); + for (i = MLX5_MAX_MAC_ADDRESSES - 1; i >= 0; --i) { + if (BITFIELD_ISSET(priv->mac_own, i)) { + if (vf) + mlx5_nl_mac_addr_remove(priv->nl_socket_route, + mlx5_ifindex(dev), + &dev->data->mac_addrs[i], i); + BITFIELD_RESET(priv->mac_own, i); + } + } } static bool -- 2.54.0

