bnx2x_sriov.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. /* bnx2x_sriov.h: Broadcom Everest network driver.
  2. *
  3. * Copyright 2009-2013 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: Ariel Elior <ariel.elior@qlogic.com>
  16. * Written by: Shmulik Ravid
  17. * Ariel Elior <ariel.elior@qlogic.com>
  18. */
  19. #ifndef BNX2X_SRIOV_H
  20. #define BNX2X_SRIOV_H
  21. #include "bnx2x_vfpf.h"
  22. #include "bnx2x.h"
  23. enum sample_bulletin_result {
  24. PFVF_BULLETIN_UNCHANGED,
  25. PFVF_BULLETIN_UPDATED,
  26. PFVF_BULLETIN_CRC_ERR
  27. };
  28. #ifdef CONFIG_BNX2X_SRIOV
  29. extern struct workqueue_struct *bnx2x_iov_wq;
  30. /* The bnx2x device structure holds vfdb structure described below.
  31. * The VF array is indexed by the relative vfid.
  32. */
  33. #define BNX2X_VF_MAX_QUEUES 16
  34. #define BNX2X_VF_MAX_TPA_AGG_QUEUES 8
  35. struct bnx2x_sriov {
  36. u32 first_vf_in_pf;
  37. /* standard SRIOV capability fields, mostly for debugging */
  38. int pos; /* capability position */
  39. int nres; /* number of resources */
  40. u32 cap; /* SR-IOV Capabilities */
  41. u16 ctrl; /* SR-IOV Control */
  42. u16 total; /* total VFs associated with the PF */
  43. u16 initial; /* initial VFs associated with the PF */
  44. u16 nr_virtfn; /* number of VFs available */
  45. u16 offset; /* first VF Routing ID offset */
  46. u16 stride; /* following VF stride */
  47. u32 pgsz; /* page size for BAR alignment */
  48. u8 link; /* Function Dependency Link */
  49. };
  50. /* bars */
  51. struct bnx2x_vf_bar {
  52. u64 bar;
  53. u32 size;
  54. };
  55. struct bnx2x_vf_bar_info {
  56. struct bnx2x_vf_bar bars[PCI_SRIOV_NUM_BARS];
  57. u8 nr_bars;
  58. };
  59. /* vf queue (used both for rx or tx) */
  60. struct bnx2x_vf_queue {
  61. struct eth_context *cxt;
  62. /* MACs object */
  63. struct bnx2x_vlan_mac_obj mac_obj;
  64. /* VLANs object */
  65. struct bnx2x_vlan_mac_obj vlan_obj;
  66. atomic_t vlan_count; /* 0 means vlan-0 is set ~ untagged */
  67. unsigned long accept_flags; /* last accept flags configured */
  68. /* Queue Slow-path State object */
  69. struct bnx2x_queue_sp_obj sp_obj;
  70. u32 cid;
  71. u16 index;
  72. u16 sb_idx;
  73. bool is_leading;
  74. bool sp_initialized;
  75. };
  76. /* struct bnx2x_vf_queue_construct_params - prepare queue construction
  77. * parameters: q-init, q-setup and SB index
  78. */
  79. struct bnx2x_vf_queue_construct_params {
  80. struct bnx2x_queue_state_params qstate;
  81. struct bnx2x_queue_setup_params prep_qsetup;
  82. };
  83. /* forward */
  84. struct bnx2x_virtf;
  85. /* VFOP definitions */
  86. struct bnx2x_vf_mac_vlan_filter {
  87. int type;
  88. #define BNX2X_VF_FILTER_MAC 1
  89. #define BNX2X_VF_FILTER_VLAN 2
  90. bool add;
  91. u8 *mac;
  92. u16 vid;
  93. };
  94. struct bnx2x_vf_mac_vlan_filters {
  95. int count;
  96. struct bnx2x_vf_mac_vlan_filter filters[];
  97. };
  98. /* vf context */
  99. struct bnx2x_virtf {
  100. u16 cfg_flags;
  101. #define VF_CFG_STATS 0x0001
  102. #define VF_CFG_FW_FC 0x0002
  103. #define VF_CFG_TPA 0x0004
  104. #define VF_CFG_INT_SIMD 0x0008
  105. #define VF_CACHE_LINE 0x0010
  106. #define VF_CFG_VLAN 0x0020
  107. #define VF_CFG_STATS_COALESCE 0x0040
  108. #define VF_CFG_EXT_BULLETIN 0x0080
  109. u8 link_cfg; /* IFLA_VF_LINK_STATE_AUTO
  110. * IFLA_VF_LINK_STATE_ENABLE
  111. * IFLA_VF_LINK_STATE_DISABLE
  112. */
  113. u8 state;
  114. #define VF_FREE 0 /* VF ready to be acquired holds no resc */
  115. #define VF_ACQUIRED 1 /* VF acquired, but not initialized */
  116. #define VF_ENABLED 2 /* VF Enabled */
  117. #define VF_RESET 3 /* VF FLR'd, pending cleanup */
  118. bool flr_clnup_stage; /* true during flr cleanup */
  119. /* dma */
  120. dma_addr_t fw_stat_map; /* valid iff VF_CFG_STATS */
  121. u16 stats_stride;
  122. dma_addr_t spq_map;
  123. dma_addr_t bulletin_map;
  124. /* Allocated resources counters. Before the VF is acquired, the
  125. * counters hold the following values:
  126. *
  127. * - xxq_count = 0 as the queues memory is not allocated yet.
  128. *
  129. * - sb_count = The number of status blocks configured for this VF in
  130. * the IGU CAM. Initially read during probe.
  131. *
  132. * - xx_rules_count = The number of rules statically and equally
  133. * allocated for each VF, during PF load.
  134. */
  135. struct vf_pf_resc_request alloc_resc;
  136. #define vf_rxq_count(vf) ((vf)->alloc_resc.num_rxqs)
  137. #define vf_txq_count(vf) ((vf)->alloc_resc.num_txqs)
  138. #define vf_sb_count(vf) ((vf)->alloc_resc.num_sbs)
  139. #define vf_mac_rules_cnt(vf) ((vf)->alloc_resc.num_mac_filters)
  140. #define vf_vlan_rules_cnt(vf) ((vf)->alloc_resc.num_vlan_filters)
  141. #define vf_mc_rules_cnt(vf) ((vf)->alloc_resc.num_mc_filters)
  142. /* Hide a single vlan filter credit for the hypervisor */
  143. #define vf_vlan_rules_visible_cnt(vf) (vf_vlan_rules_cnt(vf) - 1)
  144. u8 sb_count; /* actual number of SBs */
  145. u8 igu_base_id; /* base igu status block id */
  146. struct bnx2x_vf_queue *vfqs;
  147. #define LEADING_IDX 0
  148. #define bnx2x_vfq_is_leading(vfq) ((vfq)->index == LEADING_IDX)
  149. #define bnx2x_vfq(vf, nr, var) ((vf)->vfqs[(nr)].var)
  150. #define bnx2x_leading_vfq(vf, var) ((vf)->vfqs[LEADING_IDX].var)
  151. u8 index; /* index in the vf array */
  152. u8 abs_vfid;
  153. u8 sp_cl_id;
  154. u32 error; /* 0 means all's-well */
  155. /* BDF */
  156. unsigned int bus;
  157. unsigned int devfn;
  158. /* bars */
  159. struct bnx2x_vf_bar bars[PCI_SRIOV_NUM_BARS];
  160. /* set-mac ramrod state 1-pending, 0-done */
  161. unsigned long filter_state;
  162. /* leading rss client id ~~ the client id of the first rxq, must be
  163. * set for each txq.
  164. */
  165. int leading_rss;
  166. /* MCAST object */
  167. int mcast_list_len;
  168. struct bnx2x_mcast_obj mcast_obj;
  169. /* RSS configuration object */
  170. struct bnx2x_rss_config_obj rss_conf_obj;
  171. /* slow-path operations */
  172. struct mutex op_mutex; /* one vfop at a time mutex */
  173. enum channel_tlvs op_current;
  174. };
  175. #define BNX2X_NR_VIRTFN(bp) ((bp)->vfdb->sriov.nr_virtfn)
  176. #define for_each_vf(bp, var) \
  177. for ((var) = 0; (var) < BNX2X_NR_VIRTFN(bp); (var)++)
  178. #define for_each_vfq(vf, var) \
  179. for ((var) = 0; (var) < vf_rxq_count(vf); (var)++)
  180. #define for_each_vf_sb(vf, var) \
  181. for ((var) = 0; (var) < vf_sb_count(vf); (var)++)
  182. #define is_vf_multi(vf) (vf_rxq_count(vf) > 1)
  183. #define HW_VF_HANDLE(bp, abs_vfid) \
  184. (u16)(BP_ABS_FUNC((bp)) | (1<<3) | ((u16)(abs_vfid) << 4))
  185. #define FW_PF_MAX_HANDLE 8
  186. #define FW_VF_HANDLE(abs_vfid) \
  187. (abs_vfid + FW_PF_MAX_HANDLE)
  188. /* locking and unlocking the channel mutex */
  189. void bnx2x_lock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
  190. enum channel_tlvs tlv);
  191. void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
  192. enum channel_tlvs expected_tlv);
  193. /* VF mail box (aka vf-pf channel) */
  194. /* a container for the bi-directional vf<-->pf messages.
  195. * The actual response will be placed according to the offset parameter
  196. * provided in the request
  197. */
  198. #define MBX_MSG_ALIGN 8
  199. #define MBX_MSG_ALIGNED_SIZE (roundup(sizeof(struct bnx2x_vf_mbx_msg), \
  200. MBX_MSG_ALIGN))
  201. struct bnx2x_vf_mbx_msg {
  202. union vfpf_tlvs req;
  203. union pfvf_tlvs resp;
  204. };
  205. struct bnx2x_vf_mbx {
  206. struct bnx2x_vf_mbx_msg *msg;
  207. dma_addr_t msg_mapping;
  208. /* VF GPA address */
  209. u32 vf_addr_lo;
  210. u32 vf_addr_hi;
  211. struct vfpf_first_tlv first_tlv; /* saved VF request header */
  212. };
  213. struct bnx2x_vf_sp {
  214. union {
  215. struct eth_classify_rules_ramrod_data e2;
  216. } mac_rdata;
  217. union {
  218. struct eth_classify_rules_ramrod_data e2;
  219. } vlan_rdata;
  220. union {
  221. struct eth_filter_rules_ramrod_data e2;
  222. } rx_mode_rdata;
  223. union {
  224. struct eth_multicast_rules_ramrod_data e2;
  225. } mcast_rdata;
  226. union {
  227. struct client_init_ramrod_data init_data;
  228. struct client_update_ramrod_data update_data;
  229. } q_data;
  230. union {
  231. struct eth_rss_update_ramrod_data e2;
  232. } rss_rdata;
  233. };
  234. struct hw_dma {
  235. void *addr;
  236. dma_addr_t mapping;
  237. size_t size;
  238. };
  239. struct bnx2x_vfdb {
  240. #define BP_VFDB(bp) ((bp)->vfdb)
  241. /* vf array */
  242. struct bnx2x_virtf *vfs;
  243. #define BP_VF(bp, idx) ((BP_VFDB(bp) && (bp)->vfdb->vfs) ? \
  244. &((bp)->vfdb->vfs[idx]) : NULL)
  245. #define bnx2x_vf(bp, idx, var) ((bp)->vfdb->vfs[idx].var)
  246. /* queue array - for all vfs */
  247. struct bnx2x_vf_queue *vfqs;
  248. /* vf HW contexts */
  249. struct hw_dma context[BNX2X_VF_CIDS/ILT_PAGE_CIDS];
  250. #define BP_VF_CXT_PAGE(bp, i) (&(bp)->vfdb->context[i])
  251. /* SR-IOV information */
  252. struct bnx2x_sriov sriov;
  253. struct hw_dma mbx_dma;
  254. #define BP_VF_MBX_DMA(bp) (&((bp)->vfdb->mbx_dma))
  255. struct bnx2x_vf_mbx mbxs[BNX2X_MAX_NUM_OF_VFS];
  256. #define BP_VF_MBX(bp, vfid) (&((bp)->vfdb->mbxs[vfid]))
  257. struct hw_dma bulletin_dma;
  258. #define BP_VF_BULLETIN_DMA(bp) (&((bp)->vfdb->bulletin_dma))
  259. #define BP_VF_BULLETIN(bp, vf) \
  260. (((struct pf_vf_bulletin_content *)(BP_VF_BULLETIN_DMA(bp)->addr)) \
  261. + (vf))
  262. struct hw_dma sp_dma;
  263. #define bnx2x_vf_sp(bp, vf, field) ((bp)->vfdb->sp_dma.addr + \
  264. (vf)->index * sizeof(struct bnx2x_vf_sp) + \
  265. offsetof(struct bnx2x_vf_sp, field))
  266. #define bnx2x_vf_sp_map(bp, vf, field) ((bp)->vfdb->sp_dma.mapping + \
  267. (vf)->index * sizeof(struct bnx2x_vf_sp) + \
  268. offsetof(struct bnx2x_vf_sp, field))
  269. #define FLRD_VFS_DWORDS (BNX2X_MAX_NUM_OF_VFS / 32)
  270. u32 flrd_vfs[FLRD_VFS_DWORDS];
  271. /* the number of msix vectors belonging to this PF designated for VFs */
  272. u16 vf_sbs_pool;
  273. u16 first_vf_igu_entry;
  274. /* sp_rtnl synchronization */
  275. struct mutex event_mutex;
  276. u64 event_occur;
  277. /* bulletin board update synchronization */
  278. struct mutex bulletin_mutex;
  279. };
  280. /* queue access */
  281. static inline struct bnx2x_vf_queue *vfq_get(struct bnx2x_virtf *vf, u8 index)
  282. {
  283. return &(vf->vfqs[index]);
  284. }
  285. /* FW ids */
  286. static inline u8 vf_igu_sb(struct bnx2x_virtf *vf, u16 sb_idx)
  287. {
  288. return vf->igu_base_id + sb_idx;
  289. }
  290. static inline u8 vf_hc_qzone(struct bnx2x_virtf *vf, u16 sb_idx)
  291. {
  292. return vf_igu_sb(vf, sb_idx);
  293. }
  294. static u8 vfq_cl_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
  295. {
  296. return vf->igu_base_id + q->index;
  297. }
  298. static inline u8 vfq_stat_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
  299. {
  300. if (vf->cfg_flags & VF_CFG_STATS_COALESCE)
  301. return vf->leading_rss;
  302. else
  303. return vfq_cl_id(vf, q);
  304. }
  305. static inline u8 vfq_qzone_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
  306. {
  307. return vfq_cl_id(vf, q);
  308. }
  309. /* global iov routines */
  310. int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line);
  311. int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, int num_vfs_param);
  312. void bnx2x_iov_remove_one(struct bnx2x *bp);
  313. void bnx2x_iov_free_mem(struct bnx2x *bp);
  314. int bnx2x_iov_alloc_mem(struct bnx2x *bp);
  315. int bnx2x_iov_nic_init(struct bnx2x *bp);
  316. int bnx2x_iov_chip_cleanup(struct bnx2x *bp);
  317. void bnx2x_iov_init_dq(struct bnx2x *bp);
  318. void bnx2x_iov_init_dmae(struct bnx2x *bp);
  319. void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp, int vf_cid,
  320. struct bnx2x_queue_sp_obj **q_obj);
  321. int bnx2x_iov_eq_sp_event(struct bnx2x *bp, union event_ring_elem *elem);
  322. void bnx2x_iov_adjust_stats_req(struct bnx2x *bp);
  323. void bnx2x_iov_storm_stats_update(struct bnx2x *bp);
  324. /* global vf mailbox routines */
  325. void bnx2x_vf_mbx(struct bnx2x *bp);
  326. void bnx2x_vf_mbx_schedule(struct bnx2x *bp,
  327. struct vf_pf_event_data *vfpf_event);
  328. void bnx2x_vf_enable_mbx(struct bnx2x *bp, u8 abs_vfid);
  329. /* CORE VF API */
  330. typedef u8 bnx2x_mac_addr_t[ETH_ALEN];
  331. /* acquire */
  332. int bnx2x_vf_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf,
  333. struct vf_pf_resc_request *resc);
  334. /* init */
  335. int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf,
  336. dma_addr_t *sb_map);
  337. /* VFOP queue construction helpers */
  338. void bnx2x_vfop_qctor_dump_tx(struct bnx2x *bp, struct bnx2x_virtf *vf,
  339. struct bnx2x_queue_init_params *init_params,
  340. struct bnx2x_queue_setup_params *setup_params,
  341. u16 q_idx, u16 sb_idx);
  342. void bnx2x_vfop_qctor_dump_rx(struct bnx2x *bp, struct bnx2x_virtf *vf,
  343. struct bnx2x_queue_init_params *init_params,
  344. struct bnx2x_queue_setup_params *setup_params,
  345. u16 q_idx, u16 sb_idx);
  346. void bnx2x_vfop_qctor_prep(struct bnx2x *bp,
  347. struct bnx2x_virtf *vf,
  348. struct bnx2x_vf_queue *q,
  349. struct bnx2x_vf_queue_construct_params *p,
  350. unsigned long q_type);
  351. int bnx2x_vf_mac_vlan_config_list(struct bnx2x *bp, struct bnx2x_virtf *vf,
  352. struct bnx2x_vf_mac_vlan_filters *filters,
  353. int qid, bool drv_only);
  354. int bnx2x_vf_queue_setup(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid,
  355. struct bnx2x_vf_queue_construct_params *qctor);
  356. int bnx2x_vf_queue_teardown(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid);
  357. int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf,
  358. bnx2x_mac_addr_t *mcasts, int mc_num, bool drv_only);
  359. int bnx2x_vf_rxmode(struct bnx2x *bp, struct bnx2x_virtf *vf,
  360. int qid, unsigned long accept_flags);
  361. int bnx2x_vf_close(struct bnx2x *bp, struct bnx2x_virtf *vf);
  362. int bnx2x_vf_free(struct bnx2x *bp, struct bnx2x_virtf *vf);
  363. int bnx2x_vf_rss_update(struct bnx2x *bp, struct bnx2x_virtf *vf,
  364. struct bnx2x_config_rss_params *rss);
  365. int bnx2x_vf_tpa_update(struct bnx2x *bp, struct bnx2x_virtf *vf,
  366. struct vfpf_tpa_tlv *tlv,
  367. struct bnx2x_queue_update_tpa_params *params);
  368. /* VF release ~ VF close + VF release-resources
  369. *
  370. * Release is the ultimate SW shutdown and is called whenever an
  371. * irrecoverable error is encountered.
  372. */
  373. int bnx2x_vf_release(struct bnx2x *bp, struct bnx2x_virtf *vf);
  374. int bnx2x_vf_idx_by_abs_fid(struct bnx2x *bp, u16 abs_vfid);
  375. u8 bnx2x_vf_max_queue_cnt(struct bnx2x *bp, struct bnx2x_virtf *vf);
  376. /* FLR routines */
  377. /* VF FLR helpers */
  378. int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp, u8 abs_vfid);
  379. void bnx2x_vf_enable_access(struct bnx2x *bp, u8 abs_vfid);
  380. /* Handles an FLR (or VF_DISABLE) notification form the MCP */
  381. void bnx2x_vf_handle_flr_event(struct bnx2x *bp);
  382. bool bnx2x_tlv_supported(u16 tlvtype);
  383. u32 bnx2x_crc_vf_bulletin(struct pf_vf_bulletin_content *bulletin);
  384. int bnx2x_post_vf_bulletin(struct bnx2x *bp, int vf);
  385. void bnx2x_vf_bulletin_finalize(struct pf_vf_bulletin_content *bulletin,
  386. bool support_long);
  387. enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
  388. /* VF side vfpf channel functions */
  389. int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count);
  390. int bnx2x_vfpf_release(struct bnx2x *bp);
  391. int bnx2x_vfpf_release(struct bnx2x *bp);
  392. int bnx2x_vfpf_init(struct bnx2x *bp);
  393. void bnx2x_vfpf_close_vf(struct bnx2x *bp);
  394. int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp,
  395. bool is_leading);
  396. int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set);
  397. int bnx2x_vfpf_config_rss(struct bnx2x *bp,
  398. struct bnx2x_config_rss_params *params);
  399. int bnx2x_vfpf_set_mcast(struct net_device *dev);
  400. int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp);
  401. static inline void bnx2x_vf_fill_fw_str(struct bnx2x *bp, char *buf,
  402. size_t buf_len)
  403. {
  404. strlcpy(buf, bp->acquire_resp.pfdev_info.fw_ver, buf_len);
  405. }
  406. static inline int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp,
  407. struct bnx2x_fastpath *fp)
  408. {
  409. return PXP_VF_ADDR_USDM_QUEUES_START +
  410. bp->acquire_resp.resc.hw_qid[fp->index] *
  411. sizeof(struct ustorm_queue_zone_data);
  412. }
  413. enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
  414. void bnx2x_timer_sriov(struct bnx2x *bp);
  415. void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp);
  416. void bnx2x_vf_pci_dealloc(struct bnx2x *bp);
  417. int bnx2x_vf_pci_alloc(struct bnx2x *bp);
  418. int bnx2x_enable_sriov(struct bnx2x *bp);
  419. void bnx2x_disable_sriov(struct bnx2x *bp);
  420. static inline int bnx2x_vf_headroom(struct bnx2x *bp)
  421. {
  422. return bp->vfdb->sriov.nr_virtfn * BNX2X_CIDS_PER_VF;
  423. }
  424. void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp);
  425. int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs);
  426. void bnx2x_iov_channel_down(struct bnx2x *bp);
  427. void bnx2x_iov_task(struct work_struct *work);
  428. void bnx2x_schedule_iov_task(struct bnx2x *bp, enum bnx2x_iov_flag flag);
  429. void bnx2x_iov_link_update(struct bnx2x *bp);
  430. int bnx2x_iov_link_update_vf(struct bnx2x *bp, int idx);
  431. int bnx2x_set_vf_link_state(struct net_device *dev, int vf, int link_state);
  432. #else /* CONFIG_BNX2X_SRIOV */
  433. static inline void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp, int vf_cid,
  434. struct bnx2x_queue_sp_obj **q_obj) {}
  435. static inline void bnx2x_vf_handle_flr_event(struct bnx2x *bp) {}
  436. static inline int bnx2x_iov_eq_sp_event(struct bnx2x *bp,
  437. union event_ring_elem *elem) {return 1; }
  438. static inline void bnx2x_vf_mbx(struct bnx2x *bp) {}
  439. static inline void bnx2x_vf_mbx_schedule(struct bnx2x *bp,
  440. struct vf_pf_event_data *vfpf_event) {}
  441. static inline int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line) {return line; }
  442. static inline void bnx2x_iov_init_dq(struct bnx2x *bp) {}
  443. static inline int bnx2x_iov_alloc_mem(struct bnx2x *bp) {return 0; }
  444. static inline void bnx2x_iov_free_mem(struct bnx2x *bp) {}
  445. static inline int bnx2x_iov_chip_cleanup(struct bnx2x *bp) {return 0; }
  446. static inline void bnx2x_iov_init_dmae(struct bnx2x *bp) {}
  447. static inline int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param,
  448. int num_vfs_param) {return 0; }
  449. static inline void bnx2x_iov_remove_one(struct bnx2x *bp) {}
  450. static inline int bnx2x_enable_sriov(struct bnx2x *bp) {return 0; }
  451. static inline void bnx2x_disable_sriov(struct bnx2x *bp) {}
  452. static inline int bnx2x_vfpf_acquire(struct bnx2x *bp,
  453. u8 tx_count, u8 rx_count) {return 0; }
  454. static inline int bnx2x_vfpf_release(struct bnx2x *bp) {return 0; }
  455. static inline int bnx2x_vfpf_init(struct bnx2x *bp) {return 0; }
  456. static inline void bnx2x_vfpf_close_vf(struct bnx2x *bp) {}
  457. static inline int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp, bool is_leading) {return 0; }
  458. static inline int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr,
  459. u8 vf_qid, bool set) {return 0; }
  460. static inline int bnx2x_vfpf_config_rss(struct bnx2x *bp,
  461. struct bnx2x_config_rss_params *params) {return 0; }
  462. static inline int bnx2x_vfpf_set_mcast(struct net_device *dev) {return 0; }
  463. static inline int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp) {return 0; }
  464. static inline int bnx2x_iov_nic_init(struct bnx2x *bp) {return 0; }
  465. static inline int bnx2x_vf_headroom(struct bnx2x *bp) {return 0; }
  466. static inline void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) {}
  467. static inline void bnx2x_vf_fill_fw_str(struct bnx2x *bp, char *buf,
  468. size_t buf_len) {}
  469. static inline int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp,
  470. struct bnx2x_fastpath *fp) {return 0; }
  471. static inline enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp)
  472. {
  473. return PFVF_BULLETIN_UNCHANGED;
  474. }
  475. static inline void bnx2x_timer_sriov(struct bnx2x *bp) {}
  476. static inline void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp)
  477. {
  478. return NULL;
  479. }
  480. static inline void bnx2x_vf_pci_dealloc(struct bnx2x *bp) {}
  481. static inline int bnx2x_vf_pci_alloc(struct bnx2x *bp) {return 0; }
  482. static inline void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp) {}
  483. static inline int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs) {return 0; }
  484. static inline void bnx2x_iov_channel_down(struct bnx2x *bp) {}
  485. static inline void bnx2x_iov_task(struct work_struct *work) {}
  486. static inline void bnx2x_schedule_iov_task(struct bnx2x *bp, enum bnx2x_iov_flag flag) {}
  487. static inline void bnx2x_iov_link_update(struct bnx2x *bp) {}
  488. static inline int bnx2x_iov_link_update_vf(struct bnx2x *bp, int idx) {return 0; }
  489. static inline int bnx2x_set_vf_link_state(struct net_device *dev, int vf,
  490. int link_state) {return 0; }
  491. struct pf_vf_bulletin_content;
  492. static inline void bnx2x_vf_bulletin_finalize(struct pf_vf_bulletin_content *bulletin,
  493. bool support_long) {}
  494. #endif /* CONFIG_BNX2X_SRIOV */
  495. #endif /* bnx2x_sriov.h */