Skip to contentSkip to conversation

net/i40e: fix vlan insert code redundance

PATCH In review Qiming Yang 2 participants 8 messages Feb 10, 2017 – Feb 20, 2017 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/i40e: fix vlan insert code redundance

This patch removed useless tx_flags in vlan insertion.

Fixes 4861cde46116 ("i40e: new poll mode driver")
---
 drivers/net/i40e/i40e_rxtx.c | 8 +-------
 drivers/net/i40e/i40e_rxtx.h | 2 --
 2 files changed, 1 insertion(+), 9 deletions(-)
drivers/net/i40e/i40e_rxtx.c +1 -7
index 608685f..b91cd70 100644
@@ -1026,7 +1026,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	uint16_t nb_tx;
 	uint32_t td_cmd;
 	uint32_t td_offset;
-	uint32_t tx_flags;
 	uint32_t td_tag;
 	uint64_t ol_flags;
 	uint16_t nb_used;
@@ -1050,7 +1049,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		td_cmd = 0;
 		td_tag = 0;
 		td_offset = 0;
-		tx_flags = 0;
 
 		tx_pkt = *tx_pkts++;
 		RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
@@ -1097,12 +1095,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		/* Descriptor based VLAN insertion */
 		if (ol_flags & (PKT_TX_VLAN_PKT | PKT_TX_QINQ_PKT)) {
-			tx_flags |= tx_pkt->vlan_tci <<
-				I40E_TX_FLAG_L2TAG1_SHIFT;
-			tx_flags |= I40E_TX_FLAG_INSERT_VLAN;
 			td_cmd |= I40E_TX_DESC_CMD_IL2TAG1;
-			td_tag = (tx_flags & I40E_TX_FLAG_L2TAG1_MASK) >>
-						I40E_TX_FLAG_L2TAG1_SHIFT;
+			td_tag = tx_pkt->vlan_tci;
 		}
 
 		/* Always enable CRC offload insertion */
drivers/net/i40e/i40e_rxtx.h +0 -2
index 9df8a56..3d4abdc 100644
@@ -38,8 +38,6 @@
  * 32 bits tx flags, high 16 bits for L2TAG1 (VLAN),
  * low 16 bits for others.
  */
-#define I40E_TX_FLAG_L2TAG1_SHIFT 16
-#define I40E_TX_FLAG_L2TAG1_MASK  0xffff0000
 #define I40E_TX_FLAG_CSUM         ((uint32_t)(1 << 0))
 #define I40E_TX_FLAG_INSERT_VLAN  ((uint32_t)(1 << 1))
 #define I40E_TX_FLAG_TSYN         ((uint32_t)(1 << 2))
Signature · 1 line
2.7.4
#1 lore raw
Quoted 1 line · Qiming Yang

This patch removed useless tx_flags in vlan insertion.

Overall this looks good, I wonder what was the initial intention of this code, understanding it helps to figure out if there is a hidden defect.

This code not fixes a defect, but improves the code, is there any performance gain with this?
If not, I am for deferring this to next release.

Quoted 30 lines
Fixes 4861cde46116 ("i40e: new poll mode driver")
---
 drivers/net/i40e/i40e_rxtx.c | 8 +-------
 drivers/net/i40e/i40e_rxtx.h | 2 --
 2 files changed, 1 insertion(+), 9 deletions(-)
drivers/net/i40e/i40e_rxtx.c +0 -2
index 608685f..b91cd70 100644
@@ -1026,7 +1026,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	uint16_t nb_tx;
 	uint32_t td_cmd;
 	uint32_t td_offset;
-	uint32_t tx_flags;
 	uint32_t td_tag;
 	uint64_t ol_flags;
 	uint16_t nb_used;
@@ -1050,7 +1049,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		td_cmd = 0;
 		td_tag = 0;
 		td_offset = 0;
-		tx_flags = 0;
 
 		tx_pkt = *tx_pkts++;
 		RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);

drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) · line 1102

Quoted 6 lines
drivers/net/i40e/i40e_rxtx.c +0 -3
@@ -1097,12 +1095,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		/* Descriptor based VLAN insertion */
 		if (ol_flags & (PKT_TX_VLAN_PKT | PKT_TX_QINQ_PKT)) {
-			tx_flags |= tx_pkt->vlan_tci <<
-				I40E_TX_FLAG_L2TAG1_SHIFT;
-			tx_flags |= I40E_TX_FLAG_INSERT_VLAN;

The I40E_TX_FLAG_INSERT_VLAN flag also seems used only here, and can be removed.

Also I40E_TX_FLAG_CSUM and I40E_TX_FLAG_TSYN seems not used at all, understanding why they are introduced at first place can be useful.

Quoted 21 lines
drivers/net/i40e/i40e_rxtx.c +1 -2
 			td_cmd |= I40E_TX_DESC_CMD_IL2TAG1;
-			td_tag = (tx_flags & I40E_TX_FLAG_L2TAG1_MASK) >>
-						I40E_TX_FLAG_L2TAG1_SHIFT;
+			td_tag = tx_pkt->vlan_tci;
 		}
 
 		/* Always enable CRC offload insertion */
