net/ice/base: set status when global cfg lock is unavailable
authorQi Zhang <qi.z.zhang@intel.com>
Thu, 29 Aug 2019 02:36:26 +0000 (10:36 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 7 Oct 2019 13:00:53 +0000 (15:00 +0200)
To download the DDP file to the device, a PF first has to grab the
global configuration lock. When a PF can't grab this lock, set
hw->pkg_dwnld_status to ICE_AQ_RC_EEXIST.

Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
drivers/net/ice/base/ice_flex_pipe.c
drivers/net/ice/base/ice_type.h

index 7daaf10..f8dd1c4 100644 (file)
@@ -961,9 +961,19 @@ ice_dwnld_cfg_bufs(struct ice_hw *hw, struct ice_buf *bufs, u32 count)
        if (LE32_TO_CPU(bh->section_entry[0].type) & ICE_METADATA_BUF)
                return ICE_SUCCESS;
 
+       /* reset pkg_dwnld_status in case this function is called in the
+        * reset/rebuild flow
+        */
+       hw->pkg_dwnld_status = ICE_AQ_RC_OK;
+
        status = ice_acquire_global_cfg_lock(hw, ICE_RES_WRITE);
-       if (status)
+       if (status) {
+               if (status == ICE_ERR_AQ_NO_WORK)
+                       hw->pkg_dwnld_status = ICE_AQ_RC_EEXIST;
+               else
+                       hw->pkg_dwnld_status = hw->adminq.sq_last_status;
                return status;
+       }
 
        for (i = 0; i < count; i++) {
                bool last = ((i + 1) == count);
@@ -986,6 +996,9 @@ ice_dwnld_cfg_bufs(struct ice_hw *hw, struct ice_buf *bufs, u32 count)
 
                status = ice_aq_download_pkg(hw, bh, ICE_PKG_BUF_SIZE, last,
                                             &offset, &info, NULL);
+
+               /* Save AQ status from download package */
+               hw->pkg_dwnld_status = hw->adminq.sq_last_status;
                if (status) {
                        ice_debug(hw, ICE_DBG_PKG,
                                  "Pkg download failed: err %d off %d inf %d\n",
index dc04176..541e298 100644 (file)
@@ -775,6 +775,8 @@ struct ice_hw {
        u8 active_pkg_name[ICE_PKG_NAME_SIZE];
        u8 active_pkg_in_nvm;
 
+       enum ice_aq_err pkg_dwnld_status;
+
        /* Driver's package ver - (from the Metadata seg) */
        struct ice_pkg_ver pkg_ver;
        u8 pkg_name[ICE_PKG_NAME_SIZE];