DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wei Hu (Xavier)" <xavier.huwei@tom.com>
To: dev@dpdk.org, stable@dpdk.org
Cc: xavier_huwei@163.com, xavier.huwei@tom.com, huwei87@hisilicon.com
Subject: [dpdk-dev] [PATCH 6/6] net/hns3: fix duplicate VLAN
Date: Fri, 22 Nov 2019 20:06:24 +0800	[thread overview]
Message-ID: <20191122120624.4963-7-xavier.huwei@tom.com> (raw)
In-Reply-To: <20191122120624.4963-1-xavier.huwei@tom.com>

From: "Min Hu (Connor)" <humin29@huawei.com>

When setting duplicate vlan, hns3 driver will also add vlan entry
to vlan linked list, and this is unreasonable.

This patch adds checking whether the VLAN to be added already exists
in the linked list and preventing adding duplicate vlan.

Fixes: 411d23b9eafb ("net/hns3: support VLAN")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 3435bce26..72315718a 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -282,6 +282,11 @@ hns3_add_dev_vlan_table(struct hns3_adapter *hns, uint16_t vlan_id,
 	struct hns3_hw *hw = &hns->hw;
 	struct hns3_pf *pf = &hns->pf;
 
+	LIST_FOREACH(vlan_entry, &pf->vlan_list, next) {
+		if (vlan_entry->vlan_id == vlan_id)
+			return;
+	}
+
 	vlan_entry = rte_zmalloc("hns3_vlan_tbl", sizeof(*vlan_entry), 0);
 	if (vlan_entry == NULL) {
 		hns3_err(hw, "Failed to malloc hns3 vlan table");
-- 
2.23.0


  parent reply	other threads:[~2019-11-22 14:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22 12:06 [dpdk-dev] [PATCH 0/6] Fixes for hns3 PMD driver Wei Hu (Xavier)
2019-11-22 12:06 ` [dpdk-dev] [PATCH 1/6] net/hns3: fix RSS hardware configuration restore failure Wei Hu (Xavier)
2019-11-22 12:06 ` [dpdk-dev] [PATCH 2/6] net/hns3: fix VF configuration table entries " Wei Hu (Xavier)
2019-11-22 15:42   ` Ferruh Yigit
2019-11-22 12:06 ` [dpdk-dev] [PATCH 3/6] net/hns3: fix the failure sending packets less than 60 bytes Wei Hu (Xavier)
2019-11-22 12:06 ` [dpdk-dev] [PATCH 4/6] net/hns3: fix the error length limit of maiblox response Wei Hu (Xavier)
2019-11-22 12:06 ` [dpdk-dev] [PATCH 5/6] net/hns3: fix the strategy of getting link status for VF Wei Hu (Xavier)
2019-11-22 12:06 ` Wei Hu (Xavier) [this message]
2019-11-22 16:31 ` [dpdk-dev] [PATCH 0/6] Fixes for hns3 PMD driver Ferruh Yigit

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=20191122120624.4963-7-xavier.huwei@tom.com \
    --to=xavier.huwei@tom.com \
    --cc=dev@dpdk.org \
    --cc=huwei87@hisilicon.com \
    --cc=stable@dpdk.org \
    --cc=xavier_huwei@163.com \
    /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).