DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v 0/4] bugfixes for hns3 PMD driver
@ 2020-06-03  9:31 Wei Hu (Xavier)
  2020-06-03  9:31 ` [dpdk-dev] [PATCH v 1/4] net/hns3: remove unsupported VLAN capabilities Wei Hu (Xavier)
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Wei Hu (Xavier) @ 2020-06-03  9:31 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

This series are bugfixes for hns3 PMD driver.

Chengchang Tang (2):
  net/hns3: remove unsupported VLAN capabilities
  net/hns3: fix VLAN strip configuration when setting a PVID

Hongbo Zheng (1):
  net/hns3: add checking tso segsz when sending TSO packets

Wei Hu (Xavier) (1):
  net/hns3: fix VLAN tags report in Rx

 drivers/net/hns3/hns3_ethdev.c    | 75 ++++++++++++++++++---------------------
 drivers/net/hns3/hns3_ethdev.h    | 15 ++++----
 drivers/net/hns3/hns3_ethdev_vf.c |  1 -
 drivers/net/hns3/hns3_rxtx.c      | 74 +++++++++++++++++++++++++++++++-------
 4 files changed, 106 insertions(+), 59 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-dev] [PATCH v 1/4] net/hns3: remove unsupported VLAN capabilities
  2020-06-03  9:31 [dpdk-dev] [PATCH v 0/4] bugfixes for hns3 PMD driver Wei Hu (Xavier)
@ 2020-06-03  9:31 ` Wei Hu (Xavier)
  2020-06-03  9:31 ` [dpdk-dev] [PATCH v 2/4] net/hns3: fix VLAN strip configuration when setting a PVID Wei Hu (Xavier)
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Wei Hu (Xavier) @ 2020-06-03  9:31 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

From: Chengchang Tang <tangchengchang@huawei.com>

This patch removes unsupported vlan capabilities to avoid misleading users.

Fixes: a5475d61fa34 ("net/hns3: support VF")
Fixes: 1f5ca0b460cd ("net/hns3: support some device operations")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c    | 2 --
 drivers/net/hns3/hns3_ethdev_vf.c | 1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 33d7c5c..4030bd3 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2461,9 +2461,7 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
 				 DEV_RX_OFFLOAD_KEEP_CRC |
 				 DEV_RX_OFFLOAD_SCATTER |
 				 DEV_RX_OFFLOAD_VLAN_STRIP |
-				 DEV_RX_OFFLOAD_QINQ_STRIP |
 				 DEV_RX_OFFLOAD_VLAN_FILTER |
-				 DEV_RX_OFFLOAD_VLAN_EXTEND |
 				 DEV_RX_OFFLOAD_JUMBO_FRAME |
 				 DEV_RX_OFFLOAD_RSS_HASH);
 	info->tx_queue_offload_capa = DEV_TX_OFFLOAD_MBUF_FAST_FREE;
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 16d6012..0fdee4d 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -908,7 +908,6 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
 				 DEV_RX_OFFLOAD_KEEP_CRC |
 				 DEV_RX_OFFLOAD_SCATTER |
 				 DEV_RX_OFFLOAD_VLAN_STRIP |
-				 DEV_RX_OFFLOAD_QINQ_STRIP |
 				 DEV_RX_OFFLOAD_VLAN_FILTER |
 				 DEV_RX_OFFLOAD_JUMBO_FRAME |
 				 DEV_RX_OFFLOAD_RSS_HASH);
-- 
2.7.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-dev] [PATCH v 2/4] net/hns3: fix VLAN strip configuration when setting a PVID
  2020-06-03  9:31 [dpdk-dev] [PATCH v 0/4] bugfixes for hns3 PMD driver Wei Hu (Xavier)
  2020-06-03  9:31 ` [dpdk-dev] [PATCH v 1/4] net/hns3: remove unsupported VLAN capabilities Wei Hu (Xavier)
@ 2020-06-03  9:31 ` Wei Hu (Xavier)
  2020-06-03  9:32 ` [dpdk-dev] [PATCH v 3/4] net/hns3: fix VLAN tags report in Rx Wei Hu (Xavier)
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Wei Hu (Xavier) @ 2020-06-03  9:31 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

From: Chengchang Tang <tangchengchang@huawei.com>

