net/ice/base: adjust function signature style format
[dpdk.git] / drivers / net / ice / base / ice_switch.c
index 5b968b7..6387f9b 100644 (file)
@@ -446,7 +446,7 @@ static const u8 dummy_udp_ipv6_packet[] = {
        0x86, 0xDD,             /* ICE_ETYPE_OL 12 */
 
        0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 40 */
-       0x00, 0x08, 0x11, 0x00, /* Next header UDP*/
+       0x00, 0x10, 0x11, 0x00, /* Next header UDP */
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00,
@@ -457,7 +457,10 @@ static const u8 dummy_udp_ipv6_packet[] = {
        0x00, 0x00, 0x00, 0x00,
 
        0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 54 */
-       0x00, 0x08, 0x00, 0x00,
+       0x00, 0x10, 0x00, 0x00,
+
+       0x00, 0x00, 0x00, 0x00, /* needed for ESP packets */
+       0x00, 0x00, 0x00, 0x00,
 
        0x00, 0x00, /* 2 bytes for 4 byte alignment */
 };
@@ -1004,8 +1007,7 @@ err_unroll:
  * this array is the recipe ID and the element is the mapping of which profiles
  * is this recipe mapped to.
  */
-static void
-ice_get_recp_to_prof_map(struct ice_hw *hw)
+static void ice_get_recp_to_prof_map(struct ice_hw *hw)
 {
        ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES);
        u16 i;
@@ -2163,15 +2165,13 @@ out:
  */
 static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info *fi)
 {
-       fi->lb_en = false;
-       fi->lan_en = false;
-
        if ((fi->flag & ICE_FLTR_RX) &&
            (fi->fltr_act == ICE_FWD_TO_VSI ||
             fi->fltr_act == ICE_FWD_TO_VSI_LIST) &&
            fi->lkup_type == ICE_SW_LKUP_LAST)
                fi->lan_en = true;
-
+       fi->lb_en = false;
+       fi->lan_en = false;
        if ((fi->flag & ICE_FLTR_TX) &&
            (fi->fltr_act == ICE_FWD_TO_VSI ||
             fi->fltr_act == ICE_FWD_TO_VSI_LIST ||
@@ -3510,8 +3510,7 @@ ice_add_mac_exit:
  *
  * Function add MAC rule for logical port from HW struct
  */
-enum ice_status
-ice_add_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list)
+enum ice_status ice_add_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list)
 {
        if (!m_list || !hw)
                return ICE_ERR_PARAM;
@@ -3709,8 +3708,7 @@ ice_add_vlan_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list,
  *
  * Function add VLAN rule for logical port from HW struct
  */
-enum ice_status
-ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list)
+enum ice_status ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list)
 {
        if (!v_list || !hw)
                return ICE_ERR_PARAM;
@@ -3813,7 +3811,6 @@ ice_add_eth_mac_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list,
        return ICE_SUCCESS;
 }
 
-enum ice_status
 /**
  * ice_add_eth_mac - Add a ethertype based filter rule
  * @hw: pointer to the hardware structure
@@ -3821,6 +3818,7 @@ enum ice_status
  *
  * Function add ethertype rule for logical port from HW struct
  */
+enum ice_status
 ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list)
 {
        if (!em_list || !hw)
@@ -4123,8 +4121,7 @@ ice_remove_mac_rule(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list,
  * @m_list: list of MAC addresses and forwarding information
  *
  */
-enum ice_status
-ice_remove_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list)
+enum ice_status ice_remove_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list)
 {
        struct ice_sw_recipe *recp_list;
 
@@ -4354,17 +4351,17 @@ static u8 ice_determine_promisc_mask(struct ice_fltr_info *fi)
 }
 
 /**
- * ice_get_vsi_promisc - get promiscuous mode of given VSI
+ * _ice_get_vsi_promisc - get promiscuous mode of given VSI
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to retrieve info from
  * @promisc_mask: pointer to mask to be filled in
  * @vid: VLAN ID of promisc VLAN VSI
+ * @sw: pointer to switch info struct for which function add rule
  */
