net/ice/base: add function to configure MIB

Decouple ice_cfg_lldp_mib_change from the ice_init_dcb function call.

Signed-off-by: Chinh T Cao <chinh.t.cao@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
Leyi Rong 2019-06-19 23:17:39 +08:00 committed by Ferruh Yigit
parent 83a148038e
commit 53c7ea0c53
2 changed files with 36 additions and 5 deletions

View File

@ -927,10 +927,11 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi)
/** /**
* ice_init_dcb * ice_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 ice_status ice_init_dcb(struct ice_hw *hw) enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change)
{ {
struct ice_port_info *pi = hw->port_info; struct ice_port_info *pi = hw->port_info;
enum ice_status ret = ICE_SUCCESS; enum ice_status ret = ICE_SUCCESS;
@ -952,13 +953,42 @@ enum ice_status ice_init_dcb(struct ice_hw *hw)
return ret; return ret;
} else if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) { } else if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) {
return ICE_ERR_NOT_READY; return ICE_ERR_NOT_READY;
} else if (pi->dcbx_status == ICE_DCBX_STATUS_MULTIPLE_PEERS) {
} }
/* Configure the LLDP MIB change event */ /* Configure the LLDP MIB change event */
ret = ice_aq_cfg_lldp_mib_change(hw, true, NULL); if (enable_mib_change) {
ret = ice_aq_cfg_lldp_mib_change(hw, true, NULL);
if (!ret)
pi->is_sw_lldp = false;
}
return ret;
}
/**
* ice_cfg_lldp_mib_change
* @hw: pointer to the HW struct
* @ena_mib: enable/disable MIB change event
*
* Configure (disable/enable) MIB
*/
enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib)
{
struct ice_port_info *pi = hw->port_info;
enum ice_status ret;
if (!hw->func_caps.common_cap.dcb)
return ICE_ERR_NOT_SUPPORTED;
/* Get DCBX status */
pi->dcbx_status = ice_get_dcbx_status(hw);
if (pi->dcbx_status == ICE_DCBX_STATUS_DIS)
return ICE_ERR_NOT_READY;
ret = ice_aq_cfg_lldp_mib_change(hw, ena_mib, NULL);
if (!ret) if (!ret)
pi->is_sw_lldp = false; pi->is_sw_lldp = !ena_mib;
return ret; return ret;
} }

View File

@ -197,7 +197,7 @@ ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,
struct ice_dcbx_cfg *dcbcfg); struct ice_dcbx_cfg *dcbcfg);
enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi); enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi);
enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi); enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi);
enum ice_status ice_init_dcb(struct ice_hw *hw); enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change);
void ice_dcb_cfg_to_lldp(u8 *lldpmib, u16 *miblen, struct ice_dcbx_cfg *dcbcfg); void ice_dcb_cfg_to_lldp(u8 *lldpmib, u16 *miblen, struct ice_dcbx_cfg *dcbcfg);
enum ice_status enum ice_status
ice_query_port_ets(struct ice_port_info *pi, ice_query_port_ets(struct ice_port_info *pi,
@ -217,6 +217,7 @@ enum ice_status ice_aq_start_lldp(struct ice_hw *hw, struct ice_sq_cd *cd);
enum ice_status enum ice_status
ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent, ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent,
bool *dcbx_agent_status, struct ice_sq_cd *cd); bool *dcbx_agent_status, struct ice_sq_cd *cd);
enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib);
enum ice_status enum ice_status
ice_aq_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_update, ice_aq_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_update,
struct ice_sq_cd *cd); struct ice_sq_cd *cd);