From 7e9c8558428e1f437611e1d0398610701e7f8a77 Mon Sep 17 00:00:00 2001 From: Wei Zhao Date: Fri, 10 Apr 2020 08:41:56 +0800 Subject: [PATCH] net/ice/base: add mask check to 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 Acked-by: Qi Zhang Tested-by: Nannan Lu --- 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 7e7d748948..373f4b3a4a 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.20.1