[v3,09/12] net/ice/base: fix flow raw field vector extraction
diff mbox series

Message ID 20191008015018.17086-10-qi.z.zhang@intel.com
State Accepted
Delegated to: xiaolong ye
Headers show
Series
  • net/ice: base code update
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Qi Zhang Oct. 8, 2019, 1:50 a.m. UTC
Correct the ordering of raw field extraction in the field vector
by taking into account the ordering setting for requesting block.

Fixes: aa1cd410fa64 ("net/ice/base: add flow module")

Signed-off-by: Dan Nowlin <dan.nowlin@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_flow.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

Comments

Yang, Qiming Oct. 10, 2019, 3:07 a.m. UTC | #1
-----Original Message-----
From: Zhang, Qi Z 
Sent: Tuesday, October 8, 2019 09:50
To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming <qiming.yang@intel.com>
Cc: dev@dpdk.org; Ye, Xiaolong <xiaolong.ye@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Nowlin, Dan <dan.nowlin@intel.com>; Stillwell Jr, Paul M <paul.m.stillwell.jr@intel.com>
Subject: [PATCH v3 09/12] net/ice/base: fix flow raw field vector extraction

Correct the ordering of raw field extraction in the field vector by taking into account the ordering setting for requesting block.

Fixes: aa1cd410fa64 ("net/ice/base: add flow module")

Signed-off-by: Dan Nowlin <dan.nowlin@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_flow.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c index 370ad9ba3..38c7c42f7 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -806,6 +806,7 @@ static enum ice_status  ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 		     u8 seg)
 {
+	u16 fv_words;
 	u16 hdrs_sz;
 	u8 i;
 
@@ -821,6 +822,8 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 	if (!hdrs_sz)
 		return ICE_ERR_PARAM;
 
+	fv_words = hw->blk[params->blk].es.fvw;
+
 	for (i = 0; i < params->prof->segs[seg].raws_cnt; i++) {
 		struct ice_flow_seg_fld_raw *raw;
 		u16 off, cnt, j;
@@ -853,6 +856,8 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 					   BITS_PER_BYTE));
 		off = raw->info.xtrct.off;
 		for (j = 0; j < cnt; j++) {
+			u16 idx;
+
 			/* Make sure the number of extraction sequence required
 			 * does not exceed the block's capability
 			 */
@@ -860,8 +865,14 @@ ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 			    params->es_cnt >= ICE_MAX_FV_WORDS)
 				return ICE_ERR_MAX_LIMIT;
 
-			params->es[params->es_cnt].prot_id = ICE_PROT_PAY;
-			params->es[params->es_cnt].off = off;
+			/* some blocks require a reversed field vector layout */
+			if (hw->blk[params->blk].es.reverse)
+				idx = fv_words - params->es_cnt - 1;
+			else
+				idx = params->es_cnt;
+
+			params->es[idx].prot_id = ICE_PROT_PAY;
+			params->es[idx].off = off;
 			params->es_cnt++;
 			off += ICE_FLOW_FV_EXTRACT_SZ;
 		}
--
2.13.6

Acked-by: Qiming Yang <qiming.yang@intel.com>

Patch
diff mbox series

diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index 370ad9ba3..38c7c42f7 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -806,6 +806,7 @@  static enum ice_status
 ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 		     u8 seg)
 {
+	u16 fv_words;
 	u16 hdrs_sz;
 	u8 i;
 
@@ -821,6 +822,8 @@  ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 	if (!hdrs_sz)
 		return ICE_ERR_PARAM;
 
+	fv_words = hw->blk[params->blk].es.fvw;
+
 	for (i = 0; i < params->prof->segs[seg].raws_cnt; i++) {
 		struct ice_flow_seg_fld_raw *raw;
 		u16 off, cnt, j;
@@ -853,6 +856,8 @@  ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 					   BITS_PER_BYTE));
 		off = raw->info.xtrct.off;
 		for (j = 0; j < cnt; j++) {
+			u16 idx;
+
 			/* Make sure the number of extraction sequence required
 			 * does not exceed the block's capability
 			 */
@@ -860,8 +865,14 @@  ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
 			    params->es_cnt >= ICE_MAX_FV_WORDS)
 				return ICE_ERR_MAX_LIMIT;
 
-			params->es[params->es_cnt].prot_id = ICE_PROT_PAY;
-			params->es[params->es_cnt].off = off;
+			/* some blocks require a reversed field vector layout */
+			if (hw->blk[params->blk].es.reverse)
+				idx = fv_words - params->es_cnt - 1;
+			else
+				idx = params->es_cnt;
+
+			params->es[idx].prot_id = ICE_PROT_PAY;
+			params->es[idx].off = off;
 			params->es_cnt++;
 			off += ICE_FLOW_FV_EXTRACT_SZ;
 		}