Lines Matching +full:tcs +full:- +full:offset

1 /* SPDX-License-Identifier: BSD-3-Clause */
41 * @buf: pointer to the caller-supplied buffer to store the MIB block
65 cmd->type = mib_type & ICE_AQ_LLDP_MIB_TYPE_M;
66 cmd->type |= (bridge_type << ICE_AQ_LLDP_BRID_TYPE_S) &
74 *local_len = LE16_TO_CPU(cmd->local_len);
76 *remote_len = LE16_TO_CPU(cmd->remote_len);
103 cmd->command |= ICE_AQ_LLDP_MIB_UPDATE_DIS;
105 cmd->command |= ICE_AQ_LLDP_MIB_PENDING_ENABLE <<
155 cmd->type = ((bridge_type << ICE_AQ_LLDP_BRID_TYPE_S) &
157 cmd->len = CPU_TO_LE16(tlv_len);
174 * @offset: offset of the updated TLV in the buff
184 u16 buf_size, u16 old_len, u16 new_len, u16 offset,
193 if (offset == 0 || old_len == 0 || new_len == 0)
200 cmd->type = ((bridge_type << ICE_AQ_LLDP_BRID_TYPE_S) &
202 cmd->old_len = CPU_TO_LE16(old_len);
203 cmd->new_offset = CPU_TO_LE16(offset);
204 cmd->new_len = CPU_TO_LE16(new_len);
236 cmd->command |= ICE_AQ_LLDP_AGENT_SHUTDOWN;
239 cmd->command |= ICE_AQ_LLDP_AGENT_PERSIST_DIS;
262 cmd->command = ICE_AQ_LLDP_AGENT_START;
265 cmd->command |= ICE_AQ_LLDP_AGENT_PERSIST_ENA;
295 u8 offset = 0;
300 * -----------------------------------------
302 * -----------------------------------------
304 * -----------------------------------------
307 ets_cfg->prio_table[i * 2] =
308 ((buf[offset] & ICE_IEEE_ETS_PRIO_1_M) >>
310 ets_cfg->prio_table[i * 2 + 1] =
311 ((buf[offset] & ICE_IEEE_ETS_PRIO_0_M) >>
313 offset++;
318 * ---------------------------------
320 * ---------------------------------
324 * ---------------------------------
326 * ---------------------------------
329 ets_cfg->tcbwtable[i] = buf[offset];
330 ets_cfg->tsatable[i] = buf[ICE_MAX_TRAFFIC_CLASS + offset++];
346 u8 *buf = tlv->tlvinfo;
349 * --------------------------
350 * |will-|CBS | Re- | Max |
351 * |ing | |served| TCs |
352 * --------------------------
355 etscfg = &dcbcfg->etscfg;
356 etscfg->willing = ((buf[0] & ICE_IEEE_ETS_WILLING_M) >>
358 etscfg->cbs = ((buf[0] & ICE_IEEE_ETS_CBS_M) >> ICE_IEEE_ETS_CBS_S);
359 etscfg->maxtcs = ((buf[0] & ICE_IEEE_ETS_MAXTC_M) >>
362 /* Begin parsing at Priority Assignment Table (offset 1 in buf) */
377 u8 *buf = tlv->tlvinfo;
379 /* Begin parsing at Priority Assignment Table (offset 1 in buf) */
380 ice_parse_ieee_ets_common_tlv(&buf[1], &dcbcfg->etsrec);
394 u8 *buf = tlv->tlvinfo;
396 /* ----------------------------------------
397 * |will-|MBC | Re- | PFC | PFC Enable |
399 * -----------------------------------------
402 dcbcfg->pfc.willing = ((buf[0] & ICE_IEEE_PFC_WILLING_M) >>
404 dcbcfg->pfc.mbc = ((buf[0] & ICE_IEEE_PFC_MBC_M) >> ICE_IEEE_PFC_MBC_S);
405 dcbcfg->pfc.pfccap = ((buf[0] & ICE_IEEE_PFC_CAP_M) >>
407 dcbcfg->pfc.pfcena = buf[1];
421 u16 offset = 0;
427 typelen = NTOHS(tlv->typelen);
429 buf = tlv->tlvinfo;
434 len -= (sizeof(tlv->ouisubtype) + 1);
436 /* Move offset to App Priority Table */
437 offset++;
441 * -----------------------------------------
443 * -----------------------------------------
445 * -----------------------------------------
447 while (offset < len) {
448 dcbcfg->app[i].priority = ((buf[offset] &
451 dcbcfg->app[i].selector = ((buf[offset] &
454 dcbcfg->app[i].prot_id = (buf[offset + 1] << 0x8) |
455 buf[offset + 2];
457 offset += 3;
463 dcbcfg->numapps = i;
480 ouisubtype = NTOHL(tlv->ouisubtype);
513 u8 *buf = tlv->tlvinfo;
514 u16 offset = 0;
517 etscfg = &dcbcfg->etscfg;
519 if (tlv->en_will_err & ICE_CEE_FEAT_TLV_WILLING_M)
520 etscfg->willing = 1;
522 etscfg->cbs = 0;
525 * -----------------------------------------
527 * -----------------------------------------
529 * -----------------------------------------
532 etscfg->prio_table[i * 2] =
533 ((buf[offset] & ICE_CEE_PGID_PRIO_1_M) >>
535 etscfg->prio_table[i * 2 + 1] =
536 ((buf[offset] & ICE_CEE_PGID_PRIO_0_M) >>
538 offset++;
543 * ---------------------------------
545 * ---------------------------------
548 etscfg->tcbwtable[i] = buf[offset++];
550 if (etscfg->prio_table[i] == ICE_CEE_PGID_STRICT)
551 dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_STRICT;
553 dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_ETS;
556 /* Number of TCs supported (1 octet) */
557 etscfg->maxtcs = buf[offset];
571 u8 *buf = tlv->tlvinfo;
573 if (tlv->en_will_err & ICE_CEE_FEAT_TLV_WILLING_M)
574 dcbcfg->pfc.willing = 1;
576 /* ------------------------
577 * | PFC Enable | PFC TCs |
578 * ------------------------
581 dcbcfg->pfc.pfcena = buf[0];
582 dcbcfg->pfc.pfccap = buf[1];
595 u16 len, typelen, offset = 0;
599 typelen = NTOHS(tlv->hdr.typelen);
602 dcbcfg->numapps = len / sizeof(*app);
603 if (!dcbcfg->numapps)
605 if (dcbcfg->numapps > ICE_DCBX_MAX_APPS)
606 dcbcfg->numapps = ICE_DCBX_MAX_APPS;
608 for (i = 0; i < dcbcfg->numapps; i++) {
611 app = (struct ice_cee_app_prio *)(tlv->tlvinfo + offset);
613 if (app->prio_map & BIT(up))
616 dcbcfg->app[i].priority = up;
619 selector = (app->upper_oui_sel & ICE_CEE_APP_SELECTOR_M);
622 dcbcfg->app[i].selector = ICE_APP_SEL_ETHTYPE;
625 dcbcfg->app[i].selector = ICE_APP_SEL_TCPIP;
629 dcbcfg->app[i].selector = selector;
632 dcbcfg->app[i].prot_id = NTOHS(app->protocol);
634 offset += sizeof(*app);
654 ouisubtype = NTOHL(tlv->ouisubtype);
661 typelen = NTOHS(tlv->typelen);
663 len = sizeof(tlv->typelen) + sizeof(ouisubtype) +
673 typelen = NTOHS(sub_tlv->hdr.typelen);
688 return; /* Invalid Sub-type return */
693 ((char *)sub_tlv + sizeof(sub_tlv->hdr.typelen) +
712 ouisubtype = NTOHL(tlv->ouisubtype);
736 u16 offset = 0;
749 typelen = NTOHS(tlv->typelen);
752 offset += sizeof(typelen) + len;
755 if (type == ICE_TLV_TYPE_END || offset > ICE_LLDPDU_SIZE)
768 ((char *)tlv + sizeof(tlv->typelen) + len);
808 * ice_aq_dcb_ignore_pfc - Ignore PFC for given TCs
812 * @tcmap_ret: return TCs for which PFC is currently ignored
816 * It will return the TCs for which PFC is currently ignored. (0x0301)
831 cmd->cmd_flags = ICE_AQC_PFC_IGNORE_SET;
833 cmd->tc_bitmap = tcmap;
838 *tcmap_ret = cmd->tc_bitmap;
844 * ice_aq_start_stop_dcbx - Start/Stop DCBX service in FW
873 cmd->command = ICE_AQC_START_STOP_AGENT_START_DCBX;
880 cmd->command == ICE_AQC_START_STOP_AGENT_START_DCBX)
907 * ice_aq_query_pfc_mode - Query PFC mode
912 * This will return an indication if DSCP-based PFC or VLAN-based PFC
929 *pfcmode_ret = cmd->pfc_mode;
935 * ice_aq_set_pfc_mode - Set PFC mode
940 * This AQ call configures the PFC mdoe to DSCP-based PFC mode or VLAN
941 * -based PFC (0x0303)
957 cmd->pfc_mode = pfc_mode;
963 /* FW will write the PFC mode set back into cmd->pfc_mode, but if DCB is
964 * disabled, FW will write back 0 to cmd->pfc_mode. After the AQ has
965 * been executed, check if cmd->pfc_mode is what was requested. If not,
968 if (cmd->pfc_mode != pfc_mode)
975 * ice_aq_set_dcb_parameters - Set DCB parameters
994 cmd->valid_flags = ICE_AQC_LINK_UP_DCB_CFG_VALID;
996 cmd->cmd_flags = ICE_AQC_LINK_UP_DCB_CFG;
1012 u32 status, tlv_status = LE32_TO_CPU(cee_cfg->tlv_status);
1015 u16 app_prio = LE16_TO_CPU(cee_cfg->oper_app_prio);
1020 dcbcfg = &pi->qos_cfg.local_dcbx_cfg;
1021 dcbcfg->dcbx_mode = ICE_DCBX_MODE_CEE;
1022 dcbcfg->tlv_status = tlv_status;
1025 dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc;
1028 * from those in the CEE Priority Group sub-TLV.
1031 dcbcfg->etscfg.prio_table[i * 2] =
1032 ((cee_cfg->oper_prio_tc[i] & ICE_CEE_PGID_PRIO_0_M) >>
1034 dcbcfg->etscfg.prio_table[i * 2 + 1] =
1035 ((cee_cfg->oper_prio_tc[i] & ICE_CEE_PGID_PRIO_1_M) >>
1040 dcbcfg->etscfg.tcbwtable[i] = cee_cfg->oper_tc_bw[i];
1042 if (dcbcfg->etscfg.prio_table[i] == ICE_CEE_PGID_STRICT) {
1044 dcbcfg->etscfg.prio_table[i] = cee_cfg->oper_num_tc - 1;
1045 dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_STRICT;
1047 dcbcfg->etscfg.tsatable[i] = ICE_IEEE_TSA_ETS;
1052 dcbcfg->pfc.pfcena = cee_cfg->oper_pfc_en;
1053 dcbcfg->pfc.pfccap = ICE_MAX_TRAFFIC_CLASS;
1056 if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING)
1057 cmp_dcbcfg = &pi->qos_cfg.desired_dcbx_cfg;
1059 cmp_dcbcfg = &pi->qos_cfg.remote_dcbx_cfg;
1080 for (j = 0; j < cmp_dcbcfg->numapps; j++) {
1081 u16 prot_id = cmp_dcbcfg->app[j].prot_id;
1082 u8 sel = cmp_dcbcfg->app[j].selector;
1110 dcbcfg->app[app_index].priority =
1113 dcbcfg->app[app_index].selector = ice_app_sel_type;
1114 dcbcfg->app[app_index].prot_id = ice_app_prot_id_type;
1119 dcbcfg->numapps = app_index;
1139 dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg;
1141 dcbx_cfg = &pi->qos_cfg.desired_dcbx_cfg;
1146 ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_LOCAL,
1152 dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg;
1153 ret = ice_aq_get_dcb_cfg(pi->hw, ICE_AQ_LLDP_MIB_REMOTE,
1156 if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT)
1178 ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL);
1183 } else if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) {
1185 dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg;
1186 dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_IEEE;
1203 struct ice_dcbx_cfg *dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg;
1207 mib = (struct ice_aqc_lldp_get_mib *)&event->desc.params.raw;
1209 change_type = mib->type & ICE_AQ_LLDP_MIB_TYPE_M;
1211 dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg;
1213 dcbx_mode = ((mib->type & ICE_AQ_LLDP_DCBX_M) >>
1218 dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_IEEE;
1219 ice_lldp_to_dcb_cfg(event->msg_buf, dcbx_cfg);
1223 pi->qos_cfg.desired_dcbx_cfg = pi->qos_cfg.local_dcbx_cfg;
1225 event->msg_buf, pi);
1239 struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg;
1242 if (!hw->func_caps.common_cap.dcb)
1245 qos_cfg->is_sw_lldp = true;
1248 qos_cfg->dcbx_status = ice_get_dcbx_status(hw);
1250 if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DONE ||
1251 qos_cfg->dcbx_status == ICE_DCBX_STATUS_IN_PROGRESS ||
1252 qos_cfg->dcbx_status == ICE_DCBX_STATUS_NOT_STARTED) {
1254 ret = ice_get_dcb_cfg(hw->port_info);
1257 qos_cfg->is_sw_lldp = false;
1258 } else if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS) {
1266 qos_cfg->is_sw_lldp = true;
1281 struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg;
1284 if (!hw->func_caps.common_cap.dcb)
1288 qos_cfg->dcbx_status = ice_get_dcbx_status(hw);
1290 if (qos_cfg->dcbx_status == ICE_DCBX_STATUS_DIS)
1295 qos_cfg->is_sw_lldp = !ena_mib;
1311 u8 offset = 0;
1316 * -----------------------------------------
1318 * -----------------------------------------
1320 * -----------------------------------------
1323 priority0 = ets_cfg->prio_table[i * 2] & 0xF;
1324 priority1 = ets_cfg->prio_table[i * 2 + 1] & 0xF;
1325 buf[offset] = (priority0 << ICE_IEEE_ETS_PRIO_1_S) | priority1;
1326 offset++;
1331 * ---------------------------------
1333 * ---------------------------------
1337 * ---------------------------------
1339 * ---------------------------------
1342 buf[offset] = ets_cfg->tcbwtable[i];
1343 buf[ICE_MAX_TRAFFIC_CLASS + offset] = ets_cfg->tsatable[i];
1344 offset++;
1349 * ice_add_ieee_ets_tlv - Prepare ETS TLV in IEEE format
1359 u8 *buf = tlv->tlvinfo;
1366 tlv->typelen = HTONS(typelen);
1370 tlv->ouisubtype = HTONL(ouisubtype);
1373 * --------------------------
1374 * |will-|CBS | Re- | Max |
1375 * |ing | |served| TCs |
1376 * --------------------------
1379 etscfg = &dcbcfg->etscfg;
1380 if (etscfg->willing)
1382 maxtcwilling |= etscfg->maxtcs & ICE_IEEE_ETS_MAXTC_M;
1385 /* Begin adding at Priority Assignment Table (offset 1 in buf) */
1390 * ice_add_ieee_etsrec_tlv - Prepare ETS Recommended TLV in IEEE format
1401 u8 *buf = tlv->tlvinfo;
1407 tlv->typelen = HTONS(typelen);
1411 tlv->ouisubtype = HTONL(ouisubtype);
1413 etsrec = &dcbcfg->etsrec;
1416 /* Begin adding at Priority Assignment Table (offset 1 in buf) */
1421 * ice_add_ieee_pfc_tlv - Prepare PFC TLV in IEEE format
1430 u8 *buf = tlv->tlvinfo;
1436 tlv->typelen = HTONS(typelen);
1440 tlv->ouisubtype = HTONL(ouisubtype);
1442 /* ----------------------------------------
1443 * |will-|MBC | Re- | PFC | PFC Enable |
1445 * -----------------------------------------
1448 if (dcbcfg->pfc.willing)
1451 if (dcbcfg->pfc.mbc)
1454 buf[0] |= dcbcfg->pfc.pfccap & 0xF;
1455 buf[1] = dcbcfg->pfc.pfcena;
1459 * ice_add_ieee_app_pri_tlv - Prepare APP TLV in IEEE format
1469 u16 typelen, len, offset = 0;
1471 u8 *buf = tlv->tlvinfo;
1475 if (dcbcfg->numapps == 0)
1479 tlv->ouisubtype = HTONL(ouisubtype);
1481 /* Move offset to App Priority Table */
1482 offset++;
1485 * -----------------------------------------
1487 * -----------------------------------------
1489 * -----------------------------------------
1491 while (i < dcbcfg->numapps) {
1492 priority = dcbcfg->app[i].priority & 0x7;
1493 selector = dcbcfg->app[i].selector & 0x7;
1494 buf[offset] = (priority << ICE_IEEE_APP_PRIO_S) | selector;
1495 buf[offset + 1] = (dcbcfg->app[i].prot_id >> 0x8) & 0xFF;
1496 buf[offset + 2] = dcbcfg->app[i].prot_id & 0xFF;
1498 offset += 3;
1504 len = sizeof(tlv->ouisubtype) + 1 + (i * 3);
1506 tlv->typelen = HTONS(typelen);
1510 * ice_add_dscp_up_tlv - Prepare DSCP to UP TLV
1517 u8 *buf = tlv->tlvinfo;
1524 tlv->typelen = HTONS(typelen);
1528 tlv->ouisubtype = HTONL(ouisubtype);
1530 /* bytes 0 - 63 - IPv4 DSCP2UP LUT */
1533 buf[i] = dcbcfg->dscp_map[i];
1535 buf[i + ICE_DSCP_IPV6_OFFSET] = dcbcfg->dscp_map[i];
1538 /* byte 64 - IPv4 untagged traffic */
1541 /* byte 144 - IPv6 untagged traffic */
1547 * ice_add_dscp_enf_tlv - Prepare DSCP Enforcement TLV
1553 u8 *buf = tlv->tlvinfo;
1559 tlv->typelen = HTONS(typelen);
1563 tlv->ouisubtype = HTONL(ouisubtype);
1570 * ice_add_dscp_tc_bw_tlv - Prepare DSCP BW for TC TLV
1579 u8 *buf = tlv->tlvinfo;
1581 u8 offset = 0;
1587 tlv->typelen = HTONS(typelen);
1591 tlv->ouisubtype = HTONL(ouisubtype);
1594 * ----------------------------
1595 * | RSV | CBS | RSV | Max TCs |
1597 * ----------------------------
1599 etscfg = &dcbcfg->etscfg;
1600 buf[0] = etscfg->maxtcs & ICE_IEEE_ETS_MAXTC_M;
1602 /* bytes 1 - 4 reserved */
1603 offset = 5;
1606 * bytes 0 - 7 for TC 0 - 7
1609 * bytes 8 - 15 for TC 0 - 7
1612 buf[offset] = etscfg->tcbwtable[i];
1613 buf[offset + ICE_MAX_TRAFFIC_CLASS] = etscfg->tsatable[i];
1614 offset++;
1619 * ice_add_dscp_pfc_tlv - Prepare DSCP PFC TLV
1626 u8 *buf = tlv->tlvinfo;
1632 tlv->typelen = HTONS(typelen);
1636 tlv->ouisubtype = HTONL(ouisubtype);
1638 buf[0] = dcbcfg->pfc.pfccap & 0xF;
1639 buf[1] = dcbcfg->pfc.pfcena;
1643 * ice_add_dcb_tlv - Add all IEEE or DSCP TLVs
1654 if (dcbcfg->pfc_mode == ICE_QOS_MODE_VLAN) {
1693 * ice_dcb_cfg_to_lldp - Convert DCB configuration to MIB format
1702 u16 len, offset = 0, tlvid = ICE_TLV_ID_START;
1709 typelen = NTOHS(tlv->typelen);
1712 offset += len + 2;
1715 offset > ICE_LLDPDU_SIZE)
1720 ((char *)tlv + sizeof(tlv->typelen) + len);
1722 *miblen = offset;
1726 * ice_set_dcb_cfg - Set the local LLDP MIB to FW
1742 hw = pi->hw;
1745 dcbcfg = &pi->qos_cfg.local_dcbx_cfg;
1752 if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING)
1765 * ice_aq_query_port_ets - query port ETS configuration
1782 if (!pi || !pi->root)
1786 cmd->port_teid = pi->root->info.node_teid;
1788 status = ice_aq_send_cmd(pi->hw, &desc, buf, buf_size, cd);
1793 * ice_update_port_tc_tree_cfg - update TC tree configuration
1812 for (i = 0; i < pi->root->num_children; i++) {
1813 teid1 = LE32_TO_CPU(pi->root->children[i]->info.node_teid);
1815 teid2 = LE32_TO_CPU(buf->tc_node_teid[j]);
1822 pi->root->children[i]->in_use = false;
1826 teid2 = LE32_TO_CPU(buf->tc_node_teid[j]);
1830 for (i = 0; i < pi->root->num_children; i++) {
1831 tc_node = pi->root->children[i];
1834 teid1 = LE32_TO_CPU(tc_node->info.node_teid);
1836 tc_node->tc_num = j;
1837 tc_node->in_use = true;
1841 if (i < pi->root->num_children)
1844 status = ice_sched_query_elem(pi->hw, teid2, &elem);
1850 node = ice_sched_find_node_by_teid(pi->root, teid2);
1852 node->tc_num = j;
1858 * ice_query_port_ets - query port ETS configuration
1874 ice_acquire_lock(&pi->sched_lock);
1878 ice_release_lock(&pi->sched_lock);