bnx2x_vfpf.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. /* bnx2x_vfpf.h: Broadcom Everest network driver.
  2. *
  3. * Copyright (c) 2011-2012 Broadcom Corporation
  4. *
  5. * Unless you and Broadcom execute a separate written software license
  6. * agreement governing use of this software, this software is licensed to you
  7. * under the terms of the GNU General Public License version 2, available
  8. * at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html (the "GPL").
  9. *
  10. * Notwithstanding the above, under no circumstances may you combine this
  11. * software in any way with any other Broadcom software provided under a
  12. * license other than the GPL, without Broadcom's express prior written
  13. * consent.
  14. *
  15. * Maintained by: Eilon Greenstein <eilong@broadcom.com>
  16. * Written by: Ariel Elior <ariele@broadcom.com>
  17. */
  18. #ifndef VF_PF_IF_H
  19. #define VF_PF_IF_H
  20. /* Common definitions for all HVs */
  21. struct vf_pf_resc_request {
  22. u8 num_rxqs;
  23. u8 num_txqs;
  24. u8 num_sbs;
  25. u8 num_mac_filters;
  26. u8 num_vlan_filters;
  27. u8 num_mc_filters; /* No limit so superfluous */
  28. };
  29. struct hw_sb_info {
  30. u8 hw_sb_id; /* aka absolute igu id, used to ack the sb */
  31. u8 sb_qid; /* used to update DHC for sb */
  32. };
  33. /* HW VF-PF channel definitions
  34. * A.K.A VF-PF mailbox
  35. */
  36. #define TLV_BUFFER_SIZE 1024
  37. #define VFPF_QUEUE_FLG_TPA 0x0001
  38. #define VFPF_QUEUE_FLG_TPA_IPV6 0x0002
  39. #define VFPF_QUEUE_FLG_TPA_GRO 0x0004
  40. #define VFPF_QUEUE_FLG_CACHE_ALIGN 0x0008
  41. #define VFPF_QUEUE_FLG_STATS 0x0010
  42. #define VFPF_QUEUE_FLG_OV 0x0020
  43. #define VFPF_QUEUE_FLG_VLAN 0x0040
  44. #define VFPF_QUEUE_FLG_COS 0x0080
  45. #define VFPF_QUEUE_FLG_HC 0x0100
  46. #define VFPF_QUEUE_FLG_DHC 0x0200
  47. #define VFPF_QUEUE_DROP_IP_CS_ERR (1 << 0)
  48. #define VFPF_QUEUE_DROP_TCP_CS_ERR (1 << 1)
  49. #define VFPF_QUEUE_DROP_TTL0 (1 << 2)
  50. #define VFPF_QUEUE_DROP_UDP_CS_ERR (1 << 3)
  51. #define VFPF_RX_MASK_ACCEPT_NONE 0x00000000
  52. #define VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST 0x00000001
  53. #define VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST 0x00000002
  54. #define VFPF_RX_MASK_ACCEPT_ALL_UNICAST 0x00000004
  55. #define VFPF_RX_MASK_ACCEPT_ALL_MULTICAST 0x00000008
  56. #define VFPF_RX_MASK_ACCEPT_BROADCAST 0x00000010
  57. enum {
  58. PFVF_STATUS_WAITING = 0,
  59. PFVF_STATUS_SUCCESS,
  60. PFVF_STATUS_FAILURE,
  61. PFVF_STATUS_NOT_SUPPORTED,
  62. PFVF_STATUS_NO_RESOURCE
  63. };
  64. /* vf pf channel tlvs */
  65. /* general tlv header (used for both vf->pf request and pf->vf response) */
  66. struct channel_tlv {
  67. u16 type;
  68. u16 length;
  69. };
  70. /* header of first vf->pf tlv carries the offset used to calculate response
  71. * buffer address
  72. */
  73. struct vfpf_first_tlv {
  74. struct channel_tlv tl;
  75. u32 resp_msg_offset;
  76. };
  77. /* header of pf->vf tlvs, carries the status of handling the request */
  78. struct pfvf_tlv {
  79. struct channel_tlv tl;
  80. u8 status;
  81. u8 padding[3];
  82. };
  83. /* response tlv used for most tlvs */
  84. struct pfvf_general_resp_tlv {
  85. struct pfvf_tlv hdr;
  86. };
  87. /* used to terminate and pad a tlv list */
  88. struct channel_list_end_tlv {
  89. struct channel_tlv tl;
  90. u8 padding[4];
  91. };
  92. /* Acquire */
  93. struct vfpf_acquire_tlv {
  94. struct vfpf_first_tlv first_tlv;
  95. struct vf_pf_vfdev_info {
  96. /* the following fields are for debug purposes */
  97. u8 vf_id; /* ME register value */
  98. u8 vf_os; /* e.g. Linux, W2K8 */
  99. u8 padding[2];
  100. } vfdev_info;
  101. struct vf_pf_resc_request resc_request;
  102. aligned_u64 bulletin_addr;
  103. };
  104. /* simple operation request on queue */
  105. struct vfpf_q_op_tlv {
  106. struct vfpf_first_tlv first_tlv;
  107. u8 vf_qid;
  108. u8 padding[3];
  109. };
  110. /* acquire response tlv - carries the allocated resources */
  111. struct pfvf_acquire_resp_tlv {
  112. struct pfvf_tlv hdr;
  113. struct pf_vf_pfdev_info {
  114. u32 chip_num;
  115. u32 pf_cap;
  116. #define PFVF_CAP_RSS 0x00000001
  117. #define PFVF_CAP_DHC 0x00000002
  118. #define PFVF_CAP_TPA 0x00000004
  119. char fw_ver[32];
  120. u16 db_size;
  121. u8 indices_per_sb;
  122. u8 padding;
  123. } pfdev_info;
  124. struct pf_vf_resc {
  125. /* in case of status NO_RESOURCE in message hdr, pf will fill
  126. * this struct with suggested amount of resources for next
  127. * acquire request
  128. */
  129. #define PFVF_MAX_QUEUES_PER_VF 16
  130. #define PFVF_MAX_SBS_PER_VF 16
  131. struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
  132. u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
  133. u8 num_rxqs;
  134. u8 num_txqs;
  135. u8 num_sbs;
  136. u8 num_mac_filters;
  137. u8 num_vlan_filters;
  138. u8 num_mc_filters;
  139. u8 permanent_mac_addr[ETH_ALEN];
  140. u8 current_mac_addr[ETH_ALEN];
  141. u8 padding[2];
  142. } resc;
  143. };
  144. /* Init VF */
  145. struct vfpf_init_tlv {
  146. struct vfpf_first_tlv first_tlv;
  147. aligned_u64 sb_addr[PFVF_MAX_SBS_PER_VF]; /* vf_sb based */
  148. aligned_u64 spq_addr;
  149. aligned_u64 stats_addr;
  150. };
  151. /* Setup Queue */
  152. struct vfpf_setup_q_tlv {
  153. struct vfpf_first_tlv first_tlv;
  154. struct vf_pf_rxq_params {
  155. /* physical addresses */
  156. aligned_u64 rcq_addr;
  157. aligned_u64 rcq_np_addr;
  158. aligned_u64 rxq_addr;
  159. aligned_u64 sge_addr;
  160. /* sb + hc info */
  161. u8 vf_sb; /* index in hw_sbs[] */
  162. u8 sb_index; /* Index in the SB */
  163. u16 hc_rate; /* desired interrupts per sec. */
  164. /* valid iff VFPF_QUEUE_FLG_HC */
  165. /* rx buffer info */
  166. u16 mtu;
  167. u16 buf_sz;
  168. u16 flags; /* VFPF_QUEUE_FLG_X flags */
  169. u16 stat_id; /* valid iff VFPF_QUEUE_FLG_STATS */
  170. /* valid iff VFPF_QUEUE_FLG_TPA */
  171. u16 sge_buf_sz;
  172. u16 tpa_agg_sz;
  173. u8 max_sge_pkt;
  174. u8 drop_flags; /* VFPF_QUEUE_DROP_X, for Linux VMs
  175. * all the flags are turned off
  176. */
  177. u8 cache_line_log; /* VFPF_QUEUE_FLG_CACHE_ALIGN */
  178. u8 padding;
  179. } rxq;
  180. struct vf_pf_txq_params {
  181. /* physical addresses */
  182. aligned_u64 txq_addr;
  183. /* sb + hc info */
  184. u8 vf_sb; /* index in hw_sbs[] */
  185. u8 sb_index; /* Index in the SB */
  186. u16 hc_rate; /* desired interrupts per sec. */
  187. /* valid iff VFPF_QUEUE_FLG_HC */
  188. u32 flags; /* VFPF_QUEUE_FLG_X flags */
  189. u16 stat_id; /* valid iff VFPF_QUEUE_FLG_STATS */
  190. u8 traffic_type; /* see in setup_context() */
  191. u8 padding;
  192. } txq;
  193. u8 vf_qid; /* index in hw_qid[] */
  194. u8 param_valid;
  195. #define VFPF_RXQ_VALID 0x01
  196. #define VFPF_TXQ_VALID 0x02
  197. u8 padding[2];
  198. };
  199. /* Set Queue Filters */
  200. struct vfpf_q_mac_vlan_filter {
  201. u32 flags;
  202. #define VFPF_Q_FILTER_DEST_MAC_VALID 0x01
  203. #define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02
  204. #define VFPF_Q_FILTER_SET_MAC 0x100 /* set/clear */
  205. u8 mac[ETH_ALEN];
  206. u16 vlan_tag;
  207. };
  208. /* configure queue filters */
  209. struct vfpf_set_q_filters_tlv {
  210. struct vfpf_first_tlv first_tlv;
  211. u32 flags;
  212. #define VFPF_SET_Q_FILTERS_MAC_VLAN_CHANGED 0x01
  213. #define VFPF_SET_Q_FILTERS_MULTICAST_CHANGED 0x02
  214. #define VFPF_SET_Q_FILTERS_RX_MASK_CHANGED 0x04
  215. u8 vf_qid; /* index in hw_qid[] */
  216. u8 n_mac_vlan_filters;
  217. u8 n_multicast;
  218. u8 padding;
  219. #define PFVF_MAX_MAC_FILTERS 16
  220. #define PFVF_MAX_VLAN_FILTERS 16
  221. #define PFVF_MAX_FILTERS (PFVF_MAX_MAC_FILTERS +\
  222. PFVF_MAX_VLAN_FILTERS)
  223. struct vfpf_q_mac_vlan_filter filters[PFVF_MAX_FILTERS];
  224. #define PFVF_MAX_MULTICAST_PER_VF 32
  225. u8 multicast[PFVF_MAX_MULTICAST_PER_VF][ETH_ALEN];
  226. u32 rx_mask; /* see mask constants at the top of the file */
  227. };
  228. /* close VF (disable VF) */
  229. struct vfpf_close_tlv {
  230. struct vfpf_first_tlv first_tlv;
  231. u16 vf_id; /* for debug */
  232. u8 padding[2];
  233. };
  234. /* release the VF's acquired resources */
  235. struct vfpf_release_tlv {
  236. struct vfpf_first_tlv first_tlv;
  237. u16 vf_id;
  238. u8 padding[2];
  239. };
  240. struct tlv_buffer_size {
  241. u8 tlv_buffer[TLV_BUFFER_SIZE];
  242. };
  243. union vfpf_tlvs {
  244. struct vfpf_first_tlv first_tlv;
  245. struct vfpf_acquire_tlv acquire;
  246. struct vfpf_init_tlv init;
  247. struct vfpf_close_tlv close;
  248. struct vfpf_q_op_tlv q_op;
  249. struct vfpf_setup_q_tlv setup_q;
  250. struct vfpf_set_q_filters_tlv set_q_filters;
  251. struct vfpf_release_tlv release;
  252. struct channel_list_end_tlv list_end;
  253. struct tlv_buffer_size tlv_buf_size;
  254. };
  255. union pfvf_tlvs {
  256. struct pfvf_general_resp_tlv general_resp;
  257. struct pfvf_acquire_resp_tlv acquire_resp;
  258. struct channel_list_end_tlv list_end;
  259. struct tlv_buffer_size tlv_buf_size;
  260. };
  261. #define MAX_TLVS_IN_LIST 50
  262. enum channel_tlvs {
  263. CHANNEL_TLV_NONE,
  264. CHANNEL_TLV_ACQUIRE,
  265. CHANNEL_TLV_INIT,
  266. CHANNEL_TLV_SETUP_Q,
  267. CHANNEL_TLV_SET_Q_FILTERS,
  268. CHANNEL_TLV_TEARDOWN_Q,
  269. CHANNEL_TLV_CLOSE,
  270. CHANNEL_TLV_RELEASE,
  271. CHANNEL_TLV_LIST_END,
  272. CHANNEL_TLV_MAX
  273. };
  274. #endif /* VF_PF_IF_H */