1 /* bnx2x_sriov.h: Broadcom Everest network driver.
3 * Copyright 2009-2013 Broadcom Corporation
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").
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
15 * Maintained by: Eilon Greenstein <eilong@broadcom.com>
16 * Written by: Shmulik Ravid <shmulikr@broadcom.com>
17 * Ariel Elior <ariele@broadcom.com>
22 #include "bnx2x_vfpf.h"
25 enum sample_bulletin_result {
26 PFVF_BULLETIN_UNCHANGED,
27 PFVF_BULLETIN_UPDATED,
31 #ifdef CONFIG_BNX2X_SRIOV
33 /* The bnx2x device structure holds vfdb structure described below.
34 * The VF array is indexed by the relative vfid.
36 #define BNX2X_VF_MAX_QUEUES 16
37 #define BNX2X_VF_MAX_TPA_AGG_QUEUES 8
42 /* standard SRIOV capability fields, mostly for debugging */
43 int pos; /* capability position */
44 int nres; /* number of resources */
45 u32 cap; /* SR-IOV Capabilities */
46 u16 ctrl; /* SR-IOV Control */
47 u16 total; /* total VFs associated with the PF */
48 u16 initial; /* initial VFs associated with the PF */
49 u16 nr_virtfn; /* number of VFs available */
50 u16 offset; /* first VF Routing ID offset */
51 u16 stride; /* following VF stride */
52 u32 pgsz; /* page size for BAR alignment */
53 u8 link; /* Function Dependency Link */
62 struct bnx2x_vf_bar_info {
63 struct bnx2x_vf_bar bars[PCI_SRIOV_NUM_BARS];
67 /* vf queue (used both for rx or tx) */
68 struct bnx2x_vf_queue {
69 struct eth_context *cxt;
72 struct bnx2x_vlan_mac_obj mac_obj;
75 struct bnx2x_vlan_mac_obj vlan_obj;
76 atomic_t vlan_count; /* 0 means vlan-0 is set ~ untagged */
78 /* Queue Slow-path State object */
79 struct bnx2x_queue_sp_obj sp_obj;
86 /* struct bnx2x_vfop_qctor_params - prepare queue construction parameters:
87 * q-init, q-setup and SB index
89 struct bnx2x_vfop_qctor_params {
90 struct bnx2x_queue_state_params qstate;
91 struct bnx2x_queue_setup_params prep_qsetup;
94 /* VFOP parameters (one copy per VF) */
95 union bnx2x_vfop_params {
96 struct bnx2x_vlan_mac_ramrod_params vlan_mac;
97 struct bnx2x_rx_mode_ramrod_params rx_mode;
98 struct bnx2x_mcast_ramrod_params mcast;
99 struct bnx2x_config_rss_params rss;
100 struct bnx2x_vfop_qctor_params qctor;
106 /* VFOP definitions */
107 typedef void (*vfop_handler_t)(struct bnx2x *bp, struct bnx2x_virtf *vf);
109 struct bnx2x_vfop_cmd {
114 /* VFOP queue filters command additional arguments */
115 struct bnx2x_vfop_filter {
116 struct list_head link;
118 #define BNX2X_VFOP_FILTER_MAC 1
119 #define BNX2X_VFOP_FILTER_VLAN 2
126 struct bnx2x_vfop_filters {
128 struct list_head head;
129 struct bnx2x_vfop_filter filters[];
132 /* transient list allocated, built and saved until its
133 * passed to the SP-VERBs layer.
135 struct bnx2x_vfop_args_mcast {
137 struct bnx2x_mcast_list_elem *mc;
140 struct bnx2x_vfop_args_qctor {
145 struct bnx2x_vfop_args_qdtor {
147 struct eth_context *cxt;
150 struct bnx2x_vfop_args_defvlan {
157 struct bnx2x_vfop_args_qx {
162 struct bnx2x_vfop_args_filters {
163 struct bnx2x_vfop_filters *multi_filter;
164 atomic_t *credit; /* non NULL means 'don't consume credit' */
167 union bnx2x_vfop_args {
168 struct bnx2x_vfop_args_mcast mc_list;
169 struct bnx2x_vfop_args_qctor qctor;
170 struct bnx2x_vfop_args_qdtor qdtor;
171 struct bnx2x_vfop_args_defvlan defvlan;
172 struct bnx2x_vfop_args_qx qx;
173 struct bnx2x_vfop_args_filters filters;
177 struct list_head link;
178 int rc; /* return code */
179 int state; /* next state */
180 union bnx2x_vfop_args args; /* extra arguments */
181 union bnx2x_vfop_params *op_p; /* ramrod params */
183 /* state machine callbacks */
184 vfop_handler_t transition;
191 #define VF_CFG_STATS 0x0001
192 #define VF_CFG_FW_FC 0x0002
193 #define VF_CFG_TPA 0x0004
194 #define VF_CFG_INT_SIMD 0x0008
195 #define VF_CACHE_LINE 0x0010
198 #define VF_FREE 0 /* VF ready to be acquired holds no resc */
199 #define VF_ACQUIRED 1 /* VF aquired, but not initalized */
200 #define VF_ENABLED 2 /* VF Enabled */
201 #define VF_RESET 3 /* VF FLR'd, pending cleanup */
203 /* non 0 during flr cleanup */
205 #define VF_FLR_CLN 1 /* reclaim resources and do 'final cleanup'
208 #define VF_FLR_ACK 2 /* ACK flr notification */
209 #define VF_FLR_EPILOG 3 /* wait for VF remnants to dissipate in the HW
210 * ~ final cleanup' end wait
214 dma_addr_t fw_stat_map; /* valid iff VF_CFG_STATS */
216 dma_addr_t bulletin_map;
218 /* Allocated resources counters. Before the VF is acquired, the
219 * counters hold the following values:
221 * - xxq_count = 0 as the queues memory is not allocated yet.
223 * - sb_count = The number of status blocks configured for this VF in
224 * the IGU CAM. Initially read during probe.
226 * - xx_rules_count = The number of rules statically and equally
227 * allocated for each VF, during PF load.
229 struct vf_pf_resc_request alloc_resc;
230 #define vf_rxq_count(vf) ((vf)->alloc_resc.num_rxqs)
231 #define vf_txq_count(vf) ((vf)->alloc_resc.num_txqs)
232 #define vf_sb_count(vf) ((vf)->alloc_resc.num_sbs)
233 #define vf_mac_rules_cnt(vf) ((vf)->alloc_resc.num_mac_filters)
234 #define vf_vlan_rules_cnt(vf) ((vf)->alloc_resc.num_vlan_filters)
235 #define vf_mc_rules_cnt(vf) ((vf)->alloc_resc.num_mc_filters)
237 u8 sb_count; /* actual number of SBs */
238 u8 igu_base_id; /* base igu status block id */
240 struct bnx2x_vf_queue *vfqs;
241 #define bnx2x_vfq(vf, nr, var) ((vf)->vfqs[(nr)].var)
243 u8 index; /* index in the vf array */
246 u32 error; /* 0 means all's-well */
253 struct bnx2x_vf_bar bars[PCI_SRIOV_NUM_BARS];
255 /* set-mac ramrod state 1-pending, 0-done */
256 unsigned long filter_state;
258 /* leading rss client id ~~ the client id of the first rxq, must be
264 struct bnx2x_mcast_obj mcast_obj;
266 /* RSS configuration object */
267 struct bnx2x_rss_config_obj rss_conf_obj;
269 /* slow-path operations */
270 atomic_t op_in_progress;
272 bool op_wait_blocking;
273 struct list_head op_list_head;
274 union bnx2x_vfop_params op_params;
275 struct mutex op_mutex; /* one vfop at a time mutex */
276 enum channel_tlvs op_current;
279 #define BNX2X_NR_VIRTFN(bp) ((bp)->vfdb->sriov.nr_virtfn)
281 #define for_each_vf(bp, var) \
282 for ((var) = 0; (var) < BNX2X_NR_VIRTFN(bp); (var)++)
284 #define for_each_vfq(vf, var) \
285 for ((var) = 0; (var) < vf_rxq_count(vf); (var)++)
287 #define for_each_vf_sb(vf, var) \
288 for ((var) = 0; (var) < vf_sb_count(vf); (var)++)
290 #define is_vf_multi(vf) (vf_rxq_count(vf) > 1)
292 #define HW_VF_HANDLE(bp, abs_vfid) \
293 (u16)(BP_ABS_FUNC((bp)) | (1<<3) | ((u16)(abs_vfid) << 4))
295 #define FW_PF_MAX_HANDLE 8
297 #define FW_VF_HANDLE(abs_vfid) \
298 (abs_vfid + FW_PF_MAX_HANDLE)
300 /* locking and unlocking the channel mutex */
301 void bnx2x_lock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
302 enum channel_tlvs tlv);
304 void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
305 enum channel_tlvs expected_tlv);
307 /* VF mail box (aka vf-pf channel) */
309 /* a container for the bi-directional vf<-->pf messages.
310 * The actual response will be placed according to the offset parameter
311 * provided in the request
314 #define MBX_MSG_ALIGN 8
315 #define MBX_MSG_ALIGNED_SIZE (roundup(sizeof(struct bnx2x_vf_mbx_msg), \
318 struct bnx2x_vf_mbx_msg {
320 union pfvf_tlvs resp;
323 struct bnx2x_vf_mbx {
324 struct bnx2x_vf_mbx_msg *msg;
325 dma_addr_t msg_mapping;
331 struct vfpf_first_tlv first_tlv; /* saved VF request header */
334 #define VF_MSG_INPROCESS 0x1 /* failsafe - the FW should prevent
335 * more then one pending msg
341 struct eth_classify_rules_ramrod_data e2;
345 struct eth_classify_rules_ramrod_data e2;
349 struct eth_filter_rules_ramrod_data e2;
353 struct eth_multicast_rules_ramrod_data e2;
357 struct client_init_ramrod_data init_data;
358 struct client_update_ramrod_data update_data;
369 #define BP_VFDB(bp) ((bp)->vfdb)
371 struct bnx2x_virtf *vfs;
372 #define BP_VF(bp, idx) (&((bp)->vfdb->vfs[(idx)]))
373 #define bnx2x_vf(bp, idx, var) ((bp)->vfdb->vfs[(idx)].var)
375 /* queue array - for all vfs */
376 struct bnx2x_vf_queue *vfqs;
379 struct hw_dma context[BNX2X_VF_CIDS/ILT_PAGE_CIDS];
380 #define BP_VF_CXT_PAGE(bp, i) (&(bp)->vfdb->context[(i)])
382 /* SR-IOV information */
383 struct bnx2x_sriov sriov;
384 struct hw_dma mbx_dma;
385 #define BP_VF_MBX_DMA(bp) (&((bp)->vfdb->mbx_dma))
386 struct bnx2x_vf_mbx mbxs[BNX2X_MAX_NUM_OF_VFS];
387 #define BP_VF_MBX(bp, vfid) (&((bp)->vfdb->mbxs[(vfid)]))
389 struct hw_dma bulletin_dma;
390 #define BP_VF_BULLETIN_DMA(bp) (&((bp)->vfdb->bulletin_dma))
391 #define BP_VF_BULLETIN(bp, vf) \
392 (((struct pf_vf_bulletin_content *)(BP_VF_BULLETIN_DMA(bp)->addr)) \
395 struct hw_dma sp_dma;
396 #define bnx2x_vf_sp(bp, vf, field) ((bp)->vfdb->sp_dma.addr + \
397 (vf)->index * sizeof(struct bnx2x_vf_sp) + \
398 offsetof(struct bnx2x_vf_sp, field))
399 #define bnx2x_vf_sp_map(bp, vf, field) ((bp)->vfdb->sp_dma.mapping + \
400 (vf)->index * sizeof(struct bnx2x_vf_sp) + \
401 offsetof(struct bnx2x_vf_sp, field))
403 #define FLRD_VFS_DWORDS (BNX2X_MAX_NUM_OF_VFS / 32)
404 u32 flrd_vfs[FLRD_VFS_DWORDS];
408 static inline struct bnx2x_vf_queue *vfq_get(struct bnx2x_virtf *vf, u8 index)
410 return &(vf->vfqs[index]);
413 static inline bool vfq_is_leading(struct bnx2x_vf_queue *vfq)
415 return (vfq->index == 0);
419 static inline u8 vf_igu_sb(struct bnx2x_virtf *vf, u16 sb_idx)
421 return vf->igu_base_id + sb_idx;
424 static inline u8 vf_hc_qzone(struct bnx2x_virtf *vf, u16 sb_idx)
426 return vf_igu_sb(vf, sb_idx);
429 static u8 vfq_cl_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
431 return vf->igu_base_id + q->index;
434 static inline u8 vfq_stat_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
436 return vfq_cl_id(vf, q);
439 static inline u8 vfq_qzone_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
441 return vfq_cl_id(vf, q);
444 /* global iov routines */
445 int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line);
446 int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, int num_vfs_param);
447 void bnx2x_iov_remove_one(struct bnx2x *bp);
448 void bnx2x_iov_free_mem(struct bnx2x *bp);
449 int bnx2x_iov_alloc_mem(struct bnx2x *bp);
450 int bnx2x_iov_nic_init(struct bnx2x *bp);
451 int bnx2x_iov_chip_cleanup(struct bnx2x *bp);
452 void bnx2x_iov_init_dq(struct bnx2x *bp);
453 void bnx2x_iov_init_dmae(struct bnx2x *bp);
454 void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp, int vf_cid,
455 struct bnx2x_queue_sp_obj **q_obj);
456 void bnx2x_iov_sp_event(struct bnx2x *bp, int vf_cid, bool queue_work);
457 int bnx2x_iov_eq_sp_event(struct bnx2x *bp, union event_ring_elem *elem);
458 void bnx2x_iov_adjust_stats_req(struct bnx2x *bp);
459 void bnx2x_iov_storm_stats_update(struct bnx2x *bp);
460 void bnx2x_iov_sp_task(struct bnx2x *bp);
461 /* global vf mailbox routines */
462 void bnx2x_vf_mbx(struct bnx2x *bp, struct vf_pf_event_data *vfpf_event);
463 void bnx2x_vf_enable_mbx(struct bnx2x *bp, u8 abs_vfid);
466 typedef u8 bnx2x_mac_addr_t[ETH_ALEN];
469 int bnx2x_vf_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf,
470 struct vf_pf_resc_request *resc);
472 int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf,
475 /* VFOP generic helpers */
476 #define bnx2x_vfop_default(state) do { \
477 BNX2X_ERR("Bad state %d\n", (state)); \
478 vfop->rc = -EINVAL; \
488 #define bnx2x_vfop_finalize(vf, rc, next) do { \
493 else if ((next) == VFOP_DONE) \
495 else if ((next) == VFOP_VERIFY_PEND) \
496 BNX2X_ERR("expected pending\n"); \
498 DP(BNX2X_MSG_IOV, "no ramrod. scheduling\n"); \
499 atomic_set(&vf->op_in_progress, 1); \
500 queue_delayed_work(bnx2x_wq, &bp->sp_task, 0); \
505 #define bnx2x_vfop_opset(first_state, trans_hndlr, done_hndlr) \
507 vfop->state = first_state; \
508 vfop->op_p = &vf->op_params; \
509 vfop->transition = trans_hndlr; \
510 vfop->done = done_hndlr; \
513 static inline struct bnx2x_vfop *bnx2x_vfop_cur(struct bnx2x *bp,
514 struct bnx2x_virtf *vf)
516 WARN(!mutex_is_locked(&vf->op_mutex), "about to access vf op linked list but mutex was not locked!");
517 WARN_ON(list_empty(&vf->op_list_head));
518 return list_first_entry(&vf->op_list_head, struct bnx2x_vfop, link);
521 static inline struct bnx2x_vfop *bnx2x_vfop_add(struct bnx2x *bp,
522 struct bnx2x_virtf *vf)
524 struct bnx2x_vfop *vfop = kzalloc(sizeof(*vfop), GFP_KERNEL);
526 WARN(!mutex_is_locked(&vf->op_mutex), "about to access vf op linked list but mutex was not locked!");
528 INIT_LIST_HEAD(&vfop->link);
529 list_add(&vfop->link, &vf->op_list_head);
534 static inline void bnx2x_vfop_end(struct bnx2x *bp, struct bnx2x_virtf *vf,
535 struct bnx2x_vfop *vfop)
537 /* rc < 0 - error, otherwise set to 0 */
538 DP(BNX2X_MSG_IOV, "rc was %d\n", vfop->rc);
541 DP(BNX2X_MSG_IOV, "rc is now %d\n", vfop->rc);
543 /* unlink the current op context and propagate error code
544 * must be done before invoking the 'done()' handler
546 WARN(!mutex_is_locked(&vf->op_mutex),
547 "about to access vf op linked list but mutex was not locked!");
548 list_del(&vfop->link);
550 if (list_empty(&vf->op_list_head)) {
551 DP(BNX2X_MSG_IOV, "list was empty %d\n", vfop->rc);
552 vf->op_rc = vfop->rc;
553 DP(BNX2X_MSG_IOV, "copying rc vf->op_rc %d, vfop->rc %d\n",
554 vf->op_rc, vfop->rc);
556 struct bnx2x_vfop *cur_vfop;
558 DP(BNX2X_MSG_IOV, "list not empty %d\n", vfop->rc);
559 cur_vfop = bnx2x_vfop_cur(bp, vf);
560 cur_vfop->rc = vfop->rc;
561 DP(BNX2X_MSG_IOV, "copying rc vf->op_rc %d, vfop->rc %d\n",
562 vf->op_rc, vfop->rc);
565 /* invoke done handler */
567 DP(BNX2X_MSG_IOV, "calling done handler\n");
570 /* there is no done handler for the operation to unlock
571 * the mutex. Must have gotten here from PF initiated VF RELEASE
573 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_RELEASE_VF);
576 DP(BNX2X_MSG_IOV, "done handler complete. vf->op_rc %d, vfop->rc %d\n",
577 vf->op_rc, vfop->rc);
579 /* if this is the last nested op reset the wait_blocking flag
580 * to release any blocking wrappers, only after 'done()' is invoked
582 if (list_empty(&vf->op_list_head)) {
583 DP(BNX2X_MSG_IOV, "list was empty after done %d\n", vfop->rc);
584 vf->op_wait_blocking = false;
590 static inline int bnx2x_vfop_wait_blocking(struct bnx2x *bp,
591 struct bnx2x_virtf *vf)
593 /* can take a while if any port is running */
598 if (vf->op_wait_blocking == false) {
599 #ifdef BNX2X_STOP_ON_ERROR
600 DP(BNX2X_MSG_IOV, "exit (cnt %d)\n", 5000 - cnt);
604 usleep_range(1000, 2000);
611 #ifdef BNX2X_STOP_ON_ERROR
618 static inline int bnx2x_vfop_transition(struct bnx2x *bp,
619 struct bnx2x_virtf *vf,
620 vfop_handler_t transition,
624 vf->op_wait_blocking = true;
627 return bnx2x_vfop_wait_blocking(bp, vf);
631 /* VFOP queue construction helpers */
632 void bnx2x_vfop_qctor_dump_tx(struct bnx2x *bp, struct bnx2x_virtf *vf,
633 struct bnx2x_queue_init_params *init_params,
634 struct bnx2x_queue_setup_params *setup_params,
635 u16 q_idx, u16 sb_idx);
637 void bnx2x_vfop_qctor_dump_rx(struct bnx2x *bp, struct bnx2x_virtf *vf,
638 struct bnx2x_queue_init_params *init_params,
639 struct bnx2x_queue_setup_params *setup_params,
640 u16 q_idx, u16 sb_idx);
642 void bnx2x_vfop_qctor_prep(struct bnx2x *bp,
643 struct bnx2x_virtf *vf,
644 struct bnx2x_vf_queue *q,
645 struct bnx2x_vfop_qctor_params *p,
646 unsigned long q_type);
647 int bnx2x_vfop_mac_list_cmd(struct bnx2x *bp,
648 struct bnx2x_virtf *vf,
649 struct bnx2x_vfop_cmd *cmd,
650 struct bnx2x_vfop_filters *macs,
651 int qid, bool drv_only);
653 int bnx2x_vfop_vlan_set_cmd(struct bnx2x *bp,
654 struct bnx2x_virtf *vf,
655 struct bnx2x_vfop_cmd *cmd,
656 int qid, u16 vid, bool add);
658 int bnx2x_vfop_vlan_list_cmd(struct bnx2x *bp,
659 struct bnx2x_virtf *vf,
660 struct bnx2x_vfop_cmd *cmd,
661 struct bnx2x_vfop_filters *vlans,
662 int qid, bool drv_only);
664 int bnx2x_vfop_qsetup_cmd(struct bnx2x *bp,
665 struct bnx2x_virtf *vf,
666 struct bnx2x_vfop_cmd *cmd,
669 int bnx2x_vfop_qdown_cmd(struct bnx2x *bp,
670 struct bnx2x_virtf *vf,
671 struct bnx2x_vfop_cmd *cmd,
674 int bnx2x_vfop_mcast_cmd(struct bnx2x *bp,
675 struct bnx2x_virtf *vf,
676 struct bnx2x_vfop_cmd *cmd,
677 bnx2x_mac_addr_t *mcasts,
678 int mcast_num, bool drv_only);
680 int bnx2x_vfop_rxmode_cmd(struct bnx2x *bp,
681 struct bnx2x_virtf *vf,
682 struct bnx2x_vfop_cmd *cmd,
683 int qid, unsigned long accept_flags);
685 int bnx2x_vfop_close_cmd(struct bnx2x *bp,
686 struct bnx2x_virtf *vf,
687 struct bnx2x_vfop_cmd *cmd);
689 int bnx2x_vfop_release_cmd(struct bnx2x *bp,
690 struct bnx2x_virtf *vf,
691 struct bnx2x_vfop_cmd *cmd);
693 /* VF release ~ VF close + VF release-resources
695 * Release is the ultimate SW shutdown and is called whenever an
696 * irrecoverable error is encountered.
698 void bnx2x_vf_release(struct bnx2x *bp, struct bnx2x_virtf *vf, bool block);
699 int bnx2x_vf_idx_by_abs_fid(struct bnx2x *bp, u16 abs_vfid);
700 u8 bnx2x_vf_max_queue_cnt(struct bnx2x *bp, struct bnx2x_virtf *vf);
705 int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp, u8 abs_vfid);
706 void bnx2x_vf_enable_access(struct bnx2x *bp, u8 abs_vfid);
708 /* Handles an FLR (or VF_DISABLE) notification form the MCP */
709 void bnx2x_vf_handle_flr_event(struct bnx2x *bp);
711 void bnx2x_add_tlv(struct bnx2x *bp, void *tlvs_list, u16 offset, u16 type,
713 void bnx2x_vfpf_prep(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv,
714 u16 type, u16 length);
715 void bnx2x_dp_tlv_list(struct bnx2x *bp, void *tlvs_list);
717 bool bnx2x_tlv_supported(u16 tlvtype);
719 u32 bnx2x_crc_vf_bulletin(struct bnx2x *bp,
720 struct pf_vf_bulletin_content *bulletin);
721 int bnx2x_post_vf_bulletin(struct bnx2x *bp, int vf);
724 enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
726 /* VF side vfpf channel functions */
727 int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count);
728 int bnx2x_vfpf_release(struct bnx2x *bp);
729 int bnx2x_vfpf_release(struct bnx2x *bp);
730 int bnx2x_vfpf_init(struct bnx2x *bp);
731 void bnx2x_vfpf_close_vf(struct bnx2x *bp);
732 int bnx2x_vfpf_setup_q(struct bnx2x *bp, int fp_idx);
733 int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx);
734 int bnx2x_vfpf_set_mac(struct bnx2x *bp);
735 int bnx2x_vfpf_set_mcast(struct net_device *dev);
736 int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp);
738 static inline void bnx2x_vf_fill_fw_str(struct bnx2x *bp, char *buf,
741 strlcpy(buf, bp->acquire_resp.pfdev_info.fw_ver, buf_len);
744 static inline int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp,
745 struct bnx2x_fastpath *fp)
747 return PXP_VF_ADDR_USDM_QUEUES_START +
748 bp->acquire_resp.resc.hw_qid[fp->index] *
749 sizeof(struct ustorm_queue_zone_data);
752 enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
753 void bnx2x_vf_map_doorbells(struct bnx2x *bp);
754 int bnx2x_vf_pci_alloc(struct bnx2x *bp);
755 void bnx2x_enable_sriov(struct bnx2x *bp);
756 static inline int bnx2x_vf_headroom(struct bnx2x *bp)
758 return bp->vfdb->sriov.nr_virtfn * BNX2X_CLIENTS_PER_VF;
761 #else /* CONFIG_BNX2X_SRIOV */
763 static inline void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp, int vf_cid,
764 struct bnx2x_queue_sp_obj **q_obj) {}
765 static inline void bnx2x_iov_sp_event(struct bnx2x *bp, int vf_cid,
767 static inline void bnx2x_vf_handle_flr_event(struct bnx2x *bp) {}
768 static inline int bnx2x_iov_eq_sp_event(struct bnx2x *bp,
769 union event_ring_elem *elem) {return 1; }
770 static inline void bnx2x_iov_sp_task(struct bnx2x *bp) {}
771 static inline void bnx2x_vf_mbx(struct bnx2x *bp,
772 struct vf_pf_event_data *vfpf_event) {}
773 static inline int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line) {return line; }
774 static inline void bnx2x_iov_init_dq(struct bnx2x *bp) {}
775 static inline int bnx2x_iov_alloc_mem(struct bnx2x *bp) {return 0; }
776 static inline void bnx2x_iov_free_mem(struct bnx2x *bp) {}
777 static inline int bnx2x_iov_chip_cleanup(struct bnx2x *bp) {return 0; }
778 static inline void bnx2x_iov_init_dmae(struct bnx2x *bp) {}
779 static inline int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param,
780 int num_vfs_param) {return 0; }
781 static inline void bnx2x_iov_remove_one(struct bnx2x *bp) {}
782 static inline void bnx2x_enable_sriov(struct bnx2x *bp) {}
783 static inline int bnx2x_vfpf_acquire(struct bnx2x *bp,
784 u8 tx_count, u8 rx_count) {return 0; }
785 static inline int bnx2x_vfpf_release(struct bnx2x *bp) {return 0; }
786 static inline int bnx2x_vfpf_init(struct bnx2x *bp) {return 0; }
787 static inline void bnx2x_vfpf_close_vf(struct bnx2x *bp) {}
788 static inline int bnx2x_vfpf_setup_q(struct bnx2x *bp, int fp_idx) {return 0; }
789 static inline int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx) {return 0; }
790 static inline int bnx2x_vfpf_set_mac(struct bnx2x *bp) {return 0; }
791 static inline int bnx2x_vfpf_set_mcast(struct net_device *dev) {return 0; }
792 static inline int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp) {return 0; }
793 static inline int bnx2x_iov_nic_init(struct bnx2x *bp) {return 0; }
794 static inline int bnx2x_vf_headroom(struct bnx2x *bp) {return 0; }
795 static inline void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) {}
796 static inline void bnx2x_vf_fill_fw_str(struct bnx2x *bp, char *buf,
798 static inline int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp,
799 struct bnx2x_fastpath *fp) {return 0; }
800 static inline enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp)
802 return PFVF_BULLETIN_UNCHANGED;
805 static inline int bnx2x_vf_map_doorbells(struct bnx2x *bp) {return 0; }
806 static inline int bnx2x_vf_pci_alloc(struct bnx2x *bp) {return 0; }
808 #endif /* CONFIG_BNX2X_SRIOV */
809 #endif /* bnx2x_sriov.h */