[2/3] net/ice/base: add mask check when find switch recipe

Message ID 20200410004157.3032-3-wei.zhao1@intel.com (mailing list archive)
State Accepted, archived
Delegated to: xiaolong ye
Headers
Series update ice switch base code |

Checks

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

Commit Message

Zhao1, Wei April 10, 2020, 12:41 a.m. UTC
  In order to find accurate recipe for switch filter, we
need to add mask as an element when searching for recipe.
If we create different rules with the same input set, but
using different masks, then proper recipes should use
those different mask.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Lu, Nannan April 14, 2020, 3:02 a.m. UTC | #1
Tested-by: Lu, Nannan <nannan.lu@intel.com>

-----Original Message-----
From: Zhao1, Wei 
Sent: Friday, April 10, 2020 8:42 AM
To: dev@dpdk.org
Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Lu, Nannan <nannan.lu@intel.com>; Peng, Yuan <yuan.peng@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
Subject: [PATCH 2/3] net/ice/base: add mask check when find switch recipe

In order to find accurate recipe for switch filter, we need to add mask as an element when searching for recipe.
If we create different rules with the same input set, but using different masks, then proper recipes should use those different mask.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index c17219274..bc0c368d7 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -5012,6 +5012,8 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)
 		if (lkup_exts->n_val_words == recp[i].lkup_exts.n_val_words) {
 			struct ice_fv_word *a = lkup_exts->fv_words;
 			struct ice_fv_word *b = recp[i].lkup_exts.fv_words;
+			u16 *c = recp[i].lkup_exts.field_mask;
+			u16 *d = lkup_exts->field_mask;
 			bool found = true;
 			u8 p, q;
 
@@ -5019,7 +5021,8 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)
 				for (q = 0; q < recp[i].lkup_exts.n_val_words;
 				     q++) {
 					if (a[p].off == b[q].off &&
-					    a[p].prot_id == b[q].prot_id)
+					    a[p].prot_id == b[q].prot_id &&
+					    d[p] == c[q])
 						/* Found the "p"th word in the
 						 * given recipe
 						 */
--
2.19.1
  

Patch

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index c17219274..bc0c368d7 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -5012,6 +5012,8 @@  static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)
 		if (lkup_exts->n_val_words == recp[i].lkup_exts.n_val_words) {
 			struct ice_fv_word *a = lkup_exts->fv_words;
 			struct ice_fv_word *b = recp[i].lkup_exts.fv_words;
+			u16 *c = recp[i].lkup_exts.field_mask;
+			u16 *d = lkup_exts->field_mask;
 			bool found = true;
 			u8 p, q;
 
@@ -5019,7 +5021,8 @@  static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)
 				for (q = 0; q < recp[i].lkup_exts.n_val_words;
 				     q++) {
 					if (a[p].off == b[q].off &&
-					    a[p].prot_id == b[q].prot_id)
+					    a[p].prot_id == b[q].prot_id &&
+					    d[p] == c[q])
 						/* Found the "p"th word in the
 						 * given recipe
 						 */