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 */
77 unsigned long accept_flags; /* last accept flags configured */
79 /* Queue Slow-path State object */
80 struct bnx2x_queue_sp_obj sp_obj;
88 /* struct bnx2x_vfop_qctor_params - prepare queue construction parameters:
89 * q-init, q-setup and SB index
91 struct bnx2x_vfop_qctor_params {
92 struct bnx2x_queue_state_params qstate;
93 struct bnx2x_queue_setup_params prep_qsetup;
96 /* VFOP parameters (one copy per VF) */
97 union bnx2x_vfop_params {
98 struct bnx2x_vlan_mac_ramrod_params vlan_mac;
99 struct bnx2x_rx_mode_ramrod_params rx_mode;
100 struct bnx2x_mcast_ramrod_params mcast;
101 struct bnx2x_config_rss_params rss;
102 struct bnx2x_vfop_qctor_params qctor;
108 /* VFOP definitions */
109 typedef void (*vfop_handler_t)(struct bnx2x *bp, struct bnx2x_virtf *vf);
111 struct bnx2x_vfop_cmd {
116 /* VFOP queue filters command additional arguments */
117 struct bnx2x_vfop_filter {
118 struct list_head link;
120 #define BNX2X_VFOP_FILTER_MAC 1
121 #define BNX2X_VFOP_FILTER_VLAN 2
128 struct bnx2x_vfop_filters {
130 struct list_head head;
131 struct bnx2x_vfop_filter filters[];
134 /* transient list allocated, built and saved until its
135 * passed to the SP-VERBs layer.
137 struct bnx2x_vfop_args_mcast {
139 struct bnx2x_mcast_list_elem *mc;
142 struct bnx2x_vfop_args_qctor {
147 struct bnx2x_vfop_args_qdtor {
149 struct eth_context *cxt;
152 struct bnx2x_vfop_args_defvlan {
159 struct bnx2x_vfop_args_qx {
164 struct bnx2x_vfop_args_filters {
165 struct bnx2x_vfop_filters *multi_filter;
166 atomic_t *credit; /* non NULL means 'don't consume credit' */
169 union bnx2x_vfop_args {
170 struct bnx2x_vfop_args_mcast mc_list;
171 struct bnx2x_vfop_args_qctor qctor;
172 struct bnx2x_vfop_args_qdtor qdtor;
173 struct bnx2x_vfop_args_defvlan defvlan;
174 struct bnx2x_vfop_args_qx qx;
175 struct bnx2x_vfop_args_filters filters;
179 struct list_head link;
180 int rc; /* return code */
181 int state; /* next state */
182 union bnx2x_vfop_args args; /* extra arguments */
183 union bnx2x_vfop_params *op_p; /* ramrod params */
185 /* state machine callbacks */
186 vfop_handler_t transition;
193 #define VF_CFG_STATS 0x0001
194 #define VF_CFG_FW_FC 0x0002
195 #define VF_CFG_TPA 0x0004
196 #define VF_CFG_INT_SIMD 0x0008
197 #define VF_CACHE_LINE 0x0010
198 #define VF_CFG_VLAN 0x0020
199 #define VF_CFG_STATS_COALESCE 0x0040
202 #define VF_FREE 0 /* VF ready to be acquired holds no resc */
203 #define VF_ACQUIRED 1 /* VF acquired, but not initialized */
204 #define VF_ENABLED 2 /* VF Enabled */
205 #define VF_RESET 3 /* VF FLR'd, pending cleanup */
207 /* non 0 during flr cleanup */
209 #define VF_FLR_CLN 1 /* reclaim resources and do 'final cleanup'
212 #define VF_FLR_ACK 2 /* ACK flr notification */
213 #define VF_FLR_EPILOG 3 /* wait for VF remnants to dissipate in the HW
214 * ~ final cleanup' end wait
218 dma_addr_t fw_stat_map; /* valid iff VF_CFG_STATS */
221 dma_addr_t bulletin_map;
223 /* Allocated resources counters. Before the VF is acquired, the
224 * counters hold the following values:
226 * - xxq_count = 0 as the queues memory is not allocated yet.
228 * - sb_count = The number of status blocks configured for this VF in
229 * the IGU CAM. Initially read during probe.
231 * - xx_rules_count = The number of rules statically and equally
232 * allocated for each VF, during PF load.
234 struct vf_pf_resc_request alloc_resc;
235 #define vf_rxq_count(vf) ((vf)->alloc_resc.num_rxqs)
236 #define vf_txq_count(vf) ((vf)->alloc_resc.num_txqs)
237 #define vf_sb_count(vf) ((vf)->alloc_resc.num_sbs)
238 #define vf_mac_rules_cnt(vf) ((vf)->alloc_resc.num_mac_filters)
239 #define vf_vlan_rules_cnt(vf) ((vf)->alloc_resc.num_vlan_filters)
240 #define vf_mc_rules_cnt(vf) ((vf)->alloc_resc.num_mc_filters)
242 u8 sb_count; /* actual number of SBs */
243 u8 igu_base_id; /* base igu status block id */
245 struct bnx2x_vf_queue *vfqs;
246 #define LEADING_IDX 0
247 #define bnx2x_vfq_is_leading(vfq) ((vfq)->index == LEADING_IDX)
248 #define bnx2x_vfq(vf, nr, var) ((vf)->vfqs[(nr)].var)
249 #define bnx2x_leading_vfq(vf, var) ((vf)->vfqs[LEADING_IDX].var)
251 u8 index; /* index in the vf array */
254 u32 error; /* 0 means all's-well */
261 struct bnx2x_vf_bar bars[PCI_SRIOV_NUM_BARS];
263 /* set-mac ramrod state 1-pending, 0-done */
264 unsigned long filter_state;
266 /* leading rss client id ~~ the client id of the first rxq, must be
272 struct bnx2x_mcast_obj mcast_obj;
274 /* RSS configuration object */
275 struct bnx2x_rss_config_obj rss_conf_obj;
277 /* slow-path operations */
278 atomic_t op_in_progress;
280 bool op_wait_blocking;
281 struct list_head op_list_head;
282 union bnx2x_vfop_params op_params;
283 struct mutex op_mutex; /* one vfop at a time mutex */
284 enum channel_tlvs op_current;
287 #define BNX2X_NR_VIRTFN(bp) ((bp)->vfdb->sriov.nr_virtfn)
289 #define for_each_vf(bp, var) \
290 for ((var) = 0; (var) < BNX2X_NR_VIRTFN(bp); (var)++)
292 #define for_each_vfq(vf, var) \
293 for ((var) = 0; (var) < vf_rxq_count(vf); (var)++)
295 #define for_each_vf_sb(vf, var) \
296 for ((var) = 0; (var) < vf_sb_count(vf); (var)++)
298 #define is_vf_multi(vf) (vf_rxq_count(vf) > 1)
300 #define HW_VF_HANDLE(bp, abs_vfid) \
301 (u16)(BP_ABS_FUNC((bp)) | (1<<3) | ((u16)(abs_vfid) << 4))
303 #define FW_PF_MAX_HANDLE 8
305 #define FW_VF_HANDLE(abs_vfid) \
306 (abs_vfid + FW_PF_MAX_HANDLE)
308 /* locking and unlocking the channel mutex */
309 void bnx2x_lock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
310 enum channel_tlvs tlv);
312 void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
313 enum channel_tlvs expected_tlv);
315 /* VF mail box (aka vf-pf channel) */
317 /* a container for the bi-directional vf<-->pf messages.
318 * The actual response will be placed according to the offset parameter
319 * provided in the request
322 #define MBX_MSG_ALIGN 8
323 #define MBX_MSG_ALIGNED_SIZE (roundup(sizeof(struct bnx2x_vf_mbx_msg), \
326 struct bnx2x_vf_mbx_msg {
328 union pfvf_tlvs resp;
331 struct bnx2x_vf_mbx {
332 struct bnx2x_vf_mbx_msg *msg;
333 dma_addr_t msg_mapping;
339 struct vfpf_first_tlv first_tlv; /* saved VF request header */
342 #define VF_MSG_INPROCESS 0x1 /* failsafe - the FW should prevent
343 * more then one pending msg
349 struct eth_classify_rules_ramrod_data e2;
353 struct eth_classify_rules_ramrod_data e2;
357 struct eth_filter_rules_ramrod_data e2;
361 struct eth_multicast_rules_ramrod_data e2;
365 struct client_init_ramrod_data init_data;
366 struct client_update_ramrod_data update_data;
370 struct eth_rss_update_ramrod_data e2;
381 #define BP_VFDB(bp) ((bp)->vfdb)
383 struct bnx2x_virtf *vfs;
384 #define BP_VF(bp, idx) (&((bp)->vfdb->vfs[(idx)]))
385 #define bnx2x_vf(bp, idx, var) ((bp)->vfdb->vfs[(idx)].var)
387 /* queue array - for all vfs */
388 struct bnx2x_vf_queue *vfqs;
391 struct hw_dma context[BNX2X_VF_CIDS/ILT_PAGE_CIDS];
392 #define BP_VF_CXT_PAGE(bp, i) (&(bp)->vfdb->context[(i)])
394 /* SR-IOV information */
395 struct bnx2x_sriov sriov;
396 struct hw_dma mbx_dma;
397 #define BP_VF_MBX_DMA(bp) (&((bp)->vfdb->mbx_dma))
398 struct bnx2x_vf_mbx mbxs[BNX2X_MAX_NUM_OF_VFS];
399 #define BP_VF_MBX(bp, vfid) (&((bp)->vfdb->mbxs[(vfid)]))
401 struct hw_dma bulletin_dma;
402 #define BP_VF_BULLETIN_DMA(bp) (&((bp)->vfdb->bulletin_dma))
403 #define BP_VF_BULLETIN(bp, vf) \
404 (((struct pf_vf_bulletin_content *)(BP_VF_BULLETIN_DMA(bp)->addr)) \
407 struct hw_dma sp_dma;
408 #define bnx2x_vf_sp(bp, vf, field) ((bp)->vfdb->sp_dma.addr + \
409 (vf)->index * sizeof(struct bnx2x_vf_sp) + \
410 offsetof(struct bnx2x_vf_sp, field))
411 #define bnx2x_vf_sp_map(bp, vf, field) ((bp)->vfdb->sp_dma.mapping + \
412 (vf)->index * sizeof(struct bnx2x_vf_sp) + \
413 offsetof(struct bnx2x_vf_sp, field))
415 #define FLRD_VFS_DWORDS (BNX2X_MAX_NUM_OF_VFS / 32)
416 u32 flrd_vfs[FLRD_VFS_DWORDS];
418 /* the number of msix vectors belonging to this PF designated for VFs */
420 u16 first_vf_igu_entry;
424 static inline struct bnx2x_vf_queue *vfq_get(struct bnx2x_virtf *vf, u8 index)
426 return &(vf->vfqs[index]);
430 static inline u8 vf_igu_sb(struct bnx2x_virtf *vf, u16 sb_idx)
432 return vf->igu_base_id + sb_idx;
435 static inline u8 vf_hc_qzone(struct bnx2x_virtf *vf, u16 sb_idx)
437 return vf_igu_sb(vf, sb_idx);
440 static u8 vfq_cl_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
442 return vf->igu_base_id + q->index;
445 static inline u8 vfq_stat_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
447 if (vf->cfg_flags & VF_CFG_STATS_COALESCE)
448 return vf->leading_rss;
450 return vfq_cl_id(vf, q);
453 static inline u8 vfq_qzone_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
455 return vfq_cl_id(vf, q);
458 /* global iov routines */
459 int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line);
460 int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, int num_vfs_param);
461 void bnx2x_iov_remove_one(struct bnx2x *bp);
462 void bnx2x_iov_free_mem(struct bnx2x *bp);
463 int bnx2x_iov_alloc_mem(struct bnx2x *bp);
464 int bnx2x_iov_nic_init(struct bnx2x *bp);
465 int bnx2x_iov_chip_cleanup(struct bnx2x *bp);
466 void bnx2x_iov_init_dq(struct bnx2x *bp);
467 void bnx2x_iov_init_dmae(struct bnx2x *bp);
468 void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp, int vf_cid,
469 struct bnx2x_queue_sp_obj **q_obj);
470 void bnx2x_iov_sp_event(struct bnx2x *bp, int vf_cid, bool queue_work);
471 int bnx2x_iov_eq_sp_event(struct bnx2x *bp, union event_ring_elem *elem);
472 void bnx2x_iov_adjust_stats_req(struct bnx2x *bp);
473 void bnx2x_iov_storm_stats_update(struct bnx2x *bp);
474 void bnx2x_iov_sp_task(struct bnx2x *bp);
475 /* global vf mailbox routines */
476 void bnx2x_vf_mbx(struct bnx2x *bp, struct vf_pf_event_data *vfpf_event);
477 void bnx2x_vf_enable_mbx(struct bnx2x *bp, u8 abs_vfid);
480 typedef u8 bnx2x_mac_addr_t[ETH_ALEN];
483 int bnx2x_vf_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf,
484 struct vf_pf_resc_request *resc);
486 int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf,
489 /* VFOP generic helpers */
490 #define bnx2x_vfop_default(state) do { \
491 BNX2X_ERR("Bad state %d\n", (state)); \
492 vfop->rc = -EINVAL; \
502 #define bnx2x_vfop_finalize(vf, rc, next) do { \
507 else if ((next) == VFOP_DONE) \
509 else if ((next) == VFOP_VERIFY_PEND) \
510 BNX2X_ERR("expected pending\n"); \
512 DP(BNX2X_MSG_IOV, "no ramrod. Scheduling\n"); \
513 atomic_set(&vf->op_in_progress, 1); \
514 queue_delayed_work(bnx2x_wq, &bp->sp_task, 0); \
519 #define bnx2x_vfop_opset(first_state, trans_hndlr, done_hndlr) \
521 vfop->state = first_state; \
522 vfop->op_p = &vf->op_params; \
523 vfop->transition = trans_hndlr; \
524 vfop->done = done_hndlr; \
527 static inline struct bnx2x_vfop *bnx2x_vfop_cur(struct bnx2x *bp,
528 struct bnx2x_virtf *vf)
530 WARN(!mutex_is_locked(&vf->op_mutex), "about to access vf op linked list but mutex was not locked!");
531 WARN_ON(list_empty(&vf->op_list_head));
532 return list_first_entry(&vf->op_list_head, struct bnx2x_vfop, link);
535 static inline struct bnx2x_vfop *bnx2x_vfop_add(struct bnx2x *bp,
536 struct bnx2x_virtf *vf)
538 struct bnx2x_vfop *vfop = kzalloc(sizeof(*vfop), GFP_KERNEL);
540 WARN(!mutex_is_locked(&vf->op_mutex), "about to access vf op linked list but mutex was not locked!");
542 INIT_LIST_HEAD(&vfop->link);
543 list_add(&vfop->link, &vf->op_list_head);
548 static inline void bnx2x_vfop_end(struct bnx2x *bp, struct bnx2x_virtf *vf,
549 struct bnx2x_vfop *vfop)
551 /* rc < 0 - error, otherwise set to 0 */
552 DP(BNX2X_MSG_IOV, "rc was %d\n", vfop->rc);
555 DP(BNX2X_MSG_IOV, "rc is now %d\n", vfop->rc);
557 /* unlink the current op context and propagate error code
558 * must be done before invoking the 'done()' handler
560 WARN(!mutex_is_locked(&vf->op_mutex),
561 "about to access vf op linked list but mutex was not locked!");
562 list_del(&vfop->link);
564 if (list_empty(&vf->op_list_head)) {
565 DP(BNX2X_MSG_IOV, "list was empty %d\n", vfop->rc);
566 vf->op_rc = vfop->rc;
567 DP(BNX2X_MSG_IOV, "copying rc vf->op_rc %d, vfop->rc %d\n",
568 vf->op_rc, vfop->rc);
570 struct bnx2x_vfop *cur_vfop;
572 DP(BNX2X_MSG_IOV, "list not empty %d\n", vfop->rc);
573 cur_vfop = bnx2x_vfop_cur(bp, vf);
574 cur_vfop->rc = vfop->rc;
575 DP(BNX2X_MSG_IOV, "copying rc vf->op_rc %d, vfop->rc %d\n",
576 vf->op_rc, vfop->rc);
579 /* invoke done handler */
581 DP(BNX2X_MSG_IOV, "calling done handler\n");
584 /* there is no done handler for the operation to unlock
585 * the mutex. Must have gotten here from PF initiated VF RELEASE
587 bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_RELEASE_VF);
590 DP(BNX2X_MSG_IOV, "done handler complete. vf->op_rc %d, vfop->rc %d\n",
591 vf->op_rc, vfop->rc);
593 /* if this is the last nested op reset the wait_blocking flag
594 * to release any blocking wrappers, only after 'done()' is invoked
596 if (list_empty(&vf->op_list_head)) {
597 DP(BNX2X_MSG_IOV, "list was empty after done %d\n", vfop->rc);
598 vf->op_wait_blocking = false;
604 static inline int bnx2x_vfop_wait_blocking(struct bnx2x *bp,
605 struct bnx2x_virtf *vf)
607 /* can take a while if any port is running */
612 if (vf->op_wait_blocking == false) {
613 #ifdef BNX2X_STOP_ON_ERROR
614 DP(BNX2X_MSG_IOV, "exit (cnt %d)\n", 5000 - cnt);
618 usleep_range(1000, 2000);
625 #ifdef BNX2X_STOP_ON_ERROR
632 static inline int bnx2x_vfop_transition(struct bnx2x *bp,
633 struct bnx2x_virtf *vf,
634 vfop_handler_t transition,
638 vf->op_wait_blocking = true;
641 return bnx2x_vfop_wait_blocking(bp, vf);
645 /* VFOP queue construction helpers */
646 void bnx2x_vfop_qctor_dump_tx(struct bnx2x *bp, struct bnx2x_virtf *vf,
647 struct bnx2x_queue_init_params *init_params,
648 struct bnx2x_queue_setup_params *setup_params,
649 u16 q_idx, u16 sb_idx);
651 void bnx2x_vfop_qctor_dump_rx(struct bnx2x *bp, struct bnx2x_virtf *vf,
652 struct bnx2x_queue_init_params *init_params,
653 struct bnx2x_queue_setup_params *setup_params,
654 u16 q_idx, u16 sb_idx);
656 void bnx2x_vfop_qctor_prep(struct bnx2x *bp,
657 struct bnx2x_virtf *vf,
658 struct bnx2x_vf_queue *q,
659 struct bnx2x_vfop_qctor_params *p,
660 unsigned long q_type);
661 int bnx2x_vfop_mac_list_cmd(struct bnx2x *bp,
662 struct bnx2x_virtf *vf,
663 struct bnx2x_vfop_cmd *cmd,
664 struct bnx2x_vfop_filters *macs,
665 int qid, bool drv_only);
667 int bnx2x_vfop_vlan_set_cmd(struct bnx2x *bp,
668 struct bnx2x_virtf *vf,
669 struct bnx2x_vfop_cmd *cmd,
670 int qid, u16 vid, bool add);
672 int bnx2x_vfop_vlan_list_cmd(struct bnx2x *bp,
673 struct bnx2x_virtf *vf,
674 struct bnx2x_vfop_cmd *cmd,
675 struct bnx2x_vfop_filters *vlans,
676 int qid, bool drv_only);
678 int bnx2x_vfop_qsetup_cmd(struct bnx2x *bp,
679 struct bnx2x_virtf *vf,
680 struct bnx2x_vfop_cmd *cmd,
683 int bnx2x_vfop_qdown_cmd(struct bnx2x *bp,
684 struct bnx2x_virtf *vf,
685 struct bnx2x_vfop_cmd *cmd,
688 int bnx2x_vfop_mcast_cmd(struct bnx2x *bp,
689 struct bnx2x_virtf *vf,
690 struct bnx2x_vfop_cmd *cmd,
691 bnx2x_mac_addr_t *mcasts,
692 int mcast_num, bool drv_only);
694 int bnx2x_vfop_rxmode_cmd(struct bnx2x *bp,
695 struct bnx2x_virtf *vf,
696 struct bnx2x_vfop_cmd *cmd,
697 int qid, unsigned long accept_flags);
699 int bnx2x_vfop_close_cmd(struct bnx2x *bp,
700 struct bnx2x_virtf *vf,
701 struct bnx2x_vfop_cmd *cmd);
703 int bnx2x_vfop_release_cmd(struct bnx2x *bp,
704 struct bnx2x_virtf *vf,
705 struct bnx2x_vfop_cmd *cmd);
707 int bnx2x_vfop_rss_cmd(struct bnx2x *bp,
708 struct bnx2x_virtf *vf,
709 struct bnx2x_vfop_cmd *cmd);
711 /* VF release ~ VF close + VF release-resources
713 * Release is the ultimate SW shutdown and is called whenever an
714 * irrecoverable error is encountered.
716 void bnx2x_vf_release(struct bnx2x *bp, struct bnx2x_virtf *vf, bool block);
717 int bnx2x_vf_idx_by_abs_fid(struct bnx2x *bp, u16 abs_vfid);
718 u8 bnx2x_vf_max_queue_cnt(struct bnx2x *bp, struct bnx2x_virtf *vf);
723 int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp, u8 abs_vfid);
724 void bnx2x_vf_enable_access(struct bnx2x *bp, u8 abs_vfid);
726 /* Handles an FLR (or VF_DISABLE) notification form the MCP */
727 void bnx2x_vf_handle_flr_event(struct bnx2x *bp);
729 void bnx2x_add_tlv(struct bnx2x *bp, void *tlvs_list, u16 offset, u16 type,
731 void bnx2x_vfpf_prep(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv,
732 u16 type, u16 length);
733 void bnx2x_vfpf_finalize(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv);
734 void bnx2x_dp_tlv_list(struct bnx2x *bp, void *tlvs_list);
736 bool bnx2x_tlv_supported(u16 tlvtype);
738 u32 bnx2x_crc_vf_bulletin(struct bnx2x *bp,
739 struct pf_vf_bulletin_content *bulletin);
740 int bnx2x_post_vf_bulletin(struct bnx2x *bp, int vf);
742 enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
744 /* VF side vfpf channel functions */
745 int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count);
746 int bnx2x_vfpf_release(struct bnx2x *bp);
747 int bnx2x_vfpf_release(struct bnx2x *bp);
748 int bnx2x_vfpf_init(struct bnx2x *bp);
749 void bnx2x_vfpf_close_vf(struct bnx2x *bp);
750 int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp,
752 int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx);
753 int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set);
754 int bnx2x_vfpf_config_rss(struct bnx2x *bp,
755 struct bnx2x_config_rss_params *params);
756 int bnx2x_vfpf_set_mcast(struct net_device *dev);
757 int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp);
759 static inline void bnx2x_vf_fill_fw_str(struct bnx2x *bp, char *buf,
762 strlcpy(buf, bp->acquire_resp.pfdev_info.fw_ver, buf_len);
765 static inline int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp,
766 struct bnx2x_fastpath *fp)
768 return PXP_VF_ADDR_USDM_QUEUES_START +
769 bp->acquire_resp.resc.hw_qid[fp->index] *
770 sizeof(struct ustorm_queue_zone_data);
773 enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
774 void bnx2x_timer_sriov(struct bnx2x *bp);
775 void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp);
776 int bnx2x_vf_pci_alloc(struct bnx2x *bp);
777 int bnx2x_enable_sriov(struct bnx2x *bp);
778 void bnx2x_disable_sriov(struct bnx2x *bp);
779 static inline int bnx2x_vf_headroom(struct bnx2x *bp)
781 return bp->vfdb->sriov.nr_virtfn * BNX2X_CIDS_PER_VF;
783 void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp);
784 int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs);
785 void bnx2x_iov_channel_down(struct bnx2x *bp);
787 #else /* CONFIG_BNX2X_SRIOV */
789 static inline void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp, int vf_cid,
790 struct bnx2x_queue_sp_obj **q_obj) {}
791 static inline void bnx2x_iov_sp_event(struct bnx2x *bp, int vf_cid,
793 static inline void bnx2x_vf_handle_flr_event(struct bnx2x *bp) {}
794 static inline int bnx2x_iov_eq_sp_event(struct bnx2x *bp,
795 union event_ring_elem *elem) {return 1; }
796 static inline void bnx2x_iov_sp_task(struct bnx2x *bp) {}
797 static inline void bnx2x_vf_mbx(struct bnx2x *bp,
798 struct vf_pf_event_data *vfpf_event) {}
799 static inline int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line) {return line; }
800 static inline void bnx2x_iov_init_dq(struct bnx2x *bp) {}
801 static inline int bnx2x_iov_alloc_mem(struct bnx2x *bp) {return 0; }
802 static inline void bnx2x_iov_free_mem(struct bnx2x *bp) {}
803 static inline int bnx2x_iov_chip_cleanup(struct bnx2x *bp) {return 0; }
804 static inline void bnx2x_iov_init_dmae(struct bnx2x *bp) {}
805 static inline int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param,
806 int num_vfs_param) {return 0; }
807 static inline void bnx2x_iov_remove_one(struct bnx2x *bp) {}
808 static inline int bnx2x_enable_sriov(struct bnx2x *bp) {return 0; }
809 static inline void bnx2x_disable_sriov(struct bnx2x *bp) {}
810 static inline int bnx2x_vfpf_acquire(struct bnx2x *bp,
811 u8 tx_count, u8 rx_count) {return 0; }
812 static inline int bnx2x_vfpf_release(struct bnx2x *bp) {return 0; }
813 static inline int bnx2x_vfpf_init(struct bnx2x *bp) {return 0; }
814 static inline void bnx2x_vfpf_close_vf(struct bnx2x *bp) {}
815 static inline int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp, bool is_leading) {return 0; }
816 static inline int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx) {return 0; }
817 static inline int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr,
818 u8 vf_qid, bool set) {return 0; }
819 static inline int bnx2x_vfpf_config_rss(struct bnx2x *bp,
820 struct bnx2x_config_rss_params *params) {return 0; }
821 static inline int bnx2x_vfpf_set_mcast(struct net_device *dev) {return 0; }
822 static inline int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp) {return 0; }
823 static inline int bnx2x_iov_nic_init(struct bnx2x *bp) {return 0; }
824 static inline int bnx2x_vf_headroom(struct bnx2x *bp) {return 0; }
825 static inline void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) {}
826 static inline void bnx2x_vf_fill_fw_str(struct bnx2x *bp, char *buf,
828 static inline int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp,
829 struct bnx2x_fastpath *fp) {return 0; }
830 static inline enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp)
832 return PFVF_BULLETIN_UNCHANGED;
834 static inline void bnx2x_timer_sriov(struct bnx2x *bp) {}
836 static inline void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp)
841 static inline int bnx2x_vf_pci_alloc(struct bnx2x *bp) {return 0; }
842 static inline void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp) {}
843 static inline int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs) {return 0; }
844 static inline void bnx2x_iov_channel_down(struct bnx2x *bp) {}
846 #endif /* CONFIG_BNX2X_SRIOV */
847 #endif /* bnx2x_sriov.h */