Currently, based on hns3 PF device, hardware will strip 2 vlan tags when
ULP calls rte_eth_dev_set_vlan_pvid API function to set a PVID whether
vlan strip related offload is turned on by calling rte_eth_dev_configure
or rte_eth_dev_set_vlan_offload API function.

When recieving a QinQ packet with the pvid tag, if ULP does not configure
the vlan strip by the method mentioned above, a layer of vlan tag will be
lost to ULP, which is not the expected result.

It is supposed to configure the vlan strip according to the upper level
process's configuration.

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

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 4030bd3..244a3b8 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -832,25 +832,28 @@ hns3_update_vlan_filter_entries(struct hns3_adapter *hns,
 }
 
 static int
-hns3_en_rx_strip_all(struct hns3_adapter *hns, int on)
+hns3_en_pvid_strip(struct hns3_adapter *hns, int on)
 {
+	struct hns3_rx_vtag_cfg *old_cfg = &hns->pf.vtag_config.rx_vcfg;
 	struct hns3_rx_vtag_cfg rx_vlan_cfg;
-	struct hns3_hw *hw = &hns->hw;
 	bool rx_strip_en;
 	int ret;
 
-	rx_strip_en = on ? true : false;
-	rx_vlan_cfg.strip_tag1_en = rx_strip_en;
-	rx_vlan_cfg.strip_tag2_en = rx_strip_en;
+	rx_strip_en = old_cfg->rx_vlan_offload_en ? true : false;
+	if (on) {
+		rx_vlan_cfg.strip_tag1_en = rx_strip_en;
+		rx_vlan_cfg.strip_tag2_en = true;
+	} else {
+		rx_vlan_cfg.strip_tag1_en = false;
+		rx_vlan_cfg.strip_tag2_en = rx_strip_en;
+	}
 	rx_vlan_cfg.vlan1_vlan_prionly = false;
 	rx_vlan_cfg.vlan2_vlan_prionly = false;
-	rx_vlan_cfg.rx_vlan_offload_en = rx_strip_en;
+	rx_vlan_cfg.rx_vlan_offload_en = old_cfg->rx_vlan_offload_en;
 
 	ret = hns3_set_vlan_rx_offload_cfg(hns, &rx_vlan_cfg);
-	if (ret) {
-		hns3_err(hw, "enable strip rx failed, ret =%d", ret);
+	if (ret)
 		return ret;
-	}
 
 	hns3_update_rx_offload_cfg(hns, &rx_vlan_cfg);
 	return ret;
@@ -877,13 +880,15 @@ hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, int on)
 				    HNS3_PORT_BASE_VLAN_DISABLE;
 	ret = hns3_vlan_txvlan_cfg(hns, port_base_vlan_state, pvid);
 	if (ret) {
-		hns3_err(hw, "Failed to config tx vlan, ret =%d", ret);
+		hns3_err(hw, "failed to config tx vlan for pvid, ret = %d",
+			 ret);
 		return ret;
 	}
 
-	ret = hns3_en_rx_strip_all(hns, on);
+	ret = hns3_en_pvid_strip(hns, on);
 	if (ret) {
-		hns3_err(hw, "Failed to config rx vlan strip, ret =%d", ret);
+		hns3_err(hw, "failed to config rx vlan strip for pvid, "
+			 "ret = %d", ret);
 		return ret;
 	}
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-dev] [PATCH v 3/4] net/hns3: fix VLAN tags report in Rx
  2020-06-03  9:31 [dpdk-dev] [PATCH v 0/4] bugfixes for hns3 PMD driver Wei Hu (Xavier)
  2020-06-03  9:31 ` [dpdk-dev] [PATCH v 1/4] net/hns3: remove unsupported VLAN capabilities Wei Hu (Xavier)
  2020-06-03  9:31 ` [dpdk-dev] [PATCH v 2/4] net/hns3: fix VLAN strip configuration when setting a PVID Wei Hu (Xavier)
