Skip to contentSkip to conversation

net/ice: fix secondary process Rx offload path

PATCH Superseded Alvin Zhang 3 participants 7 messages Nov 12, 2021 – Nov 16, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ice: fix secondary process Rx offload path

Secondary process depends on the vector offload flag to select right Rx offload path. This patch adds a variable in share memory to store the vector offload flag that can be directly read by secondary process.

Fixes 808a17b3c1e6 ("net/ice: add Rx AVX512 offload path")
---
 drivers/net/ice/ice_ethdev.h |  1 +
 drivers/net/ice/ice_rxtx.c   | 19 +++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)
drivers/net/ice/ice_ethdev.h +1 -0
index 3a5bb9b..52daae0 100644
@@ -538,6 +538,7 @@ struct ice_adapter {
 	bool rx_use_avx512;
 	bool tx_use_avx2;
 	bool tx_use_avx512;
+	int rx_vec_path;
 #endif
 };
 
drivers/net/ice/ice_rxtx.c +11 -8
index 2d771ea..981493e 100644
@@ -3172,15 +3172,14 @@
 #ifdef RTE_ARCH_X86
 	struct ice_rx_queue *rxq;
 	int i;
-	int rx_check_ret = -1;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		ad->rx_use_avx512 = false;
 		ad->rx_use_avx2 = false;
-		rx_check_ret = ice_rx_vec_dev_check(dev);
+		ad->rx_vec_path = ice_rx_vec_dev_check(dev);
 		if (ad->ptp_ena)
-			rx_check_ret = -1;
-		if (rx_check_ret >= 0 && ad->rx_bulk_alloc_allowed &&
+			ad->rx_vec_path = -1;
+		if (ad->rx_vec_path >= 0 && ad->rx_bulk_alloc_allowed &&
 		    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
 			ad->rx_vec_allowed = true;
 			for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -3215,7 +3214,8 @@
 		if (dev->data->scattered_rx) {
 			if (ad->rx_use_avx512) {
 #ifdef CC_AVX512_SUPPORT
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						"Using AVX512 OFFLOAD Vector Scattered Rx (port %d).",
 						dev->data->port_id);
@@ -3230,7 +3230,8 @@
 				}
 #endif
 			} else if (ad->rx_use_avx2) {
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						    "Using AVX2 OFFLOAD Vector Scattered Rx (port %d).",
 						    dev->data->port_id);
@@ -3252,7 +3253,8 @@
 		} else {
 			if (ad->rx_use_avx512) {
 #ifdef CC_AVX512_SUPPORT
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						"Using AVX512 OFFLOAD Vector Rx (port %d).",
 						dev->data->port_id);
@@ -3267,7 +3269,8 @@
 				}
 #endif
 			} else if (ad->rx_use_avx2) {
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						    "Using AVX2 OFFLOAD Vector Rx (port %d).",
 						    dev->data->port_id);
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/1 net/ice: fix secondary process Rx offload path

Secondary process depends on the vector offload flag to select right Rx offload path. This patch adds a variable in share memory to store the vector offload flag that can be directly read by secondary process.

Fixes 808a17b3c1e6 ("net/ice: add Rx AVX512 offload path")
---
 drivers/net/ice/ice_ethdev.h |  1 +
 drivers/net/ice/ice_rxtx.c   | 19 +++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)
drivers/net/ice/ice_ethdev.h +1 -0
index 3a5bb9b..52daae0 100644
@@ -538,6 +538,7 @@ struct ice_adapter {
 	bool rx_use_avx512;
 	bool tx_use_avx2;
 	bool tx_use_avx512;
+	int rx_vec_path;
 #endif
 };
 
drivers/net/ice/ice_rxtx.c +11 -8
index 2d771ea..981493e 100644
@@ -3172,15 +3172,14 @@
 #ifdef RTE_ARCH_X86
 	struct ice_rx_queue *rxq;
 	int i;
-	int rx_check_ret = -1;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		ad->rx_use_avx512 = false;
 		ad->rx_use_avx2 = false;
-		rx_check_ret = ice_rx_vec_dev_check(dev);
+		ad->rx_vec_path = ice_rx_vec_dev_check(dev);
 		if (ad->ptp_ena)
