patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Alejandro Lucero <alejandro.lucero@netronome.com>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>, dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'ethdev: fix MAC changes when live change not supported' has been queued to stable release 18.08.1
Date: Tue, 20 Nov 2018 19:12:07 +0000	[thread overview]
Message-ID: <20181120191252.30277-17-ktraynor@redhat.com> (raw)
In-Reply-To: <20181120191252.30277-1-ktraynor@redhat.com>

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@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@netronome.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@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@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@dpdk.org
 
 Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
 Reviewed-by: Ferruh Yigit <ferruh.yigit@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)

  parent reply	other threads:[~2018-11-20 19:14 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 19:11 [dpdk-stable] patch 'devtools: relax rule for identifying symbol section' " Kevin Traynor
2018-11-20 19:11 ` [dpdk-stable] patch 'mk: disable OcteonTx for buggy compilers only on arm64' " Kevin Traynor
2018-11-20 19:11 ` [dpdk-stable] patch 'build: enable ARM NEON flag when __aarch64__ defined' " Kevin Traynor
2018-11-20 19:11 ` [dpdk-stable] patch 'malloc: fix potential null pointer dereference' " Kevin Traynor
2018-11-20 19:11 ` [dpdk-stable] patch 'bus/vdev: fix error log on secondary device scan' " Kevin Traynor
2018-11-20 19:11 ` [dpdk-stable] patch 'acl: forbid rule with priority zero' " Kevin Traynor
2018-11-20 19:11 ` [dpdk-stable] patch 'net/bonding: support matching QinQ ethertype' " Kevin Traynor
2018-11-20 19:11 ` [dpdk-stable] patch 'net/netvsc: fix chimney buffer size error handling' " Kevin Traynor
2018-11-20 19:11 ` [dpdk-stable] patch 'net/netvsc: resize event buffer as needed' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/octeontx: fix packet corruption on Tx' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'doc: fix style and syntax in flow API guide' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/mlx5: fix artificial L4 limitation on switch flow rules' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/mlx5: disable ConnectX-4 Lx Multi Packet Send by default' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/mlx5: fix RSS flow action hash type selection' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/mvpp2: fix array initialization' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/mvpp2: fix comments and error messages' " Kevin Traynor
2018-11-20 19:12 ` Kevin Traynor [this message]
2018-11-20 19:12 ` [dpdk-stable] patch 'net/nfp: fix live MAC changes not supported' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'ethdev: fix port ownership logs' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/bonding: fix buffer corruption in packets' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/e1000: fix Tx offload capability typos' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/cxgbe: fix memory access when parsing flow match items' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/ixgbe: do not return internal code' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/mlx5: fix interrupt completion queue index wrapping' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'doc: fix wrong usage of bind command' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'examples/vhost: remove unnecessary constant' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'vhost: fix zmbufs array leak after NUMA realloc' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/virtio-user: check negotiated features before set' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'vhost: fix vhost interrupt support' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'vhost-user: drop connection on message handling failures' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'vhost: fix return value on enqueue path' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'ethdev: fix missing names in Tx offload name array' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/bonding: use evenly distributed default RSS RETA' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/bonding: do not ignore RSS key on device config' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'crypto/qat: fix typo' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'app/bbdev: fix inputs mbuf creation' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'compat: fix symbol version support with meson' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'eal: include missing hypervisor files in " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'raw/ifpga: use -Wno-error=format-security for " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/i40e: " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'igb_uio: install module when building with " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'build: create relative symlinks for PMDs in libdir' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'pdump: remove dependency on libpthread' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'fbarray: fix detach in --no-shconf mode' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'eal: do not allow legacy mode with --in-memory " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'app/testpmd: optimize mbuf pool allocation' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'config: remove unused parameter' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/e1000: fix queue number in RSS configuration' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/ifc: do not notify before HW ready' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/nfp: fix mbuf flags with checksum good' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/qede/base: fix to handle stag update event' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/qede: fix ethernet type in HW registers' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/qede/base: fix logic for sfp get/set' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/qede: fix flow director for IPv6 filter' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/qede: fix Rx buffer size calculation' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/qede/base: fix MFW FLR flow' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/virtio-user: fix deadlock in memory events callback' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/virtio-user: fix memory hotplug support in vhost-kernel' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/failsafe: fix crash on slave queue release' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net/failsafe: add checks for deferred queue setup' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'app/testpmd: fix missing jump action in flow action' " Kevin Traynor
2018-11-20 19:12 ` [dpdk-stable] patch 'net: fix Intel prepare function for IP checksum offload' " Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181120191252.30277-17-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=alejandro.lucero@netronome.com \
    --cc=ferruh.yigit@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).