@ 2020-06-03  9:32 ` Wei Hu (Xavier)
  2020-06-03  9:32 ` [dpdk-dev] [PATCH v 4/4] net/hns3: add checking tso segsz when sending TSO packets Wei Hu (Xavier)
  2020-06-05  9:44 ` [dpdk-dev] [PATCH v 0/4] bugfixes for hns3 PMD driver Ferruh Yigit
  4 siblings, 0 replies; 10+ messages in thread
From: Wei Hu (Xavier) @ 2020-06-03  9:32 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

Currently, based on hns3 network engine, driver always reports the incoming
packet's VLAN tags to the structure rte_mbuf those are the output parameter
pointers in '.rx_pkt_burst' ops implementation function, and never reports
PKT_RX_VLAN_STRIPPED flag to the structure rte_mbuf even if Upper Level
Process configured hardware strip by calling rte_eth_dev_configure or
rte_eth_dev_set_vlan_offload API function. It makes the ULP unable to know
the stripping of VLAN.

It is supposed to present the stripped flags to the mbuf ol_flags, and
report the right VLAN tag.

And as hardware constraints, the stripped VLAN tag will always in the Rx
descriptor. Even if setting a PVID based on the function, the PVID will be
reported to the Rx descriptor. So the driver need to determine which VLAN
tag should be reported to output the structure rte_mbuf in '.rx_pkt_burst'
ops implementation function named hns3_recv_pkts.

Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations")
Fixes: 411d23b9eafb ("net/hns3: support VLAN")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 44 +++++++++++++------------------
 drivers/net/hns3/hns3_ethdev.h | 15 ++++++-----
 drivers/net/hns3/hns3_rxtx.c   | 60 ++++++++++++++++++++++++++++++++++++++----
 3 files changed, 82 insertions(+), 37 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 244a3b8..62d8758 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -35,8 +35,6 @@
 #define HNS3_DEFAULT_PORT_CONF_QUEUES_NUM	1
 
 #define HNS3_SERVICE_INTERVAL		1000000 /* us */
-#define HNS3_PORT_BASE_VLAN_DISABLE	0
-#define HNS3_PORT_BASE_VLAN_ENABLE	1
 #define HNS3_INVLID_PVID		0xFFFF
 
 #define HNS3_FILTER_TYPE_VF		0
@@ -313,13 +311,14 @@ static int
 hns3_restore_vlan_table(struct hns3_adapter *hns)
 {
 	struct hns3_user_vlan_table *vlan_entry;
+	struct hns3_hw *hw = &hns->hw;
 	struct hns3_pf *pf = &hns->pf;
 	uint16_t vlan_id;
 	int ret = 0;
 
-	if (pf->port_base_vlan_cfg.state == HNS3_PORT_BASE_VLAN_ENABLE)
+	if (hw->port_base_vlan_cfg.state == HNS3_PORT_BASE_VLAN_ENABLE)
 		return hns3_vlan_pvid_configure(hns,
-						pf->port_base_vlan_cfg.pvid, 1);
+						hw->port_base_vlan_cfg.pvid, 1);
 
 	LIST_FOREACH(vlan_entry, &pf->vlan_list, next) {
 		if (vlan_entry->hd_tbl_status) {
@@ -336,7 +335,7 @@ hns3_restore_vlan_table(struct hns3_adapter *hns)
 static int
 hns3_vlan_filter_configure(struct hns3_adapter *hns, uint16_t vlan_id, int on)
 {
-	struct hns3_pf *pf = &hns->pf;
+	struct hns3_hw *hw = &hns->hw;
 	bool writen_to_tbl = false;
 	int ret = 0;
 
@@ -354,7 +353,7 @@ hns3_vlan_filter_configure(struct hns3_adapter *hns, uint16_t vlan_id, int on)
 	 * vlan list. The vlan id in vlan list will be writen in vlan filter
 	 * table until port base vlan disabled
 	 */
-	if (pf->port_base_vlan_cfg.state == HNS3_PORT_BASE_VLAN_DISABLE) {
+	if (hw->port_base_vlan_cfg.state == HNS3_PORT_BASE_VLAN_DISABLE) {
 		ret = hns3_set_port_vlan_filter(hns, vlan_id, on);
 		writen_to_tbl = true;
 	}
@@ -507,11 +506,10 @@ static int
 hns3_en_hw_strip_rxvtag(struct hns3_adapter *hns, bool enable)
 {
 	struct hns3_rx_vtag_cfg rxvlan_cfg;
-	struct hns3_pf *pf = &hns->pf;
 	struct hns3_hw *hw = &hns->hw;
 	int ret;
 
-	if (pf->port_base_vlan_cfg.state == HNS3_PORT_BASE_VLAN_DISABLE) {
+	if (hw->port_base_vlan_cfg.state == HNS3_PORT_BASE_VLAN_DISABLE) {
 		rxvlan_cfg.strip_tag1_en = false;
 		rxvlan_cfg.strip_tag2_en = enable;
 	} else {
@@ -728,12 +726,12 @@ hns3_vlan_txvlan_cfg(struct hns3_adapter *hns, uint16_t port_base_vlan_state,
 static void
 hns3_store_port_base_vlan_info(struct hns3_adapter *hns, uint16_t pvid, int on)
 {
-	struct hns3_pf *pf = &hns->pf;
+	struct hns3_hw *hw = &hns->hw;
 
-	pf->port_base_vlan_cfg.state = on ?
+	hw->port_base_vlan_cfg.state = on ?
 	    HNS3_PORT_BASE_VLAN_ENABLE : HNS3_PORT_BASE_VLAN_DISABLE;
 
-	pf->port_base_vlan_cfg.pvid = pvid;
+	hw->port_base_vlan_cfg.pvid = pvid;
 }
 
 static void
@@ -777,13 +775,12 @@ static void
 hns3_remove_all_vlan_table(struct hns3_adapter *hns)
 {
 	struct hns3_hw *hw = &hns->hw;
-	struct hns3_pf *pf = &hns->pf;
 	int ret;
 
 	hns3_rm_all_vlan_table(hns, true);
-	if (pf->port_base_vlan_cfg.pvid != HNS3_INVLID_PVID) {
+	if (hw->port_base_vlan_cfg.pvid != HNS3_INVLID_PVID) {
 		ret = hns3_set_port_vlan_filter(hns,
-						pf->port_base_vlan_cfg.pvid, 0);
+						hw->port_base_vlan_cfg.pvid, 0);
 		if (ret) {
 			hns3_err(hw, "Failed to remove all vlan table, ret =%d",
 				 ret);
@@ -797,7 +794,6 @@ hns3_update_vlan_filter_entries(struct hns3_adapter *hns,
 				uint16_t port_base_vlan_state,
 				uint16_t new_pvid, uint16_t old_pvid)
 {
-	struct hns3_pf *pf = &hns->pf;
 	struct hns3_hw *hw = &hns->hw;
 	int ret = 0;
 
@@ -825,7 +821,7 @@ hns3_update_vlan_filter_entries(struct hns3_adapter *hns,
 		}
 	}
 
-	if (new_pvid == pf->port_base_vlan_cfg.pvid)
+	if (new_pvid == hw->port_base_vlan_cfg.pvid)
 		hns3_add_all_vlan_table(hns);
 
 	return ret;
@@ -862,17 +858,16 @@ hns3_en_pvid_strip(struct hns3_adapter *hns, int on)
 static int
 hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, int on)
 {
-	struct hns3_pf *pf = &hns->pf;
 	struct hns3_hw *hw = &hns->hw;
 	uint16_t port_base_vlan_state;
 	uint16_t old_pvid;
 	int ret;
 
-	if (on == 0 && pvid != pf->port_base_vlan_cfg.pvid) {
-		if (pf->port_base_vlan_cfg.pvid != HNS3_INVLID_PVID)
+	if (on == 0 && pvid != hw->port_base_vlan_cfg.pvid) {
+		if (hw->port_base_vlan_cfg.pvid != HNS3_INVLID_PVID)
 			hns3_warn(hw, "Invalid operation! As current pvid set "
 				  "is %u, disable pvid %u is invalid",
-				  pf->port_base_vlan_cfg.pvid, pvid);
+				  hw->port_base_vlan_cfg.pvid, pvid);
 		return 0;
 	}
 
@@ -894,7 +889,7 @@ hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, int on)
 
 	if (pvid == HNS3_INVLID_PVID)
 		goto out;
-	old_pvid = pf->port_base_vlan_cfg.pvid;
+	old_pvid = hw->port_base_vlan_cfg.pvid;
 	ret = hns3_update_vlan_filter_entries(hns, port_base_vlan_state, pvid,
 					      old_pvid);
 	if (ret) {
@@ -930,11 +925,8 @@ hns3_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t pvid, int on)
 static void
 init_port_base_vlan_info(struct hns3_hw *hw)
 {
-	struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
-	struct hns3_pf *pf = &hns->pf;
-
-	pf->port_base_vlan_cfg.state = HNS3_PORT_BASE_VLAN_DISABLE;
-	pf->port_base_vlan_cfg.pvid = HNS3_INVLID_PVID;
+	hw->port_base_vlan_cfg.state = HNS3_PORT_BASE_VLAN_DISABLE;
+	hw->port_base_vlan_cfg.pvid = HNS3_INVLID_PVID;
 }
 
 static int
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index bc458cb..21412c4 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -171,6 +171,13 @@ struct hns3_fake_queue_data {
 	uint16_t nb_fake_tx_queues; /* Number of fake TX queues. */
 };
 
+#define HNS3_PORT_BASE_VLAN_DISABLE	0
+#define HNS3_PORT_BASE_VLAN_ENABLE	1
+struct hns3_port_base_vlan_config {
+	uint16_t state;
+	uint16_t pvid;
+};
+
 /* Primary process maintains driver state in main thread.
  *
  * +---------------+
@@ -395,6 +402,8 @@ struct hns3_hw {
 	uint16_t tx_qnum_per_tc;    /* TX queue number per TC */
 
 	uint32_t flag;
+
+	struct hns3_port_base_vlan_config port_base_vlan_cfg;
 	/*
 	 * PMD setup and configuration is not thread safe. Since it is not
 	 * performance sensitive, it is better to guarantee thread-safety
@@ -424,11 +433,6 @@ struct hns3_user_vlan_table {
 	uint16_t vlan_id;
 };
 
-struct hns3_port_base_vlan_config {
-	uint16_t state;
-	uint16_t pvid;
-};
-
 /* Vlan tag configuration for RX direction */
 struct hns3_rx_vtag_cfg {
 	uint8_t rx_vlan_offload_en; /* Whether enable rx vlan offload */
@@ -504,7 +508,6 @@ struct hns3_pf {
 	bool support_sfp_query;
 
 	struct hns3_vtag_cfg vtag_config;
-	struct hns3_port_base_vlan_config port_base_vlan_cfg;
 	LIST_HEAD(vlan_tbl, hns3_user_vlan_table) vlan_list;
 
 	struct hns3_fdir_info fdir; /* flow director info */
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 25ba3b8..d870d51 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -1255,9 +1255,9 @@ rxd_pkt_info_to_pkt_type(uint32_t pkt_info, uint32_t ol_info)
 
 	static const uint32_t l2table[HNS3_L2TBL_NUM] = {
 		RTE_PTYPE_L2_ETHER,
-		RTE_PTYPE_L2_ETHER_VLAN,
 		RTE_PTYPE_L2_ETHER_QINQ,
-		0
+		RTE_PTYPE_L2_ETHER_VLAN,
+		RTE_PTYPE_L2_ETHER_VLAN
 	};
 
 	static const uint32_t l3table[HNS3_L3TBL_NUM] = {
@@ -1450,6 +1450,58 @@ hns3_rx_set_cksum_flag(struct rte_mbuf *rxm, uint64_t packet_type,
 	}
 }
 
+static inline void
+hns3_rxd_to_vlan_tci(struct rte_eth_dev *dev, struct rte_mbuf *mb,
+		     uint32_t l234_info, const struct hns3_desc *rxd)
+{
+#define HNS3_STRP_STATUS_NUM		0x4
+
+#define HNS3_NO_STRP_VLAN_VLD		0x0
+#define HNS3_INNER_STRP_VLAN_VLD	0x1
+#define HNS3_OUTER_STRP_VLAN_VLD	0x2
+	struct hns3_adapter *hns = dev->data->dev_private;
+	struct hns3_hw *hw = &hns->hw;
+	uint32_t strip_status;
+	uint32_t report_mode;
+
+	/*
+	 * Since HW limiation, the vlan tag will always be inserted into RX
+	 * descriptor when strip the tag from packet, dirver needs to determine
+	 * reporting which tag to mbuf according to the PVID configuration
+	 * and vlan striped status.
+	 */
+	static const uint32_t report_type[][HNS3_STRP_STATUS_NUM] = {
+		{
+			HNS3_NO_STRP_VLAN_VLD,
+			HNS3_OUTER_STRP_VLAN_VLD,
+			HNS3_INNER_STRP_VLAN_VLD,
+			HNS3_OUTER_STRP_VLAN_VLD
+		},
+		{
+			HNS3_NO_STRP_VLAN_VLD,
+			HNS3_NO_STRP_VLAN_VLD,
+			HNS3_NO_STRP_VLAN_VLD,
+			HNS3_INNER_STRP_VLAN_VLD
+		}
+	};
+	strip_status = hns3_get_field(l234_info, HNS3_RXD_STRP_TAGP_M,
+				      HNS3_RXD_STRP_TAGP_S);
+	report_mode = report_type[hw->port_base_vlan_cfg.state][strip_status];
+	switch (report_mode) {
+	case HNS3_NO_STRP_VLAN_VLD:
+		mb->vlan_tci = 0;
+		return;
+	case HNS3_INNER_STRP_VLAN_VLD:
+		mb->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
+		mb->vlan_tci = rte_le_to_cpu_16(rxd->rx.vlan_tag);
+		return;
+	case HNS3_OUTER_STRP_VLAN_VLD:
+		mb->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
+		mb->vlan_tci = rte_le_to_cpu_16(rxd->rx.ot_vlan_tag);
+		return;
+	}
+}
+
 uint16_t
 hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 {
@@ -1625,10 +1677,8 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			hns3_rx_set_cksum_flag(first_seg,
 					       first_seg->packet_type,
 					       cksum_err);
+		hns3_rxd_to_vlan_tci(dev, first_seg, l234_info, &rxd);
 
-		first_seg->vlan_tci = rte_le_to_cpu_16(rxd.rx.vlan_tag);
-		first_seg->vlan_tci_outer =
-			rte_le_to_cpu_16(rxd.rx.ot_vlan_tag);
 		rx_pkts[nb_rx++] = first_seg;
 		first_seg = NULL;
 		continue;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-dev] [PATCH v 4/4] net/hns3: add checking tso segsz when sending TSO packets
  2020-06-03  9:31 [dpdk-dev] [PATCH v 0/4] bugfixes for hns3 PMD driver Wei Hu (Xavier)
                   ` (2 preceding siblings ...)
  2020-06-03  9:32 ` [dpdk-dev] [PATCH v 3/4] net/hns3: fix VLAN tags report in Rx Wei Hu (Xavier)
@ 2020-06-03  9:32 ` Wei Hu (Xavier)
  2020-06-04 16:56   ` Ferruh Yigit
  2020-06-05  9:44 ` [dpdk-dev] [PATCH v 0/4] bugfixes for hns3 PMD driver Ferruh Yigit
  4 siblings, 1 reply; 10+ messages in thread
