/* SPDX-License-Identifier: BSD-3-Clause
* Copyright 2015 6WIND S.A.
- * Copyright 2015 Mellanox.
+ * Copyright 2015 Mellanox Technologies, Ltd
*/
#include <stddef.h>
void
mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
{
+ struct priv *priv = dev->data->dev_private;
+ const int vf = priv->config.vf;
+ int ret;
+
assert(index < MLX5_MAX_MAC_ADDRESSES);
+ if (vf)
+ mlx5_nl_mac_addr_remove(dev, &dev->data->mac_addrs[index],
+ index);
memset(&dev->data->mac_addrs[index], 0, sizeof(struct ether_addr));
if (!dev->data->promiscuous) {
- int ret = mlx5_traffic_restart(dev);
-
+ ret = mlx5_traffic_restart(dev);
if (ret)
- ERROR("%p cannot remove mac address: %s", (void *)dev,
- strerror(rte_errno));
+ DRV_LOG(ERR, "port %u cannot restart traffic: %s",
+ dev->data->port_id, strerror(rte_errno));
}
}
mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac,
uint32_t index, uint32_t vmdq __rte_unused)
{
+ struct priv *priv = dev->data->dev_private;
+ const int vf = priv->config.vf;
unsigned int i;
assert(index < MLX5_MAX_MAC_ADDRESSES);
rte_errno = EADDRINUSE;
return -rte_errno;
}
+ if (vf) {
+ int ret = mlx5_nl_mac_addr_add(dev, mac, index);
+
+ if (ret)
+ return ret;
+ }
dev->data->mac_addrs[index] = *mac;
if (!dev->data->promiscuous)
return mlx5_traffic_restart(dev);
{
int ret;
- DEBUG("%p: setting primary MAC address", (void *)dev);
+ DRV_LOG(DEBUG, "port %u setting primary MAC address",
+ dev->data->port_id);
+
ret = mlx5_mac_addr_add(dev, mac_addr, 0, 0);
if (ret)
- ERROR("cannot set mac address: %s", strerror(rte_errno));
+ DRV_LOG(ERR, "port %u cannot set mac address: %s",
+ dev->data->port_id, strerror(rte_errno));
}