DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wei Hu (Xavier)" <huwei013@chinasoftinc.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 6/7] net/hns3: fix configuring illeagl VLAN pvid
Date: Tue, 17 Mar 2020 17:12:05 +0800	[thread overview]
Message-ID: <20200317091206.34928-7-huwei013@chinasoftinc.com> (raw)
In-Reply-To: <20200317091206.34928-1-huwei013@chinasoftinc.com>

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

The VLAN pvid ranges from 0 to 4095. The hns3 PMD driver does not support
this situation that the VLAN pvid is larger than Maximum VLAN ID(4095).

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 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 15ef03cfe..0d0f5ebb7 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -873,6 +873,12 @@ hns3_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t pvid, int on)
 	struct hns3_hw *hw = &hns->hw;
 	int ret;
 
+	if (pvid > RTE_ETHER_MAX_VLAN_ID) {
+		hns3_err(hw, "Invalid vlan_id = %u > %d", pvid,
+			 RTE_ETHER_MAX_VLAN_ID);
+		return -EINVAL;
+	}
+
 	rte_spinlock_lock(&hw->lock);
 	ret = hns3_vlan_pvid_configure(hns, pvid, on);
 	rte_spinlock_unlock(&hw->lock);
-- 
2.23.0


  parent reply	other threads:[~2020-03-17  9:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17  9:11 [dpdk-dev] [PATCH 0/7] misc updates for hns3 PMD driver Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 1/7] net/hns3: remove redundant MAC addr check when setting MAC Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 2/7] net/hns3: modify inappropriate names Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 3/7] net/hns3: fix packets's offload features flags in Rx Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 4/7] net/hns3: fix default error code of command interface Wei Hu (Xavier)
2020-03-17  9:12 ` [dpdk-dev] [PATCH 5/7] net/hns3: fix crash when flushing RSS flow rules with FLR Wei Hu (Xavier)
2020-03-17  9:12 ` Wei Hu (Xavier) [this message]
2020-03-17  9:12 ` [dpdk-dev] [PATCH 7/7] net/hns3: fix abnormal status after reset occurs repeatedly Wei Hu (Xavier)
2020-03-19  9:08 ` [dpdk-dev] [PATCH 0/7] misc updates 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=20200317091206.34928-7-huwei013@chinasoftinc.com \
    --to=huwei013@chinasoftinc.com \
    --cc=dev@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).