-enum ice_status
-ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
-                   u16 *vid)
+static enum ice_status
+_ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
+                    u16 *vid, struct ice_switch_info *sw)
 {
-       struct ice_switch_info *sw = hw->switch_info;
        struct ice_fltr_mgmt_list_entry *itr;
        struct LIST_HEAD_TYPE *rule_head;
        struct ice_lock *rule_lock;     /* Lock to protect filter rule list */
@@ -4394,17 +4391,32 @@ ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
 }
 
 /**
- * ice_get_vsi_vlan_promisc - get VLAN promiscuous mode of given VSI
+ * ice_get_vsi_promisc - get promiscuous mode of given VSI
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to retrieve info from
  * @promisc_mask: pointer to mask to be filled in
  * @vid: VLAN ID of promisc VLAN VSI
  */
 enum ice_status
-ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
-                        u16 *vid)
+ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
+                   u16 *vid)
+{
+       return _ice_get_vsi_promisc(hw, vsi_handle, promisc_mask,
+                                   vid, hw->switch_info);
+}
+
+/**
+ * ice_get_vsi_vlan_promisc - get VLAN promiscuous mode of given VSI
+ * @hw: pointer to the hardware structure
+ * @vsi_handle: VSI handle to retrieve info from
+ * @promisc_mask: pointer to mask to be filled in
+ * @vid: VLAN ID of promisc VLAN VSI
+ * @sw: pointer to switch info struct for which function add rule
+ */
+static enum ice_status
+_ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
+                         u16 *vid, struct ice_switch_info *sw)
 {
-       struct ice_switch_info *sw = hw->switch_info;
        struct ice_fltr_mgmt_list_entry *itr;
        struct LIST_HEAD_TYPE *rule_head;
        struct ice_lock *rule_lock;     /* Lock to protect filter rule list */
@@ -4433,6 +4445,21 @@ ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
        return ICE_SUCCESS;
 }
 
+/**
+ * ice_get_vsi_vlan_promisc - get VLAN promiscuous mode of given VSI
+ * @hw: pointer to the hardware structure
+ * @vsi_handle: VSI handle to retrieve info from
+ * @promisc_mask: pointer to mask to be filled in
+ * @vid: VLAN ID of promisc VLAN VSI
+ */
+enum ice_status
+ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
+                        u16 *vid)
+{
+       return _ice_get_vsi_vlan_promisc(hw, vsi_handle, promisc_mask,
+                                        vid, hw->switch_info);
+}
+
 /**
  * ice_remove_promisc - Remove promisc based filter rules
  * @hw: pointer to the hardware structure
@@ -4458,17 +4485,17 @@ ice_remove_promisc(struct ice_hw *hw, u8 recp_id,
 }
 
 /**
- * ice_clear_vsi_promisc - clear specified promiscuous mode(s) for given VSI
+ * _ice_clear_vsi_promisc - clear specified promiscuous mode(s)
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to clear mode
  * @promisc_mask: mask of promiscuous config bits to clear
  * @vid: VLAN ID to clear VLAN promiscuous
+ * @sw: pointer to switch info struct for which function add rule
  */
-enum ice_status
-ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-                     u16 vid)
+static enum ice_status
+_ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
+                      u16 vid, struct ice_switch_info *sw)
 {
-       struct ice_switch_info *sw = hw->switch_info;
        struct ice_fltr_list_entry *fm_entry, *tmp;
        struct LIST_HEAD_TYPE remove_list_head;
        struct ice_fltr_mgmt_list_entry *itr;
@@ -4533,14 +4560,32 @@ free_fltr_list:
 }
 
 /**
- * ice_set_vsi_promisc - set given VSI to given promiscuous mode(s)
+ * ice_clear_vsi_promisc - clear specified promiscuous mode(s) for given VSI
+ * @hw: pointer to the hardware structure
+ * @vsi_handle: VSI handle to clear mode
+ * @promisc_mask: mask of promiscuous config bits to clear
+ * @vid: VLAN ID to clear VLAN promiscuous
+ */
+enum ice_status
+ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle,
+                     u8 promisc_mask, u16 vid)
+{
+       return _ice_clear_vsi_promisc(hw, vsi_handle, promisc_mask,
+                                     vid, hw->switch_info);
+}
+
+/**
+ * _ice_set_vsi_promisc - set given VSI to given promiscuous mode(s)
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to configure
  * @promisc_mask: mask of promiscuous config bits
  * @vid: VLAN ID to set VLAN promiscuous
+ * @lport: logical port number to configure promisc mode
+ * @sw: pointer to switch info struct for which function add rule
  */
