From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 72815326C for ; Tue, 20 Nov 2018 20:14:44 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CF5D3308219B; Tue, 20 Nov 2018 19:14:43 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id B90B1604A3; Tue, 20 Nov 2018 19:14:42 +0000 (UTC) From: Kevin Traynor To: Alejandro Lucero Cc: Ferruh Yigit , dpdk stable Date: Tue, 20 Nov 2018 19:12:07 +0000 Message-Id: <20181120191252.30277-17-ktraynor@redhat.com> In-Reply-To: <20181120191252.30277-1-ktraynor@redhat.com> References: <20181120191252.30277-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 20 Nov 2018 19:14:43 +0000 (UTC) Subject: [dpdk-stable] patch 'ethdev: fix MAC changes when live change not supported' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Nov 2018 19:14:44 -0000 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 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 Reviewed-by: Ferruh Yigit --- 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 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 Reviewed-by: Ferruh Yigit --- - 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)