net/ice/base: return correct error code
[dpdk.git] / drivers / net / ice / base / ice_switch.c
index 6387f9b..fa3a59e 100644 (file)
@@ -1868,6 +1868,7 @@ ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz,
                u8 num_rules, enum ice_adminq_opc opc, struct ice_sq_cd *cd)
 {
        struct ice_aq_desc desc;
+       enum ice_status status;
 
        ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__);
 
@@ -1881,7 +1882,12 @@ ice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz,
        desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD);
        desc.params.sw_rules.num_rules_fltr_entry_index =
                CPU_TO_LE16(num_rules);
-       return ice_aq_send_cmd(hw, &desc, rule_list, rule_list_sz, cd);
+       status = ice_aq_send_cmd(hw, &desc, rule_list, rule_list_sz, cd);
+       if (opc != ice_aqc_opc_add_sw_rules &&
+           hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT)
+               status = ICE_ERR_DOES_NOT_EXIST;
+
+       return status;
 }
 
 /**
@@ -7354,7 +7360,7 @@ ice_rem_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
                status = ice_aq_sw_rules(hw, (struct ice_aqc_sw_rules *)s_rule,
                                         rule_buf_sz, 1,
                                         ice_aqc_opc_remove_sw_rules, NULL);
-               if (status == ICE_SUCCESS) {
+               if (status == ICE_SUCCESS || status == ICE_ERR_DOES_NOT_EXIST) {
                        ice_acquire_lock(rule_lock);
                        LIST_DEL(&list_elem->list_entry);
                        ice_free(hw, list_elem->lkups);