net/ice/base: fix return value
[dpdk.git] / drivers / net / ice / base / ice_switch.c
index 94268d5..5c53b9e 100644 (file)
@@ -4122,6 +4122,9 @@ void ice_rem_all_sw_rules_info(struct ice_hw *hw)
                        ice_rem_sw_rule_info(hw, rule_head);
                else
                        ice_rem_adv_rule_info(hw, rule_head);
+               if (sw->recp_list[i].adv_rule &&
+                   LIST_EMPTY(&sw->recp_list[i].filt_rules))
+                       sw->recp_list[i].adv_rule = false;
        }
 }
 
@@ -6130,7 +6133,6 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
                recp->n_grp_count = rm->n_grp_count;
                recp->tun_type = rm->tun_type;
                recp->recp_created = true;
-               recp->adv_rule = 1;
        }
        rm->root_buf = buf;
        ice_free(hw, tmp);
@@ -7489,6 +7491,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,
                        ice_get_hw_vsi_num(hw, rem_vsi_handle);
                fm_list->rule_info.sw_act.fwd_id.hw_vsi_id =
                        ice_get_hw_vsi_num(hw, rem_vsi_handle);
+               fm_list->rule_info.sw_act.vsi_handle = rem_vsi_handle;
 
                /* Update the previous switch rule of "MAC forward to VSI" to
                 * "MAC fwd to VSI list"
@@ -7611,11 +7614,15 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
                                         rule_buf_sz, 1,
                                         ice_aqc_opc_remove_sw_rules, NULL);
                if (status == ICE_SUCCESS || status == ICE_ERR_DOES_NOT_EXIST) {
+                       struct ice_switch_info *sw = hw->switch_info;
+
                        ice_acquire_lock(rule_lock);
                        LIST_DEL(&list_elem->list_entry);
                        ice_free(hw, list_elem->lkups);
                        ice_free(hw, list_elem);
                        ice_release_lock(rule_lock);
+                       if (LIST_EMPTY(&sw->recp_list[rid].filt_rules))
+                               sw->recp_list[rid].adv_rule = false;
                }
                ice_free(hw, s_rule);
        }
@@ -7654,7 +7661,8 @@ ice_rem_adv_rule_by_id(struct ice_hw *hw,
                                                list_itr->lkups_cnt, &rinfo);
                }
        }
-       return ICE_ERR_PARAM;
+       /* either list is empty or unable to find rule */
+       return ICE_ERR_DOES_NOT_EXIST;
 }
 
 /**