-enum ice_status
-ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, u16 vid)
+static enum ice_status
+_ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
+                    u16 vid, u8 lport, struct ice_switch_info *sw)
 {
        enum { UCAST_FLTR = 1, MCAST_FLTR, BCAST_FLTR };
        struct ice_fltr_list_entry f_list_entry;
@@ -4631,17 +4676,16 @@ ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, u16 vid)
                        new_fltr.src = hw_vsi_id;
                } else {
                        new_fltr.flag |= ICE_FLTR_RX;
-                       new_fltr.src = hw->port_info->lport;
+                       new_fltr.src = lport;
                }
 
                new_fltr.fltr_act = ICE_FWD_TO_VSI;
                new_fltr.vsi_handle = vsi_handle;
                new_fltr.fwd_id.hw_vsi_id = hw_vsi_id;
                f_list_entry.fltr_info = new_fltr;
-               recp_list = &hw->switch_info->recp_list[recipe_id];
+               recp_list = &sw->recp_list[recipe_id];
 
-               status = ice_add_rule_internal(hw, recp_list,
-                                              hw->port_info->lport,
+               status = ice_add_rule_internal(hw, recp_list, lport,
                                               &f_list_entry);
                if (status != ICE_SUCCESS)
                        goto set_promisc_exit;
@@ -4652,19 +4696,37 @@ set_promisc_exit:
 }
 
 /**
- * ice_set_vlan_vsi_promisc
+ * ice_set_vsi_promisc - set given VSI to given promiscuous mode(s)
+ * @hw: pointer to the hardware structure
+ * @vsi_handle: VSI handle to configure
+ * @promisc_mask: mask of promiscuous config bits
+ * @vid: VLAN ID to set VLAN promiscuous
+ */
+enum ice_status
+ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
+                   u16 vid)
+{
+       return _ice_set_vsi_promisc(hw, vsi_handle, promisc_mask, vid,
+                                   hw->port_info->lport,
+                                   hw->switch_info);
+}
+
+/**
+ * _ice_set_vlan_vsi_promisc
  * @hw: pointer to the hardware structure
  * @vsi_handle: VSI handle to configure
  * @promisc_mask: mask of promiscuous config bits
  * @rm_vlan_promisc: Clear VLANs VSI promisc mode
+ * @lport: logical port number to configure promisc mode
+ * @sw: pointer to switch info struct for which function add rule
  *
  * Configure VSI with all associated VLANs to given promiscuous mode(s)
  */
-enum ice_status
-ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
-                        bool rm_vlan_promisc)
+static enum ice_status
+_ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
+                         bool rm_vlan_promisc, u8 lport,
+                         struct ice_switch_info *sw)
 {
-       struct ice_switch_info *sw = hw->switch_info;
        struct ice_fltr_list_entry *list_itr, *tmp;
        struct LIST_HEAD_TYPE vsi_list_head;
        struct LIST_HEAD_TYPE *vlan_head;
@@ -4686,11 +4748,13 @@ ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
                            list_entry) {
                vlan_id = list_itr->fltr_info.l_data.vlan.vlan_id;
                if (rm_vlan_promisc)
-                       status = ice_clear_vsi_promisc(hw, vsi_handle,
-                                                      promisc_mask, vlan_id);
+                       status =  _ice_clear_vsi_promisc(hw, vsi_handle,
+                                                        promisc_mask,
+                                                        vlan_id, sw);
                else
-                       status = ice_set_vsi_promisc(hw, vsi_handle,
-                                                    promisc_mask, vlan_id);
+                       status =  _ice_set_vsi_promisc(hw, vsi_handle,
+                                                      promisc_mask, vlan_id,
+                                                      lport, sw);
                if (status)
                        break;
        }
@@ -4704,6 +4768,24 @@ free_fltr_list:
        return status;
 }
 
