Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixl/i40e_dcb.c
Show First 20 Lines • Show All 887 Lines • ▼ Show 20 Lines | |||||
out: | out: | ||||
return ret; | return ret; | ||||
} | } | ||||
/** | /** | ||||
* i40e_init_dcb | * i40e_init_dcb | ||||
* @hw: pointer to the hw struct | * @hw: pointer to the hw struct | ||||
* @enable_mib_change: enable mib change event | |||||
* | * | ||||
* Update DCB configuration from the Firmware | * Update DCB configuration from the Firmware | ||||
**/ | **/ | ||||
enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw) | enum i40e_status_code i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change) | ||||
{ | { | ||||
enum i40e_status_code ret = I40E_SUCCESS; | enum i40e_status_code ret = I40E_SUCCESS; | ||||
struct i40e_lldp_variables lldp_cfg; | struct i40e_lldp_variables lldp_cfg; | ||||
u8 adminstatus = 0; | u8 adminstatus = 0; | ||||
if (!hw->func_caps.dcb) | if (!hw->func_caps.dcb) | ||||
return ret; | return I40E_NOT_SUPPORTED; | ||||
/* Read LLDP NVM area */ | /* Read LLDP NVM area */ | ||||
if (hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT) { | |||||
u8 offset = 0; | |||||
if (hw->mac.type == I40E_MAC_XL710) | |||||
offset = I40E_LLDP_CURRENT_STATUS_XL710_OFFSET; | |||||
else if (hw->mac.type == I40E_MAC_X722) | |||||
offset = I40E_LLDP_CURRENT_STATUS_X722_OFFSET; | |||||
else | |||||
return I40E_NOT_SUPPORTED; | |||||
ret = i40e_read_nvm_module_data(hw, | |||||
I40E_SR_EMP_SR_SETTINGS_PTR, | |||||
offset, | |||||
I40E_LLDP_CURRENT_STATUS_OFFSET, | |||||
I40E_LLDP_CURRENT_STATUS_SIZE, | |||||
&lldp_cfg.adminstatus); | |||||
} else { | |||||
ret = i40e_read_lldp_cfg(hw, &lldp_cfg); | ret = i40e_read_lldp_cfg(hw, &lldp_cfg); | ||||
} | |||||
if (ret) | if (ret) | ||||
return ret; | return I40E_ERR_NOT_READY; | ||||
/* Get the LLDP AdminStatus for the current port */ | /* Get the LLDP AdminStatus for the current port */ | ||||
adminstatus = lldp_cfg.adminstatus >> (hw->port * 4); | adminstatus = lldp_cfg.adminstatus >> (hw->port * 4); | ||||
adminstatus &= 0xF; | adminstatus &= 0xF; | ||||
/* LLDP agent disabled */ | /* LLDP agent disabled */ | ||||
if (!adminstatus) { | if (!adminstatus) { | ||||
hw->dcbx_status = I40E_DCBX_STATUS_DISABLED; | hw->dcbx_status = I40E_DCBX_STATUS_DISABLED; | ||||
return ret; | return I40E_ERR_NOT_READY; | ||||
} | } | ||||
/* Get DCBX status */ | /* Get DCBX status */ | ||||
ret = i40e_get_dcbx_status(hw, &hw->dcbx_status); | ret = i40e_get_dcbx_status(hw, &hw->dcbx_status); | ||||
if (ret) | if (ret) | ||||
return ret; | return ret; | ||||
/* Check the DCBX Status */ | /* Check the DCBX Status */ | ||||
switch (hw->dcbx_status) { | if (hw->dcbx_status == I40E_DCBX_STATUS_DONE || | ||||
case I40E_DCBX_STATUS_DONE: | hw->dcbx_status == I40E_DCBX_STATUS_IN_PROGRESS) { | ||||
case I40E_DCBX_STATUS_IN_PROGRESS: | |||||
/* Get current DCBX configuration */ | /* Get current DCBX configuration */ | ||||
ret = i40e_get_dcb_config(hw); | ret = i40e_get_dcb_config(hw); | ||||
if (ret) | if (ret) | ||||
return ret; | return ret; | ||||
break; | } else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) { | ||||
case I40E_DCBX_STATUS_DISABLED: | return I40E_ERR_NOT_READY; | ||||
return ret; | |||||
case I40E_DCBX_STATUS_NOT_STARTED: | |||||
case I40E_DCBX_STATUS_MULTIPLE_PEERS: | |||||
default: | |||||
break; | |||||
} | } | ||||
/* Configure the LLDP MIB change event */ | /* Configure the LLDP MIB change event */ | ||||
if (enable_mib_change) | |||||
ret = i40e_aq_cfg_lldp_mib_change_event(hw, TRUE, NULL); | ret = i40e_aq_cfg_lldp_mib_change_event(hw, TRUE, NULL); | ||||
return ret; | |||||
} | |||||
/** | |||||
* i40e_get_fw_lldp_status | |||||
* @hw: pointer to the hw struct | |||||
* @lldp_status: pointer to the status enum | |||||
* | |||||
* Get status of FW Link Layer Discovery Protocol (LLDP) Agent. | |||||
* Status of agent is reported via @lldp_status parameter. | |||||
**/ | |||||
enum i40e_status_code | |||||
i40e_get_fw_lldp_status(struct i40e_hw *hw, | |||||
enum i40e_get_fw_lldp_status_resp *lldp_status) | |||||
{ | |||||
enum i40e_status_code ret; | |||||
struct i40e_virt_mem mem; | |||||
u8 *lldpmib; | |||||
if (!lldp_status) | |||||
return I40E_ERR_PARAM; | |||||
/* Allocate buffer for the LLDPDU */ | |||||
ret = i40e_allocate_virt_mem(hw, &mem, I40E_LLDPDU_SIZE); | |||||
if (ret) | if (ret) | ||||
return ret; | return ret; | ||||
lldpmib = (u8 *)mem.va; | |||||
ret = i40e_aq_get_lldp_mib(hw, 0, 0, (void *)lldpmib, | |||||
I40E_LLDPDU_SIZE, NULL, NULL, NULL); | |||||
if (ret == I40E_SUCCESS) { | |||||
*lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED; | |||||
} else if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT) { | |||||
/* MIB is not available yet but the agent is running */ | |||||
*lldp_status = I40E_GET_FW_LLDP_STATUS_ENABLED; | |||||
ret = I40E_SUCCESS; | |||||
} else if (hw->aq.asq_last_status == I40E_AQ_RC_EPERM) { | |||||
*lldp_status = I40E_GET_FW_LLDP_STATUS_DISABLED; | |||||
ret = I40E_SUCCESS; | |||||
} | |||||
i40e_free_virt_mem(hw, &mem); | |||||
return ret; | return ret; | ||||
} | } | ||||
/** | /** | ||||
* i40e_add_ieee_ets_tlv - Prepare ETS TLV in IEEE format | * i40e_add_ieee_ets_tlv - Prepare ETS TLV in IEEE format | ||||
* @tlv: Fill the ETS config data in IEEE format | * @tlv: Fill the ETS config data in IEEE format | ||||
* @dcbcfg: Local store which holds the DCB Config | * @dcbcfg: Local store which holds the DCB Config | ||||
* | * | ||||
* Prepare IEEE 802.1Qaz ETS CFG TLV | * Prepare IEEE 802.1Qaz ETS CFG TLV | ||||
**/ | **/ | ||||
static void i40e_add_ieee_ets_tlv(struct i40e_lldp_org_tlv *tlv, | static void i40e_add_ieee_ets_tlv(struct i40e_lldp_org_tlv *tlv, | ||||
▲ Show 20 Lines • Show All 276 Lines • ▼ Show 20 Lines | enum i40e_status_code i40e_set_dcb_config(struct i40e_hw *hw) | ||||
ret = i40e_aq_set_lldp_mib(hw, mib_type, (void *)lldpmib, miblen, NULL); | ret = i40e_aq_set_lldp_mib(hw, mib_type, (void *)lldpmib, miblen, NULL); | ||||
i40e_free_virt_mem(hw, &mem); | i40e_free_virt_mem(hw, &mem); | ||||
return ret; | return ret; | ||||
} | } | ||||
/** | /** | ||||
* i40e_dcb_config_to_lldp - Convert Dcbconfig to MIB format | * i40e_dcb_config_to_lldp - Convert Dcbconfig to MIB format | ||||
* @hw: pointer to the hw struct | * @lldpmib: pointer to mib to be output | ||||
* @miblen: pointer to u16 for length of lldpmib | |||||
* @dcbcfg: store for LLDPDU data | * @dcbcfg: store for LLDPDU data | ||||
* | * | ||||
* send DCB configuration to FW | * send DCB configuration to FW | ||||
**/ | **/ | ||||
enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen, | enum i40e_status_code i40e_dcb_config_to_lldp(u8 *lldpmib, u16 *miblen, | ||||
struct i40e_dcbx_config *dcbcfg) | struct i40e_dcbx_config *dcbcfg) | ||||
{ | { | ||||
u16 length, offset = 0, tlvid = I40E_TLV_ID_START; | u16 length, offset = 0, tlvid = I40E_TLV_ID_START; | ||||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |