For chained recipe entry, the field vector index used to match
switch ID should always be zero.

Add ICE_AQ_SW_ID_LKUP_IDX define to indicate the FV index used
to extract the switch ID.

Fixes: dca90ed479cf ("net/ice/base: programming a new switch recipe")

Signed-off-by: Dan Nowlin <dan.now...@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell...@intel.com>
Signed-off-by: Leyi Rong <leyi.r...@intel.com>
---
 drivers/net/ice/base/ice_adminq_cmd.h |  1 +
 drivers/net/ice/base/ice_switch.c     | 11 ++++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ice/base/ice_adminq_cmd.h 
b/drivers/net/ice/base/ice_adminq_cmd.h
index 1fdd612a1..8b8ed7a73 100644
--- a/drivers/net/ice/base/ice_adminq_cmd.h
+++ b/drivers/net/ice/base/ice_adminq_cmd.h
@@ -711,6 +711,7 @@ struct ice_aqc_recipe_content {
 #define ICE_AQ_RECIPE_ID_S             0
 #define ICE_AQ_RECIPE_ID_M             (0x3F << ICE_AQ_RECIPE_ID_S)
 #define ICE_AQ_RECIPE_ID_IS_ROOT       BIT(7)
+#define ICE_AQ_SW_ID_LKUP_IDX          0
        u8 lkup_indx[5];
 #define ICE_AQ_RECIPE_LKUP_DATA_S      0
 #define ICE_AQ_RECIPE_LKUP_DATA_M      (0x3F << ICE_AQ_RECIPE_LKUP_DATA_S)
diff --git a/drivers/net/ice/base/ice_switch.c 
b/drivers/net/ice/base/ice_switch.c
index 7f4edd274..660d491ed 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -4737,8 +4737,8 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe 
*rm,
                           sizeof(buf[recps].content.lkup_indx),
                           ICE_NONDMA_MEM);
 
-               /* All recipes use look-up field index 0 to match switch ID. */
-               buf[recps].content.lkup_indx[0] = 0;
+               /* All recipes use look-up index 0 to match switch ID. */
+               buf[recps].content.lkup_indx[0] = ICE_AQ_SW_ID_LKUP_IDX;
                buf[recps].content.mask[0] =
                        CPU_TO_LE16(ICE_AQ_SW_ID_LKUP_MASK);
                /* Setup lkup_indx 1..4 to INVALID/ignore and set the mask
@@ -4804,7 +4804,7 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe 
*rm,
                buf[0].content.act_ctrl_fwd_priority = rm->priority;
        } else {
                struct ice_recp_grp_entry *last_chain_entry;
-               u16 rid, i = 0;
+               u16 rid, i;
 
                /* Allocate the last recipe that will chain the outcomes of the
                 * other recipes together
@@ -4829,8 +4829,9 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe 
*rm,
                ice_memset(&buf[recps].content.lkup_indx, 0,
                           sizeof(buf[recps].content.lkup_indx),
                           ICE_NONDMA_MEM);
-               buf[recps].content.lkup_indx[i] = hw->port_info->sw_id;
-               buf[recps].content.mask[i] =
+               /* All recipes use look-up index 0 to match switch ID. */
+               buf[recps].content.lkup_indx[0] = ICE_AQ_SW_ID_LKUP_IDX;
+               buf[recps].content.mask[0] =
                        CPU_TO_LE16(ICE_AQ_SW_ID_LKUP_MASK);
                for (i = 1; i <= ICE_NUM_WORDS_RECIPE; i++) {
                        buf[recps].content.lkup_indx[i] =
-- 
2.17.1

Reply via email to