From: Wei Hu (Xavier) @ 2020-06-03  9:32 UTC (permalink / raw)
  To: dev; +Cc: xavier.huwei

From: Hongbo Zheng <zhenghongbo3@huawei.com>

Base on hns3 network engine, when the rte_eth_tx_burst API is called
by Upper Level Process, if PKT_TX_TCP_SEG flag is set and tso_segsz
is 0 in the input parameter structure rte_mbuf, hns3 PMD driver will
process this packet as an non-TSO packet, otherwise hardware will enter
an abnormal state.

Fixes: 6dca716c9e1d ("net/hns3: support TSO")
Cc: stable@dpdk.org

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_rxtx.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index d870d51..2ce9bf4 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -1850,6 +1850,12 @@ hns3_tso_proc_tunnel(struct hns3_desc *desc, uint64_t ol_flags,
 	return 0;
 }
 
+static inline bool
+hns3_pkt_is_tso(struct rte_mbuf *m)
+{
+	return (m->tso_segsz != 0 && m->ol_flags & PKT_TX_TCP_SEG);
+}
+
 static void
 hns3_set_tso(struct hns3_desc *desc,
 	     uint64_t ol_flags, struct rte_mbuf *rxm)
@@ -1858,7 +1864,7 @@ hns3_set_tso(struct hns3_desc *desc,
 	uint32_t tmp;
 	uint8_t l2_len = rxm->l2_len;
 
-	if (!(ol_flags & PKT_TX_TCP_SEG))
+	if (!hns3_pkt_is_tso(rxm))
 		return;
 
 	if (hns3_tso_proc_tunnel(desc, ol_flags, rxm, &l2_len))
@@ -2307,12 +2313,6 @@ hns3_outer_header_cksum_prepare(struct rte_mbuf *m)
 	}
 }
 