drivers/net/i40e/i40e_rxtx.h +0 -2
index 9df8a56..3d4abdc 100644
@@ -38,8 +38,6 @@
  * 32 bits tx flags, high 16 bits for L2TAG1 (VLAN),
  * low 16 bits for others.
  */
-#define I40E_TX_FLAG_L2TAG1_SHIFT 16
-#define I40E_TX_FLAG_L2TAG1_MASK  0xffff0000
 #define I40E_TX_FLAG_CSUM         ((uint32_t)(1 << 0))
 #define I40E_TX_FLAG_INSERT_VLAN  ((uint32_t)(1 << 1))
 #define I40E_TX_FLAG_TSYN         ((uint32_t)(1 << 2))
#2 lore raw
Quoted 9 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, February 10, 2017 6:25 PM
To: Yang, Qiming <[email protected]>; [email protected]
Cc: Wu, Jingjing <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix vlan insert code redundance

Quoted 5 lines
Quoted 1 line · Qiming Yang

This patch removed useless tx_flags in vlan insertion.

Overall this looks good, I wonder what was the initial intention of this code, understanding it helps to figure out if there is a hidden defect.

Thank you for your remind. I'll investigate it.

Quoted 3 lines

This code not fixes a defect, but improves the code, is there any performance gain with this?

I'll do more test and give you a feedback.

Quoted 71 lines

If not, I am for deferring this to next release.

drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts(void *tx_queue, struct rte_mbuf

Quoted 14 lines
Fixes 4861cde46116 ("i40e: new poll mode driver")
---
 drivers/net/i40e/i40e_rxtx.c | 8 +-------
drivers/net/i40e/i40e_rxtx.h | 2 --
 2 files changed, 1 insertion(+), 9 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_rxtx.c index 608685f..b91cd70 100644

drivers/net/i40e/i40e_rxtx.c +0 -0
@@ -1026,7 +1026,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf

**tx_pkts, uint16_t nb_pkts)

drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts(void *tx_queue, struct rte_mbuf

Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c +0 -1
 	uint16_t nb_tx;
 	uint32_t td_cmd;
 	uint32_t td_offset;
-	uint32_t tx_flags;
 	uint32_t td_tag;
 	uint64_t ol_flags;
 	uint16_t nb_used;
@@ -1050,7 +1049,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf

**tx_pkts, uint16_t nb_pkts)

drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts(void *tx_queue, struct

Quoted 8 lines
drivers/net/i40e/i40e_rxtx.c +0 -1
 		td_cmd = 0;
 		td_tag = 0;
 		td_offset = 0;
-		tx_flags = 0;
 
 		tx_pkt = *tx_pkts++;
 		RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
@@ -1097,12 +1095,8 @@ i40e_xmit_pkts(void *tx_queue, struct

rte_mbuf

drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) · line 1102

Quoted 7 lines
drivers/net/i40e/i40e_rxtx.c +0 -3
 **tx_pkts, uint16_t nb_pkts)
 
 		/* Descriptor based VLAN insertion */
 		if (ol_flags & (PKT_TX_VLAN_PKT | PKT_TX_QINQ_PKT)) {
-			tx_flags |= tx_pkt->vlan_tci <<
-				I40E_TX_FLAG_L2TAG1_SHIFT;
-			tx_flags |= I40E_TX_FLAG_INSERT_VLAN;

The I40E_TX_FLAG_INSERT_VLAN flag also seems used only here, and can be removed.

Also I40E_TX_FLAG_CSUM and I40E_TX_FLAG_TSYN seems not used at all, understanding why they are introduced at first place can be useful.

drivers/net/i40e/i40e_rxtx.c i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)

Quoted 3 lines
drivers/net/i40e/i40e_rxtx.c +0 -2
 			td_cmd |= I40E_TX_DESC_CMD_IL2TAG1;
-			td_tag = (tx_flags & I40E_TX_FLAG_L2TAG1_MASK) >>
-
	I40E_TX_FLAG_L2TAG1_SHIFT;
