From: Kumar Sanghvi Date: Sat, 10 Mar 2018 22:48:27 +0000 (+0530) Subject: net/cxgbe: support setting MAC address X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0c4a5dfc2f6f98cde6a15523892ea77c7abdf75a;p=dpdk.git net/cxgbe: support setting MAC address Signed-off-by: Kumar Sanghvi Signed-off-by: Rahul Lakkireddy --- diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index f039364876..2610d62efc 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -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, }; /* diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h index 19bfd6d92a..0c1c170710 100644 --- a/drivers/net/cxgbe/cxgbe_pfvf.h +++ b/drivers/net/cxgbe/cxgbe_pfvf.h @@ -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, diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c index 27308c71fa..4885b97480 100644 --- a/drivers/net/cxgbe/cxgbevf_ethdev.c +++ b/drivers/net/cxgbe/cxgbevf_ethdev.c @@ -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, }; /*