Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ice/ice_dcb.c
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd) | ||||
if (persist) | if (persist) | ||||
cmd->command |= ICE_AQ_LLDP_AGENT_PERSIST_ENA; | cmd->command |= ICE_AQ_LLDP_AGENT_PERSIST_ENA; | ||||
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd); | return ice_aq_send_cmd(hw, &desc, NULL, 0, cd); | ||||
} | } | ||||
/** | /** | ||||
* ice_aq_set_lldp_mib - Set the LLDP MIB | |||||
* @hw: pointer to the HW struct | |||||
* @mib_type: Local, Remote or both Local and Remote MIBs | |||||
* @buf: pointer to the caller-supplied buffer to store the MIB block | |||||
* @buf_size: size of the buffer (in bytes) | |||||
* @cd: pointer to command details structure or NULL | |||||
* | |||||
* Set the LLDP MIB. (0x0A08) | |||||
*/ | |||||
enum ice_status | |||||
ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size, | |||||
struct ice_sq_cd *cd) | |||||
{ | |||||
struct ice_aqc_lldp_set_local_mib *cmd; | |||||
struct ice_aq_desc desc; | |||||
cmd = &desc.params.lldp_set_mib; | |||||
if (buf_size == 0 || !buf) | |||||
return ICE_ERR_PARAM; | |||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_lldp_set_local_mib); | |||||
desc.flags |= CPU_TO_LE16((u16)ICE_AQ_FLAG_RD); | |||||
desc.datalen = CPU_TO_LE16(buf_size); | |||||
cmd->type = mib_type; | |||||
cmd->length = CPU_TO_LE16(buf_size); | |||||
return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd); | |||||
} | |||||
/** | |||||
* ice_get_dcbx_status | * ice_get_dcbx_status | ||||
* @hw: pointer to the HW struct | * @hw: pointer to the HW struct | ||||
* | * | ||||
* Get the DCBX status from the Firmware | * Get the DCBX status from the Firmware | ||||
*/ | */ | ||||
u8 ice_get_dcbx_status(struct ice_hw *hw) | u8 ice_get_dcbx_status(struct ice_hw *hw) | ||||
{ | { | ||||
u32 reg; | u32 reg; | ||||
▲ Show 20 Lines • Show All 446 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* ice_lldp_to_dcb_cfg | * ice_lldp_to_dcb_cfg | ||||
* @lldpmib: LLDPDU to be parsed | * @lldpmib: LLDPDU to be parsed | ||||
* @dcbcfg: store for LLDPDU data | * @dcbcfg: store for LLDPDU data | ||||
* | * | ||||
* Parse DCB configuration from the LLDPDU | * Parse DCB configuration from the LLDPDU | ||||
*/ | */ | ||||
enum ice_status | enum ice_status ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg) | ||||
ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg) | |||||
{ | { | ||||
struct ice_lldp_org_tlv *tlv; | struct ice_lldp_org_tlv *tlv; | ||||
enum ice_status ret = ICE_SUCCESS; | enum ice_status ret = ICE_SUCCESS; | ||||
u16 offset = 0; | u16 offset = 0; | ||||
u16 typelen; | u16 typelen; | ||||
u16 type; | u16 type; | ||||
u16 len; | u16 len; | ||||
▲ Show 20 Lines • Show All 361 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct ice_dcbx_cfg *dcbx_cfg = NULL; | struct ice_dcbx_cfg *dcbx_cfg = NULL; | ||||
enum ice_status ret; | enum ice_status ret; | ||||
if (!pi) | if (!pi) | ||||
return ICE_ERR_PARAM; | return ICE_ERR_PARAM; | ||||
if (dcbx_mode == ICE_DCBX_MODE_IEEE) | if (dcbx_mode == ICE_DCBX_MODE_IEEE) | ||||
dcbx_cfg = &pi->local_dcbx_cfg; | dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; | ||||
else if (dcbx_mode == ICE_DCBX_MODE_CEE) | else if (dcbx_mode == ICE_DCBX_MODE_CEE) | ||||
dcbx_cfg = &pi->desired_dcbx_cfg; | dcbx_cfg = &pi->qos_cfg.desired_dcbx_cfg; | ||||
/* Get Local DCB Config in case of ICE_DCBX_MODE_IEEE | /* Get Local DCB Config in case of ICE_DCBX_MODE_IEEE | ||||
* or get CEE DCB Desired Config in case of ICE_DCBX_MODE_CEE | * or get CEE DCB Desired Config in case of ICE_DCBX_MODE_CEE | ||||
*/ | */ | ||||
ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_LOCAL, | ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_LOCAL, | ||||
ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID, dcbx_cfg); | ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID, dcbx_cfg); | ||||
if (ret) | if (ret) | ||||
goto out; | goto out; | ||||
/* Get Remote DCB Config */ | /* Get Remote DCB Config */ | ||||
dcbx_cfg = &pi->remote_dcbx_cfg; | dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg; | ||||
ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_REMOTE, | ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_REMOTE, | ||||
ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID, dcbx_cfg); | ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID, dcbx_cfg); | ||||
/* Don't treat ENOENT as an error for Remote MIBs */ | /* Don't treat ENOENT as an error for Remote MIBs */ | ||||
if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) | if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) | ||||
ret = ICE_SUCCESS; | ret = ICE_SUCCESS; | ||||
out: | out: | ||||
return ret; | return ret; | ||||
Show All 12 Lines | enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) | ||||
enum ice_status ret; | enum ice_status ret; | ||||
if (!pi) | if (!pi) | ||||
return ICE_ERR_PARAM; | return ICE_ERR_PARAM; | ||||
ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL); | ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL); | ||||
if (ret == ICE_SUCCESS) { | if (ret == ICE_SUCCESS) { | ||||
/* CEE mode */ | /* CEE mode */ | ||||
dcbx_cfg = &pi->local_dcbx_cfg; | dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; | ||||
dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_CEE; | dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_CEE; | ||||
dcbx_cfg->tlv_status = LE32_TO_CPU(cee_cfg.tlv_status); | dcbx_cfg->tlv_status = LE32_TO_CPU(cee_cfg.tlv_status); | ||||
ice_cee_to_dcb_cfg(&cee_cfg, dcbx_cfg); | ice_cee_to_dcb_cfg(&cee_cfg, dcbx_cfg); | ||||
ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_CEE); | ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_CEE); | ||||
} else if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) { | } else if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) { | ||||
/* CEE mode not enabled try querying IEEE data */ | /* CEE mode not enabled try querying IEEE data */ | ||||
dcbx_cfg = &pi->local_dcbx_cfg; | dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; | ||||
dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_IEEE; | dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_IEEE; | ||||
ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_IEEE); | ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_IEEE); | ||||
} | } | ||||
return ret; | return ret; | ||||
} | } | ||||
/** | /** | ||||
* 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 | * @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, bool enable_mib_change) | enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change) | ||||
{ | { | ||||
struct ice_port_info *pi = hw->port_info; | struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg; | ||||
enum ice_status ret = ICE_SUCCESS; | enum ice_status ret = ICE_SUCCESS; | ||||
if (!hw->func_caps.common_cap.dcb) | if (!hw->func_caps.common_cap.dcb) | ||||
return ICE_ERR_NOT_SUPPORTED; | return ICE_ERR_NOT_SUPPORTED; | ||||
pi->is_sw_lldp = true; | qos_cfg->is_sw_lldp = true; | ||||
/* Get DCBX status */ | /* Get DCBX status */ | ||||
pi->dcbx_status = ice_get_dcbx_status(hw); | qos_cfg->dcbx_status = ice_get_dcbx_status(hw); | ||||
if (pi->dcbx_status == ICE_DCBX_STATUS_DONE || | if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DONE || | ||||
pi->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS || | qos_cfg->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS || | ||||
pi->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) { | qos_cfg->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) { | ||||
/* Get current DCBX configuration */ | /* Get current DCBX configuration */ | ||||
ret = ice_get_dcb_cfg(pi); | ret = ice_get_dcb_cfg(hw->port_info); | ||||
if (ret) | if (ret) | ||||
return ret; | return ret; | ||||
pi->is_sw_lldp = false; | qos_cfg->is_sw_lldp = false; | ||||
} else if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) { | } else if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) { | ||||
return ICE_ERR_NOT_READY; | return ICE_ERR_NOT_READY; | ||||
} | } | ||||
/* Configure the LLDP MIB change event */ | /* Configure the LLDP MIB change event */ | ||||
if (enable_mib_change) { | if (enable_mib_change) { | ||||
ret = ice_aq_cfg_lldp_mib_change(hw, true, NULL); | ret = ice_aq_cfg_lldp_mib_change(hw, true, NULL); | ||||
if (ret) | if (ret) | ||||
pi->is_sw_lldp = true; | qos_cfg->is_sw_lldp = true; | ||||
} | } | ||||
return ret; | return ret; | ||||
} | } | ||||
/** | /** | ||||
* ice_cfg_lldp_mib_change | * ice_cfg_lldp_mib_change | ||||
* @hw: pointer to the HW struct | * @hw: pointer to the HW struct | ||||
* @ena_mib: enable/disable MIB change event | * @ena_mib: enable/disable MIB change event | ||||
* | * | ||||
* Configure (disable/enable) MIB | * Configure (disable/enable) MIB | ||||
*/ | */ | ||||
enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib) | enum ice_status ice_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_mib) | ||||
{ | { | ||||
struct ice_port_info *pi = hw->port_info; | struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg; | ||||
enum ice_status ret; | enum ice_status ret; | ||||
if (!hw->func_caps.common_cap.dcb) | if (!hw->func_caps.common_cap.dcb) | ||||
return ICE_ERR_NOT_SUPPORTED; | return ICE_ERR_NOT_SUPPORTED; | ||||
/* Get DCBX status */ | /* Get DCBX status */ | ||||
pi->dcbx_status = ice_get_dcbx_status(hw); | qos_cfg->dcbx_status = ice_get_dcbx_status(hw); | ||||
if (pi->dcbx_status == ICE_DCBX_STATUS_DIS) | if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) | ||||
return ICE_ERR_NOT_READY; | return ICE_ERR_NOT_READY; | ||||
ret = ice_aq_cfg_lldp_mib_change(hw, ena_mib, NULL); | ret = ice_aq_cfg_lldp_mib_change(hw, ena_mib, NULL); | ||||
if (!ret) | if (!ret) | ||||
pi->is_sw_lldp = !ena_mib; | qos_cfg->is_sw_lldp = !ena_mib; | ||||
return ret; | return ret; | ||||
} | } | ||||
/** | /** | ||||
* ice_add_ieee_ets_common_tlv | * ice_add_ieee_ets_common_tlv | ||||
* @buf: Data buffer to be populated with ice_dcb_ets_cfg data | * @buf: Data buffer to be populated with ice_dcb_ets_cfg data | ||||
* @ets_cfg: Container for ice_dcb_ets_cfg data | * @ets_cfg: Container for ice_dcb_ets_cfg data | ||||
▲ Show 20 Lines • Show All 280 Lines • ▼ Show 20 Lines | enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi) | ||||
u16 miblen; | u16 miblen; | ||||
if (!pi) | if (!pi) | ||||
return ICE_ERR_PARAM; | return ICE_ERR_PARAM; | ||||
hw = pi->hw; | hw = pi->hw; | ||||
/* update the HW local config */ | /* update the HW local config */ | ||||
dcbcfg = &pi->local_dcbx_cfg; | dcbcfg = &pi->qos_cfg.local_dcbx_cfg; | ||||
/* Allocate the LLDPDU */ | /* Allocate the LLDPDU */ | ||||
lldpmib = (u8 *)ice_malloc(hw, ICE_LLDPDU_SIZE); | lldpmib = (u8 *)ice_malloc(hw, ICE_LLDPDU_SIZE); | ||||
if (!lldpmib) | if (!lldpmib) | ||||
return ICE_ERR_NO_MEMORY; | return ICE_ERR_NO_MEMORY; | ||||
mib_type = SET_LOCAL_MIB_TYPE_LOCAL_MIB; | mib_type = SET_LOCAL_MIB_TYPE_LOCAL_MIB; | ||||
if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING) | if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING) | ||||
mib_type |= SET_LOCAL_MIB_TYPE_CEE_NON_WILLING; | mib_type |= SET_LOCAL_MIB_TYPE_CEE_NON_WILLING; | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* update the SW DB with the new TC changes | * update the SW DB with the new TC changes | ||||
*/ | */ | ||||
enum ice_status | enum ice_status | ||||
ice_update_port_tc_tree_cfg(struct ice_port_info *pi, | ice_update_port_tc_tree_cfg(struct ice_port_info *pi, | ||||
struct ice_aqc_port_ets_elem *buf) | struct ice_aqc_port_ets_elem *buf) | ||||
{ | { | ||||
struct ice_sched_node *node, *tc_node; | struct ice_sched_node *node, *tc_node; | ||||
struct ice_aqc_get_elem elem; | struct ice_aqc_txsched_elem_data elem; | ||||
enum ice_status status = ICE_SUCCESS; | enum ice_status status = ICE_SUCCESS; | ||||
u32 teid1, teid2; | u32 teid1, teid2; | ||||
u8 i, j; | u8 i, j; | ||||
if (!pi) | if (!pi) | ||||
return ICE_ERR_PARAM; | return ICE_ERR_PARAM; | ||||
/* suspend the missing TC nodes */ | /* suspend the missing TC nodes */ | ||||
for (i = 0; i < pi->root->num_children; i++) { | for (i = 0; i < pi->root->num_children; i++) { | ||||
Show All 25 Lines | for (i = 0; i < pi->root->num_children; i++) { | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (i < pi->root->num_children) | if (i < pi->root->num_children) | ||||
continue; | continue; | ||||
/* new TC */ | /* new TC */ | ||||
status = ice_sched_query_elem(pi->hw, teid2, &elem); | status = ice_sched_query_elem(pi->hw, teid2, &elem); | ||||
if (!status) | if (!status) | ||||
status = ice_sched_add_node(pi, 1, &elem.generic[0]); | status = ice_sched_add_node(pi, 1, &elem); | ||||
if (status) | if (status) | ||||
break; | break; | ||||
/* update the TC number */ | /* update the TC number */ | ||||
node = ice_sched_find_node_by_teid(pi->root, teid2); | node = ice_sched_find_node_by_teid(pi->root, teid2); | ||||
if (node) | if (node) | ||||
node->tc_num = j; | node->tc_num = j; | ||||
} | } | ||||
return status; | return status; | ||||
Show All 26 Lines |