From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AB005A0A02 for ; Mon, 17 May 2021 18:15:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A185641101; Mon, 17 May 2021 18:15:15 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by mails.dpdk.org (Postfix) with ESMTP id D9D5B40041 for ; Mon, 17 May 2021 18:15:13 +0200 (CEST) Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=Keschdeichel.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lifth-0008BS-LU; Mon, 17 May 2021 16:15:13 +0000 From: Christian Ehrhardt To: Robin Zhang Cc: Yan Xia , dpdk stable Date: Mon, 17 May 2021 18:09:07 +0200 Message-Id: <20210517161039.3132619-118-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> References: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/iavf: fix lack of MAC type when set MAC address' has been queued to stable release 19.11.9 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/19/21. 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. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/ecffee2c06a163a87634af7e850c08b6d9adbb0b Thanks. Christian Ehrhardt --- >From ecffee2c06a163a87634af7e850c08b6d9adbb0b Mon Sep 17 00:00:00 2001 From: Robin Zhang Date: Fri, 19 Mar 2021 09:20:19 +0000 Subject: [PATCH] net/iavf: fix lack of MAC type when set MAC address [ upstream commit b335e7203475c82f79692171ce9add9f846d71ef ] When set default MAC address, use type VIRTCHNL_ETHER_ADDR_PRIMARY as this case is changing device/primary unicast MAC. For other cases, such as adding or deleting extra unicast addresses and multicast addresses, use type VIRTCHNL_ETHER_ADDR_EXTRA. Fixes: cb25d4323fbf ("net/avf: enable MAC VLAN and promisc ops") Signed-off-by: Robin Zhang Tested-by: Yan Xia --- drivers/net/iavf/iavf.h | 2 +- drivers/net/iavf/iavf_ethdev.c | 16 +++++++--------- drivers/net/iavf/iavf_vchnl.c | 5 ++++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index b343f58004..432e700d84 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -233,7 +233,7 @@ int iavf_query_stats(struct iavf_adapter *adapter, int iavf_config_promisc(struct iavf_adapter *adapter, bool enable_unicast, bool enable_multicast); int iavf_add_del_eth_addr(struct iavf_adapter *adapter, - struct rte_ether_addr *addr, bool add); + struct rte_ether_addr *addr, bool add, uint8_t type); int iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add); int iavf_add_del_mc_addr_list(struct iavf_adapter *adapter, struct rte_ether_addr *mc_addrs, diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 717d6a242c..fc45a39714 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -792,7 +792,7 @@ iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, return -EINVAL; } - err = iavf_add_del_eth_addr(adapter, addr, TRUE); + err = iavf_add_del_eth_addr(adapter, addr, TRUE, VIRTCHNL_ETHER_ADDR_EXTRA); if (err) { PMD_DRV_LOG(ERR, "fail to add MAC address"); return -EIO; @@ -814,7 +814,7 @@ iavf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) addr = &dev->data->mac_addrs[index]; - err = iavf_add_del_eth_addr(adapter, addr, FALSE); + err = iavf_add_del_eth_addr(adapter, addr, FALSE, VIRTCHNL_ETHER_ADDR_EXTRA); if (err) PMD_DRV_LOG(ERR, "fail to delete MAC address"); @@ -1026,17 +1026,15 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter); - struct rte_ether_addr *perm_addr, *old_addr; + struct rte_ether_addr *old_addr; int ret; old_addr = (struct rte_ether_addr *)hw->mac.addr; - perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; - /* If the MAC address is configured by host, skip the setting */ - if (rte_is_valid_assigned_ether_addr(perm_addr)) - return -EPERM; + if (rte_is_same_ether_addr(old_addr, mac_addr)) + return 0; - ret = iavf_add_del_eth_addr(adapter, old_addr, FALSE); + ret = iavf_add_del_eth_addr(adapter, old_addr, FALSE, VIRTCHNL_ETHER_ADDR_PRIMARY); if (ret) PMD_DRV_LOG(ERR, "Fail to delete old MAC:" " %02X:%02X:%02X:%02X:%02X:%02X", @@ -1047,7 +1045,7 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, old_addr->addr_bytes[4], old_addr->addr_bytes[5]); - ret = iavf_add_del_eth_addr(adapter, mac_addr, TRUE); + ret = iavf_add_del_eth_addr(adapter, mac_addr, TRUE, VIRTCHNL_ETHER_ADDR_PRIMARY); if (ret) PMD_DRV_LOG(ERR, "Fail to add new MAC:" " %02X:%02X:%02X:%02X:%02X:%02X", diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 81ad748f4d..149c52e778 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -708,6 +708,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) continue; rte_memcpy(list->list[j].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); + list->list[j].type = VIRTCHNL_ETHER_ADDR_EXTRA; PMD_DRV_LOG(DEBUG, "add/rm mac:%x:%x:%x:%x:%x:%x", addr->addr_bytes[0], addr->addr_bytes[1], addr->addr_bytes[2], addr->addr_bytes[3], @@ -794,7 +795,7 @@ iavf_config_promisc(struct iavf_adapter *adapter, int iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr, - bool add) + bool add, uint8_t type) { struct virtchnl_ether_addr_list *list; struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); @@ -806,6 +807,7 @@ iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr, list = (struct virtchnl_ether_addr_list *)cmd_buffer; list->vsi_id = vf->vsi_res->vsi_id; list->num_elements = 1; + list->list[0].type = type; rte_memcpy(list->list[0].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); @@ -886,6 +888,7 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter, memcpy(list->list[i].addr, mc_addrs[i].addr_bytes, sizeof(list->list[i].addr)); + list->list[i].type = VIRTCHNL_ETHER_ADDR_EXTRA; } args.ops = add ? VIRTCHNL_OP_ADD_ETH_ADDR : VIRTCHNL_OP_DEL_ETH_ADDR; -- 2.31.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-17 17:40:34.062338684 +0200 +++ 0118-net-iavf-fix-lack-of-MAC-type-when-set-MAC-address.patch 2021-05-17 17:40:29.347810863 +0200 @@ -1 +1 @@ -From b335e7203475c82f79692171ce9add9f846d71ef Mon Sep 17 00:00:00 2001 +From ecffee2c06a163a87634af7e850c08b6d9adbb0b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b335e7203475c82f79692171ce9add9f846d71ef ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index c934d2e614..d1ae5a3f0b 100644 +index b343f58004..432e700d84 100644 @@ -26 +27 @@ -@@ -328,7 +328,7 @@ int iavf_query_stats(struct iavf_adapter *adapter, +@@ -233,7 +233,7 @@ int iavf_query_stats(struct iavf_adapter *adapter, @@ -33,2 +34,2 @@ - int iavf_fdir_add(struct iavf_adapter *adapter, struct iavf_fdir_conf *filter); - int iavf_fdir_del(struct iavf_adapter *adapter, struct iavf_fdir_conf *filter); + int iavf_add_del_mc_addr_list(struct iavf_adapter *adapter, + struct rte_ether_addr *mc_addrs, @@ -36 +37 @@ -index 51cad48069..8f25a21e85 100644 +index 717d6a242c..fc45a39714 100644 @@ -39 +40 @@ -@@ -997,7 +997,7 @@ iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, +@@ -792,7 +792,7 @@ iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, @@ -43,2 +44,2 @@ -- err = iavf_add_del_eth_addr(adapter, addr, true); -+ err = iavf_add_del_eth_addr(adapter, addr, true, VIRTCHNL_ETHER_ADDR_EXTRA); +- err = iavf_add_del_eth_addr(adapter, addr, TRUE); ++ err = iavf_add_del_eth_addr(adapter, addr, TRUE, VIRTCHNL_ETHER_ADDR_EXTRA); @@ -48 +49 @@ -@@ -1019,7 +1019,7 @@ iavf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) +@@ -814,7 +814,7 @@ iavf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) @@ -52,2 +53,2 @@ -- err = iavf_add_del_eth_addr(adapter, addr, false); -+ err = iavf_add_del_eth_addr(adapter, addr, false, VIRTCHNL_ETHER_ADDR_EXTRA); +- err = iavf_add_del_eth_addr(adapter, addr, FALSE); ++ err = iavf_add_del_eth_addr(adapter, addr, FALSE, VIRTCHNL_ETHER_ADDR_EXTRA); @@ -57 +58 @@ -@@ -1339,17 +1339,15 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, +@@ -1026,17 +1026,15 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, @@ -74,2 +75,2 @@ -- ret = iavf_add_del_eth_addr(adapter, old_addr, false); -+ ret = iavf_add_del_eth_addr(adapter, old_addr, false, VIRTCHNL_ETHER_ADDR_PRIMARY); +- ret = iavf_add_del_eth_addr(adapter, old_addr, FALSE); ++ ret = iavf_add_del_eth_addr(adapter, old_addr, FALSE, VIRTCHNL_ETHER_ADDR_PRIMARY); @@ -79 +80 @@ -@@ -1360,7 +1358,7 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, +@@ -1047,7 +1045,7 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, @@ -83,2 +84,2 @@ -- ret = iavf_add_del_eth_addr(adapter, mac_addr, true); -+ ret = iavf_add_del_eth_addr(adapter, mac_addr, true, VIRTCHNL_ETHER_ADDR_PRIMARY); +- ret = iavf_add_del_eth_addr(adapter, mac_addr, TRUE); ++ ret = iavf_add_del_eth_addr(adapter, mac_addr, TRUE, VIRTCHNL_ETHER_ADDR_PRIMARY); @@ -89 +90 @@ -index aae5b900bb..45096cbfae 100644 +index 81ad748f4d..149c52e778 100644 @@ -92 +93 @@ -@@ -1166,6 +1166,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) +@@ -708,6 +708,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) @@ -100 +101 @@ -@@ -1261,7 +1262,7 @@ iavf_config_promisc(struct iavf_adapter *adapter, +@@ -794,7 +795,7 @@ iavf_config_promisc(struct iavf_adapter *adapter, @@ -109 +110 @@ -@@ -1273,6 +1274,7 @@ iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr, +@@ -806,6 +807,7 @@ iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr, @@ -117 +118 @@ -@@ -1550,6 +1552,7 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter, +@@ -886,6 +888,7 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,