aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/i40e/i40e_adminq.c
diff options
context:
space:
mode:
authorShannon Nelson <shannon.nelson@intel.com>2014-07-09 03:46:09 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-07-24 06:32:40 -0400
commitcd552cb49e9ad5fd8748fb6b38a8bd38e9e4d86c (patch)
treef83278a853151b9370e542d5092df9c2862982b8 /drivers/net/ethernet/intel/i40e/i40e_adminq.c
parentefe1ac25d084fd56c5b809634a0444606c2a5cd3 (diff)
i40e/i40evf: Add nvmupdate support
This implements a state machine intended to support the userland tool for updating the device eeprom. The state machine implements one-shot reads, writes, multi-step write sessions, and checksum requests. If we're in the middle of a multi-step write session, no one should fire off other writes, however, one shot reads are valid. The userland tool is expected to keep track of its session status, arrange the placement and ordering of the writes, and deal with the checksum requirement. This patch also adds nvmupdate support to ethtool callbacks. The get_eeprom() and set_eeprom() services in ethtool are used here to facilitate the userland NVMUpdate tool. The 'magic' value in the get and set commands is used to pass additional control information for managing the read and write steps. The read operation works both as normally expected in the standard ethtool method, as well as with the extra NVM controls. The write operation works only for the expanded NVM functions - the normal ethtool method is not allowed because of the NVM semaphore management needed for multipart writes, as well as the checksum requirement. Change-ID: I1d84a170153a9f437906744e2e350fd68fe7563d Signed-off-by: Shannon Nelson <shannon.nelson@intel.com> Tested-by: Jim Young <jamesx.m.young@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_adminq.c')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_adminq.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
index 0e551f281d59..1e21fbb1359c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
@@ -38,8 +38,8 @@ static void i40e_resume_aq(struct i40e_hw *hw);
38 **/ 38 **/
39static inline bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc) 39static inline bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc)
40{ 40{
41 return (desc->opcode == i40e_aqc_opc_nvm_erase) || 41 return (desc->opcode == cpu_to_le16(i40e_aqc_opc_nvm_erase)) ||
42 (desc->opcode == i40e_aqc_opc_nvm_update); 42 (desc->opcode == cpu_to_le16(i40e_aqc_opc_nvm_update));
43} 43}
44 44
45/** 45/**
@@ -889,9 +889,6 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,
889 hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval; 889 hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval;
890 } 890 }
891 891
892 if (i40e_is_nvm_update_op(desc))
893 hw->aq.nvm_busy = true;
894
895 if (le16_to_cpu(desc->datalen) == buff_size) { 892 if (le16_to_cpu(desc->datalen) == buff_size) {
896 i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, 893 i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
897 "AQTX: desc and buffer writeback:\n"); 894 "AQTX: desc and buffer writeback:\n");
@@ -907,6 +904,9 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,
907 status = I40E_ERR_ADMIN_QUEUE_TIMEOUT; 904 status = I40E_ERR_ADMIN_QUEUE_TIMEOUT;
908 } 905 }
909 906
907 if (!status && i40e_is_nvm_update_op(desc))
908 hw->aq.nvm_busy = true;
909
910asq_send_command_error: 910asq_send_command_error:
911 mutex_unlock(&hw->aq.asq_mutex); 911 mutex_unlock(&hw->aq.asq_mutex);
912asq_send_command_exit: 912asq_send_command_exit:
@@ -988,9 +988,6 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw,
988 e->msg_size); 988 e->msg_size);
989 } 989 }
990 990
991 if (i40e_is_nvm_update_op(&e->desc))
992 hw->aq.nvm_busy = false;
993
994 i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: desc and buffer:\n"); 991 i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: desc and buffer:\n");
995 i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf); 992 i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf);
996 993
@@ -1023,6 +1020,14 @@ clean_arq_element_out:
1023 *pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc); 1020 *pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
1024 mutex_unlock(&hw->aq.arq_mutex); 1021 mutex_unlock(&hw->aq.arq_mutex);
1025 1022
1023 if (i40e_is_nvm_update_op(&e->desc)) {
1024 hw->aq.nvm_busy = false;
1025 if (hw->aq.nvm_release_on_done) {
1026 i40e_release_nvm(hw);
1027 hw->aq.nvm_release_on_done = false;
1028 }
1029 }
1030
1026 return ret_code; 1031 return ret_code;
1027} 1032}
1028 1033