+/**
+ * ice_set_vlan_vsi_promisc
+ * @hw: pointer to the hardware structure
+ * @vsi_handle: VSI handle to configure
+ * @promisc_mask: mask of promiscuous config bits
+ * @rm_vlan_promisc: Clear VLANs VSI promisc mode
+ *
+ * Configure VSI with all associated VLANs to given promiscuous mode(s)
+ */
+enum ice_status
+ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
+                        bool rm_vlan_promisc)
+{
+       return _ice_set_vlan_vsi_promisc(hw, vsi_handle, promisc_mask,
+                                        rm_vlan_promisc, hw->port_info->lport,
+                                        hw->switch_info);
+}
+
 /**
  * ice_remove_vsi_lkup_fltr - Remove lookup type filters for a VSI
  * @hw: pointer to the hardware structure
@@ -5263,7 +5345,7 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts,
                        u8 pe, qr;
 
                        /* ar, cr, and qr are related to the recipe words, while
-                        * be, de and pe are related to the lookup words
+                        * be, de, and pe are related to the lookup words
                         */
                        for (pe = 0; pe < lkup_exts->n_val_words; pe++) {
                                for (qr = 0; qr < recp[i].lkup_exts.n_val_words;
@@ -5565,12 +5647,12 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles,
  * ice_add_sw_recipe - function to call AQ calls to create switch recipe
  * @hw: pointer to hardware structure
  * @rm: recipe management list entry
- * @match_tun: if field vector index for tunnel needs to be programmed
- * @profiles: bitmap of profiles that will be assocated.
+ * @match_tun_mask: tunnel mask that needs to be programmed
+ * @profiles: bitmap of profiles that will be associated.
  */
 static enum ice_status
 ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
-                 bool match_tun, ice_bitmap_t *profiles)
+                 u16 match_tun_mask, ice_bitmap_t *profiles)
 {
        ice_declare_bitmap(result_idx_bm, ICE_MAX_FV_WORDS);
        struct ice_aqc_recipe_data_elem *tmp;
@@ -5788,10 +5870,10 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
                /* To differentiate among different UDP tunnels, a meta data ID
                 * flag is used.
                 */
-               if (match_tun) {
+               if (match_tun_mask) {
                        buf[recps].content.lkup_indx[i] = ICE_TUN_FLAG_FV_IND;
                        buf[recps].content.mask[i] =
-                               CPU_TO_LE16(ICE_TUN_FLAG_MASK);
+                               CPU_TO_LE16(match_tun_mask);
                }
 
                recps++;
@@ -5952,12 +6034,19 @@ static bool ice_tun_type_match_word(enum ice_sw_tunnel_type tun_type, u16 *mask)
 {
        switch (tun_type) {
        case ICE_SW_TUN_VXLAN_GPE:
+       case ICE_SW_TUN_GENEVE:
+       case ICE_SW_TUN_VXLAN:
        case ICE_SW_TUN_NVGRE:
        case ICE_SW_TUN_UDP:
        case ICE_ALL_TUNNELS:
                *mask = ICE_TUN_FLAG_MASK;
                return true;
 
+       case ICE_SW_TUN_GENEVE_VLAN:
+       case ICE_SW_TUN_VXLAN_VLAN:
+               *mask = ICE_TUN_FLAG_MASK & ~ICE_TUN_FLAG_VLAN_MASK;
+               return true;
+
        default:
                *mask = 0;
                return false;
@@ -6015,7 +6104,9 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
                break;
        case ICE_SW_TUN_VXLAN_GPE:
        case ICE_SW_TUN_GENEVE:
+       case ICE_SW_TUN_GENEVE_VLAN:
        case ICE_SW_TUN_VXLAN:
+       case ICE_SW_TUN_VXLAN_VLAN:
        case ICE_SW_TUN_UDP:
        case ICE_SW_TUN_GTP:
                prof_type = ICE_PROF_TUN_UDP;
@@ -6123,7 +6214,7 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
        struct ice_sw_fv_list_entry *tmp;
        enum ice_status status = ICE_SUCCESS;
        struct ice_sw_recipe *rm;
-       bool match_tun = false;
+       u16 match_tun_mask = 0;
        u16 mask;
        u8 i;
 
@@ -6186,9 +6277,9 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
         * differentiate different tunnel types. A separate recipe needs to be
         * used for the metadata.
         */
-       if (ice_tun_type_match_word(rinfo->tun_type,  &mask) &&
+       if (ice_tun_type_match_word(rinfo->tun_type, &mask) &&
            rm->n_grp_count > 1)
-               match_tun = mask;
+               match_tun_mask = mask;
 
        /* set the recipe priority if specified */
        rm->priority = (u8)rinfo->priority;
@@ -6243,7 +6334,7 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 
        rm->tun_type = rinfo->tun_type;
        /* Recipe we need does not exist, add a recipe */
-       status = ice_add_sw_recipe(hw, rm, match_tun, profiles);
+       status = ice_add_sw_recipe(hw, rm, match_tun_mask, profiles);
        if (status)
                goto err_unroll;
 
@@ -6424,6 +6515,7 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
                *offsets = dummy_udp_gtp_packet_offsets;
                return;
        }
+
        if (tun_type == ICE_SW_TUN_PPPOE && ipv6) {
                *pkt = dummy_pppoe_ipv6_packet;
                *pkt_len = sizeof(dummy_pppoe_ipv6_packet);
@@ -6458,7 +6550,9 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
        }
 
        if (tun_type == ICE_SW_TUN_VXLAN || tun_type == ICE_SW_TUN_GENEVE ||
-           tun_type == ICE_SW_TUN_VXLAN_GPE || tun_type == ICE_SW_TUN_UDP) {
+           tun_type == ICE_SW_TUN_VXLAN_GPE || tun_type == ICE_SW_TUN_UDP ||
+           tun_type == ICE_SW_TUN_GENEVE_VLAN ||
+           tun_type == ICE_SW_TUN_VXLAN_VLAN) {
                if (tcp) {
                        *pkt = dummy_udp_tun_tcp_packet;
                        *pkt_len = sizeof(dummy_udp_tun_tcp_packet);
@@ -6665,12 +6759,14 @@ ice_fill_adv_packet_tun(struct ice_hw *hw, enum ice_sw_tunnel_type tun_type,
        case ICE_SW_TUN_AND_NON_TUN:
        case ICE_SW_TUN_VXLAN_GPE:
        case ICE_SW_TUN_VXLAN:
+       case ICE_SW_TUN_VXLAN_VLAN:
        case ICE_SW_TUN_UDP:
                if (!ice_get_open_tunnel_port(hw, TNL_VXLAN, &open_port))
                        return ICE_ERR_CFG;
                break;
 
        case ICE_SW_TUN_GENEVE:
+       case ICE_SW_TUN_GENEVE_VLAN:
                if (!ice_get_open_tunnel_port(hw, TNL_GENEVE, &open_port))
                        return ICE_ERR_CFG;
                break;
@@ -6779,13 +6875,6 @@ ice_adv_add_update_vsi_list(struct ice_hw *hw,
             cur_fltr->sw_act.fltr_act == ICE_FWD_TO_VSI_LIST))
                return ICE_ERR_NOT_IMPL;
 
-       /* Workaround fix for unexpected rule deletion by kernel PF
-        * during VF reset.
-        */
-       if (new_fltr->sw_act.fltr_act == ICE_FWD_TO_VSI &&
-           cur_fltr->sw_act.fltr_act == ICE_FWD_TO_VSI)
-               return ICE_ERR_NOT_IMPL;
-
        if (m_entry->vsi_count < 2 && !m_entry->vsi_list_info) {
                 /* Only one entry existed in the mapping and it was not already
                  * a part of a VSI list. So, create a VSI list with the old and
@@ -7322,8 +7411,7 @@ ice_rem_adv_rule_by_id(struct ice_hw *hw,
  * as removing a rule fails, it will return immediately with the error code,
  * else it will return ICE_SUCCESS
  */
-enum ice_status
-ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle)
+enum ice_status ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle)
 {
        struct ice_adv_fltr_mgmt_list_entry *list_itr;
        struct ice_vsi_list_map_info *map_info;
@@ -7460,6 +7548,8 @@ enum ice_status ice_replay_all_fltr(struct ice_hw *hw)
 /**
  * ice_replay_vsi_fltr - Replay filters for requested VSI
  * @hw: pointer to the hardware structure
+ * @pi: pointer to port information structure
+ * @sw: pointer to switch info struct for which function replays filters
  * @vsi_handle: driver VSI handle
  * @recp_id: Recipe ID for which rules need to be replayed
  * @list_head: list for which filters need to be replayed
@@ -7468,7 +7558,8 @@ enum ice_status ice_replay_all_fltr(struct ice_hw *hw)
  * It is required to pass valid VSI handle.
  */
 static enum ice_status
-ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id,
+ice_replay_vsi_fltr(struct ice_hw *hw, struct ice_port_info *pi,
+                   struct ice_switch_info *sw, u16 vsi_handle, u8 recp_id,
                    struct LIST_HEAD_TYPE *list_head)
 {
        struct ice_fltr_mgmt_list_entry *itr;
@@ -7478,7 +7569,7 @@ ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id,
 
        if (LIST_EMPTY(list_head))
                return status;
-       recp_list = &hw->switch_info->recp_list[recp_id];
+       recp_list = &sw->recp_list[recp_id];
        hw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle);
 
        LIST_FOR_EACH_ENTRY(itr, list_head, ice_fltr_mgmt_list_entry,
@@ -7492,7 +7583,7 @@ ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id,
                        if (f_entry.fltr_info.src_id == ICE_SRC_ID_VSI)
                                f_entry.fltr_info.src = hw_vsi_id;
                        status = ice_add_rule_internal(hw, recp_list,
-                                                      hw->port_info->lport,
+                                                      pi->lport,
                                                       &f_entry);
                        if (status != ICE_SUCCESS)
                                goto end;
@@ -7512,7 +7603,7 @@ ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id,
                        status = ice_add_vlan_internal(hw, recp_list, &f_entry);
                else
                        status = ice_add_rule_internal(hw, recp_list,
-                                                      hw->port_info->lport,
+                                                      pi->lport,
                                                       &f_entry);
                if (status != ICE_SUCCESS)
                        goto end;
@@ -7557,11 +7648,14 @@ ice_replay_vsi_adv_rule(struct ice_hw *hw, u16 vsi_handle,
 /**
  * ice_replay_vsi_all_fltr - replay all filters stored in bookkeeping lists
  * @hw: pointer to the hardware structure
+ * @pi: pointer to port information structure
  * @vsi_handle: driver VSI handle
  *
  * Replays filters for requested VSI via vsi_handle.
  */
-enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle)
+enum ice_status
+ice_replay_vsi_all_fltr(struct ice_hw *hw, struct ice_port_info *pi,
+                       u16 vsi_handle)
 {
        struct ice_switch_info *sw = hw->switch_info;
        enum ice_status status;
@@ -7573,7 +7667,8 @@ enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle)
 
                head = &sw->recp_list[i].filt_replay_rules;
                if (!sw->recp_list[i].adv_rule)
-                       status = ice_replay_vsi_fltr(hw, vsi_handle, i, head);
+                       status = ice_replay_vsi_fltr(hw, pi, sw, vsi_handle, i,
+                                                    head);
                else
                        status = ice_replay_vsi_adv_rule(hw, vsi_handle, head);
                if (status != ICE_SUCCESS)
@@ -7584,14 +7679,14 @@ enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle)
 }
 
 /**
- * ice_rm_all_sw_replay_rule_info - deletes filter replay rules
+ * ice_rm_all_sw_replay_rule - helper function to delete filter replay rules
  * @hw: pointer to the HW struct
+ * @sw: pointer to switch info struct for which function removes filters
  *
- * Deletes the filter replay rules.
+ * Deletes the filter replay rules for given switch
  */
-void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw)
+void ice_rm_sw_replay_rule_info(struct ice_hw *hw, struct ice_switch_info *sw)
 {
-       struct ice_switch_info *sw = hw->switch_info;
        u8 i;
 
        if (!sw)
@@ -7609,3 +7704,14 @@ void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw)
                }
        }
 }
+
+/**
+ * ice_rm_all_sw_replay_rule_info - deletes filter replay rules
+ * @hw: pointer to the HW struct
+ *
+ * Deletes the filter replay rules.
+ */
+void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw)
+{
+       ice_rm_sw_replay_rule_info(hw, hw->switch_info);
+}