qed_dcbx.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* QLogic qed NIC Driver
  2. * Copyright (c) 2015 QLogic Corporation
  3. *
  4. * This software is available under the terms of the GNU General Public License
  5. * (GPL) Version 2, available from the file COPYING in the main directory of
  6. * this source tree.
  7. */
  8. #ifndef _QED_DCBX_H
  9. #define _QED_DCBX_H
  10. #include <linux/types.h>
  11. #include <linux/slab.h>
  12. #include "qed.h"
  13. #include "qed_hsi.h"
  14. #include "qed_hw.h"
  15. #include "qed_mcp.h"
  16. #include "qed_reg_addr.h"
  17. #define DCBX_CONFIG_MAX_APP_PROTOCOL 4
  18. enum qed_mib_read_type {
  19. QED_DCBX_OPERATIONAL_MIB,
  20. QED_DCBX_REMOTE_MIB,
  21. QED_DCBX_LOCAL_MIB,
  22. QED_DCBX_REMOTE_LLDP_MIB,
  23. QED_DCBX_LOCAL_LLDP_MIB
  24. };
  25. struct qed_dcbx_app_data {
  26. bool enable; /* DCB enabled */
  27. bool update; /* Update indication */
  28. u8 priority; /* Priority */
  29. u8 tc; /* Traffic Class */
  30. };
  31. #ifdef CONFIG_DCB
  32. #define QED_DCBX_VERSION_DISABLED 0
  33. #define QED_DCBX_VERSION_IEEE 1
  34. #define QED_DCBX_VERSION_CEE 2
  35. struct qed_dcbx_set {
  36. #define QED_DCBX_OVERRIDE_STATE BIT(0)
  37. #define QED_DCBX_OVERRIDE_PFC_CFG BIT(1)
  38. #define QED_DCBX_OVERRIDE_ETS_CFG BIT(2)
  39. #define QED_DCBX_OVERRIDE_APP_CFG BIT(3)
  40. #define QED_DCBX_OVERRIDE_DSCP_CFG BIT(4)
  41. u32 override_flags;
  42. bool enabled;
  43. struct qed_dcbx_admin_params config;
  44. u32 ver_num;
  45. };
  46. #endif
  47. struct qed_dcbx_results {
  48. bool dcbx_enabled;
  49. u8 pf_id;
  50. struct qed_dcbx_app_data arr[DCBX_MAX_PROTOCOL_TYPE];
  51. };
  52. struct qed_dcbx_app_metadata {
  53. enum dcbx_protocol_type id;
  54. char *name;
  55. enum qed_pci_personality personality;
  56. };
  57. #define QED_MFW_GET_FIELD(name, field) \
  58. (((name) & (field ## _MASK)) >> (field ## _SHIFT))
  59. struct qed_dcbx_info {
  60. struct lldp_status_params_s lldp_remote[LLDP_MAX_LLDP_AGENTS];
  61. struct lldp_config_params_s lldp_local[LLDP_MAX_LLDP_AGENTS];
  62. struct dcbx_local_params local_admin;
  63. struct qed_dcbx_results results;
  64. struct dcbx_mib operational;
  65. struct dcbx_mib remote;
  66. #ifdef CONFIG_DCB
  67. struct qed_dcbx_set set;
  68. #endif
  69. u8 dcbx_cap;
  70. };
  71. struct qed_dcbx_mib_meta_data {
  72. struct lldp_config_params_s *lldp_local;
  73. struct lldp_status_params_s *lldp_remote;
  74. struct dcbx_local_params *local_admin;
  75. struct dcbx_mib *mib;
  76. size_t size;
  77. u32 addr;
  78. };
  79. #ifdef CONFIG_DCB
  80. int qed_dcbx_get_config_params(struct qed_hwfn *, struct qed_dcbx_set *);
  81. int qed_dcbx_config_params(struct qed_hwfn *,
  82. struct qed_ptt *, struct qed_dcbx_set *, bool);
  83. #endif
  84. /* QED local interface routines */
  85. int
  86. qed_dcbx_mib_update_event(struct qed_hwfn *,
  87. struct qed_ptt *, enum qed_mib_read_type);
  88. int qed_dcbx_info_alloc(struct qed_hwfn *p_hwfn);
  89. void qed_dcbx_info_free(struct qed_hwfn *, struct qed_dcbx_info *);
  90. void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src,
  91. struct pf_update_ramrod_data *p_dest);
  92. #endif