net/i40e: upgrade AQ command of MAC/VLAN remove
authorRobin Zhang <robinx.zhang@intel.com>
Mon, 11 Oct 2021 08:12:48 +0000 (08:12 +0000)
committerQi Zhang <qi.z.zhang@intel.com>
Wed, 13 Oct 2021 02:22:19 +0000 (04:22 +0200)
Firmware 8.4+ will return I40E_AQ_RC_ENOENT when try to delete
non-existent MAC/VLAN addresses from the HW filtering, this should
not be considered as an Admin Queue error. But in i40e_asq_send_command,
it will return I40E_ERR_ADMIN_QUEUE_ERROR if the return value of Admin
Queue command processed by Firmware is not I40E_AQ_RC_OK or
I40E_AQ_RC_EBUSY.

Use i40e_aq_remove_macvlan_v2 instead so that we can get the
corresponding Admin Queue status, and not report as an error in DPDK
when Firmware return I40E_AQ_RC_ENOENT, and this also not break with an
old firmware.

Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/i40e/i40e_ethdev.c

index cd723f1..f856bbe 100644 (file)
@@ -7010,6 +7010,7 @@ i40e_remove_macvlan_filters(struct i40e_vsi *vsi,
        int ret = I40E_SUCCESS;
        struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
        struct i40e_aqc_remove_macvlan_element_data *req_list;
+       enum i40e_admin_queue_err aq_status;
 
        if (filter == NULL  || total == 0)
                return I40E_ERR_PARAM;
@@ -7057,11 +7058,17 @@ i40e_remove_macvlan_filters(struct i40e_vsi *vsi,
                        req_list[i].flags = rte_cpu_to_le_16(flags);
                }
 
-               ret = i40e_aq_remove_macvlan(hw, vsi->seid, req_list,
-                                               actual_num, NULL);
+               ret = i40e_aq_remove_macvlan_v2(hw, vsi->seid, req_list,
+                                               actual_num, NULL, &aq_status);
+
                if (ret != I40E_SUCCESS) {
-                       PMD_DRV_LOG(ERR, "Failed to remove macvlan filter");
-                       goto DONE;
+                       /* Do not report as an error when firmware returns ENOENT */
+                       if (aq_status == I40E_AQ_RC_ENOENT) {
+                               ret = I40E_SUCCESS;
+                       } else {
+                               PMD_DRV_LOG(ERR, "Failed to remove macvlan filter");
+                               goto DONE;
+                       }
                }
                num += actual_num;
        } while (num < total);