Fix ice_add_mac_rule function by not overriding action value
with vsi id. It's possible to add MAC based switch filters
with action other than FWD_TO_VSI.
In current implementation fwd_id member of filter config
structure was always overwritten with hw vsi index, regardless
of action type.
Fix it, by setting hw vsi index only for FWD_TO_VSI action
filter and leave it as it is in case of other actions.

Fixes: 3ee1b0159ee5 ("net/ice/base: support adding MAC rules on specific port")
Cc: sta...@dpdk.org

Signed-off-by: Grzegorz Nitka <grzegorz.ni...@intel.com>
Signed-off-by: Qi Zhang <qi.z.zh...@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_switch.c 
b/drivers/net/ice/base/ice_switch.c
index 124b4fad1b..edcfa89bcb 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -4858,7 +4858,8 @@ ice_add_mac_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE 
*m_list,
                if (!ice_is_vsi_valid(hw, vsi_handle))
                        return ICE_ERR_PARAM;
                hw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);
-               m_list_itr->fltr_info.fwd_id.hw_vsi_id = hw_vsi_id;
+               if (m_list_itr->fltr_info.fltr_act == ICE_FWD_TO_VSI)
+                       m_list_itr->fltr_info.fwd_id.hw_vsi_id = hw_vsi_id;
                /* update the src in case it is VSI num */
                if (m_list_itr->fltr_info.src_id != ICE_SRC_ID_VSI)
                        return ICE_ERR_PARAM;
-- 
2.31.1

Reply via email to