From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B81EDA051C for ; Tue, 11 Feb 2020 12:39:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AE40E137D; Tue, 11 Feb 2020 12:39:11 +0100 (CET) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id A766C137D for ; Tue, 11 Feb 2020 12:39:10 +0100 (CET) Received: by mail-wr1-f67.google.com with SMTP id y17so11933372wrh.5 for ; Tue, 11 Feb 2020 03:39:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jUWIMdqyi5QtNvrnf0czrRO4ZhSRFLr0O4J+NexTZJY=; b=AIp8yX7MHjSi4FiFJdWLNksSSEQ+UUMs2oodRfAUNaC5inT0HKZqH1OzDjA6JtXU7V Tqh38CzHLmhDVYuXBTLxJKlJWKvy/IAKU1PQQAZLS1IfeHMv9QDz6xflsIGHni4+IuC8 alNVA8EGWK8pvIdYq/nukPLtxLJuHzLfZnGyjY8QX08haJbJGtEVAKtNS4E2B5urvqTP 0b+yVPqpsTEO+UffGsz67nMpNhPC5oqHV3YxuYoyky9Jgm4oLN083KDNmmvHpMBg1M3+ Ag460BRGxItohOIi2Ut4KugpSZP2yki8mHxlVfEa87i1jMXufgCaFi2uaEyDWPfAO069 c6sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jUWIMdqyi5QtNvrnf0czrRO4ZhSRFLr0O4J+NexTZJY=; b=YZ2NMdq8G+5WcvEZk1hkDW/dQk6XkocYibDeL6Nc3+b9LU74GRisNJvhmadcrJS8p3 7LqLFfj78FOhesyri4/XzI4dyY/DDkts0QY5UtwBVK240/TyWXjZwEGk+SkiCNXp3bVT 5Kt7nu6GbqX192OSSBYadLws838e7jX/JI9D/5XHE2agi2LsI7xvfsy9SDFgdW6s5xK3 EJ/uF4mRDNcQ9MAmFwTXLxSKe9rPZrYjcT5ttNW1xg+5/6XbSoN71wejPmdRhiBZUpM4 X0A6SZHhdJFImSYKAl2O3vaVJ7EfUZPGD5v+uSEB95h/H8f1plROfeaodcW/LQJ4XrNd TIcA== X-Gm-Message-State: APjAAAUHILbWP0zsaqTU2dzTe+fYSiH0dpqLAcj8+LKLTRIja0p3RTqn PU2zHGL7kKzrEKE+cfvzayk= X-Google-Smtp-Source: APXvYqxgbaCjc0rn7njplfBAyhVBij1ebPbJ+PzAhRXIHve4fVFmt1cqL1x+EACHgaHk64gunBL3og== X-Received: by 2002:a5d:474d:: with SMTP id o13mr7959956wrs.309.1581421150378; Tue, 11 Feb 2020 03:39:10 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id v15sm5107835wrf.7.2020.02.11.03.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 03:39:09 -0800 (PST) From: luca.boccassi@gmail.com To: Kalesh AP Cc: Somnath Kotur , Ajit Khaparde , dpdk stable Date: Tue, 11 Feb 2020 11:21:19 +0000 Message-Id: <20200211112216.3929-133-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com> References: <20200211112216.3929-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/bnxt: fix enable/disable VLAN filtering' has been queued to stable release 19.11.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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.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 02/13/20. 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. Thanks. Luca Boccassi --- >From 5822975a3b0cb560851aa8723842c4d6608adb21 Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Thu, 16 Jan 2020 18:34:49 +0530 Subject: [PATCH] net/bnxt: fix enable/disable VLAN filtering [ upstream commit 39b88344e36426bea97cb131fb8ff5b4348e4676 ] There is no condition check for the user requested operation for VLAN filtering. As a result, VLAN filtering is getting disabled when the user enables/disables VLAN stripping on same port. The function bnxt_hwrm_clear_l2_filter() didn't actually free L2 filter in HW if the reference count of filter is zero. Fixed it by incrementing the reference count of filter in bnxt_alloc_filter() routine. Because of the recent changes in bnxt_hwrm_clear_l2_filter(), change was needed in the routine bnxt_set_default_mac_addr_op() to destroy and re-create the default filter when the user changes the default MAC of the port. Fixes: 5c1171c97216 ("net/bnxt: refactor filter/flow") Fixes: 6118503d8071 ("net/bnxt: fix VLAN filtering") Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 68 ++++++++++++++++++---------------- drivers/net/bnxt/bnxt_filter.c | 5 ++- 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index b2f30de5bf..517ae3e861 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1852,18 +1852,12 @@ static int bnxt_del_dflt_mac_filter(struct bnxt *bp, } static int -bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) +bnxt_config_vlan_hw_filter(struct bnxt *bp, uint64_t rx_offloads) { - struct bnxt *bp = dev->data->dev_private; - uint64_t rx_offloads = dev->data->dev_conf.rxmode.offloads; struct bnxt_vnic_info *vnic; unsigned int i; int rc; - rc = is_bnxt_in_error(bp); - if (rc) - return rc; - vnic = BNXT_GET_DEFAULT_VNIC(bp); if (!(rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)) { /* Remove any VLAN filters programmed */ @@ -1887,6 +1881,28 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) PMD_DRV_LOG(DEBUG, "VLAN Filtering: %d\n", !!(rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)); + return 0; +} + +static int +bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) +{ + uint64_t rx_offloads = dev->data->dev_conf.rxmode.offloads; + struct bnxt *bp = dev->data->dev_private; + unsigned int i; + int rc; + + rc = is_bnxt_in_error(bp); + if (rc) + return rc; + + if (mask & ETH_VLAN_FILTER_MASK) { + /* Enable or disable VLAN filtering */ + rc = bnxt_config_vlan_hw_filter(bp, rx_offloads); + if (rc) + return rc; + } + if (mask & ETH_VLAN_STRIP_MASK) { /* Enable or disable VLAN stripping */ for (i = 0; i < bp->nr_vnics; i++) { @@ -1976,7 +1992,6 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct bnxt *bp = dev->data->dev_private; /* Default Filter is tied to VNIC 0 */ struct bnxt_vnic_info *vnic = &bp->vnic_info[0]; - struct bnxt_filter_info *filter; int rc; rc = is_bnxt_in_error(bp); @@ -1989,32 +2004,23 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, if (rte_is_zero_ether_addr(addr)) return -EINVAL; - STAILQ_FOREACH(filter, &vnic->filter, next) { - /* Default Filter is at Index 0 */ - if (filter->mac_index != 0) - continue; - - memcpy(filter->l2_addr, addr, RTE_ETHER_ADDR_LEN); - memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); - filter->flags |= HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX | - HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST; - filter->enables |= - HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | - HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK; - - rc = bnxt_hwrm_set_l2_filter(bp, vnic->fw_vnic_id, filter); - if (rc) { - memcpy(filter->l2_addr, bp->mac_addr, - RTE_ETHER_ADDR_LEN); - return rc; - } - - memcpy(bp->mac_addr, addr, RTE_ETHER_ADDR_LEN); - PMD_DRV_LOG(DEBUG, "Set MAC addr\n"); + /* Check if the requested MAC is already added */ + if (memcmp(addr, bp->mac_addr, RTE_ETHER_ADDR_LEN) == 0) return 0; + + /* Destroy filter and re-create it */ + bnxt_del_dflt_mac_filter(bp, vnic); + + memcpy(bp->mac_addr, addr, RTE_ETHER_ADDR_LEN); + if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_VLAN_FILTER) { + /* This filter will allow only untagged packets */ + rc = bnxt_add_vlan_filter(bp, 0); + } else { + rc = bnxt_add_mac_filter(bp, vnic, addr, 0, 0); } - return 0; + PMD_DRV_LOG(DEBUG, "Set MAC addr\n"); + return rc; } static int diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index da1a6c24a9..04231b069d 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -39,9 +39,10 @@ struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp) filter->flags = HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX; filter->enables = HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR | HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK; - memcpy(filter->l2_addr, bp->eth_dev->data->mac_addrs->addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(filter->l2_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN); memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); + /* bump up the reference count of filter */ + filter->l2_ref_cnt++; return filter; } -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-11 11:17:43.324253636 +0000 +++ 0133-net-bnxt-fix-enable-disable-VLAN-filtering.patch 2020-02-11 11:17:38.640005834 +0000 @@ -1,8 +1,10 @@ -From 39b88344e36426bea97cb131fb8ff5b4348e4676 Mon Sep 17 00:00:00 2001 +From 5822975a3b0cb560851aa8723842c4d6608adb21 Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Thu, 16 Jan 2020 18:34:49 +0530 Subject: [PATCH] net/bnxt: fix enable/disable VLAN filtering +[ upstream commit 39b88344e36426bea97cb131fb8ff5b4348e4676 ] + There is no condition check for the user requested operation for VLAN filtering. As a result, VLAN filtering is getting disabled when the user enables/disables VLAN stripping on same port. @@ -20,7 +22,6 @@ Fixes: 5c1171c97216 ("net/bnxt: refactor filter/flow") Fixes: 6118503d8071 ("net/bnxt: fix VLAN filtering") -Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur @@ -31,10 +32,10 @@ 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c -index a948c78cba..83f475d497 100644 +index b2f30de5bf..517ae3e861 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c -@@ -1860,18 +1860,12 @@ static int bnxt_del_dflt_mac_filter(struct bnxt *bp, +@@ -1852,18 +1852,12 @@ static int bnxt_del_dflt_mac_filter(struct bnxt *bp, } static int @@ -54,7 +55,7 @@ vnic = BNXT_GET_DEFAULT_VNIC(bp); if (!(rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)) { /* Remove any VLAN filters programmed */ -@@ -1895,6 +1889,28 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) +@@ -1887,6 +1881,28 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) PMD_DRV_LOG(DEBUG, "VLAN Filtering: %d\n", !!(rx_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)); @@ -83,15 +84,15 @@ if (mask & ETH_VLAN_STRIP_MASK) { /* Enable or disable VLAN stripping */ for (i = 0; i < bp->nr_vnics; i++) { -@@ -1984,7 +2000,6 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, +@@ -1976,7 +1992,6 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct bnxt *bp = dev->data->dev_private; /* Default Filter is tied to VNIC 0 */ - struct bnxt_vnic_info *vnic = BNXT_GET_DEFAULT_VNIC(bp); + struct bnxt_vnic_info *vnic = &bp->vnic_info[0]; - struct bnxt_filter_info *filter; int rc; rc = is_bnxt_in_error(bp); -@@ -1997,32 +2012,23 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, +@@ -1989,32 +2004,23 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, if (rte_is_zero_ether_addr(addr)) return -EINVAL; @@ -139,7 +140,7 @@ static int diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c -index 0c410f8baf..b31f10479e 100644 +index da1a6c24a9..04231b069d 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -39,9 +39,10 @@ struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp)