bnx2x_sriov.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  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. u8 fp_hsi;
  175. };
  176. #define BNX2X_NR_VIRTFN(bp) ((bp)->vfdb->sriov.nr_virtfn)
  177. #define for_each_vf(bp, var) \
  178. for ((var) = 0; (var) < BNX2X_NR_VIRTFN(bp); (var)++)
  179. #define for_each_vfq(vf, var) \
  180. for ((var) = 0; (var) < vf_rxq_count(vf); (var)++)
  181. #define for_each_vf_sb(vf, var) \
  182. for ((var) = 0; (var) < vf_sb_count(vf); (var)++)
  183. #define is_vf_multi(vf) (vf_rxq_count(vf) > 1)
  184. #define HW_VF_HANDLE(bp, abs_vfid) \
  185. (u16)(BP_ABS_FUNC((bp)) | (1<<3) | ((u16)(abs_vfid) << 4))
  186. #define FW_PF_MAX_HANDLE 8
  187. #define FW_VF_HANDLE(abs_vfid) \
  188. (abs_vfid + FW_PF_MAX_HANDLE)
  189. /* locking and unlocking the channel mutex */
  190. void bnx2x_lock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
  191. enum channel_tlvs tlv);
  192. void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
  193. enum channel_tlvs expected_tlv);
  194. /* VF mail box (aka vf-pf channel) */
  195. /* a container for the bi-directional vf<-->pf messages.
  196. * The actual response will be placed according to the offset parameter
  197. * provided in the request
  198. */
  199. #define MBX_MSG_ALIGN 8
  200. #define MBX_MSG_ALIGNED_SIZE (roundup(sizeof(struct bnx2x_vf_mbx_msg), \
  201. MBX_MSG_ALIGN))
  202. struct bnx2x_vf_mbx_msg {
  203. union vfpf_tlvs req;
  204. union pfvf_tlvs resp;
  205. };
  206. struct bnx2x_vf_mbx {
  207. struct bnx2x_vf_mbx_msg *msg;
  208. dma_addr_t msg_mapping;
  209. /* VF GPA address */
  210. u32 vf_addr_lo;
  211. u32 vf_addr_hi;
  212. struct vfpf_first_tlv first_tlv; /* saved VF request header */
  213. };
  214. struct bnx2x_vf_sp {
  215. union {
  216. struct eth_classify_rules_ramrod_data e2;
  217. } mac_rdata;
  218. union {
  219. struct eth_classify_rules_ramrod_data e2;
  220. } vlan_rdata;
  221. union {
  222. struct eth_filter_rules_ramrod_data e2;
  223. } rx_mode_rdata;
  224. union {
  225. struct eth_multicast_rules_ramrod_data e2;
  226. } mcast_rdata;
  227. union {
  228. struct client_init_ramrod_data init_data;
  229. struct client_update_ramrod_data update_data;
  230. } q_data;
  231. union {
  232. struct eth_rss_update_ramrod_data e2;
  233. } rss_rdata;
  234. };
  235. struct hw_dma {
  236. void *addr;
  237. dma_addr_t mapping;
  238. size_t size;
  239. };
  240. struct bnx2x_vfdb {
  241. #define BP_VFDB(bp) ((bp)->vfdb)
  242. /* vf array */
  243. struct bnx2x_virtf *vfs;
  244. #define BP_VF(bp, idx) ((BP_VFDB(bp) && (bp)->vfdb->vfs) ? \
  245. &((bp)->vfdb->vfs[idx]) : NULL)
  246. #define bnx2x_vf(bp, idx, var) ((bp)->vfdb->vfs[idx].var)
  247. /* queue array - for all vfs */
  248. struct bnx2x_vf_queue *vfqs;
  249. /* vf HW contexts */
  250. struct hw_dma context[BNX2X_VF_CIDS/ILT_PAGE_CIDS];
  251. #define BP_VF_CXT_PAGE(bp, i) (&(bp)->vfdb->context[i])
  252. /* SR-IOV information */
  253. struct bnx2x_sriov sriov;
  254. struct hw_dma mbx_dma;
  255. #define BP_VF_MBX_DMA(bp) (&((bp)->vfdb->mbx_dma))
  256. struct bnx2x_vf_mbx mbxs[BNX2X_MAX_NUM_OF_VFS];
  257. #define BP_VF_MBX(bp, vfid) (&((bp)->vfdb->mbxs[vfid]))
  258. struct hw_dma bulletin_dma;
  259. #define BP_VF_BULLETIN_DMA(bp) (&((bp)->vfdb->bulletin_dma))
  260. #define BP_VF_BULLETIN(bp, vf) \
  261. (((struct pf_vf_bulletin_content *)(BP_VF_BULLETIN_DMA(bp)->addr)) \
  262. + (vf))
  263. struct hw_dma sp_dma;
  264. #define bnx2x_vf_sp(bp, vf, field) ((bp)->vfdb->sp_dma.addr + \
  265. (vf)->index * sizeof(struct bnx2x_vf_sp) + \
  266. offsetof(struct bnx2x_vf_sp, field))
  267. #define bnx2x_vf_sp_map(bp, vf, field) ((bp)->vfdb->sp_dma.mapping + \
  268. (vf)->index * sizeof(struct bnx2x_vf_sp) + \
  269. offsetof(struct bnx2x_vf_sp, field))
  270. #define FLRD_VFS_DWORDS (BNX2X_MAX_NUM_OF_VFS / 32)
  271. u32 flrd_vfs[FLRD_VFS_DWORDS];
  272. /* the number of msix vectors belonging to this PF designated for VFs */
  273. u16 vf_sbs_pool;
  274. u16 first_vf_igu_entry;
  275. /* sp_rtnl synchronization */
  276. struct mutex event_mutex;
  277. u64 event_occur;
  278. /* bulletin board update synchronization */
  279. struct mutex bulletin_mutex;
  280. };
  281. /* queue access */
  282. static inline struct bnx2x_vf_queue *vfq_get(struct bnx2x_virtf *vf, u8 index)
  283. {
  284. return &(vf->vfqs[index]);
  285. }
  286. /* FW ids */
  287. static inline u8 vf_igu_sb(struct bnx2x_virtf *vf, u16 sb_idx)
  288. {
  289. return vf->igu_base_id + sb_idx;
  290. }
  291. static inline u8 vf_hc_qzone(struct bnx2x_virtf *vf, u16 sb_idx)
  292. {
  293. return vf_igu_sb(vf, sb_idx);
  294. }
  295. static u8 vfq_cl_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
  296. {
  297. return vf->igu_base_id + q->index;
  298. }
  299. static inline u8 vfq_stat_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
  300. {
  301. if (vf->cfg_flags & VF_CFG_STATS_COALESCE)
  302. return vf->leading_rss;
  303. else
  304. return vfq_cl_id(vf, q);
  305. }
  306. static inline u8 vfq_qzone_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
  307. {
  308. return vfq_cl_id(vf, q);
  309. }
  310. /* global iov routines */
  311. int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line);
  312. int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, int num_vfs_param);
  313. void bnx2x_iov_remove_one(struct bnx2x *bp);
  314. void bnx2x_iov_free_mem(struct bnx2x *bp);
  315. int bnx2x_iov_alloc_mem(struct bnx2x *bp);
  316. int bnx2x_iov_nic_init(struct bnx2x *bp);
  317. int bnx2x_iov_chip_cleanup(struct bnx2x *bp);
  318. void bnx2x_iov_init_dq(struct bnx2x *bp);
  319. void bnx2x_iov_init_dmae(struct bnx2x *bp);
  320. void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp, int vf_cid,
  321. struct bnx2x_queue_sp_obj **q_obj);
  322. int bnx2x_iov_eq_sp_event(struct bnx2x *bp, union event_ring_elem *elem);
  323. void bnx2x_iov_adjust_stats_req(struct bnx2x *bp);
  324. void bnx2x_iov_storm_stats_update(struct bnx2x *bp);
  325. /* global vf mailbox routines */
  326. void bnx2x_vf_mbx(struct bnx2x *bp);
  327. void bnx2x_vf_mbx_schedule(struct bnx2x *bp,
  328. struct vf_pf_event_data *vfpf_event);
  329. void bnx2x_vf_enable_mbx(struct bnx2x *bp, u8 abs_vfid);
  330. /* CORE VF API */
  331. typedef u8 bnx2x_mac_addr_t[ETH_ALEN];
  332. /* acquire */
  333. int bnx2x_vf_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf,
  334. struct vf_pf_resc_request *resc);
  335. /* init */
  336. int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf,
  337. dma_addr_t *sb_map);
  338. /* VFOP queue construction helpers */
  339. void bnx2x_vfop_qctor_dump_tx(struct bnx2x *bp, struct bnx2x_virtf *vf,
  340. struct bnx2x_queue_init_params *init_params,
  341. struct bnx2x_queue_setup_params *setup_params,
  342. u16 q_idx, u16 sb_idx);
  343. void bnx2x_vfop_qctor_dump_rx(struct bnx2x *bp, struct bnx2x_virtf *vf,
  344. struct bnx2x_queue_init_params *init_params,
  345. struct bnx2x_queue_setup_params *setup_params,
  346. u16 q_idx, u16 sb_idx);
  347. void bnx2x_vfop_qctor_prep(struct bnx2x *bp,
  348. struct bnx2x_virtf *vf,
  349. struct bnx2x_vf_queue *q,
  350. struct bnx2x_vf_queue_construct_params *p,
  351. unsigned long q_type);
  352. int bnx2x_vf_mac_vlan_config_list(struct bnx2x *bp, struct bnx2x_virtf *vf,
  353. struct bnx2x_vf_mac_vlan_filters *filters,
  354. int qid, bool drv_only);
  355. int bnx2x_vf_queue_setup(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid,
  356. struct bnx2x_vf_queue_construct_params *qctor);
  357. int bnx2x_vf_queue_teardown(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid);
  358. int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf,
  359. bnx2x_mac_addr_t *mcasts, int mc_num, bool drv_only);
  360. int bnx2x_vf_rxmode(struct bnx2x *bp, struct bnx2x_virtf *vf,
  361. int qid, unsigned long accept_flags);
  362. int bnx2x_vf_close(struct bnx2x *bp, struct bnx2x_virtf *vf);
  363. int bnx2x_vf_free(struct bnx2x *bp, struct bnx2x_virtf *vf);
  364. int bnx2x_vf_rss_update(struct bnx2x *bp, struct bnx2x_virtf *vf,
  365. struct bnx2x_config_rss_params *rss);
  366. int bnx2x_vf_tpa_update(struct bnx2x *bp, struct bnx2x_virtf *vf,
  367. struct vfpf_tpa_tlv *tlv,
  368. struct bnx2x_queue_update_tpa_params *params);
  369. /* VF release ~ VF close + VF release-resources
  370. *
  371. * Release is the ultimate SW shutdown and is called whenever an
  372. * irrecoverable error is encountered.
  373. */
  374. int bnx2x_vf_release(struct bnx2x *bp, struct bnx2x_virtf *vf);
  375. int bnx2x_vf_idx_by_abs_fid(struct bnx2x *bp, u16 abs_vfid);
  376. u8 bnx2x_vf_max_queue_cnt(struct bnx2x *bp, struct bnx2x_virtf *vf);
  377. /* FLR routines */
  378. /* VF FLR helpers */
  379. int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp, u8 abs_vfid);
  380. void bnx2x_vf_enable_access(struct bnx2x *bp, u8 abs_vfid);
  381. /* Handles an FLR (or VF_DISABLE) notification form the MCP */
  382. void bnx2x_vf_handle_flr_event(struct bnx2x *bp);
  383. bool bnx2x_tlv_supported(u16 tlvtype);
  384. u32 bnx2x_crc_vf_bulletin(struct pf_vf_bulletin_content *bulletin);
  385. int bnx2x_post_vf_bulletin(struct bnx2x *bp, int vf);
  386. void bnx2x_vf_bulletin_finalize(struct pf_vf_bulletin_content *bulletin,
  387. bool support_long);
  388. enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
  389. /* VF side vfpf channel functions */
  390. int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count);
  391. int bnx2x_vfpf_release(struct bnx2x *bp);
  392. int bnx2x_vfpf_release(struct bnx2x *bp);
  393. int bnx2x_vfpf_init(struct bnx2x *bp);
  394. void bnx2x_vfpf_close_vf(struct bnx2x *bp);
  395. int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp,
  396. bool is_leading);
  397. int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set);
  398. int bnx2x_vfpf_config_rss(struct bnx2x *bp,
  399. struct bnx2x_config_rss_params *params);
  400. int bnx2x_vfpf_set_mcast(struct net_device *dev);
  401. int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp);
  402. static inline void bnx2x_vf_fill_fw_str(struct bnx2x *bp, char *buf,
  403. size_t buf_len)
  404. {
  405. strlcpy(buf, bp->acquire_resp.pfdev_info.fw_ver, buf_len);
  406. }
  407. static inline int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp,
  408. struct bnx2x_fastpath *fp)
  409. {
  410. return PXP_VF_ADDR_USDM_QUEUES_START +
  411. bp->acquire_resp.resc.hw_qid[fp->index] *
  412. sizeof(struct ustorm_queue_zone_data);
  413. }
  414. enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
  415. void bnx2x_timer_sriov(struct bnx2x *bp);
  416. void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp);
  417. void bnx2x_vf_pci_dealloc(struct bnx2x *bp);
  418. int bnx2x_vf_pci_alloc(struct bnx2x *bp);
  419. int bnx2x_enable_sriov(struct bnx2x *bp);
  420. void bnx2x_disable_sriov(struct bnx2x *bp);
  421. static inline int bnx2x_vf_headroom(struct bnx2x *bp)
  422. {
  423. return bp->vfdb->sriov.nr_virtfn * BNX2X_CIDS_PER_VF;
  424. }
  425. void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp);
  426. int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs);
  427. void bnx2x_iov_channel_down(struct bnx2x *bp);
  428. void bnx2x_iov_task(struct work_struct *work);
  429. void bnx2x_schedule_iov_task(struct bnx2x *bp, enum bnx2x_iov_flag flag);
  430. void bnx2x_iov_link_update(struct bnx2x *bp);
  431. int bnx2x_iov_link_update_vf(struct bnx2x *bp, int idx);
  432. int bnx2x_set_vf_link_state(struct net_device *dev, int vf, int link_state);
  433. #else /* CONFIG_BNX2X_SRIOV */
  434. static inline void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp, int vf_cid,
  435. struct bnx2x_queue_sp_obj **q_obj) {}
  436. static inline void bnx2x_vf_handle_flr_event(struct bnx2x *bp) {}
  437. static inline int bnx2x_iov_eq_sp_event(struct bnx2x *bp,
  438. union event_ring_elem *elem) {return 1; }
  439. static inline void bnx2x_vf_mbx(struct bnx2x *bp) {}
  440. static inline void bnx2x_vf_mbx_schedule(struct bnx2x *bp,
  441. struct vf_pf_event_data *vfpf_event) {}
  442. static inline int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line) {return line; }
  443. static inline void bnx2x_iov_init_dq(struct bnx2x *bp) {}
  444. static inline int bnx2x_iov_alloc_mem(struct bnx2x *bp) {return 0; }
  445. static inline void bnx2x_iov_free_mem(struct bnx2x *bp) {}
  446. static inline int bnx2x_iov_chip_cleanup(struct bnx2x *bp) {return 0; }
  447. static inline void bnx2x_iov_init_dmae(struct bnx2x *bp) {}
  448. static inline int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param,
  449. int num_vfs_param) {return 0; }
  450. static inline void bnx2x_iov_remove_one(struct bnx2x *bp) {}
  451. static inline int bnx2x_enable_sriov(struct bnx2x *bp) {return 0; }
  452. static inline void bnx2x_disable_sriov(struct bnx2x *bp) {}
  453. static inline int bnx2x_vfpf_acquire(struct bnx2x *bp,
  454. u8 tx_count, u8 rx_count) {return 0; }
  455. static inline int bnx2x_vfpf_release(struct bnx2x *bp) {return 0; }
  456. static inline int bnx2x_vfpf_init(struct bnx2x *bp) {return 0; }
  457. static inline void bnx2x_vfpf_close_vf(struct bnx2x *bp) {}
  458. static inline int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp, bool is_leading) {return 0; }
  459. static inline int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr,
  460. u8 vf_qid, bool set) {return 0; }
  461. static inline int bnx2x_vfpf_config_rss(struct bnx2x *bp,
  462. struct bnx2x_config_rss_params *params) {return 0; }
  463. static inline int bnx2x_vfpf_set_mcast(struct net_device *dev) {return 0; }
  464. static inline int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp) {return 0; }
  465. static inline int bnx2x_iov_nic_init(struct bnx2x *bp) {return 0; }
  466. static inline int bnx2x_vf_headroom(struct bnx2x *bp) {return 0; }
  467. static inline void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) {}
  468. static inline void bnx2x_vf_fill_fw_str(struct bnx2x *bp, char *buf,
  469. size_t buf_len) {}
  470. static inline int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp,
  471. struct bnx2x_fastpath *fp) {return 0; }
  472. static inline enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp)
  473. {
  474. return PFVF_BULLETIN_UNCHANGED;
  475. }
  476. static inline void bnx2x_timer_sriov(struct bnx2x *bp) {}
  477. static inline void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp)
  478. {
  479. return NULL;
  480. }
  481. static inline void bnx2x_vf_pci_dealloc(struct bnx2x *bp) {}
  482. static inline int bnx2x_vf_pci_alloc(struct bnx2x *bp) {return 0; }
  483. static inline void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp) {}
  484. static inline int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs) {return 0; }
  485. static inline void bnx2x_iov_channel_down(struct bnx2x *bp) {}
  486. static inline void bnx2x_iov_task(struct work_struct *work) {}
  487. static inline void bnx2x_schedule_iov_task(struct bnx2x *bp, enum bnx2x_iov_flag flag) {}
  488. static inline void bnx2x_iov_link_update(struct bnx2x *bp) {}
  489. static inline int bnx2x_iov_link_update_vf(struct bnx2x *bp, int idx) {return 0; }
  490. static inline int bnx2x_set_vf_link_state(struct net_device *dev, int vf,
  491. int link_state) {return 0; }
  492. struct pf_vf_bulletin_content;
  493. static inline void bnx2x_vf_bulletin_finalize(struct pf_vf_bulletin_content *bulletin,
  494. bool support_long) {}
  495. #endif /* CONFIG_BNX2X_SRIOV */
  496. #endif /* bnx2x_sriov.h */