bnx2x_vfpf.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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. enum {
  52. PFVF_STATUS_WAITING = 0,
  53. PFVF_STATUS_SUCCESS,
  54. PFVF_STATUS_FAILURE,
  55. PFVF_STATUS_NOT_SUPPORTED,
  56. PFVF_STATUS_NO_RESOURCE
  57. };
  58. /* vf pf channel tlvs */
  59. /* general tlv header (used for both vf->pf request and pf->vf response) */
  60. struct channel_tlv {
  61. u16 type;
  62. u16 length;
  63. };
  64. /* header of first vf->pf tlv carries the offset used to calculate response
  65. * buffer address
  66. */
  67. struct vfpf_first_tlv {
  68. struct channel_tlv tl;
  69. u32 resp_msg_offset;
  70. };
  71. /* header of pf->vf tlvs, carries the status of handling the request */
  72. struct pfvf_tlv {
  73. struct channel_tlv tl;
  74. u8 status;
  75. u8 padding[3];
  76. };
  77. /* response tlv used for most tlvs */
  78. struct pfvf_general_resp_tlv {
  79. struct pfvf_tlv hdr;
  80. };
  81. /* used to terminate and pad a tlv list */
  82. struct channel_list_end_tlv {
  83. struct channel_tlv tl;
  84. u8 padding[4];
  85. };
  86. /* Acquire */
  87. struct vfpf_acquire_tlv {
  88. struct vfpf_first_tlv first_tlv;
  89. struct vf_pf_vfdev_info {
  90. /* the following fields are for debug purposes */
  91. u8 vf_id; /* ME register value */
  92. u8 vf_os; /* e.g. Linux, W2K8 */
  93. u8 padding[2];
  94. } vfdev_info;
  95. struct vf_pf_resc_request resc_request;
  96. aligned_u64 bulletin_addr;
  97. };
  98. /* simple operation request on queue */
  99. struct vfpf_q_op_tlv {
  100. struct vfpf_first_tlv first_tlv;
  101. u8 vf_qid;
  102. u8 padding[3];
  103. };
  104. /* acquire response tlv - carries the allocated resources */
  105. struct pfvf_acquire_resp_tlv {
  106. struct pfvf_tlv hdr;
  107. struct pf_vf_pfdev_info {
  108. u32 chip_num;
  109. u32 pf_cap;
  110. #define PFVF_CAP_RSS 0x00000001
  111. #define PFVF_CAP_DHC 0x00000002
  112. #define PFVF_CAP_TPA 0x00000004
  113. char fw_ver[32];
  114. u16 db_size;
  115. u8 indices_per_sb;
  116. u8 padding;
  117. } pfdev_info;
  118. struct pf_vf_resc {
  119. /* in case of status NO_RESOURCE in message hdr, pf will fill
  120. * this struct with suggested amount of resources for next
  121. * acquire request
  122. */
  123. #define PFVF_MAX_QUEUES_PER_VF 16
  124. #define PFVF_MAX_SBS_PER_VF 16
  125. struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
  126. u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
  127. u8 num_rxqs;
  128. u8 num_txqs;
  129. u8 num_sbs;
  130. u8 num_mac_filters;
  131. u8 num_vlan_filters;
  132. u8 num_mc_filters;
  133. u8 permanent_mac_addr[ETH_ALEN];
  134. u8 current_mac_addr[ETH_ALEN];
  135. u8 padding[2];
  136. } resc;
  137. };
  138. /* Init VF */
  139. struct vfpf_init_tlv {
  140. struct vfpf_first_tlv first_tlv;
  141. aligned_u64 sb_addr[PFVF_MAX_SBS_PER_VF]; /* vf_sb based */
  142. aligned_u64 spq_addr;
  143. aligned_u64 stats_addr;
  144. };
  145. /* Setup Queue */
  146. struct vfpf_setup_q_tlv {
  147. struct vfpf_first_tlv first_tlv;
  148. struct vf_pf_rxq_params {
  149. /* physical addresses */
  150. aligned_u64 rcq_addr;
  151. aligned_u64 rcq_np_addr;
  152. aligned_u64 rxq_addr;
  153. aligned_u64 sge_addr;
  154. /* sb + hc info */
  155. u8 vf_sb; /* index in hw_sbs[] */
  156. u8 sb_index; /* Index in the SB */
  157. u16 hc_rate; /* desired interrupts per sec. */
  158. /* valid iff VFPF_QUEUE_FLG_HC */
  159. /* rx buffer info */
  160. u16 mtu;
  161. u16 buf_sz;
  162. u16 flags; /* VFPF_QUEUE_FLG_X flags */
  163. u16 stat_id; /* valid iff VFPF_QUEUE_FLG_STATS */
  164. /* valid iff VFPF_QUEUE_FLG_TPA */
  165. u16 sge_buf_sz;
  166. u16 tpa_agg_sz;
  167. u8 max_sge_pkt;
  168. u8 drop_flags; /* VFPF_QUEUE_DROP_X, for Linux VMs
  169. * all the flags are turned off
  170. */
  171. u8 cache_line_log; /* VFPF_QUEUE_FLG_CACHE_ALIGN */
  172. u8 padding;
  173. } rxq;
  174. struct vf_pf_txq_params {
  175. /* physical addresses */
  176. aligned_u64 txq_addr;
  177. /* sb + hc info */
  178. u8 vf_sb; /* index in hw_sbs[] */
  179. u8 sb_index; /* Index in the SB */
  180. u16 hc_rate; /* desired interrupts per sec. */
  181. /* valid iff VFPF_QUEUE_FLG_HC */
  182. u32 flags; /* VFPF_QUEUE_FLG_X flags */
  183. u16 stat_id; /* valid iff VFPF_QUEUE_FLG_STATS */
  184. u8 traffic_type; /* see in setup_context() */
  185. u8 padding;
  186. } txq;
  187. u8 vf_qid; /* index in hw_qid[] */
  188. u8 param_valid;
  189. #define VFPF_RXQ_VALID 0x01
  190. #define VFPF_TXQ_VALID 0x02
  191. u8 padding[2];
  192. };
  193. /* Set Queue Filters */
  194. struct vfpf_q_mac_vlan_filter {
  195. u32 flags;
  196. #define VFPF_Q_FILTER_DEST_MAC_VALID 0x01
  197. #define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02
  198. #define VFPF_Q_FILTER_SET_MAC 0x100 /* set/clear */
  199. u8 mac[ETH_ALEN];
  200. u16 vlan_tag;
  201. };
  202. /* configure queue filters */
  203. struct vfpf_set_q_filters_tlv {
  204. struct vfpf_first_tlv first_tlv;
  205. u32 flags;
  206. #define VFPF_SET_Q_FILTERS_MAC_VLAN_CHANGED 0x01
  207. #define VFPF_SET_Q_FILTERS_MULTICAST_CHANGED 0x02
  208. #define VFPF_SET_Q_FILTERS_RX_MASK_CHANGED 0x04
  209. u8 vf_qid; /* index in hw_qid[] */
  210. u8 n_mac_vlan_filters;
  211. u8 n_multicast;
  212. u8 padding;
  213. #define PFVF_MAX_MAC_FILTERS 16
  214. #define PFVF_MAX_VLAN_FILTERS 16
  215. #define PFVF_MAX_FILTERS (PFVF_MAX_MAC_FILTERS +\
  216. PFVF_MAX_VLAN_FILTERS)
  217. struct vfpf_q_mac_vlan_filter filters[PFVF_MAX_FILTERS];
  218. #define PFVF_MAX_MULTICAST_PER_VF 32
  219. u8 multicast[PFVF_MAX_MULTICAST_PER_VF][ETH_ALEN];
  220. u32 rx_mask; /* see mask constants at the top of the file */
  221. };
  222. /* close VF (disable VF) */
  223. struct vfpf_close_tlv {
  224. struct vfpf_first_tlv first_tlv;
  225. u16 vf_id; /* for debug */
  226. u8 padding[2];
  227. };
  228. /* release the VF's acquired resources */
  229. struct vfpf_release_tlv {
  230. struct vfpf_first_tlv first_tlv;
  231. u16 vf_id;
  232. u8 padding[2];
  233. };
  234. struct tlv_buffer_size {
  235. u8 tlv_buffer[TLV_BUFFER_SIZE];
  236. };
  237. union vfpf_tlvs {
  238. struct vfpf_first_tlv first_tlv;
  239. struct vfpf_acquire_tlv acquire;
  240. struct vfpf_init_tlv init;
  241. struct vfpf_close_tlv close;
  242. struct vfpf_q_op_tlv q_op;
  243. struct vfpf_setup_q_tlv setup_q;
  244. struct vfpf_set_q_filters_tlv set_q_filters;
  245. struct vfpf_release_tlv release;
  246. struct channel_list_end_tlv list_end;
  247. struct tlv_buffer_size tlv_buf_size;
  248. };
  249. union pfvf_tlvs {
  250. struct pfvf_general_resp_tlv general_resp;
  251. struct pfvf_acquire_resp_tlv acquire_resp;
  252. struct channel_list_end_tlv list_end;
  253. struct tlv_buffer_size tlv_buf_size;
  254. };
  255. #define MAX_TLVS_IN_LIST 50
  256. enum channel_tlvs {
  257. CHANNEL_TLV_NONE,
  258. CHANNEL_TLV_ACQUIRE,
  259. CHANNEL_TLV_INIT,
  260. CHANNEL_TLV_SETUP_Q,
  261. CHANNEL_TLV_SET_Q_FILTERS,
  262. CHANNEL_TLV_TEARDOWN_Q,
  263. CHANNEL_TLV_CLOSE,
  264. CHANNEL_TLV_RELEASE,
  265. CHANNEL_TLV_LIST_END,
  266. CHANNEL_TLV_MAX
  267. };
  268. #endif /* VF_PF_IF_H */