iidc.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (C) 2021, Intel Corporation. */
  3. #ifndef _IIDC_H_
  4. #define _IIDC_H_
  5. #include <linux/auxiliary_bus.h>
  6. #include <linux/dcbnl.h>
  7. #include <linux/device.h>
  8. #include <linux/if_ether.h>
  9. #include <linux/kernel.h>
  10. #include <linux/netdevice.h>
  11. enum iidc_event_type {
  12. IIDC_EVENT_BEFORE_MTU_CHANGE,
  13. IIDC_EVENT_AFTER_MTU_CHANGE,
  14. IIDC_EVENT_BEFORE_TC_CHANGE,
  15. IIDC_EVENT_AFTER_TC_CHANGE,
  16. IIDC_EVENT_CRIT_ERR,
  17. IIDC_EVENT_NBITS /* must be last */
  18. };
  19. enum iidc_reset_type {
  20. IIDC_PFR,
  21. IIDC_CORER,
  22. IIDC_GLOBR,
  23. };
  24. enum iidc_rdma_protocol {
  25. IIDC_RDMA_PROTOCOL_IWARP = BIT(0),
  26. IIDC_RDMA_PROTOCOL_ROCEV2 = BIT(1),
  27. };
  28. #define IIDC_MAX_USER_PRIORITY 8
  29. #define IIDC_MAX_DSCP_MAPPING 64
  30. #define IIDC_DSCP_PFC_MODE 0x1
  31. /* Struct to hold per RDMA Qset info */
  32. struct iidc_rdma_qset_params {
  33. /* Qset TEID returned to the RDMA driver in
  34. * ice_add_rdma_qset and used by RDMA driver
  35. * for calls to ice_del_rdma_qset
  36. */
  37. u32 teid; /* Qset TEID */
  38. u16 qs_handle; /* RDMA driver provides this */
  39. u16 vport_id; /* VSI index */
  40. u8 tc; /* TC branch the Qset should belong to */
  41. };
  42. struct iidc_qos_info {
  43. u64 tc_ctx;
  44. u8 rel_bw;
  45. u8 prio_type;
  46. u8 egress_virt_up;
  47. u8 ingress_virt_up;
  48. };
  49. /* Struct to pass QoS info */
  50. struct iidc_qos_params {
  51. struct iidc_qos_info tc_info[IEEE_8021QAZ_MAX_TCS];
  52. u8 up2tc[IIDC_MAX_USER_PRIORITY];
  53. u8 vport_relative_bw;
  54. u8 vport_priority_type;
  55. u8 num_tc;
  56. u8 pfc_mode;
  57. u8 dscp_map[IIDC_MAX_DSCP_MAPPING];
  58. };
  59. struct iidc_event {
  60. DECLARE_BITMAP(type, IIDC_EVENT_NBITS);
  61. u32 reg;
  62. };
  63. struct ice_pf;
  64. int ice_add_rdma_qset(struct ice_pf *pf, struct iidc_rdma_qset_params *qset);
  65. int ice_del_rdma_qset(struct ice_pf *pf, struct iidc_rdma_qset_params *qset);
  66. int ice_rdma_request_reset(struct ice_pf *pf, enum iidc_reset_type reset_type);
  67. int ice_rdma_update_vsi_filter(struct ice_pf *pf, u16 vsi_id, bool enable);
  68. void ice_get_qos_params(struct ice_pf *pf, struct iidc_qos_params *qos);
  69. /* Structure representing auxiliary driver tailored information about the core
  70. * PCI dev, each auxiliary driver using the IIDC interface will have an
  71. * instance of this struct dedicated to it.
  72. */
  73. struct iidc_auxiliary_dev {
  74. struct auxiliary_device adev;
  75. struct ice_pf *pf;
  76. };
  77. /* structure representing the auxiliary driver. This struct is to be
  78. * allocated and populated by the auxiliary driver's owner. The core PCI
  79. * driver will access these ops by performing a container_of on the
  80. * auxiliary_device->dev.driver.
  81. */
  82. struct iidc_auxiliary_drv {
  83. struct auxiliary_driver adrv;
  84. /* This event_handler is meant to be a blocking call. For instance,
  85. * when a BEFORE_MTU_CHANGE event comes in, the event_handler will not
  86. * return until the auxiliary driver is ready for the MTU change to
  87. * happen.
  88. */
  89. void (*event_handler)(struct ice_pf *pf, struct iidc_event *event);
  90. };
  91. #endif /* _IIDC_H_*/