Commit 54dea0e7 authored by Chinh T Cao's avatar Chinh T Cao Committed by Jeff Kirsher

i40e: Update i40e_init_dcb to return correct error

Modify the i40e_init_dcb to return the correct error when LLDP or DCBX
is not in operational state.
Signed-off-by: default avatarChinh T Cao <chinh.t.cao@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 26221331
...@@ -863,22 +863,23 @@ i40e_status i40e_get_dcb_config(struct i40e_hw *hw) ...@@ -863,22 +863,23 @@ i40e_status i40e_get_dcb_config(struct i40e_hw *hw)
/** /**
* 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
**/ **/
i40e_status i40e_init_dcb(struct i40e_hw *hw) i40e_status i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change)
{ {
i40e_status ret = 0; i40e_status ret = 0;
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 */
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);
...@@ -887,7 +888,7 @@ i40e_status i40e_init_dcb(struct i40e_hw *hw) ...@@ -887,7 +888,7 @@ i40e_status i40e_init_dcb(struct i40e_hw *hw)
/* 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 */
...@@ -896,26 +897,19 @@ i40e_status i40e_init_dcb(struct i40e_hw *hw) ...@@ -896,26 +897,19 @@ i40e_status i40e_init_dcb(struct i40e_hw *hw)
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 */
ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL); if (enable_mib_change)
if (ret) ret = i40e_aq_cfg_lldp_mib_change_event(hw, true, NULL);
return ret;
return ret; return ret;
} }
......
...@@ -124,5 +124,5 @@ i40e_status i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type, ...@@ -124,5 +124,5 @@ i40e_status i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
u8 bridgetype, u8 bridgetype,
struct i40e_dcbx_config *dcbcfg); struct i40e_dcbx_config *dcbcfg);
i40e_status i40e_get_dcb_config(struct i40e_hw *hw); i40e_status i40e_get_dcb_config(struct i40e_hw *hw);
i40e_status i40e_init_dcb(struct i40e_hw *hw); i40e_status i40e_init_dcb(struct i40e_hw *hw, bool enable_mib_change);
#endif /* _I40E_DCB_H_ */ #endif /* _I40E_DCB_H_ */
...@@ -6411,7 +6411,7 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf) ...@@ -6411,7 +6411,7 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf)
goto out; goto out;
/* Get the initial DCB configuration */ /* Get the initial DCB configuration */
err = i40e_init_dcb(hw); err = i40e_init_dcb(hw, true);
if (!err) { if (!err) {
/* Device/Function is not DCBX capable */ /* Device/Function is not DCBX capable */
if ((!hw->func_caps.dcb) || if ((!hw->func_caps.dcb) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment