i40e_dcb.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright(c) 2013 - 2018 Intel Corporation. */
  3. #ifndef _I40E_DCB_H_
  4. #define _I40E_DCB_H_
  5. #include "i40e_type.h"
  6. #define I40E_DCBX_STATUS_NOT_STARTED 0
  7. #define I40E_DCBX_STATUS_IN_PROGRESS 1
  8. #define I40E_DCBX_STATUS_DONE 2
  9. #define I40E_DCBX_STATUS_MULTIPLE_PEERS 3
  10. #define I40E_DCBX_STATUS_DISABLED 7
  11. #define I40E_TLV_TYPE_END 0
  12. #define I40E_TLV_TYPE_ORG 127
  13. #define I40E_IEEE_8021QAZ_OUI 0x0080C2
  14. #define I40E_IEEE_SUBTYPE_ETS_CFG 9
  15. #define I40E_IEEE_SUBTYPE_ETS_REC 10
  16. #define I40E_IEEE_SUBTYPE_PFC_CFG 11
  17. #define I40E_IEEE_SUBTYPE_APP_PRI 12
  18. #define I40E_CEE_DCBX_OUI 0x001b21
  19. #define I40E_CEE_DCBX_TYPE 2
  20. #define I40E_CEE_SUBTYPE_CTRL 1
  21. #define I40E_CEE_SUBTYPE_PG_CFG 2
  22. #define I40E_CEE_SUBTYPE_PFC_CFG 3
  23. #define I40E_CEE_SUBTYPE_APP_PRI 4
  24. #define I40E_CEE_MAX_FEAT_TYPE 3
  25. /* Defines for LLDP TLV header */
  26. #define I40E_LLDP_TLV_LEN_SHIFT 0
  27. #define I40E_LLDP_TLV_LEN_MASK (0x01FF << I40E_LLDP_TLV_LEN_SHIFT)
  28. #define I40E_LLDP_TLV_TYPE_SHIFT 9
  29. #define I40E_LLDP_TLV_TYPE_MASK (0x7F << I40E_LLDP_TLV_TYPE_SHIFT)
  30. #define I40E_LLDP_TLV_SUBTYPE_SHIFT 0
  31. #define I40E_LLDP_TLV_SUBTYPE_MASK (0xFF << I40E_LLDP_TLV_SUBTYPE_SHIFT)
  32. #define I40E_LLDP_TLV_OUI_SHIFT 8
  33. #define I40E_LLDP_TLV_OUI_MASK (0xFFFFFF << I40E_LLDP_TLV_OUI_SHIFT)
  34. /* Defines for IEEE ETS TLV */
  35. #define I40E_IEEE_ETS_MAXTC_SHIFT 0
  36. #define I40E_IEEE_ETS_MAXTC_MASK (0x7 << I40E_IEEE_ETS_MAXTC_SHIFT)
  37. #define I40E_IEEE_ETS_CBS_SHIFT 6
  38. #define I40E_IEEE_ETS_CBS_MASK BIT(I40E_IEEE_ETS_CBS_SHIFT)
  39. #define I40E_IEEE_ETS_WILLING_SHIFT 7
  40. #define I40E_IEEE_ETS_WILLING_MASK BIT(I40E_IEEE_ETS_WILLING_SHIFT)
  41. #define I40E_IEEE_ETS_PRIO_0_SHIFT 0
  42. #define I40E_IEEE_ETS_PRIO_0_MASK (0x7 << I40E_IEEE_ETS_PRIO_0_SHIFT)
  43. #define I40E_IEEE_ETS_PRIO_1_SHIFT 4
  44. #define I40E_IEEE_ETS_PRIO_1_MASK (0x7 << I40E_IEEE_ETS_PRIO_1_SHIFT)
  45. #define I40E_CEE_PGID_PRIO_0_SHIFT 0
  46. #define I40E_CEE_PGID_PRIO_0_MASK (0xF << I40E_CEE_PGID_PRIO_0_SHIFT)
  47. #define I40E_CEE_PGID_PRIO_1_SHIFT 4
  48. #define I40E_CEE_PGID_PRIO_1_MASK (0xF << I40E_CEE_PGID_PRIO_1_SHIFT)
  49. #define I40E_CEE_PGID_STRICT 15
  50. /* Defines for IEEE TSA types */
  51. #define I40E_IEEE_TSA_STRICT 0
  52. #define I40E_IEEE_TSA_ETS 2
  53. /* Defines for IEEE PFC TLV */
  54. #define I40E_IEEE_PFC_CAP_SHIFT 0
  55. #define I40E_IEEE_PFC_CAP_MASK (0xF << I40E_IEEE_PFC_CAP_SHIFT)
  56. #define I40E_IEEE_PFC_MBC_SHIFT 6
  57. #define I40E_IEEE_PFC_MBC_MASK BIT(I40E_IEEE_PFC_MBC_SHIFT)
  58. #define I40E_IEEE_PFC_WILLING_SHIFT 7
  59. #define I40E_IEEE_PFC_WILLING_MASK BIT(I40E_IEEE_PFC_WILLING_SHIFT)
  60. /* Defines for IEEE APP TLV */
  61. #define I40E_IEEE_APP_SEL_SHIFT 0
  62. #define I40E_IEEE_APP_SEL_MASK (0x7 << I40E_IEEE_APP_SEL_SHIFT)
  63. #define I40E_IEEE_APP_PRIO_SHIFT 5
  64. #define I40E_IEEE_APP_PRIO_MASK (0x7 << I40E_IEEE_APP_PRIO_SHIFT)
  65. #pragma pack(1)
  66. /* IEEE 802.1AB LLDP Organization specific TLV */
  67. struct i40e_lldp_org_tlv {
  68. __be16 typelength;
  69. __be32 ouisubtype;
  70. u8 tlvinfo[1];
  71. };
  72. struct i40e_cee_tlv_hdr {
  73. __be16 typelen;
  74. u8 operver;
  75. u8 maxver;
  76. };
  77. struct i40e_cee_ctrl_tlv {
  78. struct i40e_cee_tlv_hdr hdr;
  79. __be32 seqno;
  80. __be32 ackno;
  81. };
  82. struct i40e_cee_feat_tlv {
  83. struct i40e_cee_tlv_hdr hdr;
  84. u8 en_will_err; /* Bits: |En|Will|Err|Reserved(5)| */
  85. #define I40E_CEE_FEAT_TLV_ENABLE_MASK 0x80
  86. #define I40E_CEE_FEAT_TLV_WILLING_MASK 0x40
  87. #define I40E_CEE_FEAT_TLV_ERR_MASK 0x20
  88. u8 subtype;
  89. u8 tlvinfo[1];
  90. };
  91. struct i40e_cee_app_prio {
  92. __be16 protocol;
  93. u8 upper_oui_sel; /* Bits: |Upper OUI(6)|Selector(2)| */
  94. #define I40E_CEE_APP_SELECTOR_MASK 0x03
  95. __be16 lower_oui;
  96. u8 prio_map;
  97. };
  98. #pragma pack()
  99. i40e_status i40e_get_dcbx_status(struct i40e_hw *hw,
  100. u16 *status);
  101. i40e_status i40e_lldp_to_dcb_config(u8 *lldpmib,
  102. struct i40e_dcbx_config *dcbcfg);
  103. i40e_status i40e_aq_get_dcb_config(struct i40e_hw *hw, u8 mib_type,
  104. u8 bridgetype,
  105. struct i40e_dcbx_config *dcbcfg);
  106. i40e_status i40e_get_dcb_config(struct i40e_hw *hw);
  107. i40e_status i40e_init_dcb(struct i40e_hw *hw);
  108. #endif /* _I40E_DCB_H_ */