fm10k_pf.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Intel(R) Ethernet Switch Host Interface Driver
  3. * Copyright(c) 2013 - 2017 Intel Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * The full GNU General Public License is included in this distribution in
  15. * the file called "COPYING".
  16. *
  17. * Contact Information:
  18. * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  19. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  20. */
  21. #ifndef _FM10K_PF_H_
  22. #define _FM10K_PF_H_
  23. #include "fm10k_type.h"
  24. #include "fm10k_common.h"
  25. bool fm10k_glort_valid_pf(struct fm10k_hw *hw, u16 glort);
  26. u16 fm10k_queues_per_pool(struct fm10k_hw *hw);
  27. u16 fm10k_vf_queue_index(struct fm10k_hw *hw, u16 vf_idx);
  28. enum fm10k_pf_tlv_msg_id_v1 {
  29. FM10K_PF_MSG_ID_TEST = 0x000, /* msg ID reserved */
  30. FM10K_PF_MSG_ID_XCAST_MODES = 0x001,
  31. FM10K_PF_MSG_ID_UPDATE_MAC_FWD_RULE = 0x002,
  32. FM10K_PF_MSG_ID_LPORT_MAP = 0x100,
  33. FM10K_PF_MSG_ID_LPORT_CREATE = 0x200,
  34. FM10K_PF_MSG_ID_LPORT_DELETE = 0x201,
  35. FM10K_PF_MSG_ID_CONFIG = 0x300,
  36. FM10K_PF_MSG_ID_UPDATE_PVID = 0x400,
  37. FM10K_PF_MSG_ID_CREATE_FLOW_TABLE = 0x501,
  38. FM10K_PF_MSG_ID_DELETE_FLOW_TABLE = 0x502,
  39. FM10K_PF_MSG_ID_UPDATE_FLOW = 0x503,
  40. FM10K_PF_MSG_ID_DELETE_FLOW = 0x504,
  41. FM10K_PF_MSG_ID_SET_FLOW_STATE = 0x505,
  42. };
  43. enum fm10k_pf_tlv_attr_id_v1 {
  44. FM10K_PF_ATTR_ID_ERR = 0x00,
  45. FM10K_PF_ATTR_ID_LPORT_MAP = 0x01,
  46. FM10K_PF_ATTR_ID_XCAST_MODE = 0x02,
  47. FM10K_PF_ATTR_ID_MAC_UPDATE = 0x03,
  48. FM10K_PF_ATTR_ID_VLAN_UPDATE = 0x04,
  49. FM10K_PF_ATTR_ID_CONFIG = 0x05,
  50. FM10K_PF_ATTR_ID_CREATE_FLOW_TABLE = 0x06,
  51. FM10K_PF_ATTR_ID_DELETE_FLOW_TABLE = 0x07,
  52. FM10K_PF_ATTR_ID_UPDATE_FLOW = 0x08,
  53. FM10K_PF_ATTR_ID_FLOW_STATE = 0x09,
  54. FM10K_PF_ATTR_ID_FLOW_HANDLE = 0x0A,
  55. FM10K_PF_ATTR_ID_DELETE_FLOW = 0x0B,
  56. FM10K_PF_ATTR_ID_PORT = 0x0C,
  57. FM10K_PF_ATTR_ID_UPDATE_PVID = 0x0D,
  58. };
  59. #define FM10K_MSG_LPORT_MAP_GLORT_SHIFT 0
  60. #define FM10K_MSG_LPORT_MAP_GLORT_SIZE 16
  61. #define FM10K_MSG_LPORT_MAP_MASK_SHIFT 16
  62. #define FM10K_MSG_LPORT_MAP_MASK_SIZE 16
  63. #define FM10K_MSG_UPDATE_PVID_GLORT_SHIFT 0
  64. #define FM10K_MSG_UPDATE_PVID_GLORT_SIZE 16
  65. #define FM10K_MSG_UPDATE_PVID_PVID_SHIFT 16
  66. #define FM10K_MSG_UPDATE_PVID_PVID_SIZE 16
  67. #define FM10K_MSG_ERR_PEP_NOT_SCHEDULED 280
  68. /* The following data structures are overlayed directly onto TLV mailbox
  69. * messages, and must not break 4 byte alignment. Ensure the structures line
  70. * up correctly as per their TLV definition.
  71. */
  72. struct fm10k_mac_update {
  73. __le32 mac_lower;
  74. __le16 mac_upper;
  75. __le16 vlan;
  76. __le16 glort;
  77. u8 flags;
  78. u8 action;
  79. } __aligned(4) __packed;
  80. struct fm10k_global_table_data {
  81. __le32 used;
  82. __le32 avail;
  83. } __aligned(4) __packed;
  84. struct fm10k_swapi_error {
  85. __le32 status;
  86. struct fm10k_global_table_data mac;
  87. struct fm10k_global_table_data nexthop;
  88. struct fm10k_global_table_data ffu;
  89. } __aligned(4) __packed;
  90. s32 fm10k_msg_lport_map_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
  91. extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
  92. #define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
  93. FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_MAP, \
  94. fm10k_lport_map_msg_attr, func)
  95. extern const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[];
  96. #define FM10K_PF_MSG_UPDATE_PVID_HANDLER(func) \
  97. FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_UPDATE_PVID, \
  98. fm10k_update_pvid_msg_attr, func)
  99. s32 fm10k_msg_err_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
  100. extern const struct fm10k_tlv_attr fm10k_err_msg_attr[];
  101. #define FM10K_PF_MSG_ERR_HANDLER(msg, func) \
  102. FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_##msg, fm10k_err_msg_attr, func)
  103. s32 fm10k_iov_select_vid(struct fm10k_vf_info *vf_info, u16 vid);
  104. s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
  105. s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
  106. struct fm10k_mbx_info *);
  107. s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *, u32 **,
  108. struct fm10k_mbx_info *);
  109. extern const struct fm10k_info fm10k_pf_info;
  110. #endif /* _FM10K_PF_H */