Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ice/ice_dcb.c
/* SPDX-License-Identifier: BSD-3-Clause */ | /* SPDX-License-Identifier: BSD-3-Clause */ | ||||
/* Copyright (c) 2020, Intel Corporation | /* Copyright (c) 2021, Intel Corporation | ||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions are met: | * modification, are permitted provided that the following conditions are met: | ||||
* | * | ||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 978 Lines • ▼ Show 20 Lines | if (dcb_enable) | ||||
cmd->cmd_flags = ICE_AQC_LINK_UP_DCB_CFG; | cmd->cmd_flags = ICE_AQC_LINK_UP_DCB_CFG; | ||||
return ice_aq_send_cmd(hw, &desc, NULL, 0, cd); | return ice_aq_send_cmd(hw, &desc, NULL, 0, cd); | ||||
} | } | ||||
/** | /** | ||||
* ice_cee_to_dcb_cfg | * ice_cee_to_dcb_cfg | ||||
* @cee_cfg: pointer to CEE configuration struct | * @cee_cfg: pointer to CEE configuration struct | ||||
* @dcbcfg: DCB configuration struct | * @pi: port information structure | ||||
* | * | ||||
* Convert CEE configuration from firmware to DCB configuration | * Convert CEE configuration from firmware to DCB configuration | ||||
*/ | */ | ||||
static void | static void | ||||
ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, | ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, | ||||
struct ice_dcbx_cfg *dcbcfg) | struct ice_port_info *pi) | ||||
{ | { | ||||
u32 status, tlv_status = LE32_TO_CPU(cee_cfg->tlv_status); | u32 status, tlv_status = LE32_TO_CPU(cee_cfg->tlv_status); | ||||
u32 ice_aqc_cee_status_mask, ice_aqc_cee_status_shift; | u32 ice_aqc_cee_status_mask, ice_aqc_cee_status_shift; | ||||
u8 i, j, err, sync, oper, app_index, ice_app_sel_type; | |||||
u16 app_prio = LE16_TO_CPU(cee_cfg->oper_app_prio); | u16 app_prio = LE16_TO_CPU(cee_cfg->oper_app_prio); | ||||
u8 i, err, sync, oper, app_index, ice_app_sel_type; | |||||
u16 ice_aqc_cee_app_mask, ice_aqc_cee_app_shift; | u16 ice_aqc_cee_app_mask, ice_aqc_cee_app_shift; | ||||
struct ice_dcbx_cfg *cmp_dcbcfg, *dcbcfg; | |||||
u16 ice_app_prot_id_type; | u16 ice_app_prot_id_type; | ||||
/* CEE PG data to ETS config */ | dcbcfg = &pi->qos_cfg.local_dcbx_cfg; | ||||
dcbcfg->dcbx_mode = ICE_DCBX_MODE_CEE; | |||||
dcbcfg->tlv_status = tlv_status; | |||||
/* CEE PG data */ | |||||
dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; | dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; | ||||
/* Note that the FW creates the oper_prio_tc nibbles reversed | /* Note that the FW creates the oper_prio_tc nibbles reversed | ||||
* from those in the CEE Priority Group sub-TLV. | * from those in the CEE Priority Group sub-TLV. | ||||
*/ | */ | ||||
for (i = 0; i < ICE_MAX_TRAFFIC_CLASS / 2; i++) { | for (i = 0; i < ICE_MAX_TRAFFIC_CLASS / 2; i++) { | ||||
dcbcfg->etscfg.prio_table[i * 2] = | dcbcfg->etscfg.prio_table[i * 2] = | ||||
((cee_cfg->oper_prio_tc[i] & ICE_CEE_PGID_PRIO_0_M) >> | ((cee_cfg->oper_prio_tc[i] & ICE_CEE_PGID_PRIO_0_M) >> | ||||
Show All 10 Lines | if (dcbcfg->etscfg.prio_table[i] == ICE_CEE_PGID_STRICT) { | ||||
/* Map it to next empty TC */ | /* Map it to next empty TC */ | ||||
dcbcfg->etscfg.prio_table[i] = cee_cfg->oper_num_tc - 1; | dcbcfg->etscfg.prio_table[i] = cee_cfg->oper_num_tc - 1; | ||||
dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_STRICT; | dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_STRICT; | ||||
} else { | } else { | ||||
dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_ETS; | dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_ETS; | ||||
} | } | ||||
} | } | ||||
/* CEE PFC data to ETS config */ | /* CEE PFC data */ | ||||
dcbcfg->pfc.pfcena = cee_cfg->oper_pfc_en; | dcbcfg->pfc.pfcena = cee_cfg->oper_pfc_en; | ||||
dcbcfg->pfc.pfccap = ICE_MAX_TRAFFIC_CLASS; | dcbcfg->pfc.pfccap = ICE_MAX_TRAFFIC_CLASS; | ||||
/* CEE APP TLV data */ | |||||
if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING) | |||||
cmp_dcbcfg = &pi->qos_cfg.desired_dcbx_cfg; | |||||
else | |||||
cmp_dcbcfg = &pi->qos_cfg.remote_dcbx_cfg; | |||||
app_index = 0; | app_index = 0; | ||||
for (i = 0; i < 3; i++) { | for (i = 0; i < 3; i++) { | ||||
if (i == 0) { | if (i == 0) { | ||||
/* FCoE APP */ | /* FCoE APP */ | ||||
ice_aqc_cee_status_mask = ICE_AQC_CEE_FCOE_STATUS_M; | ice_aqc_cee_status_mask = ICE_AQC_CEE_FCOE_STATUS_M; | ||||
ice_aqc_cee_status_shift = ICE_AQC_CEE_FCOE_STATUS_S; | ice_aqc_cee_status_shift = ICE_AQC_CEE_FCOE_STATUS_S; | ||||
ice_aqc_cee_app_mask = ICE_AQC_CEE_APP_FCOE_M; | ice_aqc_cee_app_mask = ICE_AQC_CEE_APP_FCOE_M; | ||||
ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_FCOE_S; | ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_FCOE_S; | ||||
ice_app_sel_type = ICE_APP_SEL_ETHTYPE; | ice_app_sel_type = ICE_APP_SEL_ETHTYPE; | ||||
ice_app_prot_id_type = ICE_APP_PROT_ID_FCOE; | ice_app_prot_id_type = ICE_APP_PROT_ID_FCOE; | ||||
} else if (i == 1) { | } else if (i == 1) { | ||||
/* iSCSI APP */ | /* iSCSI APP */ | ||||
ice_aqc_cee_status_mask = ICE_AQC_CEE_ISCSI_STATUS_M; | ice_aqc_cee_status_mask = ICE_AQC_CEE_ISCSI_STATUS_M; | ||||
ice_aqc_cee_status_shift = ICE_AQC_CEE_ISCSI_STATUS_S; | ice_aqc_cee_status_shift = ICE_AQC_CEE_ISCSI_STATUS_S; | ||||
ice_aqc_cee_app_mask = ICE_AQC_CEE_APP_ISCSI_M; | ice_aqc_cee_app_mask = ICE_AQC_CEE_APP_ISCSI_M; | ||||
ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_ISCSI_S; | ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_ISCSI_S; | ||||
ice_app_sel_type = ICE_APP_SEL_TCPIP; | ice_app_sel_type = ICE_APP_SEL_TCPIP; | ||||
ice_app_prot_id_type = ICE_APP_PROT_ID_ISCSI; | ice_app_prot_id_type = ICE_APP_PROT_ID_ISCSI; | ||||
for (j = 0; j < cmp_dcbcfg->numapps; j++) { | |||||
u16 prot_id = cmp_dcbcfg->app[j].prot_id; | |||||
u8 sel = cmp_dcbcfg->app[j].selector; | |||||
if (sel == ICE_APP_SEL_TCPIP && | |||||
(prot_id == ICE_APP_PROT_ID_ISCSI || | |||||
prot_id == ICE_APP_PROT_ID_ISCSI_860)) { | |||||
ice_app_prot_id_type = prot_id; | |||||
break; | |||||
} | |||||
} | |||||
} else { | } else { | ||||
/* FIP APP */ | /* FIP APP */ | ||||
ice_aqc_cee_status_mask = ICE_AQC_CEE_FIP_STATUS_M; | ice_aqc_cee_status_mask = ICE_AQC_CEE_FIP_STATUS_M; | ||||
ice_aqc_cee_status_shift = ICE_AQC_CEE_FIP_STATUS_S; | ice_aqc_cee_status_shift = ICE_AQC_CEE_FIP_STATUS_S; | ||||
ice_aqc_cee_app_mask = ICE_AQC_CEE_APP_FIP_M; | ice_aqc_cee_app_mask = ICE_AQC_CEE_APP_FIP_M; | ||||
ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_FIP_S; | ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_FIP_S; | ||||
ice_app_sel_type = ICE_APP_SEL_ETHTYPE; | ice_app_sel_type = ICE_APP_SEL_ETHTYPE; | ||||
ice_app_prot_id_type = ICE_APP_PROT_ID_FIP; | ice_app_prot_id_type = ICE_APP_PROT_ID_FIP; | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 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->qos_cfg.local_dcbx_cfg; | |||||
dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_CEE; | |||||
dcbx_cfg->tlv_status = LE32_TO_CPU(cee_cfg.tlv_status); | |||||
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); | ||||
ice_cee_to_dcb_cfg(&cee_cfg, pi); | |||||
} 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->qos_cfg.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; | ||||
▲ Show 20 Lines • Show All 500 Lines • Show Last 20 Lines |