[dpdk-stable] patch 'ethdev: fix MAC changes when live change not supported' has been queued to stable release 18.08.1

Kevin Traynor ktraynor at redhat.com
Tue Nov 20 20:12:07 CET 2018


Hi,

FYI, your patch has been queued to stable release 18.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/23/18. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>From 4ca56b114fb6516355cffde286c157353b45c5cf Mon Sep 17 00:00:00 2001
From: Alejandro Lucero <alejandro.lucero at netronome.com>
Date: Fri, 24 Aug 2018 15:25:35 +0100
Subject: [PATCH] ethdev: fix MAC changes when live change not supported

[ upstream commit 1e5e3d2e72c6bfdb3553be26015b7ee5bbf745c1 ]

Current code assumes a MAC change can occur when the port has been
started. In fact, there are some NICs which require this port state
for being successful, but other NICs not always support MAC change
in that case.

This patch supports a new device flag for a device advertising this
limitation, and if the flag is set, the MAC is changed before the
port starts.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Alejandro Lucero <alejandro.lucero at netronome.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 lib/librte_ethdev/rte_ethdev.c | 28 +++++++++++++++++++---------
 lib/librte_ethdev/rte_ethdev.h |  6 ++++++
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 4c3202505..ee6bb0552 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1220,8 +1220,7 @@ _rte_eth_dev_reset(struct rte_eth_dev *dev)
 
 static void
-rte_eth_dev_config_restore(uint16_t port_id)
+rte_eth_dev_mac_restore(struct rte_eth_dev *dev,
+			struct rte_eth_dev_info *dev_info)
 {
-	struct rte_eth_dev *dev;
-	struct rte_eth_dev_info dev_info;
 	struct ether_addr *addr;
 	uint16_t i;
@@ -1229,8 +1228,4 @@ rte_eth_dev_config_restore(uint16_t port_id)
 	uint64_t pool_mask;
 
-	dev = &rte_eth_devices[port_id];
-
-	rte_eth_dev_info_get(port_id, &dev_info);
-
 	/* replay MAC address configuration including default MAC */
 	addr = &dev->data->mac_addrs[0];
@@ -1241,5 +1236,5 @@ rte_eth_dev_config_restore(uint16_t port_id)
 
 	if (*dev->dev_ops->mac_addr_add != NULL) {
-		for (i = 1; i < dev_info.max_mac_addrs; i++) {
+		for (i = 1; i < dev_info->max_mac_addrs; i++) {
 			addr = &dev->data->mac_addrs[i];
 
@@ -1260,4 +1255,12 @@ rte_eth_dev_config_restore(uint16_t port_id)
 		}
 	}
+}
+
+static void
+rte_eth_dev_config_restore(struct rte_eth_dev *dev,
+			   struct rte_eth_dev_info *dev_info, uint16_t port_id)
+{
+	if (!(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR))
+		rte_eth_dev_mac_restore(dev, dev_info);
 
 	/* replay promiscuous configuration */
@@ -1278,4 +1281,5 @@ rte_eth_dev_start(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
 	int diag;
 
@@ -1293,4 +1297,10 @@ rte_eth_dev_start(uint16_t port_id)
 	}
 
+	rte_eth_dev_info_get(port_id, &dev_info);
+
+	/* Lets restore MAC now if device does not support live change */
+	if (*dev_info.dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR)
+		rte_eth_dev_mac_restore(dev, &dev_info);
+
 	diag = (*dev->dev_ops->dev_start)(dev);
 	if (diag == 0)
@@ -1299,5 +1309,5 @@ rte_eth_dev_start(uint16_t port_id)
 		return eth_err(port_id, diag);
 
-	rte_eth_dev_config_restore(port_id);
+	rte_eth_dev_config_restore(dev, &dev_info, port_id);
 
 	if (dev->data->dev_conf.intr_conf.lsc == 0) {
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 7070e9ab4..fa2812bca 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1269,4 +1269,6 @@ struct rte_eth_dev_owner {
 /** Device is port representor */
 #define RTE_ETH_DEV_REPRESENTOR  0x0010
+/** Device does not support MAC change after started */
+#define RTE_ETH_DEV_NOLIVE_MAC_ADDR  0x0020
 
 /**
@@ -1751,4 +1753,8 @@ int rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id);
  * offload features and in starting the transmit and the receive units of the
  * device.
+ *
+ * Device RTE_ETH_DEV_NOLIVE_MAC_ADDR flag causes MAC address to be set before
+ * PMD port start callback function is invoked.
+ *
  * On success, all basic functions exported by the Ethernet API (link status,
  * receive/transmit, and so on) can be invoked.
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-20 17:53:07.870997566 +0000
+++ 0017-ethdev-fix-MAC-changes-when-live-change-not-supporte.patch	2018-11-20 17:53:07.000000000 +0000
@@ -1,8 +1,10 @@
-From 1e5e3d2e72c6bfdb3553be26015b7ee5bbf745c1 Mon Sep 17 00:00:00 2001
+From 4ca56b114fb6516355cffde286c157353b45c5cf Mon Sep 17 00:00:00 2001
 From: Alejandro Lucero <alejandro.lucero at netronome.com>
 Date: Fri, 24 Aug 2018 15:25:35 +0100
 Subject: [PATCH] ethdev: fix MAC changes when live change not supported
 
+[ upstream commit 1e5e3d2e72c6bfdb3553be26015b7ee5bbf745c1 ]
+
 Current code assumes a MAC change can occur when the port has been
 started. In fact, there are some NICs which require this port state
 for being successful, but other NICs not always support MAC change
@@ -13,33 +15,16 @@
 port starts.
 
 Fixes: af75078fece3 ("first public release")
-Cc: stable at dpdk.org
 
 Signed-off-by: Alejandro Lucero <alejandro.lucero at netronome.com>
 Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
 ---
- doc/guides/rel_notes/release_18_11.rst |  6 ++++++
- lib/librte_ethdev/rte_ethdev.c         | 28 +++++++++++++++++---------
- lib/librte_ethdev/rte_ethdev.h         |  6 ++++++
- 3 files changed, 31 insertions(+), 9 deletions(-)
-
-diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst
-index 3ae6b3f58..24204e67b 100644
---- a/doc/guides/rel_notes/release_18_11.rst
-+++ b/doc/guides/rel_notes/release_18_11.rst
-@@ -69,4 +69,10 @@ API Changes
-    =========================================================
- 
-+* A new device flag, RTE_ETH_DEV_NOLIVE_MAC_ADDR, changes the order of
-+  actions inside rte_eth_dev_start regarding MAC set. Some NICs do not
-+  support MAC changes once the port has started and with this new device
-+  flag the MAC can be properly configured in any case. This is particularly
-+  important for bonding.
-+
- 
- ABI Changes
+ lib/librte_ethdev/rte_ethdev.c | 28 +++++++++++++++++++---------
+ lib/librte_ethdev/rte_ethdev.h |  6 ++++++
+ 2 files changed, 25 insertions(+), 9 deletions(-)
+
 diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
-index f32722f36..16825bf3c 100644
+index 4c3202505..ee6bb0552 100644
 --- a/lib/librte_ethdev/rte_ethdev.c
 +++ b/lib/librte_ethdev/rte_ethdev.c
 @@ -1220,8 +1220,7 @@ _rte_eth_dev_reset(struct rte_eth_dev *dev)


More information about the stable mailing list