]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
i40e/i40evf: add GetStatus command for nvmupdate
authorShannon Nelson <shannon.nelson@intel.com>
Fri, 28 Aug 2015 21:55:48 +0000 (17:55 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 18 Sep 2015 00:44:50 +0000 (17:44 -0700)
This adds a new GetStatus command so that the NVM update tool can query
the current status instead of doing fake write requests to probe for
readiness.

Change-ID: I671ec6ccd4dfc9dbac3a03b964589d693fda5cd8
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_nvm.c
drivers/net/ethernet/intel/i40e/i40e_type.h
drivers/net/ethernet/intel/i40evf/i40e_type.h

index e71ce23d57972310910ecb2ef680c6a0efb1bec3..7ff309945d6f06a680e59667394aee784cc9370b 100644 (file)
@@ -638,6 +638,7 @@ static char *i40e_nvm_update_state_str[] = {
        "I40E_NVMUPD_CSUM_CON",
        "I40E_NVMUPD_CSUM_SA",
        "I40E_NVMUPD_CSUM_LCB",
+       "I40E_NVMUPD_STATUS",
 };
 
 /**
@@ -654,10 +655,34 @@ i40e_status i40e_nvmupd_command(struct i40e_hw *hw,
                                u8 *bytes, int *perrno)
 {
        i40e_status status;
+       enum i40e_nvmupd_cmd upd_cmd;
 
        /* assume success */
        *perrno = 0;
 
+       /* early check for status command and debug msgs */
+       upd_cmd = i40e_nvmupd_validate_command(hw, cmd, perrno);
+
+       i40e_debug(hw, I40E_DEBUG_NVM, "%s state %d nvm_release_on_hold %d\n",
+                  i40e_nvm_update_state_str[upd_cmd],
+                  hw->nvmupd_state,
+                  hw->aq.nvm_release_on_done);
+
+       if (upd_cmd == I40E_NVMUPD_INVALID) {
+               *perrno = -EFAULT;
+               i40e_debug(hw, I40E_DEBUG_NVM,
+                          "i40e_nvmupd_validate_command returns %d errno %d\n",
+                          upd_cmd, *perrno);
+       }
+
+       /* a status request returns immediately rather than
+        * going into the state machine
+        */
+       if (upd_cmd == I40E_NVMUPD_STATUS) {
+               bytes[0] = hw->nvmupd_state;
+               return 0;
+       }
+
        switch (hw->nvmupd_state) {
        case I40E_NVMUPD_STATE_INIT:
                status = i40e_nvmupd_state_init(hw, cmd, bytes, perrno);
@@ -954,12 +979,13 @@ static enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
                                                 int *perrno)
 {
        enum i40e_nvmupd_cmd upd_cmd;
-       u8 transaction;
+       u8 module, transaction;
 
        /* anything that doesn't match a recognized case is an error */
        upd_cmd = I40E_NVMUPD_INVALID;
 
        transaction = i40e_nvmupd_get_transaction(cmd->config);
+       module = i40e_nvmupd_get_module(cmd->config);
 
        /* limits on data size */
        if ((cmd->data_size < 1) ||
@@ -986,6 +1012,10 @@ static enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
                case I40E_NVM_SA:
                        upd_cmd = I40E_NVMUPD_READ_SA;
                        break;
+               case I40E_NVM_EXEC:
+                       if (module == 0xf)
+                               upd_cmd = I40E_NVMUPD_STATUS;
+                       break;
                }
                break;
 
@@ -1018,17 +1048,7 @@ static enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
                }
                break;
        }
-       i40e_debug(hw, I40E_DEBUG_NVM, "%s state %d nvm_release_on_hold %d\n",
-                  i40e_nvm_update_state_str[upd_cmd],
-                  hw->nvmupd_state,
-                  hw->aq.nvm_release_on_done);
 
-       if (upd_cmd == I40E_NVMUPD_INVALID) {
-               *perrno = -EFAULT;
-               i40e_debug(hw, I40E_DEBUG_NVM,
-                          "i40e_nvmupd_validate_command returns %d errno %d\n",
-                          upd_cmd, *perrno);
-       }
        return upd_cmd;
 }
 
index a4fec8b7bef29d9a6a7f30f87d4448b5601e1eed..f63f538d75c58b8d4295b20738371dd4e7653ee1 100644 (file)
@@ -305,6 +305,7 @@ enum i40e_nvmupd_cmd {
        I40E_NVMUPD_CSUM_CON,
        I40E_NVMUPD_CSUM_SA,
        I40E_NVMUPD_CSUM_LCB,
+       I40E_NVMUPD_STATUS,
 };
 
 enum i40e_nvmupd_state {
@@ -329,6 +330,7 @@ enum i40e_nvmupd_state {
 #define I40E_NVM_SA            (I40E_NVM_SNT | I40E_NVM_LCB)
 #define I40E_NVM_ERA           0x4
 #define I40E_NVM_CSUM          0x8
+#define I40E_NVM_EXEC          0xf
 
 #define I40E_NVM_ADAPT_SHIFT   16
 #define I40E_NVM_ADAPT_MASK    (0xffff << I40E_NVM_ADAPT_SHIFT)
index cf865cc8d1b3c901630b3f588fd858b5f6b20c76..7f3c05c7655e7d6c8adfc2098fbf749c168524b4 100644 (file)
@@ -304,6 +304,7 @@ enum i40e_nvmupd_cmd {
        I40E_NVMUPD_CSUM_CON,
        I40E_NVMUPD_CSUM_SA,
        I40E_NVMUPD_CSUM_LCB,
+       I40E_NVMUPD_STATUS,
 };
 
 enum i40e_nvmupd_state {
@@ -328,6 +329,7 @@ enum i40e_nvmupd_state {
 #define I40E_NVM_SA            (I40E_NVM_SNT | I40E_NVM_LCB)
 #define I40E_NVM_ERA           0x4
 #define I40E_NVM_CSUM          0x8
+#define I40E_NVM_EXEC          0xf
 
 #define I40E_NVM_ADAPT_SHIFT   16
 #define I40E_NVM_ADAPT_MASK    (0xffff << I40E_NVM_ADAPT_SHIFT)