-			rx_check_ret = -1;
-		if (rx_check_ret >= 0 && ad->rx_bulk_alloc_allowed &&
+			ad->rx_vec_path = -1;
+		if (ad->rx_vec_path >= 0 && ad->rx_bulk_alloc_allowed &&
 		    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
 			ad->rx_vec_allowed = true;
 			for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -3215,7 +3214,8 @@
 		if (dev->data->scattered_rx) {
 			if (ad->rx_use_avx512) {
 #ifdef CC_AVX512_SUPPORT
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						"Using AVX512 OFFLOAD Vector Scattered Rx (port %d).",
 						dev->data->port_id);
@@ -3230,7 +3230,8 @@
 				}
 #endif
 			} else if (ad->rx_use_avx2) {
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						    "Using AVX2 OFFLOAD Vector Scattered Rx (port %d).",
 						    dev->data->port_id);
@@ -3252,7 +3253,8 @@
 		} else {
 			if (ad->rx_use_avx512) {
 #ifdef CC_AVX512_SUPPORT
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						"Using AVX512 OFFLOAD Vector Rx (port %d).",
 						dev->data->port_id);
@@ -3267,7 +3269,8 @@
 				}
 #endif
 			} else if (ad->rx_use_avx2) {
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						    "Using AVX2 OFFLOAD Vector Rx (port %d).",
 						    dev->data->port_id);
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 27 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Monday, November 15, 2021 10:06 AM
To: Zhang, Qi Z <[email protected]>; Rong, Leyi <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
Subject: [PATCH v2] net/ice: fix secondary process Rx offload path

Secondary process depends on the vector offload flag to select right Rx offload path. This patch adds a variable in share memory to store the vector offload flag that can be directly read by secondary process.

Fixes 808a17b3c1e6 ("net/ice: add Rx AVX512 offload path")
---
 drivers/net/ice/ice_ethdev.h |  1 +
 drivers/net/ice/ice_rxtx.c   | 19 +++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)
drivers/net/ice/ice_ethdev.h index renamed from drivers/net/ice/ice_ethdev.h +0 -0

3a5bb9b..52daae0 100644

drivers/net/ice/ice_ethdev.h struct ice_adapter { · line 541

Quoted 4 lines
drivers/net/ice/ice_ethdev.h +1 -0
@@ -538,6 +538,7 @@ struct ice_adapter {
 	bool rx_use_avx512;
 	bool tx_use_avx2;
 	bool tx_use_avx512;
+	int rx_vec_path;

Can we make the type/ name more specific, how about defined as: "bool rx_vec_offload_support;" ?

Then we can keep most thing unchanged in primary process branch, but only add below ,

ad->rx_vec_offload_support = (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH);

in following branch

we can avoid duplicate if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH)..

Quoted 71 lines
drivers/net/ice/ice_ethdev.h +0 -0
 #endif
 };
 
drivers/net/ice/ice_rxtx.c index renamed from drivers/net/ice/ice_rxtx.c +0 -0

2d771ea..981493e 100644

drivers/net/ice/ice_rxtx.c +6 -5
@@ -3172,15 +3172,14 @@
 #ifdef RTE_ARCH_X86
 	struct ice_rx_queue *rxq;
 	int i;
-	int rx_check_ret = -1;
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		ad->rx_use_avx512 = false;
 		ad->rx_use_avx2 = false;
-		rx_check_ret = ice_rx_vec_dev_check(dev);
+		ad->rx_vec_path = ice_rx_vec_dev_check(dev);
 		if (ad->ptp_ena)
-			rx_check_ret = -1;
-		if (rx_check_ret >= 0 && ad->rx_bulk_alloc_allowed &&
+			ad->rx_vec_path = -1;
+		if (ad->rx_vec_path >= 0 && ad->rx_bulk_alloc_allowed &&
 		    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
 			ad->rx_vec_allowed = true;
 			for (i = 0; i < dev->data->nb_rx_queues; i++) { @@ -3215,7
+3214,8 @@
 		if (dev->data->scattered_rx) {
 			if (ad->rx_use_avx512) {
 #ifdef CC_AVX512_SUPPORT
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						"Using AVX512 OFFLOAD Vector Scattered Rx

(port %d).",

drivers/net/ice/ice_rxtx.c +2 -1
 						dev->data->port_id);
@@ -3230,7 +3230,8 @@
 				}
 #endif
 			} else if (ad->rx_use_avx2) {
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						    "Using AVX2 OFFLOAD Vector Scattered Rx
 (port %d).",
drivers/net/ice/ice_rxtx.c +4 -2
 						    dev->data->port_id);
@@ -3252,7 +3253,8 @@
 		} else {
 			if (ad->rx_use_avx512) {
 #ifdef CC_AVX512_SUPPORT
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						"Using AVX512 OFFLOAD Vector Rx (port %d).",
 						dev->data->port_id);
@@ -3267,7 +3269,8 @@
 				}
 #endif
 			} else if (ad->rx_use_avx2) {
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_path ==
+				    ICE_VECTOR_OFFLOAD_PATH) {
 					PMD_DRV_LOG(NOTICE,
 						    "Using AVX2 OFFLOAD Vector Rx
 (port %d).",

dev->data->port_id);
--
1.8.3.1

#3 lore raw
Quoted 46 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Tuesday, November 16, 2021 9:22 AM
To: Zhang, AlvinX <[email protected]>; Rong, Leyi <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH v2] net/ice: fix secondary process Rx offload path