-static inline bool
-hns3_pkt_is_tso(struct rte_mbuf *m)
-{
-	return (m->tso_segsz != 0 && m->ol_flags & PKT_TX_TCP_SEG);
-}
-
 static int
 hns3_check_tso_pkt_valid(struct rte_mbuf *m)
 {
-- 
2.7.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-dev] [PATCH v 4/4] net/hns3: add checking tso segsz when sending TSO packets
  2020-06-03  9:32 ` [dpdk-dev] [PATCH v 4/4] net/hns3: add checking tso segsz when sending TSO packets Wei Hu (Xavier)
@ 2020-06-04 16:56   ` Ferruh Yigit
  2020-06-05  8:50     ` Wei Hu (Xavier)
  0 siblings, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2020-06-04 16:56 UTC (permalink / raw)
  To: Wei Hu (Xavier), dev

On 6/3/2020 10:32 AM, Wei Hu (Xavier) wrote:
> From: Hongbo Zheng <zhenghongbo3@huawei.com>
> 
> Base on hns3 network engine, when the rte_eth_tx_burst API is called
> by Upper Level Process, if PKT_TX_TCP_SEG flag is set and tso_segsz
> is 0 in the input parameter structure rte_mbuf, hns3 PMD driver will
> process this packet as an non-TSO packet, otherwise hardware will enter
> an abnormal state.

What is ULP (Upper Level Process)?

And OK to have this fix but why 'tso_segsz' is zero when 'PKT_TX_TCP_SEG' is
set, shouldn't this needs to fixed in app level?

> 
> Fixes: 6dca716c9e1d ("net/hns3: support TSO")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>

<...>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-dev] [PATCH v 4/4] net/hns3: add checking tso segsz when sending TSO packets
  2020-06-04 16:56   ` Ferruh Yigit
