summaryrefslogtreecommitdiff
path: root/drivers/net/enic/enic_main.c
diff options
context:
space:
mode:
authorJohn Daley <johndale@cisco.com>2017-01-26 12:12:12 -0800
committerFerruh Yigit <ferruh.yigit@intel.com>2017-01-30 22:18:26 +0100
commitbbab3d97c37e55f05064efd7cefd965f6ff0661b (patch)
tree2d2f81f8af158d46d679a9e81bbe6f5fa7344cf3 /drivers/net/enic/enic_main.c
parent28a1fd4fd011f1a30f53bde5a91708eb628eacfa (diff)
downloaddpdk-bbab3d97c37e55f05064efd7cefd965f6ff0661b.zip
dpdk-bbab3d97c37e55f05064efd7cefd965f6ff0661b.tar.gz
dpdk-bbab3d97c37e55f05064efd7cefd965f6ff0661b.tar.xz
net/enic: fix MAC address add and remove
The mac_addr_add callback function was simply replacing the primary MAC address instead of adding new ones and the mac_addr_remove callback would only remove the primary MAC form the adapter. Fix the functions to add or remove new address. Allow up to 64 MAC addresses per port. Fixes: fefed3d1e62c ("enic: new driver") Signed-off-by: John Daley <johndale@cisco.com> Reviewed-by: Nelson Escobar <neescoba@cisco.com>
Diffstat (limited to 'drivers/net/enic/enic_main.c')
-rw-r--r--drivers/net/enic/enic_main.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index f0b15ac..21e8ede 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -190,9 +190,12 @@ void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats)
r_stats->rx_nombuf = rte_atomic64_read(&soft_stats->rx_nombuf);
}
-void enic_del_mac_address(struct enic *enic)
+void enic_del_mac_address(struct enic *enic, int mac_index)
{
- if (vnic_dev_del_addr(enic->vdev, enic->mac_addr))
+ struct rte_eth_dev *eth_dev = enic->rte_dev;
+ uint8_t *mac_addr = eth_dev->data->mac_addrs[mac_index].addr_bytes;
+
+ if (vnic_dev_del_addr(enic->vdev, mac_addr))
dev_err(enic, "del mac addr failed\n");
}
@@ -205,15 +208,6 @@ void enic_set_mac_address(struct enic *enic, uint8_t *mac_addr)
return;
}
- err = vnic_dev_del_addr(enic->vdev, enic->mac_addr);
- if (err) {
- dev_err(enic, "del mac addr failed\n");
- return;
- }
-
- ether_addr_copy((struct ether_addr *)mac_addr,
- (struct ether_addr *)enic->mac_addr);
-
err = vnic_dev_add_addr(enic->vdev, mac_addr);
if (err) {
dev_err(enic, "add mac addr failed\n");
@@ -1308,13 +1302,14 @@ static int enic_dev_init(struct enic *enic)
/* Get the supported filters */
enic_fdir_info(enic);
- eth_dev->data->mac_addrs = rte_zmalloc("enic_mac_addr", ETH_ALEN, 0);
+ eth_dev->data->mac_addrs = rte_zmalloc("enic_mac_addr", ETH_ALEN
+ * ENIC_MAX_MAC_ADDR, 0);
if (!eth_dev->data->mac_addrs) {
dev_err(enic, "mac addr storage alloc failed, aborting.\n");
return -1;
}
ether_addr_copy((struct ether_addr *) enic->mac_addr,
- &eth_dev->data->mac_addrs[0]);
+ eth_dev->data->mac_addrs);
vnic_dev_set_reset_flag(enic->vdev, 0);