Lines Matching +full:tcs +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0
13 * @buf: pointer to the caller-supplied buffer to store the MIB block
33 return -EINVAL; in ice_aq_get_lldp_mib()
37 cmd->type = mib_type & ICE_AQ_LLDP_MIB_TYPE_M; in ice_aq_get_lldp_mib()
38 cmd->type |= FIELD_PREP(ICE_AQ_LLDP_BRID_TYPE_M, bridge_type); in ice_aq_get_lldp_mib()
45 *local_len = le16_to_cpu(cmd->local_len); in ice_aq_get_lldp_mib()
47 *remote_len = le16_to_cpu(cmd->remote_len); in ice_aq_get_lldp_mib()
74 cmd->command |= ICE_AQ_LLDP_MIB_UPDATE_DIS; in ice_aq_cfg_lldp_mib_change()
76 cmd->command |= FIELD_PREP(ICE_AQ_LLDP_MIB_PENDING_M, in ice_aq_cfg_lldp_mib_change()
105 cmd->command |= ICE_AQ_LLDP_AGENT_SHUTDOWN; in ice_aq_stop_lldp()
108 cmd->command |= ICE_AQ_LLDP_AGENT_PERSIST_DIS; in ice_aq_stop_lldp()
130 cmd->command = ICE_AQ_LLDP_AGENT_START; in ice_aq_start_lldp()
133 cmd->command |= ICE_AQ_LLDP_AGENT_PERSIST_ENA; in ice_aq_start_lldp()
162 u8 offset = 0; in ice_parse_ieee_ets_common_tlv() local
167 * ----------------------------------------- in ice_parse_ieee_ets_common_tlv()
169 * ----------------------------------------- in ice_parse_ieee_ets_common_tlv()
171 * ----------------------------------------- in ice_parse_ieee_ets_common_tlv()
174 ets_cfg->prio_table[i * 2] = in ice_parse_ieee_ets_common_tlv()
175 FIELD_GET(ICE_IEEE_ETS_PRIO_1_M, buf[offset]); in ice_parse_ieee_ets_common_tlv()
176 ets_cfg->prio_table[i * 2 + 1] = in ice_parse_ieee_ets_common_tlv()
177 FIELD_GET(ICE_IEEE_ETS_PRIO_0_M, buf[offset]); in ice_parse_ieee_ets_common_tlv()
178 offset++; in ice_parse_ieee_ets_common_tlv()
183 * --------------------------------- in ice_parse_ieee_ets_common_tlv()
185 * --------------------------------- in ice_parse_ieee_ets_common_tlv()
189 * --------------------------------- in ice_parse_ieee_ets_common_tlv()
191 * --------------------------------- in ice_parse_ieee_ets_common_tlv()
194 ets_cfg->tcbwtable[i] = buf[offset]; in ice_parse_ieee_ets_common_tlv()
195 ets_cfg->tsatable[i] = buf[ICE_MAX_TRAFFIC_CLASS + offset++]; in ice_parse_ieee_ets_common_tlv()
211 u8 *buf = tlv->tlvinfo; in ice_parse_ieee_etscfg_tlv()
214 * -------------------------- in ice_parse_ieee_etscfg_tlv()
215 * |will-|CBS | Re- | Max | in ice_parse_ieee_etscfg_tlv()
216 * |ing | |served| TCs | in ice_parse_ieee_etscfg_tlv()
217 * -------------------------- in ice_parse_ieee_etscfg_tlv()
220 etscfg = &dcbcfg->etscfg; in ice_parse_ieee_etscfg_tlv()
221 etscfg->willing = FIELD_GET(ICE_IEEE_ETS_WILLING_M, buf[0]); in ice_parse_ieee_etscfg_tlv()
222 etscfg->cbs = FIELD_GET(ICE_IEEE_ETS_CBS_M, buf[0]); in ice_parse_ieee_etscfg_tlv()
223 etscfg->maxtcs = FIELD_GET(ICE_IEEE_ETS_MAXTC_M, buf[0]); in ice_parse_ieee_etscfg_tlv()
225 /* Begin parsing at Priority Assignment Table (offset 1 in buf) */ in ice_parse_ieee_etscfg_tlv()
240 u8 *buf = tlv->tlvinfo; in ice_parse_ieee_etsrec_tlv()
242 /* Begin parsing at Priority Assignment Table (offset 1 in buf) */ in ice_parse_ieee_etsrec_tlv()
243 ice_parse_ieee_ets_common_tlv(&buf[1], &dcbcfg->etsrec); in ice_parse_ieee_etsrec_tlv()
257 u8 *buf = tlv->tlvinfo; in ice_parse_ieee_pfccfg_tlv()
259 /* ---------------------------------------- in ice_parse_ieee_pfccfg_tlv()
260 * |will-|MBC | Re- | PFC | PFC Enable | in ice_parse_ieee_pfccfg_tlv()
262 * ----------------------------------------- in ice_parse_ieee_pfccfg_tlv()
265 dcbcfg->pfc.willing = FIELD_GET(ICE_IEEE_PFC_WILLING_M, buf[0]); in ice_parse_ieee_pfccfg_tlv()
266 dcbcfg->pfc.mbc = FIELD_GET(ICE_IEEE_PFC_MBC_M, buf[0]); in ice_parse_ieee_pfccfg_tlv()
267 dcbcfg->pfc.pfccap = FIELD_GET(ICE_IEEE_PFC_CAP_M, buf[0]); in ice_parse_ieee_pfccfg_tlv()
268 dcbcfg->pfc.pfcena = buf[1]; in ice_parse_ieee_pfccfg_tlv()
282 u16 offset = 0; in ice_parse_ieee_app_tlv() local
288 typelen = ntohs(tlv->typelen); in ice_parse_ieee_app_tlv()
290 buf = tlv->tlvinfo; in ice_parse_ieee_app_tlv()
295 len -= (sizeof(tlv->ouisubtype) + 1); in ice_parse_ieee_app_tlv()
297 /* Move offset to App Priority Table */ in ice_parse_ieee_app_tlv()
298 offset++; in ice_parse_ieee_app_tlv()
302 * ----------------------------------------- in ice_parse_ieee_app_tlv()
304 * ----------------------------------------- in ice_parse_ieee_app_tlv()
306 * ----------------------------------------- in ice_parse_ieee_app_tlv()
308 while (offset < len) { in ice_parse_ieee_app_tlv()
309 dcbcfg->app[i].priority = FIELD_GET(ICE_IEEE_APP_PRIO_M, in ice_parse_ieee_app_tlv()
310 buf[offset]); in ice_parse_ieee_app_tlv()
311 dcbcfg->app[i].selector = FIELD_GET(ICE_IEEE_APP_SEL_M, in ice_parse_ieee_app_tlv()
312 buf[offset]); in ice_parse_ieee_app_tlv()
313 dcbcfg->app[i].prot_id = (buf[offset + 1] << 0x8) | in ice_parse_ieee_app_tlv()
314 buf[offset + 2]; in ice_parse_ieee_app_tlv()
316 offset += 3; in ice_parse_ieee_app_tlv()
322 dcbcfg->numapps = i; in ice_parse_ieee_app_tlv()
339 ouisubtype = ntohl(tlv->ouisubtype); in ice_parse_ieee_tlv()
371 u8 *buf = tlv->tlvinfo; in ice_parse_cee_pgcfg_tlv()
372 u16 offset = 0; in ice_parse_cee_pgcfg_tlv() local
375 etscfg = &dcbcfg->etscfg; in ice_parse_cee_pgcfg_tlv()
377 if (tlv->en_will_err & ICE_CEE_FEAT_TLV_WILLING_M) in ice_parse_cee_pgcfg_tlv()
378 etscfg->willing = 1; in ice_parse_cee_pgcfg_tlv()
380 etscfg->cbs = 0; in ice_parse_cee_pgcfg_tlv()
383 * ----------------------------------------- in ice_parse_cee_pgcfg_tlv()
385 * ----------------------------------------- in ice_parse_cee_pgcfg_tlv()
387 * ----------------------------------------- in ice_parse_cee_pgcfg_tlv()
390 etscfg->prio_table[i * 2] = in ice_parse_cee_pgcfg_tlv()
391 FIELD_GET(ICE_CEE_PGID_PRIO_1_M, buf[offset]); in ice_parse_cee_pgcfg_tlv()
392 etscfg->prio_table[i * 2 + 1] = in ice_parse_cee_pgcfg_tlv()
393 FIELD_GET(ICE_CEE_PGID_PRIO_0_M, buf[offset]); in ice_parse_cee_pgcfg_tlv()
394 offset++; in ice_parse_cee_pgcfg_tlv()
399 * --------------------------------- in ice_parse_cee_pgcfg_tlv()
401 * --------------------------------- in ice_parse_cee_pgcfg_tlv()
404 etscfg->tcbwtable[i] = buf[offset++]; in ice_parse_cee_pgcfg_tlv()
406 if (etscfg->prio_table[i] == ICE_CEE_PGID_STRICT) in ice_parse_cee_pgcfg_tlv()
407 dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_STRICT; in ice_parse_cee_pgcfg_tlv()
409 dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_ETS; in ice_parse_cee_pgcfg_tlv()
412 /* Number of TCs supported (1 octet) */ in ice_parse_cee_pgcfg_tlv()
413 etscfg->maxtcs = buf[offset]; in ice_parse_cee_pgcfg_tlv()
427 u8 *buf = tlv->tlvinfo; in ice_parse_cee_pfccfg_tlv()
429 if (tlv->en_will_err & ICE_CEE_FEAT_TLV_WILLING_M) in ice_parse_cee_pfccfg_tlv()
430 dcbcfg->pfc.willing = 1; in ice_parse_cee_pfccfg_tlv()
432 /* ------------------------ in ice_parse_cee_pfccfg_tlv()
433 * | PFC Enable | PFC TCs | in ice_parse_cee_pfccfg_tlv()
434 * ------------------------ in ice_parse_cee_pfccfg_tlv()
437 dcbcfg->pfc.pfcena = buf[0]; in ice_parse_cee_pfccfg_tlv()
438 dcbcfg->pfc.pfccap = buf[1]; in ice_parse_cee_pfccfg_tlv()
451 u16 len, typelen, offset = 0; in ice_parse_cee_app_tlv() local
455 typelen = ntohs(tlv->hdr.typelen); in ice_parse_cee_app_tlv()
458 dcbcfg->numapps = len / sizeof(*app); in ice_parse_cee_app_tlv()
459 if (!dcbcfg->numapps) in ice_parse_cee_app_tlv()
461 if (dcbcfg->numapps > ICE_DCBX_MAX_APPS) in ice_parse_cee_app_tlv()
462 dcbcfg->numapps = ICE_DCBX_MAX_APPS; in ice_parse_cee_app_tlv()
464 for (i = 0; i < dcbcfg->numapps; i++) { in ice_parse_cee_app_tlv()
467 app = (struct ice_cee_app_prio *)(tlv->tlvinfo + offset); in ice_parse_cee_app_tlv()
469 if (app->prio_map & BIT(up)) in ice_parse_cee_app_tlv()
472 dcbcfg->app[i].priority = up; in ice_parse_cee_app_tlv()
475 selector = (app->upper_oui_sel & ICE_CEE_APP_SELECTOR_M); in ice_parse_cee_app_tlv()
478 dcbcfg->app[i].selector = ICE_APP_SEL_ETHTYPE; in ice_parse_cee_app_tlv()
481 dcbcfg->app[i].selector = ICE_APP_SEL_TCPIP; in ice_parse_cee_app_tlv()
485 dcbcfg->app[i].selector = selector; in ice_parse_cee_app_tlv()
488 dcbcfg->app[i].prot_id = ntohs(app->protocol); in ice_parse_cee_app_tlv()
490 offset += sizeof(*app); in ice_parse_cee_app_tlv()
510 ouisubtype = ntohl(tlv->ouisubtype); in ice_parse_cee_tlv()
516 typelen = ntohs(tlv->typelen); in ice_parse_cee_tlv()
518 len = sizeof(tlv->typelen) + sizeof(ouisubtype) + in ice_parse_cee_tlv()
528 typelen = ntohs(sub_tlv->hdr.typelen); in ice_parse_cee_tlv()
542 return; /* Invalid Sub-type return */ in ice_parse_cee_tlv()
547 ((char *)sub_tlv + sizeof(sub_tlv->hdr.typelen) + in ice_parse_cee_tlv()
566 ouisubtype = ntohl(tlv->ouisubtype); in ice_parse_org_tlv()
590 u16 offset = 0; in ice_lldp_to_dcb_cfg() local
597 return -EINVAL; in ice_lldp_to_dcb_cfg()
603 typelen = ntohs(tlv->typelen); in ice_lldp_to_dcb_cfg()
606 offset += sizeof(typelen) + len; in ice_lldp_to_dcb_cfg()
609 if (type == ICE_TLV_TYPE_END || offset > ICE_LLDPDU_SIZE) in ice_lldp_to_dcb_cfg()
622 ((char *)tlv + sizeof(tlv->typelen) + len); in ice_lldp_to_dcb_cfg()
647 return -ENOMEM; in ice_aq_get_dcb_cfg()
662 * ice_aq_start_stop_dcbx - Start/Stop DCBX service in FW
691 cmd->command = ICE_AQC_START_STOP_AGENT_START_DCBX; in ice_aq_start_stop_dcbx()
698 cmd->command == ICE_AQC_START_STOP_AGENT_START_DCBX) in ice_aq_start_stop_dcbx()
725 * ice_aq_set_pfc_mode - Set PFC mode
730 * This AQ call configures the PFC mode to DSCP-based PFC mode or
731 * VLAN-based PFC (0x0303)
740 return -EINVAL; in ice_aq_set_pfc_mode()
746 cmd->pfc_mode = pfc_mode; in ice_aq_set_pfc_mode()
752 /* FW will write the PFC mode set back into cmd->pfc_mode, but if DCB is in ice_aq_set_pfc_mode()
753 * disabled, FW will write back 0 to cmd->pfc_mode. After the AQ has in ice_aq_set_pfc_mode()
754 * been executed, check if cmd->pfc_mode is what was requested. If not, in ice_aq_set_pfc_mode()
757 if (cmd->pfc_mode != pfc_mode) in ice_aq_set_pfc_mode()
758 return -EOPNOTSUPP; in ice_aq_set_pfc_mode()
774 u32 status, tlv_status = le32_to_cpu(cee_cfg->tlv_status); in ice_cee_to_dcb_cfg()
777 u16 app_prio = le16_to_cpu(cee_cfg->oper_app_prio); in ice_cee_to_dcb_cfg()
782 dcbcfg = &pi->qos_cfg.local_dcbx_cfg; in ice_cee_to_dcb_cfg()
783 dcbcfg->dcbx_mode = ICE_DCBX_MODE_CEE; in ice_cee_to_dcb_cfg()
784 dcbcfg->tlv_status = tlv_status; in ice_cee_to_dcb_cfg()
787 dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; in ice_cee_to_dcb_cfg()
790 * from those in the CEE Priority Group sub-TLV. in ice_cee_to_dcb_cfg()
793 dcbcfg->etscfg.prio_table[i * 2] = in ice_cee_to_dcb_cfg()
795 cee_cfg->oper_prio_tc[i]); in ice_cee_to_dcb_cfg()
796 dcbcfg->etscfg.prio_table[i * 2 + 1] = in ice_cee_to_dcb_cfg()
798 cee_cfg->oper_prio_tc[i]); in ice_cee_to_dcb_cfg()
802 dcbcfg->etscfg.tcbwtable[i] = cee_cfg->oper_tc_bw[i]; in ice_cee_to_dcb_cfg()
804 if (dcbcfg->etscfg.prio_table[i] == ICE_CEE_PGID_STRICT) { in ice_cee_to_dcb_cfg()
806 dcbcfg->etscfg.prio_table[i] = cee_cfg->oper_num_tc - 1; in ice_cee_to_dcb_cfg()
807 dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_STRICT; in ice_cee_to_dcb_cfg()
809 dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_ETS; in ice_cee_to_dcb_cfg()
814 dcbcfg->pfc.pfcena = cee_cfg->oper_pfc_en; in ice_cee_to_dcb_cfg()
815 dcbcfg->pfc.pfccap = ICE_MAX_TRAFFIC_CLASS; in ice_cee_to_dcb_cfg()
818 if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING) in ice_cee_to_dcb_cfg()
819 cmp_dcbcfg = &pi->qos_cfg.desired_dcbx_cfg; in ice_cee_to_dcb_cfg()
821 cmp_dcbcfg = &pi->qos_cfg.remote_dcbx_cfg; in ice_cee_to_dcb_cfg()
842 for (j = 0; j < cmp_dcbcfg->numapps; j++) { in ice_cee_to_dcb_cfg()
843 u16 prot_id = cmp_dcbcfg->app[j].prot_id; in ice_cee_to_dcb_cfg()
844 u8 sel = cmp_dcbcfg->app[j].selector; in ice_cee_to_dcb_cfg()
872 dcbcfg->app[app_index].priority = in ice_cee_to_dcb_cfg()
875 dcbcfg->app[app_index].selector = ice_app_sel_type; in ice_cee_to_dcb_cfg()
876 dcbcfg->app[app_index].prot_id = ice_app_prot_id_type; in ice_cee_to_dcb_cfg()
881 dcbcfg->numapps = app_index; in ice_cee_to_dcb_cfg()
897 return -EINVAL; in ice_get_ieee_or_cee_dcb_cfg()
900 dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; in ice_get_ieee_or_cee_dcb_cfg()
902 dcbx_cfg = &pi->qos_cfg.desired_dcbx_cfg; in ice_get_ieee_or_cee_dcb_cfg()
907 ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_LOCAL, in ice_get_ieee_or_cee_dcb_cfg()
913 dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg; in ice_get_ieee_or_cee_dcb_cfg()
914 ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_REMOTE, in ice_get_ieee_or_cee_dcb_cfg()
917 if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) in ice_get_ieee_or_cee_dcb_cfg()
937 return -EINVAL; in ice_get_dcb_cfg()
939 ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL); in ice_get_dcb_cfg()
944 } else if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) { in ice_get_dcb_cfg()
946 dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; in ice_get_dcb_cfg()
947 dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_IEEE; in ice_get_dcb_cfg()
964 struct ice_dcbx_cfg *dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; in ice_get_dcb_cfg_from_mib_change()
968 mib = (struct ice_aqc_lldp_get_mib *)&event->desc.params.raw; in ice_get_dcb_cfg_from_mib_change()
970 change_type = FIELD_GET(ICE_AQ_LLDP_MIB_TYPE_M, mib->type); in ice_get_dcb_cfg_from_mib_change()
972 dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg; in ice_get_dcb_cfg_from_mib_change()
974 dcbx_mode = FIELD_GET(ICE_AQ_LLDP_DCBX_M, mib->type); in ice_get_dcb_cfg_from_mib_change()
978 dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_IEEE; in ice_get_dcb_cfg_from_mib_change()
979 ice_lldp_to_dcb_cfg(event->msg_buf, dcbx_cfg); in ice_get_dcb_cfg_from_mib_change()
983 pi->qos_cfg.desired_dcbx_cfg = pi->qos_cfg.local_dcbx_cfg; in ice_get_dcb_cfg_from_mib_change()
985 event->msg_buf, pi); in ice_get_dcb_cfg_from_mib_change()
999 struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg; in ice_init_dcb()
1002 if (!hw->func_caps.common_cap.dcb) in ice_init_dcb()
1003 return -EOPNOTSUPP; in ice_init_dcb()
1005 qos_cfg->is_sw_lldp = true; in ice_init_dcb()
1008 qos_cfg->dcbx_status = ice_get_dcbx_status(hw); in ice_init_dcb()
1010 if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DONE || in ice_init_dcb()
1011 qos_cfg->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS || in ice_init_dcb()
1012 qos_cfg->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) { in ice_init_dcb()
1014 ret = ice_get_dcb_cfg(hw->port_info); in ice_init_dcb()
1017 qos_cfg->is_sw_lldp = false; in ice_init_dcb()
1018 } else if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) { in ice_init_dcb()
1019 return -EBUSY; in ice_init_dcb()
1026 qos_cfg->is_sw_lldp = true; in ice_init_dcb()
1041 struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg; in ice_cfg_lldp_mib_change()
1044 if (!hw->func_caps.common_cap.dcb) in ice_cfg_lldp_mib_change()
1045 return -EOPNOTSUPP; in ice_cfg_lldp_mib_change()
1048 qos_cfg->dcbx_status = ice_get_dcbx_status(hw); in ice_cfg_lldp_mib_change()
1050 if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) in ice_cfg_lldp_mib_change()
1051 return -EBUSY; in ice_cfg_lldp_mib_change()
1055 qos_cfg->is_sw_lldp = !ena_mib; in ice_cfg_lldp_mib_change()
1071 u8 offset = 0; in ice_add_ieee_ets_common_tlv() local
1076 * ----------------------------------------- in ice_add_ieee_ets_common_tlv()
1078 * ----------------------------------------- in ice_add_ieee_ets_common_tlv()
1080 * ----------------------------------------- in ice_add_ieee_ets_common_tlv()
1083 priority0 = ets_cfg->prio_table[i * 2] & 0xF; in ice_add_ieee_ets_common_tlv()
1084 priority1 = ets_cfg->prio_table[i * 2 + 1] & 0xF; in ice_add_ieee_ets_common_tlv()
1085 buf[offset] = (priority0 << ICE_IEEE_ETS_PRIO_1_S) | priority1; in ice_add_ieee_ets_common_tlv()
1086 offset++; in ice_add_ieee_ets_common_tlv()
1091 * --------------------------------- in ice_add_ieee_ets_common_tlv()
1093 * --------------------------------- in ice_add_ieee_ets_common_tlv()
1097 * --------------------------------- in ice_add_ieee_ets_common_tlv()
1099 * --------------------------------- in ice_add_ieee_ets_common_tlv()
1102 buf[offset] = ets_cfg->tcbwtable[i]; in ice_add_ieee_ets_common_tlv()
1103 buf[ICE_MAX_TRAFFIC_CLASS + offset] = ets_cfg->tsatable[i]; in ice_add_ieee_ets_common_tlv()
1104 offset++; in ice_add_ieee_ets_common_tlv()
1109 * ice_add_ieee_ets_tlv - Prepare ETS TLV in IEEE format
1119 u8 *buf = tlv->tlvinfo; in ice_add_ieee_ets_tlv()
1126 tlv->typelen = htons(typelen); in ice_add_ieee_ets_tlv()
1130 tlv->ouisubtype = htonl(ouisubtype); in ice_add_ieee_ets_tlv()
1133 * -------------------------- in ice_add_ieee_ets_tlv()
1134 * |will-|CBS | Re- | Max | in ice_add_ieee_ets_tlv()
1135 * |ing | |served| TCs | in ice_add_ieee_ets_tlv()
1136 * -------------------------- in ice_add_ieee_ets_tlv()
1139 etscfg = &dcbcfg->etscfg; in ice_add_ieee_ets_tlv()
1140 if (etscfg->willing) in ice_add_ieee_ets_tlv()
1142 maxtcwilling |= etscfg->maxtcs & ICE_IEEE_ETS_MAXTC_M; in ice_add_ieee_ets_tlv()
1145 /* Begin adding at Priority Assignment Table (offset 1 in buf) */ in ice_add_ieee_ets_tlv()
1150 * ice_add_ieee_etsrec_tlv - Prepare ETS Recommended TLV in IEEE format
1161 u8 *buf = tlv->tlvinfo; in ice_add_ieee_etsrec_tlv()
1167 tlv->typelen = htons(typelen); in ice_add_ieee_etsrec_tlv()
1171 tlv->ouisubtype = htonl(ouisubtype); in ice_add_ieee_etsrec_tlv()
1173 etsrec = &dcbcfg->etsrec; in ice_add_ieee_etsrec_tlv()
1176 /* Begin adding at Priority Assignment Table (offset 1 in buf) */ in ice_add_ieee_etsrec_tlv()
1181 * ice_add_ieee_pfc_tlv - Prepare PFC TLV in IEEE format
1190 u8 *buf = tlv->tlvinfo; in ice_add_ieee_pfc_tlv()
1196 tlv->typelen = htons(typelen); in ice_add_ieee_pfc_tlv()
1200 tlv->ouisubtype = htonl(ouisubtype); in ice_add_ieee_pfc_tlv()
1202 /* ---------------------------------------- in ice_add_ieee_pfc_tlv()
1203 * |will-|MBC | Re- | PFC | PFC Enable | in ice_add_ieee_pfc_tlv()
1205 * ----------------------------------------- in ice_add_ieee_pfc_tlv()
1208 if (dcbcfg->pfc.willing) in ice_add_ieee_pfc_tlv()
1211 if (dcbcfg->pfc.mbc) in ice_add_ieee_pfc_tlv()
1214 buf[0] |= dcbcfg->pfc.pfccap & 0xF; in ice_add_ieee_pfc_tlv()
1215 buf[1] = dcbcfg->pfc.pfcena; in ice_add_ieee_pfc_tlv()
1219 * ice_add_ieee_app_pri_tlv - Prepare APP TLV in IEEE format
1229 u16 typelen, len, offset = 0; in ice_add_ieee_app_pri_tlv() local
1231 u8 *buf = tlv->tlvinfo; in ice_add_ieee_app_pri_tlv()
1235 if (dcbcfg->numapps == 0) in ice_add_ieee_app_pri_tlv()
1239 tlv->ouisubtype = htonl(ouisubtype); in ice_add_ieee_app_pri_tlv()
1241 /* Move offset to App Priority Table */ in ice_add_ieee_app_pri_tlv()
1242 offset++; in ice_add_ieee_app_pri_tlv()
1245 * ----------------------------------------- in ice_add_ieee_app_pri_tlv()
1247 * ----------------------------------------- in ice_add_ieee_app_pri_tlv()
1249 * ----------------------------------------- in ice_add_ieee_app_pri_tlv()
1251 while (i < dcbcfg->numapps) { in ice_add_ieee_app_pri_tlv()
1252 priority = dcbcfg->app[i].priority & 0x7; in ice_add_ieee_app_pri_tlv()
1253 selector = dcbcfg->app[i].selector & 0x7; in ice_add_ieee_app_pri_tlv()
1254 buf[offset] = (priority << ICE_IEEE_APP_PRIO_S) | selector; in ice_add_ieee_app_pri_tlv()
1255 buf[offset + 1] = (dcbcfg->app[i].prot_id >> 0x8) & 0xFF; in ice_add_ieee_app_pri_tlv()
1256 buf[offset + 2] = dcbcfg->app[i].prot_id & 0xFF; in ice_add_ieee_app_pri_tlv()
1258 offset += 3; in ice_add_ieee_app_pri_tlv()
1264 len = sizeof(tlv->ouisubtype) + 1 + (i * 3); in ice_add_ieee_app_pri_tlv()
1266 tlv->typelen = htons(typelen); in ice_add_ieee_app_pri_tlv()
1270 * ice_add_dscp_up_tlv - Prepare DSCP to UP TLV
1277 u8 *buf = tlv->tlvinfo; in ice_add_dscp_up_tlv()
1284 tlv->typelen = htons(typelen); in ice_add_dscp_up_tlv()
1288 tlv->ouisubtype = htonl(ouisubtype); in ice_add_dscp_up_tlv()
1290 /* bytes 0 - 63 - IPv4 DSCP2UP LUT */ in ice_add_dscp_up_tlv()
1293 buf[i] = dcbcfg->dscp_map[i]; in ice_add_dscp_up_tlv()
1295 buf[i + ICE_DSCP_IPV6_OFFSET] = dcbcfg->dscp_map[i]; in ice_add_dscp_up_tlv()
1298 /* byte 64 - IPv4 untagged traffic */ in ice_add_dscp_up_tlv()
1301 /* byte 144 - IPv6 untagged traffic */ in ice_add_dscp_up_tlv()
1307 * ice_add_dscp_enf_tlv - Prepare DSCP Enforcement TLV
1313 u8 *buf = tlv->tlvinfo; in ice_add_dscp_enf_tlv()
1319 tlv->typelen = htons(typelen); in ice_add_dscp_enf_tlv()
1323 tlv->ouisubtype = htonl(ouisubtype); in ice_add_dscp_enf_tlv()
1330 * ice_add_dscp_tc_bw_tlv - Prepare DSCP BW for TC TLV
1339 u8 *buf = tlv->tlvinfo; in ice_add_dscp_tc_bw_tlv()
1341 u8 offset = 0; in ice_add_dscp_tc_bw_tlv() local
1347 tlv->typelen = htons(typelen); in ice_add_dscp_tc_bw_tlv()
1351 tlv->ouisubtype = htonl(ouisubtype); in ice_add_dscp_tc_bw_tlv()
1354 * ---------------------------- in ice_add_dscp_tc_bw_tlv()
1355 * | RSV | CBS | RSV | Max TCs | in ice_add_dscp_tc_bw_tlv()
1357 * ---------------------------- in ice_add_dscp_tc_bw_tlv()
1359 etscfg = &dcbcfg->etscfg; in ice_add_dscp_tc_bw_tlv()
1360 buf[0] = etscfg->maxtcs & ICE_IEEE_ETS_MAXTC_M; in ice_add_dscp_tc_bw_tlv()
1362 /* bytes 1 - 4 reserved */ in ice_add_dscp_tc_bw_tlv()
1363 offset = 5; in ice_add_dscp_tc_bw_tlv()
1366 * bytes 0 - 7 for TC 0 - 7 in ice_add_dscp_tc_bw_tlv()
1369 * bytes 8 - 15 for TC 0 - 7 in ice_add_dscp_tc_bw_tlv()
1372 buf[offset] = etscfg->tcbwtable[i]; in ice_add_dscp_tc_bw_tlv()
1373 buf[offset + ICE_MAX_TRAFFIC_CLASS] = etscfg->tsatable[i]; in ice_add_dscp_tc_bw_tlv()
1374 offset++; in ice_add_dscp_tc_bw_tlv()
1379 * ice_add_dscp_pfc_tlv - Prepare DSCP PFC TLV
1386 u8 *buf = tlv->tlvinfo; in ice_add_dscp_pfc_tlv()
1392 tlv->typelen = htons(typelen); in ice_add_dscp_pfc_tlv()
1396 tlv->ouisubtype = htonl(ouisubtype); in ice_add_dscp_pfc_tlv()
1398 buf[0] = dcbcfg->pfc.pfccap & 0xF; in ice_add_dscp_pfc_tlv()
1399 buf[1] = dcbcfg->pfc.pfcena; in ice_add_dscp_pfc_tlv()
1403 * ice_add_dcb_tlv - Add all IEEE or DSCP TLVs
1414 if (dcbcfg->pfc_mode == ICE_QOS_MODE_VLAN) { in ice_add_dcb_tlv()
1453 * ice_dcb_cfg_to_lldp - Convert DCB configuration to MIB format
1463 u16 len, offset = 0, tlvid = ICE_TLV_ID_START; in ice_dcb_cfg_to_lldp() local
1470 typelen = ntohs(tlv->typelen); in ice_dcb_cfg_to_lldp()
1473 offset += len + 2; in ice_dcb_cfg_to_lldp()
1476 offset > ICE_LLDPDU_SIZE) in ice_dcb_cfg_to_lldp()
1481 ((char *)tlv + sizeof(tlv->typelen) + len); in ice_dcb_cfg_to_lldp()
1483 *miblen = offset; in ice_dcb_cfg_to_lldp()
1487 * ice_set_dcb_cfg - Set the local LLDP MIB to FW
1501 return -EINVAL; in ice_set_dcb_cfg()
1503 hw = pi->hw; in ice_set_dcb_cfg()
1506 dcbcfg = &pi->qos_cfg.local_dcbx_cfg; in ice_set_dcb_cfg()
1510 return -ENOMEM; in ice_set_dcb_cfg()
1513 if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING) in ice_set_dcb_cfg()
1526 * ice_aq_query_port_ets - query port ETS configuration
1544 return -EINVAL; in ice_aq_query_port_ets()
1547 cmd->port_teid = pi->root->info.node_teid; in ice_aq_query_port_ets()
1549 status = ice_aq_send_cmd(pi->hw, &desc, buf, buf_size, cd); in ice_aq_query_port_ets()
1554 * ice_update_port_tc_tree_cfg - update TC tree configuration
1571 return -EINVAL; in ice_update_port_tc_tree_cfg()
1573 for (i = 0; i < pi->root->num_children; i++) { in ice_update_port_tc_tree_cfg()
1574 teid1 = le32_to_cpu(pi->root->children[i]->info.node_teid); in ice_update_port_tc_tree_cfg()
1576 teid2 = le32_to_cpu(buf->tc_node_teid[j]); in ice_update_port_tc_tree_cfg()
1583 pi->root->children[i]->in_use = false; in ice_update_port_tc_tree_cfg()
1587 teid2 = le32_to_cpu(buf->tc_node_teid[j]); in ice_update_port_tc_tree_cfg()
1591 for (i = 0; i < pi->root->num_children; i++) { in ice_update_port_tc_tree_cfg()
1592 tc_node = pi->root->children[i]; in ice_update_port_tc_tree_cfg()
1595 teid1 = le32_to_cpu(tc_node->info.node_teid); in ice_update_port_tc_tree_cfg()
1597 tc_node->tc_num = j; in ice_update_port_tc_tree_cfg()
1598 tc_node->in_use = true; in ice_update_port_tc_tree_cfg()
1602 if (i < pi->root->num_children) in ice_update_port_tc_tree_cfg()
1605 status = ice_sched_query_elem(pi->hw, teid2, &elem); in ice_update_port_tc_tree_cfg()
1611 node = ice_sched_find_node_by_teid(pi->root, teid2); in ice_update_port_tc_tree_cfg()
1613 node->tc_num = j; in ice_update_port_tc_tree_cfg()
1619 * ice_query_port_ets - query port ETS configuration
1635 mutex_lock(&pi->sched_lock); in ice_query_port_ets()
1639 mutex_unlock(&pi->sched_lock); in ice_query_port_ets()