@ 2020-06-05  8:50     ` Wei Hu (Xavier)
  2020-06-05  9:44       ` Ferruh Yigit
  0 siblings, 1 reply; 10+ messages in thread
From: Wei Hu (Xavier) @ 2020-06-05  8:50 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, xavier.huwei



On 2020/6/5 0:56, Ferruh Yigit wrote:
> On 6/3/2020 10:32 AM, Wei Hu (Xavier) wrote:
>> From: Hongbo Zheng <zhenghongbo3@huawei.com>
>>
>> Base on hns3 network engine, when the rte_eth_tx_burst API is called
>> by Upper Level Process, if PKT_TX_TCP_SEG flag is set and tso_segsz
>> is 0 in the input parameter structure rte_mbuf, hns3 PMD driver will
>> process this packet as an non-TSO packet, otherwise hardware will enter
>> an abnormal state.
> What is ULP (Upper Level Process)?
>
> And OK to have this fix but why 'tso_segsz' is zero when 'PKT_TX_TCP_SEG' is
> set, shouldn't this needs to fixed in app level?
ULP is our own test application.
The process is added to the driver to ensure If the upper application 
called the API
in the wrong way, it will still not cause serious abnormalities in 
network engine.

Thanks, Xavier
>> Fixes: 6dca716c9e1d ("net/hns3: support TSO")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> <...>
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-dev] [PATCH v 4/4] net/hns3: add checking tso segsz when sending TSO packets
  2020-06-05  8:50     ` Wei Hu (Xavier)
@ 2020-06-05  9:44       ` Ferruh Yigit
  2020-06-06  1:06         ` Wei Hu (Xavier)
  0 siblings, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2020-06-05  9:44 UTC (permalink / raw)
  To: Wei Hu (Xavier); +Cc: dev

On 6/5/2020 9:50 AM, Wei Hu (Xavier) wrote:
> 
> 
> On 2020/6/5 0:56, Ferruh Yigit wrote:
>> On 6/3/2020 10:32 AM, Wei Hu (Xavier) wrote:
>>> From: Hongbo Zheng <zhenghongbo3@huawei.com>
>>>
>>> Base on hns3 network engine, when the rte_eth_tx_burst API is called
>>> by Upper Level Process, if PKT_TX_TCP_SEG flag is set and tso_segsz
>>> is 0 in the input parameter structure rte_mbuf, hns3 PMD driver will
>>> process this packet as an non-TSO packet, otherwise hardware will enter
>>> an abnormal state.
>> What is ULP (Upper Level Process)?
>>
>> And OK to have this fix but why 'tso_segsz' is zero when 'PKT_TX_TCP_SEG' is
>> set, shouldn't this needs to fixed in app level?
> ULP is our own test application.

OK. Is it open source?

> The process is added to the driver to ensure If the upper application 
> called the API
> in the wrong way, it will still not cause serious abnormalities in 
> network engine.
> 
> Thanks, Xavier
>>> Fixes: 6dca716c9e1d ("net/hns3: support TSO")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
>>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>> <...>
>>
>>
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-dev] [PATCH v 0/4] bugfixes for hns3 PMD driver
  2020-06-03  9:31 [dpdk-dev] [PATCH v 0/4] bugfixes for hns3 PMD driver Wei Hu (Xavier)
                   ` (3 preceding siblings ...)
  2020-06-03  9:32 ` [dpdk-dev] [PATCH v 4/4] net/hns3: add checking tso segsz when sending TSO packets Wei Hu (Xavier)
@ 2020-06-05  9:44 ` Ferruh Yigit
  4 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2020-06-05  9:44 UTC (permalink / raw)
  To: Wei Hu (Xavier), dev

