[dpdk-dev,1/2] mlx4: add callback to set primary mac address

Message ID 1452016809-29347-1-git-send-email-david.marchand@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Commit Message

David Marchand Jan. 5, 2016, 6 p.m. UTC
  Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 drivers/net/mlx4/mlx4.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Comments

Adrien Mazarguil Jan. 6, 2016, 8:50 a.m. UTC | #1
On Tue, Jan 05, 2016 at 07:00:08PM +0100, David Marchand wrote:
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
>  drivers/net/mlx4/mlx4.c |   17 +++++++++++++++++
>  1 file changed, 17 insertions(+)

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
  
Bruce Richardson Feb. 8, 2016, 3:50 p.m. UTC | #2
On Wed, Jan 06, 2016 at 09:50:19AM +0100, Adrien Mazarguil wrote:
> On Tue, Jan 05, 2016 at 07:00:08PM +0100, David Marchand wrote:
> > Signed-off-by: David Marchand <david.marchand@6wind.com>
> > ---
> >  drivers/net/mlx4/mlx4.c |   17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> 
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> 
Patch-set applied to dpdk-next-net/rel_16_04

Thanks,
/Bruce
  

Patch

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 207bfe2..acc76d7 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -4432,6 +4432,22 @@  end:
 }
 
 /**
+ * DPDK callback to set the primary MAC address.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param mac_addr
+ *   MAC address to register.
+ */
+static void
+mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
+{
+	DEBUG("%p: setting primary MAC address", (void *)dev);
+	mlx4_mac_addr_remove(dev, 0);
+	mlx4_mac_addr_add(dev, mac_addr, 0, 0);
+}
+
+/**
  * DPDK callback to enable promiscuous mode.
  *
  * @param dev
@@ -5004,6 +5020,7 @@  static const struct eth_dev_ops mlx4_dev_ops = {
 	.priority_flow_ctrl_set = NULL,
 	.mac_addr_remove = mlx4_mac_addr_remove,
 	.mac_addr_add = mlx4_mac_addr_add,
+	.mac_addr_set = mlx4_mac_addr_set,
 	.mtu_set = mlx4_dev_set_mtu,
 	.udp_tunnel_add = NULL,
 	.udp_tunnel_del = NULL,