net/i40e/base: get SAN MAC address

Add function that reads the adapter's Storage Area Network (SAN) MAC
address from NVM.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
Qi Zhang 2016-08-25 16:05:17 -04:00 committed by Bruce Richardson
parent 68cae24ffd
commit fc1d8b8a16
2 changed files with 27 additions and 0 deletions

View File

@ -1188,6 +1188,32 @@ void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 queue, bool enable)
wr32(hw, I40E_GLLAN_TXPRE_QDIS(reg_block), reg_val);
}
/**
* i40e_get_san_mac_addr - get SAN MAC address
* @hw: pointer to the HW structure
* @mac_addr: pointer to SAN MAC address
*
* Reads the adapter's SAN MAC address from NVM
**/
enum i40e_status_code i40e_get_san_mac_addr(struct i40e_hw *hw,
u8 *mac_addr)
{
struct i40e_aqc_mac_address_read_data addrs;
enum i40e_status_code status;
u16 flags = 0;
status = i40e_aq_mac_address_read(hw, &flags, &addrs, NULL);
if (status)
return status;
if (flags & I40E_AQC_SAN_ADDR_VALID)
memcpy(mac_addr, &addrs.pf_san_mac, sizeof(addrs.pf_san_mac));
else
status = I40E_ERR_INVALID_MAC_ADDR;
return status;
}
/**
* i40e_read_pba_string - Reads part number string from EEPROM
* @hw: pointer to hardware structure

View File

@ -440,6 +440,7 @@ enum i40e_status_code i40e_get_port_mac_addr(struct i40e_hw *hw, u8 *mac_addr);
enum i40e_status_code i40e_read_pba_string(struct i40e_hw *hw, u8 *pba_num,
u32 pba_num_size);
void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 queue, bool enable);
enum i40e_status_code i40e_get_san_mac_addr(struct i40e_hw *hw, u8 *mac_addr);
enum i40e_aq_link_speed i40e_get_link_speed(struct i40e_hw *hw);
/* prototype for functions used for NVM access */
enum i40e_status_code i40e_init_nvm(struct i40e_hw *hw);