On 6/3/2020 10:31 AM, Wei Hu (Xavier) wrote:
> This series are bugfixes for hns3 PMD driver.
> 
> Chengchang Tang (2):
>   net/hns3: remove unsupported VLAN capabilities
>   net/hns3: fix VLAN strip configuration when setting a PVID
> 
> Hongbo Zheng (1):
>   net/hns3: add checking tso segsz when sending TSO packets
> 
> Wei Hu (Xavier) (1):
>   net/hns3: fix VLAN tags report in Rx
> 

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-dev] [PATCH v 4/4] net/hns3: add checking tso segsz when sending TSO packets
  2020-06-05  9:44       ` Ferruh Yigit
@ 2020-06-06  1:06         ` Wei Hu (Xavier)
  0 siblings, 0 replies; 10+ messages in thread
From: Wei Hu (Xavier) @ 2020-06-06  1:06 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, xavier.huwei



On 2020/6/5 17:44, Ferruh Yigit wrote:
> On 6/5/2020 9:50 AM, Wei Hu (Xavier) wrote:
>>
>> On 2020/6/5 0:56, Ferruh Yigit wrote:
>>> On 6/3/2020 10:32 AM, Wei Hu (Xavier) wrote:
>>>> From: Hongbo Zheng <zhenghongbo3@huawei.com>
>>>>
>>>> Base on hns3 network engine, when the rte_eth_tx_burst API is called
>>>> by Upper Level Process, if PKT_TX_TCP_SEG flag is set and tso_segsz
>>>> is 0 in the input parameter structure rte_mbuf, hns3 PMD driver will
>>>> process this packet as an non-TSO packet, otherwise hardware will enter
>>>> an abnormal state.
>>> What is ULP (Upper Level Process)?
>>>
>>> And OK to have this fix but why 'tso_segsz' is zero when 'PKT_TX_TCP_SEG' is
>>> set, shouldn't this needs to fixed in app level?
>> ULP is our own test application.
> OK. Is it open source?
We have do some modification on the basis of the current DPDK test program,
as our own internal test program.
But it is not perfect enough, so there is not open source.