Quoted 28 lines

-----Original Message-----
From: Zhang, AlvinX <[email protected]>
Sent: Monday, November 15, 2021 10:06 AM
To: Zhang, Qi Z <[email protected]>; Rong, Leyi <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
Subject: [PATCH v2] net/ice: fix secondary process Rx offload path

Secondary process depends on the vector offload flag to select right Rx offload path. This patch adds a variable in share memory to store the vector offload flag that can be directly read by secondary process.

Fixes 808a17b3c1e6 ("net/ice: add Rx AVX512 offload path")
---
 drivers/net/ice/ice_ethdev.h |  1 +
 drivers/net/ice/ice_rxtx.c   | 19 +++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ice/ice_ethdev.h index
3a5bb9b..52daae0 100644

drivers/net/ice/ice_ethdev.h struct ice_adapter { bool rx_use_avx512; bool · line 539

Quoted 2 lines
drivers/net/ice/ice_ethdev.h +1 -0
@@ -538,6 +538,7 @@ struct ice_adapter {  bool rx_use_avx512;  bool
 tx_use_avx2;  bool tx_use_avx512;
+int rx_vec_path;

Can we make the type/ name more specific, how about defined as: "bool rx_vec_offload_support;" ?

Then we can keep most thing unchanged in primary process branch, but only add below ,

Quoted 7 lines

ad->rx_vec_offload_support = (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH);

in following branch

we can avoid duplicate if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH)..

Ok, I'll update it in V3.

Quoted 65 lines
Quoted 64 lines
drivers/net/ice/ice_ethdev.h +0 -0
 #endif
 };
 
drivers/net/ice/ice_rxtx.c +3 -4
index 2d771ea..981493e 100644
@@ -3172,15 +3172,14 @@
 #ifdef RTE_ARCH_X86
 struct ice_rx_queue *rxq;
 int i;
-int rx_check_ret = -1;
 
 if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 ad->rx_use_avx512 = false;
 ad->rx_use_avx2 = false;
-rx_check_ret = ice_rx_vec_dev_check(dev);
+ad->rx_vec_path = ice_rx_vec_dev_check(dev);
 if (ad->ptp_ena)