Quoted 18 lines
drivers/net/i40e/i40e_rxtx.c +1 -0
+			td_tag = tx_pkt->vlan_tci;
 		}
 

/* Always enable CRC offload insertion */ diff --git
a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h index 9df8a56..3d4abdc 100644

drivers/net/i40e/i40e_rxtx.h +0 -2
@@ -38,8 +38,6 @@
  * 32 bits tx flags, high 16 bits for L2TAG1 (VLAN),
  * low 16 bits for others.
  */
-#define I40E_TX_FLAG_L2TAG1_SHIFT 16
-#define I40E_TX_FLAG_L2TAG1_MASK  0xffff0000
 #define I40E_TX_FLAG_CSUM         ((uint32_t)(1 << 0))
 #define I40E_TX_FLAG_INSERT_VLAN  ((uint32_t)(1 << 1))
 #define I40E_TX_FLAG_TSYN         ((uint32_t)(1 << 2))
#3 lore raw

PATCH 1/1 net/i40e: fix vlan insert code redundance

Hi, Ferruh

Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Yang, Qiming
Sent: Friday, February 10, 2017 7:21 PM
To: Yigit, Ferruh <[email protected]>; [email protected]
Cc: Wu, Jingjing <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix vlan insert code redundance

Quoted 7 lines
Quoted 5 lines · Qiming Yang
Quoted 1 line

This patch removed useless tx_flags in vlan insertion.

Overall this looks good, I wonder what was the initial intention of this code, understanding it helps to figure out if there is a hidden defect.

Thank you for your remind. I'll investigate it.

I have aligned with Helin (he contribute these code), and make sure these code is useless, these code is left by history.

Quoted 6 lines
Quoted 4 lines

This code not fixes a defect, but improves the code, is there any performance gain with this?

I'll do more test and give you a feedback.

According to my test, this code will not bring any obvious performance gain, and no lose also. And as you said this is not a bug fix, should I remove the fix line and modify the commit log?

Quoted 8 lines
Quoted 8 lines

If not, I am for deferring this to next release.

Quoted 5 lines
Fixes 4861cde46116 ("i40e: new poll mode driver")

---

#4 lore raw
Quoted 21 lines · Qiming

Hi, Ferruh

Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Yang, Qiming
Sent: Friday, February 10, 2017 7:21 PM
To: Yigit, Ferruh <[email protected]>; [email protected]
Cc: Wu, Jingjing <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix vlan insert code redundance

Quoted 7 lines
Quoted 5 lines · Qiming Yang
Quoted 1 line

This patch removed useless tx_flags in vlan insertion.

Overall this looks good, I wonder what was the initial intention of this code, understanding it helps to figure out if there is a hidden defect.

Thank you for your remind. I'll investigate it.

I have aligned with Helin (he contribute these code), and make sure these code is useless, these code is left by history.

Quoted 2 lines
Quoted 2 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This code not fixes a defect, but improves the code, is there any performance gain with this?

I'll do more test and give you a feedback.

According to my test, this code will not bring any obvious performance gain, and no lose also. And as you said this is not a bug fix, should I remove the fix line and modify the commit log?

Please do if you will send a new version already, no need to send a new version just for title update.

Thanks,
ferruh

Quoted 10 lines
Quoted 9 lines
Quoted 9 lines

If not, I am for deferring this to next release.

Quoted 5 lines
Fixes 4861cde46116 ("i40e: new poll mode driver")

---

#5 lore raw

PATCH v2 1/1 net/i40e: remove redundant vlan insert code

In reply to Qiming Yang

This patch removed useless tx_flags and related macros in vlan insertion.

---
v2 changes:
* removed I40E_TX_FLAG_INSERT_VLAN and modified the commit log.

---
 drivers/net/i40e/i40e_rxtx.c | 8 +-------
 drivers/net/i40e/i40e_rxtx.h | 3 ---
 2 files changed, 1 insertion(+), 10 deletions(-)
drivers/net/i40e/i40e_rxtx.c +1 -7
index 48429cc..2085f4a 100644
@@ -1034,7 +1034,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	uint16_t nb_tx;
 	uint32_t td_cmd;
 	uint32_t td_offset;
-	uint32_t tx_flags;
 	uint32_t td_tag;
 	uint64_t ol_flags;
 	uint16_t nb_used;
@@ -1058,7 +1057,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		td_cmd = 0;
 		td_tag = 0;
 		td_offset = 0;
-		tx_flags = 0;
 
 		tx_pkt = *tx_pkts++;
 		RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
