net/cxgbe: support setting MAC address
authorKumar Sanghvi <kumaras@chelsio.com>
Sat, 10 Mar 2018 22:48:27 +0000 (04:18 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 30 Mar 2018 12:08:44 +0000 (14:08 +0200)
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
drivers/net/cxgbe/cxgbe_ethdev.c
drivers/net/cxgbe/cxgbe_pfvf.h
drivers/net/cxgbe/cxgbevf_ethdev.c

index f039364..2610d62 100644 (file)
@@ -1031,6 +1031,22 @@ static int cxgbe_get_regs(struct rte_eth_dev *eth_dev,
        return 0;
 }
 
+void cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr)
+{
+       struct port_info *pi = (struct port_info *)(dev->data->dev_private);
+       struct adapter *adapter = pi->adapter;
+       int ret;
+
+       ret = t4_change_mac(adapter, adapter->mbox, pi->viid,
+                           pi->xact_addr_filt, (u8 *)addr, true, true);
+       if (ret < 0) {
+               dev_err(adapter, "failed to set mac addr; err = %d\n",
+                       ret);
+               return;
+       }
+       pi->xact_addr_filt = ret;
+}
+
 static const struct eth_dev_ops cxgbe_eth_dev_ops = {
        .dev_start              = cxgbe_dev_start,
        .dev_stop               = cxgbe_dev_stop,
@@ -1062,6 +1078,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = {
        .get_reg                = cxgbe_get_regs,
        .rss_hash_update        = cxgbe_dev_rss_hash_update,
        .rss_hash_conf_get      = cxgbe_dev_rss_hash_conf_get,
+       .mac_addr_set           = cxgbe_mac_addr_set,
 };
 
 /*
index 19bfd6d..0c1c170 100644 (file)
@@ -16,6 +16,7 @@ void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev);
+void cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr);
 int cxgbe_dev_configure(struct rte_eth_dev *eth_dev);
 int cxgbe_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t queue_idx,
                             uint16_t nb_desc, unsigned int socket_id,
index 27308c7..4885b97 100644 (file)
@@ -95,6 +95,7 @@ static const struct eth_dev_ops cxgbevf_eth_dev_ops = {
        .rx_queue_stop          = cxgbe_dev_rx_queue_stop,
        .rx_queue_release       = cxgbe_dev_rx_queue_release,
        .stats_get              = cxgbevf_dev_stats_get,
+       .mac_addr_set           = cxgbe_mac_addr_set,
 };
 
 /*