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

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2021 Intel Corporation. */
22 return -EINVAL; in i40e_get_dcbx_status()
41 u8 *buf = tlv->tlvinfo; in i40e_parse_ieee_etscfg_tlv()
42 u16 offset = 0; in i40e_parse_ieee_etscfg_tlv() local
47 * -------------------------- in i40e_parse_ieee_etscfg_tlv()
48 * |will-|CBS | Re- | Max | in i40e_parse_ieee_etscfg_tlv()
49 * |ing | |served| TCs | in i40e_parse_ieee_etscfg_tlv()
50 * -------------------------- in i40e_parse_ieee_etscfg_tlv()
53 etscfg = &dcbcfg->etscfg; in i40e_parse_ieee_etscfg_tlv()
54 etscfg->willing = FIELD_GET(I40E_IEEE_ETS_WILLING_MASK, buf[offset]); in i40e_parse_ieee_etscfg_tlv()
55 etscfg->cbs = FIELD_GET(I40E_IEEE_ETS_CBS_MASK, buf[offset]); in i40e_parse_ieee_etscfg_tlv()
56 etscfg->maxtcs = FIELD_GET(I40E_IEEE_ETS_MAXTC_MASK, buf[offset]); in i40e_parse_ieee_etscfg_tlv()
58 /* Move offset to Priority Assignment Table */ in i40e_parse_ieee_etscfg_tlv()
59 offset++; in i40e_parse_ieee_etscfg_tlv()
63 * ----------------------------------------- in i40e_parse_ieee_etscfg_tlv()
65 * ----------------------------------------- in i40e_parse_ieee_etscfg_tlv()
67 * ----------------------------------------- in i40e_parse_ieee_etscfg_tlv()
70 priority = FIELD_GET(I40E_IEEE_ETS_PRIO_1_MASK, buf[offset]); in i40e_parse_ieee_etscfg_tlv()
71 etscfg->prioritytable[i * 2] = priority; in i40e_parse_ieee_etscfg_tlv()
72 priority = FIELD_GET(I40E_IEEE_ETS_PRIO_0_MASK, buf[offset]); in i40e_parse_ieee_etscfg_tlv()
73 etscfg->prioritytable[i * 2 + 1] = priority; in i40e_parse_ieee_etscfg_tlv()
74 offset++; in i40e_parse_ieee_etscfg_tlv()
79 * --------------------------------- in i40e_parse_ieee_etscfg_tlv()
81 * --------------------------------- in i40e_parse_ieee_etscfg_tlv()
84 etscfg->tcbwtable[i] = buf[offset++]; in i40e_parse_ieee_etscfg_tlv()
88 * --------------------------------- in i40e_parse_ieee_etscfg_tlv()
90 * --------------------------------- in i40e_parse_ieee_etscfg_tlv()
93 etscfg->tsatable[i] = buf[offset++]; in i40e_parse_ieee_etscfg_tlv()
106 u8 *buf = tlv->tlvinfo; in i40e_parse_ieee_etsrec_tlv()
107 u16 offset = 0; in i40e_parse_ieee_etsrec_tlv() local
111 /* Move offset to priority table */ in i40e_parse_ieee_etsrec_tlv()
112 offset++; in i40e_parse_ieee_etsrec_tlv()
116 * ----------------------------------------- in i40e_parse_ieee_etsrec_tlv()
118 * ----------------------------------------- in i40e_parse_ieee_etsrec_tlv()
120 * ----------------------------------------- in i40e_parse_ieee_etsrec_tlv()
123 priority = FIELD_GET(I40E_IEEE_ETS_PRIO_1_MASK, buf[offset]); in i40e_parse_ieee_etsrec_tlv()
124 dcbcfg->etsrec.prioritytable[i * 2] = priority; in i40e_parse_ieee_etsrec_tlv()
125 priority = FIELD_GET(I40E_IEEE_ETS_PRIO_0_MASK, buf[offset]); in i40e_parse_ieee_etsrec_tlv()
126 dcbcfg->etsrec.prioritytable[(i * 2) + 1] = priority; in i40e_parse_ieee_etsrec_tlv()
127 offset++; in i40e_parse_ieee_etsrec_tlv()
132 * --------------------------------- in i40e_parse_ieee_etsrec_tlv()
134 * --------------------------------- in i40e_parse_ieee_etsrec_tlv()
137 dcbcfg->etsrec.tcbwtable[i] = buf[offset++]; in i40e_parse_ieee_etsrec_tlv()
141 * --------------------------------- in i40e_parse_ieee_etsrec_tlv()
143 * --------------------------------- in i40e_parse_ieee_etsrec_tlv()
146 dcbcfg->etsrec.tsatable[i] = buf[offset++]; in i40e_parse_ieee_etsrec_tlv()
159 u8 *buf = tlv->tlvinfo; in i40e_parse_ieee_pfccfg_tlv()
161 /* ---------------------------------------- in i40e_parse_ieee_pfccfg_tlv()
162 * |will-|MBC | Re- | PFC | PFC Enable | in i40e_parse_ieee_pfccfg_tlv()
164 * ----------------------------------------- in i40e_parse_ieee_pfccfg_tlv()
167 dcbcfg->pfc.willing = FIELD_GET(I40E_IEEE_PFC_WILLING_MASK, buf[0]); in i40e_parse_ieee_pfccfg_tlv()
168 dcbcfg->pfc.mbc = FIELD_GET(I40E_IEEE_PFC_MBC_MASK, buf[0]); in i40e_parse_ieee_pfccfg_tlv()
169 dcbcfg->pfc.pfccap = FIELD_GET(I40E_IEEE_PFC_CAP_MASK, buf[0]); in i40e_parse_ieee_pfccfg_tlv()
170 dcbcfg->pfc.pfcenable = buf[1]; in i40e_parse_ieee_pfccfg_tlv()
184 u16 offset = 0; in i40e_parse_ieee_app_tlv() local
189 typelength = ntohs(tlv->typelength); in i40e_parse_ieee_app_tlv()
191 buf = tlv->tlvinfo; in i40e_parse_ieee_app_tlv()
194 length -= (sizeof(tlv->ouisubtype) + 1); in i40e_parse_ieee_app_tlv()
196 /* Move offset to App Priority Table */ in i40e_parse_ieee_app_tlv()
197 offset++; in i40e_parse_ieee_app_tlv()
201 * ----------------------------------------- in i40e_parse_ieee_app_tlv()
203 * ----------------------------------------- in i40e_parse_ieee_app_tlv()
205 * ----------------------------------------- in i40e_parse_ieee_app_tlv()
207 while (offset < length) { in i40e_parse_ieee_app_tlv()
208 dcbcfg->app[i].priority = FIELD_GET(I40E_IEEE_APP_PRIO_MASK, in i40e_parse_ieee_app_tlv()
209 buf[offset]); in i40e_parse_ieee_app_tlv()
210 dcbcfg->app[i].selector = FIELD_GET(I40E_IEEE_APP_SEL_MASK, in i40e_parse_ieee_app_tlv()
211 buf[offset]); in i40e_parse_ieee_app_tlv()
212 dcbcfg->app[i].protocolid = (buf[offset + 1] << 0x8) | in i40e_parse_ieee_app_tlv()
213 buf[offset + 2]; in i40e_parse_ieee_app_tlv()
215 offset += 3; in i40e_parse_ieee_app_tlv()
221 dcbcfg->numapps = i; in i40e_parse_ieee_app_tlv()
238 ouisubtype = ntohl(tlv->ouisubtype); in i40e_parse_ieee_tlv()
269 u8 *buf = tlv->tlvinfo; in i40e_parse_cee_pgcfg_tlv()
270 u16 offset = 0; in i40e_parse_cee_pgcfg_tlv() local
274 etscfg = &dcbcfg->etscfg; in i40e_parse_cee_pgcfg_tlv()
276 if (tlv->en_will_err & I40E_CEE_FEAT_TLV_WILLING_MASK) in i40e_parse_cee_pgcfg_tlv()
277 etscfg->willing = 1; in i40e_parse_cee_pgcfg_tlv()
279 etscfg->cbs = 0; in i40e_parse_cee_pgcfg_tlv()
282 * ----------------------------------------- in i40e_parse_cee_pgcfg_tlv()
284 * ----------------------------------------- in i40e_parse_cee_pgcfg_tlv()
286 * ----------------------------------------- in i40e_parse_cee_pgcfg_tlv()
289 priority = FIELD_GET(I40E_CEE_PGID_PRIO_1_MASK, buf[offset]); in i40e_parse_cee_pgcfg_tlv()
290 etscfg->prioritytable[i * 2] = priority; in i40e_parse_cee_pgcfg_tlv()
291 priority = FIELD_GET(I40E_CEE_PGID_PRIO_0_MASK, buf[offset]); in i40e_parse_cee_pgcfg_tlv()
292 etscfg->prioritytable[i * 2 + 1] = priority; in i40e_parse_cee_pgcfg_tlv()
293 offset++; in i40e_parse_cee_pgcfg_tlv()
298 * --------------------------------- in i40e_parse_cee_pgcfg_tlv()
300 * --------------------------------- in i40e_parse_cee_pgcfg_tlv()
303 etscfg->tcbwtable[i] = buf[offset++]; in i40e_parse_cee_pgcfg_tlv()
305 /* Number of TCs supported (1 octet) */ in i40e_parse_cee_pgcfg_tlv()
306 etscfg->maxtcs = buf[offset]; in i40e_parse_cee_pgcfg_tlv()
319 u8 *buf = tlv->tlvinfo; in i40e_parse_cee_pfccfg_tlv()
321 if (tlv->en_will_err & I40E_CEE_FEAT_TLV_WILLING_MASK) in i40e_parse_cee_pfccfg_tlv()
322 dcbcfg->pfc.willing = 1; in i40e_parse_cee_pfccfg_tlv()
324 /* ------------------------ in i40e_parse_cee_pfccfg_tlv()
325 * | PFC Enable | PFC TCs | in i40e_parse_cee_pfccfg_tlv()
326 * ------------------------ in i40e_parse_cee_pfccfg_tlv()
329 dcbcfg->pfc.pfcenable = buf[0]; in i40e_parse_cee_pfccfg_tlv()
330 dcbcfg->pfc.pfccap = buf[1]; in i40e_parse_cee_pfccfg_tlv()
343 u16 length, typelength, offset = 0; in i40e_parse_cee_app_tlv() local
347 typelength = ntohs(tlv->hdr.typelen); in i40e_parse_cee_app_tlv()
350 dcbcfg->numapps = length / sizeof(*app); in i40e_parse_cee_app_tlv()
352 if (!dcbcfg->numapps) in i40e_parse_cee_app_tlv()
354 if (dcbcfg->numapps > I40E_DCBX_MAX_APPS) in i40e_parse_cee_app_tlv()
355 dcbcfg->numapps = I40E_DCBX_MAX_APPS; in i40e_parse_cee_app_tlv()
357 for (i = 0; i < dcbcfg->numapps; i++) { in i40e_parse_cee_app_tlv()
360 app = (struct i40e_cee_app_prio *)(tlv->tlvinfo + offset); in i40e_parse_cee_app_tlv()
362 if (app->prio_map & BIT(up)) in i40e_parse_cee_app_tlv()
365 dcbcfg->app[i].priority = up; in i40e_parse_cee_app_tlv()
368 selector = (app->upper_oui_sel & I40E_CEE_APP_SELECTOR_MASK); in i40e_parse_cee_app_tlv()
371 dcbcfg->app[i].selector = I40E_APP_SEL_ETHTYPE; in i40e_parse_cee_app_tlv()
374 dcbcfg->app[i].selector = I40E_APP_SEL_TCPIP; in i40e_parse_cee_app_tlv()
378 dcbcfg->app[i].selector = selector; in i40e_parse_cee_app_tlv()
381 dcbcfg->app[i].protocolid = ntohs(app->protocol); in i40e_parse_cee_app_tlv()
383 offset += sizeof(*app); in i40e_parse_cee_app_tlv()
403 ouisubtype = ntohl(tlv->ouisubtype); in i40e_parse_cee_tlv()
409 typelength = ntohs(tlv->typelength); in i40e_parse_cee_tlv()
411 len = sizeof(tlv->typelength) + sizeof(ouisubtype) + in i40e_parse_cee_tlv()
419 typelength = ntohs(sub_tlv->hdr.typelen); in i40e_parse_cee_tlv()
433 return; /* Invalid Sub-type return */ in i40e_parse_cee_tlv()
438 sizeof(sub_tlv->hdr.typelen) + in i40e_parse_cee_tlv()
457 ouisubtype = ntohl(tlv->ouisubtype); in i40e_parse_org_tlv()
483 u16 offset = 0; in i40e_lldp_to_dcb_config() local
489 return -EINVAL; in i40e_lldp_to_dcb_config()
495 typelength = ntohs(tlv->typelength); in i40e_lldp_to_dcb_config()
498 offset += sizeof(typelength) + length; in i40e_lldp_to_dcb_config()
501 if ((type == I40E_TLV_TYPE_END) || (offset > I40E_LLDPDU_SIZE)) in i40e_lldp_to_dcb_config()
514 sizeof(tlv->typelength) + in i40e_lldp_to_dcb_config()
569 u16 status, tlv_status = le16_to_cpu(cee_cfg->tlv_status); in i40e_cee_to_dcb_v1_config()
570 u16 app_prio = le16_to_cpu(cee_cfg->oper_app_prio); in i40e_cee_to_dcb_v1_config()
574 dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; in i40e_cee_to_dcb_v1_config()
577 * from those in the CEE Priority Group sub-TLV. in i40e_cee_to_dcb_v1_config()
583 cee_cfg->oper_prio_tc[i]); in i40e_cee_to_dcb_v1_config()
584 dcbcfg->etscfg.prioritytable[i * 2] = tc; in i40e_cee_to_dcb_v1_config()
586 cee_cfg->oper_prio_tc[i]); in i40e_cee_to_dcb_v1_config()
587 dcbcfg->etscfg.prioritytable[i*2 + 1] = tc; in i40e_cee_to_dcb_v1_config()
591 dcbcfg->etscfg.tcbwtable[i] = cee_cfg->oper_tc_bw[i]; in i40e_cee_to_dcb_v1_config()
594 if (dcbcfg->etscfg.prioritytable[i] == I40E_CEE_PGID_STRICT) { in i40e_cee_to_dcb_v1_config()
596 dcbcfg->etscfg.prioritytable[i] = in i40e_cee_to_dcb_v1_config()
597 cee_cfg->oper_num_tc - 1; in i40e_cee_to_dcb_v1_config()
598 dcbcfg->etscfg.tsatable[i] = I40E_IEEE_TSA_STRICT; in i40e_cee_to_dcb_v1_config()
600 dcbcfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS; in i40e_cee_to_dcb_v1_config()
605 dcbcfg->pfc.pfcenable = cee_cfg->oper_pfc_en; in i40e_cee_to_dcb_v1_config()
606 dcbcfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS; in i40e_cee_to_dcb_v1_config()
613 dcbcfg->numapps = I40E_CEE_OPER_MAX_APPS; in i40e_cee_to_dcb_v1_config()
616 dcbcfg->app[0].priority = in i40e_cee_to_dcb_v1_config()
618 dcbcfg->app[0].selector = I40E_APP_SEL_ETHTYPE; in i40e_cee_to_dcb_v1_config()
619 dcbcfg->app[0].protocolid = I40E_APP_PROTOID_FCOE; in i40e_cee_to_dcb_v1_config()
622 dcbcfg->app[1].priority = in i40e_cee_to_dcb_v1_config()
624 dcbcfg->app[1].selector = I40E_APP_SEL_TCPIP; in i40e_cee_to_dcb_v1_config()
625 dcbcfg->app[1].protocolid = I40E_APP_PROTOID_ISCSI; in i40e_cee_to_dcb_v1_config()
628 dcbcfg->app[2].priority = in i40e_cee_to_dcb_v1_config()
630 dcbcfg->app[2].selector = I40E_APP_SEL_ETHTYPE; in i40e_cee_to_dcb_v1_config()
631 dcbcfg->app[2].protocolid = I40E_APP_PROTOID_FIP; in i40e_cee_to_dcb_v1_config()
646 u32 status, tlv_status = le32_to_cpu(cee_cfg->tlv_status); in i40e_cee_to_dcb_config()
647 u16 app_prio = le16_to_cpu(cee_cfg->oper_app_prio); in i40e_cee_to_dcb_config()
651 dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; in i40e_cee_to_dcb_config()
654 * from those in the CEE Priority Group sub-TLV. in i40e_cee_to_dcb_config()
660 cee_cfg->oper_prio_tc[i]); in i40e_cee_to_dcb_config()
661 dcbcfg->etscfg.prioritytable[i * 2] = tc; in i40e_cee_to_dcb_config()
663 cee_cfg->oper_prio_tc[i]); in i40e_cee_to_dcb_config()
664 dcbcfg->etscfg.prioritytable[i * 2 + 1] = tc; in i40e_cee_to_dcb_config()
668 dcbcfg->etscfg.tcbwtable[i] = cee_cfg->oper_tc_bw[i]; in i40e_cee_to_dcb_config()
671 if (dcbcfg->etscfg.prioritytable[i] == I40E_CEE_PGID_STRICT) { in i40e_cee_to_dcb_config()
673 dcbcfg->etscfg.prioritytable[i] = in i40e_cee_to_dcb_config()
674 cee_cfg->oper_num_tc - 1; in i40e_cee_to_dcb_config()
675 dcbcfg->etscfg.tsatable[i] = I40E_IEEE_TSA_STRICT; in i40e_cee_to_dcb_config()
677 dcbcfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS; in i40e_cee_to_dcb_config()
682 dcbcfg->pfc.pfcenable = cee_cfg->oper_pfc_en; in i40e_cee_to_dcb_config()
683 dcbcfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS; in i40e_cee_to_dcb_config()
693 dcbcfg->app[i].priority = in i40e_cee_to_dcb_config()
695 dcbcfg->app[i].selector = I40E_APP_SEL_ETHTYPE; in i40e_cee_to_dcb_config()
696 dcbcfg->app[i].protocolid = I40E_APP_PROTOID_FCOE; in i40e_cee_to_dcb_config()
707 dcbcfg->app[i].priority = in i40e_cee_to_dcb_config()
709 dcbcfg->app[i].selector = I40E_APP_SEL_TCPIP; in i40e_cee_to_dcb_config()
710 dcbcfg->app[i].protocolid = I40E_APP_PROTOID_ISCSI; in i40e_cee_to_dcb_config()
721 dcbcfg->app[i].priority = in i40e_cee_to_dcb_config()
723 dcbcfg->app[i].selector = I40E_APP_SEL_ETHTYPE; in i40e_cee_to_dcb_config()
724 dcbcfg->app[i].protocolid = I40E_APP_PROTOID_FIP; in i40e_cee_to_dcb_config()
727 dcbcfg->numapps = i; in i40e_cee_to_dcb_config()
741 hw->local_dcbx_config.dcbx_mode = I40E_DCBX_MODE_IEEE; in i40e_get_ieee_dcb_config()
744 &hw->local_dcbx_config); in i40e_get_ieee_dcb_config()
751 &hw->remote_dcbx_config); in i40e_get_ieee_dcb_config()
753 if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT) in i40e_get_ieee_dcb_config()
773 if (hw->mac.type == I40E_MAC_XL710 && i40e_is_fw_ver_lt(hw, 4, 33)) in i40e_get_dcb_config()
777 if (hw->mac.type == I40E_MAC_XL710 && i40e_is_fw_ver_eq(hw, 4, 33)) { in i40e_get_dcb_config()
782 hw->local_dcbx_config.dcbx_mode = I40E_DCBX_MODE_CEE; in i40e_get_dcb_config()
783 hw->local_dcbx_config.tlv_status = in i40e_get_dcb_config()
786 &hw->local_dcbx_config); in i40e_get_dcb_config()
793 hw->local_dcbx_config.dcbx_mode = I40E_DCBX_MODE_CEE; in i40e_get_dcb_config()
794 hw->local_dcbx_config.tlv_status = in i40e_get_dcb_config()
797 &hw->local_dcbx_config); in i40e_get_dcb_config()
802 if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT) in i40e_get_dcb_config()
810 &hw->desired_dcbx_config); in i40e_get_dcb_config()
817 &hw->remote_dcbx_config); in i40e_get_dcb_config()
819 if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT) in i40e_get_dcb_config()
839 if (!hw->func_caps.dcb) in i40e_init_dcb()
840 return -EOPNOTSUPP; in i40e_init_dcb()
843 if (test_bit(I40E_HW_CAP_FW_LLDP_PERSISTENT, hw->caps)) { in i40e_init_dcb()
844 u8 offset = 0; in i40e_init_dcb() local
846 if (hw->mac.type == I40E_MAC_XL710) in i40e_init_dcb()
847 offset = I40E_LLDP_CURRENT_STATUS_XL710_OFFSET; in i40e_init_dcb()
848 else if (hw->mac.type == I40E_MAC_X722) in i40e_init_dcb()
849 offset = I40E_LLDP_CURRENT_STATUS_X722_OFFSET; in i40e_init_dcb()
851 return -EOPNOTSUPP; in i40e_init_dcb()
855 offset, in i40e_init_dcb()
863 return -EBUSY; in i40e_init_dcb()
866 adminstatus = lldp_cfg.adminstatus >> (hw->port * 4); in i40e_init_dcb()
871 hw->dcbx_status = I40E_DCBX_STATUS_DISABLED; in i40e_init_dcb()
872 return -EBUSY; in i40e_init_dcb()
876 ret = i40e_get_dcbx_status(hw, &hw->dcbx_status); in i40e_init_dcb()
881 if (hw->dcbx_status == I40E_DCBX_STATUS_DONE || in i40e_init_dcb()
882 hw->dcbx_status == I40E_DCBX_STATUS_IN_PROGRESS) { in i40e_init_dcb()
887 } else if (hw->dcbx_status == I40E_DCBX_STATUS_DISABLED) { in i40e_init_dcb()
888 return -EBUSY; in i40e_init_dcb()
915 return -EINVAL; in i40e_get_fw_lldp_status()
928 } else if (hw->aq.asq_last_status == I40E_AQ_RC_ENOENT) { in i40e_get_fw_lldp_status()
932 } else if (hw->aq.asq_last_status == I40E_AQ_RC_EPERM) { in i40e_get_fw_lldp_status()
942 * i40e_add_ieee_ets_tlv - Prepare ETS TLV in IEEE format
953 u16 offset = 0, typelength, i; in i40e_add_ieee_ets_tlv() local
954 u8 *buf = tlv->tlvinfo; in i40e_add_ieee_ets_tlv()
959 tlv->typelength = htons(typelength); in i40e_add_ieee_ets_tlv()
963 tlv->ouisubtype = htonl(ouisubtype); in i40e_add_ieee_ets_tlv()
966 * -------------------------- in i40e_add_ieee_ets_tlv()
967 * |will-|CBS | Re- | Max | in i40e_add_ieee_ets_tlv()
968 * |ing | |served| TCs | in i40e_add_ieee_ets_tlv()
969 * -------------------------- in i40e_add_ieee_ets_tlv()
972 etscfg = &dcbcfg->etscfg; in i40e_add_ieee_ets_tlv()
973 if (etscfg->willing) in i40e_add_ieee_ets_tlv()
975 maxtcwilling |= etscfg->maxtcs & I40E_IEEE_ETS_MAXTC_MASK; in i40e_add_ieee_ets_tlv()
976 buf[offset] = maxtcwilling; in i40e_add_ieee_ets_tlv()
978 /* Move offset to Priority Assignment Table */ in i40e_add_ieee_ets_tlv()
979 offset++; in i40e_add_ieee_ets_tlv()
983 * ----------------------------------------- in i40e_add_ieee_ets_tlv()
985 * ----------------------------------------- in i40e_add_ieee_ets_tlv()
987 * ----------------------------------------- in i40e_add_ieee_ets_tlv()
990 priority0 = etscfg->prioritytable[i * 2] & 0xF; in i40e_add_ieee_ets_tlv()
991 priority1 = etscfg->prioritytable[i * 2 + 1] & 0xF; in i40e_add_ieee_ets_tlv()
992 buf[offset] = (priority0 << I40E_IEEE_ETS_PRIO_1_SHIFT) | in i40e_add_ieee_ets_tlv()
994 offset++; in i40e_add_ieee_ets_tlv()
999 * --------------------------------- in i40e_add_ieee_ets_tlv()
1001 * --------------------------------- in i40e_add_ieee_ets_tlv()
1004 buf[offset++] = etscfg->tcbwtable[i]; in i40e_add_ieee_ets_tlv()
1008 * --------------------------------- in i40e_add_ieee_ets_tlv()
1010 * --------------------------------- in i40e_add_ieee_ets_tlv()
1013 buf[offset++] = etscfg->tsatable[i]; in i40e_add_ieee_ets_tlv()
1017 * i40e_add_ieee_etsrec_tlv - Prepare ETS Recommended TLV in IEEE format
1027 u16 offset = 0, typelength, i; in i40e_add_ieee_etsrec_tlv() local
1029 u8 *buf = tlv->tlvinfo; in i40e_add_ieee_etsrec_tlv()
1034 tlv->typelength = htons(typelength); in i40e_add_ieee_etsrec_tlv()
1038 tlv->ouisubtype = htonl(ouisubtype); in i40e_add_ieee_etsrec_tlv()
1040 etsrec = &dcbcfg->etsrec; in i40e_add_ieee_etsrec_tlv()
1042 /* Move offset to Priority Assignment Table */ in i40e_add_ieee_etsrec_tlv()
1043 offset++; in i40e_add_ieee_etsrec_tlv()
1047 * ----------------------------------------- in i40e_add_ieee_etsrec_tlv()
1049 * ----------------------------------------- in i40e_add_ieee_etsrec_tlv()
1051 * ----------------------------------------- in i40e_add_ieee_etsrec_tlv()
1054 priority0 = etsrec->prioritytable[i * 2] & 0xF; in i40e_add_ieee_etsrec_tlv()
1055 priority1 = etsrec->prioritytable[i * 2 + 1] & 0xF; in i40e_add_ieee_etsrec_tlv()
1056 buf[offset] = (priority0 << I40E_IEEE_ETS_PRIO_1_SHIFT) | in i40e_add_ieee_etsrec_tlv()
1058 offset++; in i40e_add_ieee_etsrec_tlv()
1063 * --------------------------------- in i40e_add_ieee_etsrec_tlv()
1065 * --------------------------------- in i40e_add_ieee_etsrec_tlv()
1068 buf[offset++] = etsrec->tcbwtable[i]; in i40e_add_ieee_etsrec_tlv()
1072 * --------------------------------- in i40e_add_ieee_etsrec_tlv()
1074 * --------------------------------- in i40e_add_ieee_etsrec_tlv()
1077 buf[offset++] = etsrec->tsatable[i]; in i40e_add_ieee_etsrec_tlv()
1081 * i40e_add_ieee_pfc_tlv - Prepare PFC TLV in IEEE format
1090 u8 *buf = tlv->tlvinfo; in i40e_add_ieee_pfc_tlv()
1096 tlv->typelength = htons(typelength); in i40e_add_ieee_pfc_tlv()
1100 tlv->ouisubtype = htonl(ouisubtype); in i40e_add_ieee_pfc_tlv()
1102 /* ---------------------------------------- in i40e_add_ieee_pfc_tlv()
1103 * |will-|MBC | Re- | PFC | PFC Enable | in i40e_add_ieee_pfc_tlv()
1105 * ----------------------------------------- in i40e_add_ieee_pfc_tlv()
1108 if (dcbcfg->pfc.willing) in i40e_add_ieee_pfc_tlv()
1111 if (dcbcfg->pfc.mbc) in i40e_add_ieee_pfc_tlv()
1114 buf[0] |= dcbcfg->pfc.pfccap & 0xF; in i40e_add_ieee_pfc_tlv()
1115 buf[1] = dcbcfg->pfc.pfcenable; in i40e_add_ieee_pfc_tlv()
1119 * i40e_add_ieee_app_pri_tlv - Prepare APP TLV in IEEE format
1128 u16 typelength, length, offset = 0; in i40e_add_ieee_app_pri_tlv() local
1130 u8 *buf = tlv->tlvinfo; in i40e_add_ieee_app_pri_tlv()
1134 if (dcbcfg->numapps == 0) in i40e_add_ieee_app_pri_tlv()
1138 tlv->ouisubtype = htonl(ouisubtype); in i40e_add_ieee_app_pri_tlv()
1140 /* Move offset to App Priority Table */ in i40e_add_ieee_app_pri_tlv()
1141 offset++; in i40e_add_ieee_app_pri_tlv()
1144 * ----------------------------------------- in i40e_add_ieee_app_pri_tlv()
1146 * ----------------------------------------- in i40e_add_ieee_app_pri_tlv()
1148 * ----------------------------------------- in i40e_add_ieee_app_pri_tlv()
1150 while (i < dcbcfg->numapps) { in i40e_add_ieee_app_pri_tlv()
1151 priority = dcbcfg->app[i].priority & 0x7; in i40e_add_ieee_app_pri_tlv()
1152 selector = dcbcfg->app[i].selector & 0x7; in i40e_add_ieee_app_pri_tlv()
1153 buf[offset] = (priority << I40E_IEEE_APP_PRIO_SHIFT) | selector; in i40e_add_ieee_app_pri_tlv()
1154 buf[offset + 1] = (dcbcfg->app[i].protocolid >> 0x8) & 0xFF; in i40e_add_ieee_app_pri_tlv()
1155 buf[offset + 2] = dcbcfg->app[i].protocolid & 0xFF; in i40e_add_ieee_app_pri_tlv()
1157 offset += 3; in i40e_add_ieee_app_pri_tlv()
1163 length = sizeof(tlv->ouisubtype) + 1 + (i * 3); in i40e_add_ieee_app_pri_tlv()
1166 tlv->typelength = htons(typelength); in i40e_add_ieee_app_pri_tlv()
1170 * i40e_add_dcb_tlv - Add all IEEE TLVs
1199 * i40e_set_dcb_config - Set the local LLDP MIB to FW
1213 dcbcfg = &hw->local_dcbx_config; in i40e_set_dcb_config()
1220 if (dcbcfg->app_mode == I40E_DCBX_APPS_NON_WILLING) { in i40e_set_dcb_config()
1233 * i40e_dcb_config_to_lldp - Convert Dcbconfig to MIB format
1243 u16 length, offset = 0, tlvid, typelength; in i40e_dcb_config_to_lldp() local
1250 typelength = ntohs(tlv->typelength); in i40e_dcb_config_to_lldp()
1253 offset += length + I40E_IEEE_TLV_HEADER_LENGTH; in i40e_dcb_config_to_lldp()
1256 offset >= I40E_LLDPDU_SIZE) in i40e_dcb_config_to_lldp()
1261 sizeof(tlv->typelength) + length); in i40e_dcb_config_to_lldp()
1263 *miblen = offset; in i40e_dcb_config_to_lldp()
1371 u32 link_speed = hw->phy.link_info.link_speed; in i40e_dcb_hw_pfc_config()
1378 /* Get Number of PFC TCs and TC2PFC map */ in i40e_dcb_hw_pfc_config()
1564 * i40e_dcb_hw_calculate_pool_sizes - configure dcb pool sizes
1601 port_pb_size -= I40E_BT2B(I40E_EEE_TX_LPI_EXIT_TIME); in i40e_dcb_hw_calculate_pool_sizes()
1602 port_pb_size -= mfs_max; in i40e_dcb_hw_calculate_pool_sizes()
1624 shared_pool_size = port_pb_size - total_pool_size; in i40e_dcb_hw_calculate_pool_sizes()
1626 pb_cfg->shared_pool_size = shared_pool_size; in i40e_dcb_hw_calculate_pool_sizes()
1627 pb_cfg->shared_pool_high_wm = shared_pool_size; in i40e_dcb_hw_calculate_pool_sizes()
1628 pb_cfg->shared_pool_low_wm = 0; in i40e_dcb_hw_calculate_pool_sizes()
1630 pb_cfg->shared_pool_low_thresh[i] = 0; in i40e_dcb_hw_calculate_pool_sizes()
1631 pb_cfg->shared_pool_high_thresh[i] = shared_pool_size; in i40e_dcb_hw_calculate_pool_sizes()
1632 pb_cfg->tc_pool_size[i] = pool_size[i]; in i40e_dcb_hw_calculate_pool_sizes()
1633 pb_cfg->tc_pool_high_wm[i] = high_wm[i]; in i40e_dcb_hw_calculate_pool_sizes()
1634 pb_cfg->tc_pool_low_wm[i] = low_wm[i]; in i40e_dcb_hw_calculate_pool_sizes()
1667 old_val = old_pb_cfg->shared_pool_low_wm; in i40e_dcb_hw_rx_pb_config()
1668 new_val = new_pb_cfg->shared_pool_low_wm; in i40e_dcb_hw_rx_pb_config()
1680 old_val = old_pb_cfg->shared_pool_low_thresh[i]; in i40e_dcb_hw_rx_pb_config()
1681 new_val = new_pb_cfg->shared_pool_low_thresh[i]; in i40e_dcb_hw_rx_pb_config()
1690 old_val = old_pb_cfg->tc_pool_low_wm[i]; in i40e_dcb_hw_rx_pb_config()
1691 new_val = new_pb_cfg->tc_pool_low_wm[i]; in i40e_dcb_hw_rx_pb_config()
1702 old_val = old_pb_cfg->shared_pool_high_wm; in i40e_dcb_hw_rx_pb_config()
1703 new_val = new_pb_cfg->shared_pool_high_wm; in i40e_dcb_hw_rx_pb_config()
1715 old_val = old_pb_cfg->shared_pool_high_thresh[i]; in i40e_dcb_hw_rx_pb_config()
1716 new_val = new_pb_cfg->shared_pool_high_thresh[i]; in i40e_dcb_hw_rx_pb_config()
1725 old_val = old_pb_cfg->tc_pool_high_wm[i]; in i40e_dcb_hw_rx_pb_config()
1726 new_val = new_pb_cfg->tc_pool_high_wm[i]; in i40e_dcb_hw_rx_pb_config()
1738 new_val = new_pb_cfg->tc_pool_size[i]; in i40e_dcb_hw_rx_pb_config()
1746 new_val = new_pb_cfg->shared_pool_size; in i40e_dcb_hw_rx_pb_config()
1753 old_val = old_pb_cfg->shared_pool_low_wm; in i40e_dcb_hw_rx_pb_config()
1754 new_val = new_pb_cfg->shared_pool_low_wm; in i40e_dcb_hw_rx_pb_config()
1766 old_val = old_pb_cfg->shared_pool_low_thresh[i]; in i40e_dcb_hw_rx_pb_config()
1767 new_val = new_pb_cfg->shared_pool_low_thresh[i]; in i40e_dcb_hw_rx_pb_config()
1776 old_val = old_pb_cfg->tc_pool_low_wm[i]; in i40e_dcb_hw_rx_pb_config()
1777 new_val = new_pb_cfg->tc_pool_low_wm[i]; in i40e_dcb_hw_rx_pb_config()
1788 old_val = old_pb_cfg->shared_pool_high_wm; in i40e_dcb_hw_rx_pb_config()
1789 new_val = new_pb_cfg->shared_pool_high_wm; in i40e_dcb_hw_rx_pb_config()
1801 old_val = old_pb_cfg->shared_pool_high_thresh[i]; in i40e_dcb_hw_rx_pb_config()
1802 new_val = new_pb_cfg->shared_pool_high_thresh[i]; in i40e_dcb_hw_rx_pb_config()
1811 old_val = old_pb_cfg->tc_pool_high_wm[i]; in i40e_dcb_hw_rx_pb_config()
1812 new_val = new_pb_cfg->tc_pool_high_wm[i]; in i40e_dcb_hw_rx_pb_config()
1824 * _i40e_read_lldp_cfg - generic read of LLDP Configuration data from NVM
1828 * @word_offset: offset of LLDP configuration
1836 u32 address, offset = (2 * word_offset); in _i40e_read_lldp_cfg() local
1864 ret = i40e_aq_read_nvm(hw, module, offset, sizeof(raw_mem), &raw_mem, in _i40e_read_lldp_cfg()
1871 offset = mem + word_offset; in _i40e_read_lldp_cfg()
1872 offset *= 2; in _i40e_read_lldp_cfg()
1878 ret = i40e_aq_read_nvm(hw, 0, address + offset, in _i40e_read_lldp_cfg()
1888 * i40e_read_lldp_cfg - read LLDP Configuration data from NVM
1901 return -EINVAL; in i40e_read_lldp_cfg()