@@ -1105,12 +1103,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		/* Descriptor based VLAN insertion */
 		if (ol_flags & (PKT_TX_VLAN_PKT | PKT_TX_QINQ_PKT)) {
-			tx_flags |= tx_pkt->vlan_tci <<
-				I40E_TX_FLAG_L2TAG1_SHIFT;
-			tx_flags |= I40E_TX_FLAG_INSERT_VLAN;
 			td_cmd |= I40E_TX_DESC_CMD_IL2TAG1;
-			td_tag = (tx_flags & I40E_TX_FLAG_L2TAG1_MASK) >>
-						I40E_TX_FLAG_L2TAG1_SHIFT;
+			td_tag = tx_pkt->vlan_tci;
 		}
 
 		/* Always enable CRC offload insertion */
drivers/net/i40e/i40e_rxtx.h +0 -3
index 9df8a56..c3ab6e4 100644
@@ -38,10 +38,7 @@
  * 32 bits tx flags, high 16 bits for L2TAG1 (VLAN),
  * low 16 bits for others.
  */
-#define I40E_TX_FLAG_L2TAG1_SHIFT 16
-#define I40E_TX_FLAG_L2TAG1_MASK  0xffff0000
 #define I40E_TX_FLAG_CSUM         ((uint32_t)(1 << 0))
-#define I40E_TX_FLAG_INSERT_VLAN  ((uint32_t)(1 << 1))
 #define I40E_TX_FLAG_TSYN         ((uint32_t)(1 << 2))
 
 #define RTE_PMD_I40E_RX_MAX_BURST 32
Signature · 1 line
2.7.4
Applied
#6 lore raw

Re: [PATCH v2] net/i40e: remove redundant vlan insert code

Quoted 4 lines · Qiming Yang

This patch removed useless tx_flags and related macros in vlan insertion.

Applied to dpdk-next-net/master, thanks.

#7 lore raw

PATCH v2 1/1 net/i40e: remove redundant vlan insert code

In reply to Qiming Yang

This patch removed useless tx_flags and related macros in vlan insertion.

---
v2 changes:
* removed I40E_TX_FLAG_INSERT_VLAN and modified the commit log.

---
 drivers/net/i40e/i40e_rxtx.c | 8 +-------
 drivers/net/i40e/i40e_rxtx.h | 7 -------
 2 files changed, 1 insertion(+), 14 deletions(-)
drivers/net/i40e/i40e_rxtx.c +1 -7
index 48429cc..2085f4a 100644
@@ -1034,7 +1034,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 	uint16_t nb_tx;
 	uint32_t td_cmd;
 	uint32_t td_offset;
-	uint32_t tx_flags;
 	uint32_t td_tag;
 	uint64_t ol_flags;
 	uint16_t nb_used;
@@ -1058,7 +1057,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		td_cmd = 0;
 		td_tag = 0;
 		td_offset = 0;
-		tx_flags = 0;
 
 		tx_pkt = *tx_pkts++;
 		RTE_MBUF_PREFETCH_TO_FREE(txe->mbuf);
@@ -1105,12 +1103,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 
 		/* Descriptor based VLAN insertion */
 		if (ol_flags & (PKT_TX_VLAN_PKT | PKT_TX_QINQ_PKT)) {
-			tx_flags |= tx_pkt->vlan_tci <<
-				I40E_TX_FLAG_L2TAG1_SHIFT;
-			tx_flags |= I40E_TX_FLAG_INSERT_VLAN;
 			td_cmd |= I40E_TX_DESC_CMD_IL2TAG1;
-			td_tag = (tx_flags & I40E_TX_FLAG_L2TAG1_MASK) >>
-						I40E_TX_FLAG_L2TAG1_SHIFT;
+			td_tag = tx_pkt->vlan_tci;
 		}
 
 		/* Always enable CRC offload insertion */
drivers/net/i40e/i40e_rxtx.h +0 -7
index 9df8a56..f8bfc7c 100644
@@ -34,14 +34,7 @@
 #ifndef _I40E_RXTX_H_
 #define _I40E_RXTX_H_
 
-/**
- * 32 bits tx flags, high 16 bits for L2TAG1 (VLAN),
- * low 16 bits for others.
- */
-#define I40E_TX_FLAG_L2TAG1_SHIFT 16
-#define I40E_TX_FLAG_L2TAG1_MASK  0xffff0000
 #define I40E_TX_FLAG_CSUM         ((uint32_t)(1 << 0))
-#define I40E_TX_FLAG_INSERT_VLAN  ((uint32_t)(1 << 1))
 #define I40E_TX_FLAG_TSYN         ((uint32_t)(1 << 2))
 
 #define RTE_PMD_I40E_RX_MAX_BURST 32
Signature · 1 line
2.7.4