summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Shin <jonshin@cisco.com>2017-01-31 13:38:08 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2017-02-02 12:36:45 +0000
commit460bc633b131d2001bb81d7c2ad5a51ec177ac93 (patch)
tree535f2519be74a2ead116c6678715021fc01eb30b
parentb17dd9607ee8ecba5ae3ef69c7b4915b57de292a (diff)
ENIC driver patch to 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. Change-Id: Ieff396ae27505c4c09f028911eff907757b03c7d Signed-off-by: Steve Shin <jonshin@cisco.com>
-rw-r--r--dpdk/Makefile2
-rw-r--r--dpdk/dpdk-16.11_patches/0003-enic-fix-MAC-address-add-and-remove.patch122
2 files changed, 123 insertions, 1 deletions
diff --git a/dpdk/Makefile b/dpdk/Makefile
index 02b5b2107bb..00d606d220b 100644
--- a/dpdk/Makefile
+++ b/dpdk/Makefile
@@ -27,7 +27,7 @@ DPDK_MLX5_PMD ?= n
B := $(DPDK_BUILD_DIR)
I := $(DPDK_INSTALL_DIR)
DPDK_VERSION ?= 16.11
-PKG_SUFFIX ?= vpp3
+PKG_SUFFIX ?= vpp4
DPDK_BASE_URL ?= http://fast.dpdk.org/rel
DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.xz
DPDK_TAR_URL := $(DPDK_BASE_URL)/$(DPDK_TARBALL)
diff --git a/dpdk/dpdk-16.11_patches/0003-enic-fix-MAC-address-add-and-remove.patch b/dpdk/dpdk-16.11_patches/0003-enic-fix-MAC-address-add-and-remove.patch
new file mode 100644
index 00000000000..e2965676a0a
--- /dev/null
+++ b/dpdk/dpdk-16.11_patches/0003-enic-fix-MAC-address-add-and-remove.patch
@@ -0,0 +1,122 @@
+From 0cd0ed7b0b966704236e07fc1d3bd099deb407a7 Mon Sep 17 00:00:00 2001
+From: John Daley <johndale@cisco.com>
+Date: Tue, 31 Jan 2017 12:59:23 -0800
+Subject: [PATCH] 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.
+
+Signed-off-by: John Daley <johndale@cisco.com>
+---
+ drivers/net/enic/enic.h | 5 +++--
+ drivers/net/enic/enic_ethdev.c | 6 +++---
+ drivers/net/enic/enic_main.c | 21 ++++++++-------------
+ 3 files changed, 14 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
+index 865cd76..5a807d4 100644
+--- a/drivers/net/enic/enic.h
++++ b/drivers/net/enic/enic.h
+@@ -60,6 +60,7 @@
+ #define ENIC_RQ_MAX 16
+ #define ENIC_CQ_MAX (ENIC_WQ_MAX + (ENIC_RQ_MAX / 2))
+ #define ENIC_INTR_MAX (ENIC_CQ_MAX + 2)
++#define ENIC_MAX_MAC_ADDR 64
+
+ #define VLAN_ETH_HLEN 18
+
+@@ -277,8 +278,8 @@ extern void enic_dev_stats_get(struct enic *enic,
+ struct rte_eth_stats *r_stats);
+ extern void enic_dev_stats_clear(struct enic *enic);
+ extern void enic_add_packet_filter(struct enic *enic);
+-extern void enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
+-extern void enic_del_mac_address(struct enic *enic);
++void enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
++void enic_del_mac_address(struct enic *enic, int mac_index);
+ extern unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq);
+ extern void enic_send_pkt(struct enic *enic, struct vnic_wq *wq,
+ struct rte_mbuf *tx_pkt, unsigned short len,
+diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
+index 2b154ec..d2d04a9 100644
+--- a/drivers/net/enic/enic_ethdev.c
++++ b/drivers/net/enic/enic_ethdev.c
+@@ -464,7 +464,7 @@ static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev,
+ device_info->max_tx_queues = enic->conf_wq_count;
+ device_info->min_rx_bufsize = ENIC_MIN_MTU;
+ device_info->max_rx_pktlen = enic->max_mtu + ETHER_HDR_LEN + 4;
+- device_info->max_mac_addrs = 1;
++ device_info->max_mac_addrs = ENIC_MAX_MAC_ADDR;
+ device_info->rx_offload_capa =
+ DEV_RX_OFFLOAD_VLAN_STRIP |
+ DEV_RX_OFFLOAD_IPV4_CKSUM |
+@@ -545,12 +545,12 @@ static void enicpmd_add_mac_addr(struct rte_eth_dev *eth_dev,
+ enic_set_mac_address(enic, mac_addr->addr_bytes);
+ }
+
+-static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, __rte_unused uint32_t index)
++static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index)
+ {
+ struct enic *enic = pmd_priv(eth_dev);
+
+ ENICPMD_FUNC_TRACE();
+- enic_del_mac_address(enic);
++ enic_del_mac_address(enic, index);
+ }
+
+ static int enicpmd_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
+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);
+
+--
+1.9.1
+