Thanks, Xavier
>> The process is added to the driver to ensure If the upper application
>> called the API
>> in the wrong way, it will still not cause serious abnormalities in
>> network engine.
>>
>> Thanks, Xavier
>>>> Fixes: 6dca716c9e1d ("net/hns3: support TSO")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
>>>> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>>> <...>
>>>
>>>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-06-06  1:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03  9:31 [dpdk-dev] [PATCH v 0/4] bugfixes for hns3 PMD driver Wei Hu (Xavier)
2020-06-03  9:31 ` [dpdk-dev] [PATCH v 1/4] net/hns3: remove unsupported VLAN capabilities Wei Hu (Xavier)
2020-06-03  9:31 ` [dpdk-dev] [PATCH v 2/4] net/hns3: fix VLAN strip configuration when setting a PVID Wei Hu (Xavier)
2020-06-03  9:32 ` [dpdk-dev] [PATCH v 3/4] net/hns3: fix VLAN tags report in Rx Wei Hu (Xavier)
2020-06-03  9:32 ` [dpdk-dev] [PATCH v 4/4] net/hns3: add checking tso segsz when sending TSO packets Wei Hu (Xavier)
2020-06-04 16:56   ` Ferruh Yigit
2020-06-05  8:50     ` Wei Hu (Xavier)
2020-06-05  9:44       ` Ferruh Yigit
2020-06-06  1:06         ` Wei Hu (Xavier)
2020-06-05  9:44 ` [dpdk-dev] [PATCH v 0/4] bugfixes for hns3 PMD driver Ferruh Yigit

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).