-rx_check_ret = -1;
-if (rx_check_ret >= 0 && ad->rx_bulk_alloc_allowed &&
+ad->rx_vec_path = -1;
+if (ad->rx_vec_path >= 0 && ad->rx_bulk_alloc_allowed &&
     rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
 ad->rx_vec_allowed = true;  for (i = 0; i < dev->data->nb_rx_queues;

i++) { @@ -3215,7
+3214,8 @@
if (dev->data->scattered_rx) {
if (ad->rx_use_avx512) {
#ifdef CC_AVX512_SUPPORT

drivers/net/ice/ice_rxtx.c +2 -1
-if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+if (ad->rx_vec_path ==
+    ICE_VECTOR_OFFLOAD_PATH) {
 PMD_DRV_LOG(NOTICE,
 "Using AVX512 OFFLOAD Vector Scattered Rx (port %d).",

dev->data->port_id); @@ -3230,7 +3230,8 @@ } #endif } else if (ad->rx_use_avx2) { -if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {

drivers/net/ice/ice_rxtx.c +4 -2
+if (ad->rx_vec_path ==
+    ICE_VECTOR_OFFLOAD_PATH) {
 PMD_DRV_LOG(NOTICE,
     "Using AVX2 OFFLOAD Vector Scattered Rx (port %d).",
     dev->data->port_id);
@@ -3252,7 +3253,8 @@
 } else {
 if (ad->rx_use_avx512) {
 #ifdef CC_AVX512_SUPPORT
-if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+if (ad->rx_vec_path ==
+    ICE_VECTOR_OFFLOAD_PATH) {
 PMD_DRV_LOG(NOTICE,
 "Using AVX512 OFFLOAD Vector Rx (port %d).",  dev->data->port_id); @@
-3267,7 +3269,8 @@  }  #endif  } else if (ad->rx_use_avx2) { -if

(rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {

drivers/net/ice/ice_rxtx.c +2 -0
+if (ad->rx_vec_path ==
+    ICE_VECTOR_OFFLOAD_PATH) {
 PMD_DRV_LOG(NOTICE,
     "Using AVX2 OFFLOAD Vector Rx

(port %d).",

     dev->data->port_id);

--
1.8.3.1

#4 lore raw

PATCH v3 1/1 net/ice: fix secondary process Rx offload path

In reply to Alvin Zhang

Secondary process depends on the vector offload flag to select right Rx offload path. This patch adds a variable in share memory to store the vector offload flag that can be directly read by secondary process.

Fixes 808a17b3c1e6 ("net/ice: add Rx AVX512 offload path")

---

v3: Modify the patch according to comment.

---
 drivers/net/ice/ice_ethdev.h |  1 +
 drivers/net/ice/ice_rxtx.c   | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/ice/ice_ethdev.h +1 -0
index 3a5bb9b..f8d0f0c 100644
@@ -538,6 +538,7 @@ struct ice_adapter {
 	bool rx_use_avx512;
 	bool tx_use_avx2;
 	bool tx_use_avx512;
+	bool rx_vec_offload_support;
 #endif
 };
 
drivers/net/ice/ice_rxtx.c +6 -4
index 2d771ea..f6d8564 100644
@@ -3180,6 +3180,8 @@
 		rx_check_ret = ice_rx_vec_dev_check(dev);
 		if (ad->ptp_ena)
 			rx_check_ret = -1;
+		ad->rx_vec_offload_support =
+				(rx_check_ret == ICE_VECTOR_OFFLOAD_PATH);
 		if (rx_check_ret >= 0 && ad->rx_bulk_alloc_allowed &&
 		    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
 			ad->rx_vec_allowed = true;
@@ -3215,7 +3217,7 @@
 		if (dev->data->scattered_rx) {
 			if (ad->rx_use_avx512) {
 #ifdef CC_AVX512_SUPPORT
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_offload_support) {
 					PMD_DRV_LOG(NOTICE,
 						"Using AVX512 OFFLOAD Vector Scattered Rx (port %d).",
 						dev->data->port_id);
@@ -3230,7 +3232,7 @@
 				}
 #endif
 			} else if (ad->rx_use_avx2) {
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_offload_support) {
 					PMD_DRV_LOG(NOTICE,
 						    "Using AVX2 OFFLOAD Vector Scattered Rx (port %d).",
 						    dev->data->port_id);
@@ -3252,7 +3254,7 @@
 		} else {
 			if (ad->rx_use_avx512) {
 #ifdef CC_AVX512_SUPPORT
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_offload_support) {
 					PMD_DRV_LOG(NOTICE,
 						"Using AVX512 OFFLOAD Vector Rx (port %d).",
 						dev->data->port_id);
@@ -3267,7 +3269,7 @@
 				}
 #endif
 			} else if (ad->rx_use_avx2) {
-				if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) {
+				if (ad->rx_vec_offload_support) {
 					PMD_DRV_LOG(NOTICE,
 						    "Using AVX2 OFFLOAD Vector Rx (port %d).",
 						    dev->data->port_id);
Signature · 1 line
1.8.3.1
Tested-by on v3 1/1
#5 lore raw
Quoted 8 lines

-----Original Message-----
From: Alvin Zhang <[email protected]>
Sent: Tuesday, November 16, 2021 10:32 AM
To: Zhang, Qi Z <[email protected]>; Rong, Leyi <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
Subject: [PATCH v3] net/ice: fix secondary process Rx offload path

Quoted 8 lines

Secondary process depends on the vector offload flag to select right Rx offload path. This patch adds a variable in share memory to store the vector offload flag that can be directly read by secondary process.

Fixes 808a17b3c1e6 ("net/ice: add Rx AVX512 offload path")
Acked-by Applied
#6 lore raw
Quoted 23 lines

-----Original Message-----
From: Sun, QinX <[email protected]>
Sent: Tuesday, November 16, 2021 11:09 AM
To: Zhang, AlvinX <[email protected]>; Zhang, Qi Z <[email protected]>; Rong, Leyi <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
Subject: RE: [PATCH v3] net/ice: fix secondary process Rx offload path

Quoted 13 lines

-----Original Message-----
From: Alvin Zhang <[email protected]>
Sent: Tuesday, November 16, 2021 10:32 AM
To: Zhang, Qi Z <[email protected]>; Rong, Leyi <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>; [email protected]
Subject: [PATCH v3] net/ice: fix secondary process Rx offload path

Secondary process depends on the vector offload flag to select right Rx offload path. This patch adds a variable in share memory to store the vector offload flag that can be directly read by secondary process.

Quoted 6 lines
Quoted 4 lines
Fixes 808a17b3c1e6 ("net/ice: add Rx AVX512 offload path")

Applied to dpdk-next-net-intel.

Thanks
Qi

Quoted 2 lines