mlx5: support setting primary MAC address
authorDavid Marchand <david.marchand@6wind.com>
Tue, 5 Jan 2016 18:00:09 +0000 (19:00 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 16 Mar 2016 17:52:17 +0000 (18:52 +0100)
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
drivers/net/mlx5/mlx5.c
drivers/net/mlx5/mlx5.h
drivers/net/mlx5/mlx5_mac.c

index 821ee0f..30d88b5 100644 (file)
@@ -162,6 +162,7 @@ static const struct eth_dev_ops mlx5_dev_ops = {
        .flow_ctrl_set = mlx5_dev_set_flow_ctrl,
        .mac_addr_remove = mlx5_mac_addr_remove,
        .mac_addr_add = mlx5_mac_addr_add,
+       .mac_addr_set = mlx5_mac_addr_set,
        .mtu_set = mlx5_dev_set_mtu,
        .reta_update = mlx5_dev_rss_reta_update,
        .reta_query = mlx5_dev_rss_reta_query,
index b84d31d..2f9a594 100644 (file)
@@ -179,6 +179,7 @@ int priv_mac_addr_add(struct priv *, unsigned int,
 int priv_mac_addrs_enable(struct priv *);
 void mlx5_mac_addr_add(struct rte_eth_dev *, struct ether_addr *, uint32_t,
                       uint32_t);
+void mlx5_mac_addr_set(struct rte_eth_dev *, struct ether_addr *);
 
 /* mlx5_rss.c */
 
index e37ce06..b1f34d9 100644 (file)
@@ -488,3 +488,19 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
 end:
        priv_unlock(priv);
 }
+
+/**
+ * DPDK callback to set primary MAC address.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param mac_addr
+ *   MAC address to register.
+ */
+void
+mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
+{
+       DEBUG("%p: setting primary MAC address", (void *)dev);
+       mlx5_mac_addr_remove(dev, 0);
+       mlx5_mac_addr_add(dev, mac_addr, 0, 0);
+}