aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/i40e/i40e_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_common.c')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_common.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index c65f4e8e6cee..f4e502a305ff 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -2121,6 +2121,47 @@ i40e_aq_read_nvm_exit:
2121 return status; 2121 return status;
2122} 2122}
2123 2123
2124/**
2125 * i40e_aq_erase_nvm
2126 * @hw: pointer to the hw struct
2127 * @module_pointer: module pointer location in words from the NVM beginning
2128 * @offset: offset in the module (expressed in 4 KB from module's beginning)
2129 * @length: length of the section to be erased (expressed in 4 KB)
2130 * @last_command: tells if this is the last command in a series
2131 * @cmd_details: pointer to command details structure or NULL
2132 *
2133 * Erase the NVM sector using the admin queue commands
2134 **/
2135i40e_status i40e_aq_erase_nvm(struct i40e_hw *hw, u8 module_pointer,
2136 u32 offset, u16 length, bool last_command,
2137 struct i40e_asq_cmd_details *cmd_details)
2138{
2139 struct i40e_aq_desc desc;
2140 struct i40e_aqc_nvm_update *cmd =
2141 (struct i40e_aqc_nvm_update *)&desc.params.raw;
2142 i40e_status status;
2143
2144 /* In offset the highest byte must be zeroed. */
2145 if (offset & 0xFF000000) {
2146 status = I40E_ERR_PARAM;
2147 goto i40e_aq_erase_nvm_exit;
2148 }
2149
2150 i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_nvm_erase);
2151
2152 /* If this is the last command in a series, set the proper flag. */
2153 if (last_command)
2154 cmd->command_flags |= I40E_AQ_NVM_LAST_CMD;
2155 cmd->module_pointer = module_pointer;
2156 cmd->offset = cpu_to_le32(offset);
2157 cmd->length = cpu_to_le16(length);
2158
2159 status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details);
2160
2161i40e_aq_erase_nvm_exit:
2162 return status;
2163}
2164
2124#define I40E_DEV_FUNC_CAP_SWITCH_MODE 0x01 2165#define I40E_DEV_FUNC_CAP_SWITCH_MODE 0x01
2125#define I40E_DEV_FUNC_CAP_MGMT_MODE 0x02 2166#define I40E_DEV_FUNC_CAP_MGMT_MODE 0x02
2126#define I40E_DEV_FUNC_CAP_NPAR 0x03 2167#define I40E_DEV_FUNC_CAP_NPAR 0x03
@@ -2351,6 +2392,53 @@ exit:
2351} 2392}
2352 2393
2353/** 2394/**
2395 * i40e_aq_update_nvm
2396 * @hw: pointer to the hw struct
2397 * @module_pointer: module pointer location in words from the NVM beginning
2398 * @offset: byte offset from the module beginning
2399 * @length: length of the section to be written (in bytes from the offset)
2400 * @data: command buffer (size [bytes] = length)
2401 * @last_command: tells if this is the last command in a series
2402 * @cmd_details: pointer to command details structure or NULL
2403 *
2404 * Update the NVM using the admin queue commands
2405 **/
2406i40e_status i40e_aq_update_nvm(struct i40e_hw *hw, u8 module_pointer,
2407 u32 offset, u16 length, void *data,
2408 bool last_command,
2409 struct i40e_asq_cmd_details *cmd_details)
2410{
2411 struct i40e_aq_desc desc;
2412 struct i40e_aqc_nvm_update *cmd =
2413 (struct i40e_aqc_nvm_update *)&desc.params.raw;
2414 i40e_status status;
2415
2416 /* In offset the highest byte must be zeroed. */
2417 if (offset & 0xFF000000) {
2418 status = I40E_ERR_PARAM;
2419 goto i40e_aq_update_nvm_exit;
2420 }
2421
2422 i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_nvm_update);
2423
2424 /* If this is the last command in a series, set the proper flag. */
2425 if (last_command)
2426 cmd->command_flags |= I40E_AQ_NVM_LAST_CMD;
2427 cmd->module_pointer = module_pointer;
2428 cmd->offset = cpu_to_le32(offset);
2429 cmd->length = cpu_to_le16(length);
2430
2431 desc.flags |= cpu_to_le16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
2432 if (length > I40E_AQ_LARGE_BUF)
2433 desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB);
2434
2435 status = i40e_asq_send_command(hw, &desc, data, length, cmd_details);
2436
2437i40e_aq_update_nvm_exit:
2438 return status;
2439}
2440
2441/**
2354 * i40e_aq_get_lldp_mib 2442 * i40e_aq_get_lldp_mib
2355 * @hw: pointer to the hw struct 2443 * @hw: pointer to the hw struct
2356 * @bridge_type: type of bridge requested 2444 * @bridge_type: type of bridge requested