Back to home page

OSCL-LXR

 
 

    


0001 /* bnx2x_sriov.h: QLogic Everest network driver.
0002  *
0003  * Copyright 2009-2013 Broadcom Corporation
0004  * Copyright 2014 QLogic Corporation
0005  * All rights reserved
0006  *
0007  * Unless you and QLogic execute a separate written software license
0008  * agreement governing use of this software, this software is licensed to you
0009  * under the terms of the GNU General Public License version 2, available
0010  * at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html (the "GPL").
0011  *
0012  * Notwithstanding the above, under no circumstances may you combine this
0013  * software in any way with any other QLogic software provided under a
0014  * license other than the GPL, without QLogic's express prior written
0015  * consent.
0016  *
0017  * Maintained by: Ariel Elior <ariel.elior@qlogic.com>
0018  * Written by: Shmulik Ravid
0019  *         Ariel Elior <ariel.elior@qlogic.com>
0020  */
0021 #ifndef BNX2X_SRIOV_H
0022 #define BNX2X_SRIOV_H
0023 
0024 #include "bnx2x_vfpf.h"
0025 #include "bnx2x.h"
0026 
0027 enum sample_bulletin_result {
0028        PFVF_BULLETIN_UNCHANGED,
0029        PFVF_BULLETIN_UPDATED,
0030        PFVF_BULLETIN_CRC_ERR
0031 };
0032 
0033 #ifdef CONFIG_BNX2X_SRIOV
0034 
0035 extern struct workqueue_struct *bnx2x_iov_wq;
0036 
0037 /* The bnx2x device structure holds vfdb structure described below.
0038  * The VF array is indexed by the relative vfid.
0039  */
0040 #define BNX2X_VF_MAX_QUEUES     16
0041 #define BNX2X_VF_MAX_TPA_AGG_QUEUES 8
0042 
0043 struct bnx2x_sriov {
0044     u32 first_vf_in_pf;
0045 
0046     /* standard SRIOV capability fields, mostly for debugging */
0047     int pos;        /* capability position */
0048     int nres;       /* number of resources */
0049     u32 cap;        /* SR-IOV Capabilities */
0050     u16 ctrl;       /* SR-IOV Control */
0051     u16 total;      /* total VFs associated with the PF */
0052     u16 initial;        /* initial VFs associated with the PF */
0053     u16 nr_virtfn;      /* number of VFs available */
0054     u16 offset;     /* first VF Routing ID offset */
0055     u16 stride;     /* following VF stride */
0056     u32 pgsz;       /* page size for BAR alignment */
0057     u8 link;        /* Function Dependency Link */
0058 };
0059 
0060 /* bars */
0061 struct bnx2x_vf_bar {
0062     u64 bar;
0063     u32 size;
0064 };
0065 
0066 struct bnx2x_vf_bar_info {
0067     struct bnx2x_vf_bar bars[PCI_SRIOV_NUM_BARS];
0068     u8 nr_bars;
0069 };
0070 
0071 /* vf queue (used both for rx or tx) */
0072 struct bnx2x_vf_queue {
0073     struct eth_context      *cxt;
0074 
0075     /* MACs object */
0076     struct bnx2x_vlan_mac_obj   mac_obj;
0077 
0078     /* VLANs object */
0079     struct bnx2x_vlan_mac_obj   vlan_obj;
0080 
0081     /* VLAN-MACs object */
0082     struct bnx2x_vlan_mac_obj   vlan_mac_obj;
0083 
0084     unsigned long accept_flags; /* last accept flags configured */
0085 
0086     /* Queue Slow-path State object */
0087     struct bnx2x_queue_sp_obj   sp_obj;
0088 
0089     u32 cid;
0090     u16 index;
0091     u16 sb_idx;
0092     bool is_leading;
0093     bool sp_initialized;
0094 };
0095 
0096 /* struct bnx2x_vf_queue_construct_params - prepare queue construction
0097  * parameters: q-init, q-setup and SB index
0098  */
0099 struct bnx2x_vf_queue_construct_params {
0100     struct bnx2x_queue_state_params     qstate;
0101     struct bnx2x_queue_setup_params     prep_qsetup;
0102 };
0103 
0104 /* forward */
0105 struct bnx2x_virtf;
0106 
0107 /* VFOP definitions */
0108 
0109 struct bnx2x_vf_mac_vlan_filter {
0110     int type;
0111 #define BNX2X_VF_FILTER_MAC BIT(0)
0112 #define BNX2X_VF_FILTER_VLAN    BIT(1)
0113 #define BNX2X_VF_FILTER_VLAN_MAC \
0114     (BNX2X_VF_FILTER_MAC | BNX2X_VF_FILTER_VLAN) /*shortcut*/
0115 
0116     bool add;
0117     bool applied;
0118     u8 *mac;
0119     u16 vid;
0120 };
0121 
0122 struct bnx2x_vf_mac_vlan_filters {
0123     int count;
0124     struct bnx2x_vf_mac_vlan_filter filters[];
0125 };
0126 
0127 /* vf context */
0128 struct bnx2x_virtf {
0129     u16 cfg_flags;
0130 #define VF_CFG_STATS_COALESCE   0x1
0131 #define VF_CFG_EXT_BULLETIN 0x2
0132 #define VF_CFG_VLAN_FILTER  0x4
0133     u8 link_cfg;        /* IFLA_VF_LINK_STATE_AUTO
0134                  * IFLA_VF_LINK_STATE_ENABLE
0135                  * IFLA_VF_LINK_STATE_DISABLE
0136                  */
0137     u8 state;
0138 #define VF_FREE     0   /* VF ready to be acquired holds no resc */
0139 #define VF_ACQUIRED 1   /* VF acquired, but not initialized */
0140 #define VF_ENABLED  2   /* VF Enabled */
0141 #define VF_RESET    3   /* VF FLR'd, pending cleanup */
0142 #define VF_LOST     4   /* Recovery while VFs are loaded */
0143 
0144     bool flr_clnup_stage;   /* true during flr cleanup */
0145     bool malicious;     /* true if FW indicated so, until FLR */
0146     /* 1(true) if spoof check is enabled */
0147     u8 spoofchk;
0148 
0149     /* dma */
0150     dma_addr_t fw_stat_map;
0151     u16 stats_stride;
0152     dma_addr_t bulletin_map;
0153 
0154     /* Allocated resources counters. Before the VF is acquired, the
0155      * counters hold the following values:
0156      *
0157      * - xxq_count = 0 as the queues memory is not allocated yet.
0158      *
0159      * - sb_count  = The number of status blocks configured for this VF in
0160      *       the IGU CAM. Initially read during probe.
0161      *
0162      * - xx_rules_count = The number of rules statically and equally
0163      *            allocated for each VF, during PF load.
0164      */
0165     struct vf_pf_resc_request   alloc_resc;
0166 #define vf_rxq_count(vf)        ((vf)->alloc_resc.num_rxqs)
0167 #define vf_txq_count(vf)        ((vf)->alloc_resc.num_txqs)
0168 #define vf_sb_count(vf)         ((vf)->alloc_resc.num_sbs)
0169 #define vf_mac_rules_cnt(vf)        ((vf)->alloc_resc.num_mac_filters)
0170 #define vf_vlan_rules_cnt(vf)       ((vf)->alloc_resc.num_vlan_filters)
0171 #define vf_mc_rules_cnt(vf)     ((vf)->alloc_resc.num_mc_filters)
0172 
0173     u8 sb_count;    /* actual number of SBs */
0174     u8 igu_base_id; /* base igu status block id */
0175 
0176     struct bnx2x_vf_queue   *vfqs;
0177 #define LEADING_IDX         0
0178 #define bnx2x_vfq_is_leading(vfq)   ((vfq)->index == LEADING_IDX)
0179 #define bnx2x_vfq(vf, nr, var)      ((vf)->vfqs[(nr)].var)
0180 #define bnx2x_leading_vfq(vf, var)  ((vf)->vfqs[LEADING_IDX].var)
0181 
0182     u8 index;   /* index in the vf array */
0183     u8 abs_vfid;
0184     u8 sp_cl_id;
0185     u32 error;  /* 0 means all's-well */
0186 
0187     /* BDF */
0188     unsigned int domain;
0189     unsigned int bus;
0190     unsigned int devfn;
0191 
0192     /* bars */
0193     struct bnx2x_vf_bar bars[PCI_SRIOV_NUM_BARS];
0194 
0195     /* set-mac ramrod state 1-pending, 0-done */
0196     unsigned long   filter_state;
0197 
0198     /* leading rss client id ~~ the client id of the first rxq, must be
0199      * set for each txq.
0200      */
0201     int leading_rss;
0202 
0203     /* MCAST object */
0204     struct bnx2x_mcast_obj      mcast_obj;
0205 
0206     /* RSS configuration object */
0207     struct bnx2x_rss_config_obj     rss_conf_obj;
0208 
0209     /* slow-path operations */
0210     struct mutex            op_mutex; /* one vfop at a time mutex */
0211     enum channel_tlvs       op_current;
0212 
0213     u8 fp_hsi;
0214 
0215     struct bnx2x_credit_pool_obj    vf_vlans_pool;
0216     struct bnx2x_credit_pool_obj    vf_macs_pool;
0217 };
0218 
0219 #define BNX2X_NR_VIRTFN(bp) ((bp)->vfdb->sriov.nr_virtfn)
0220 
0221 #define for_each_vf(bp, var) \
0222         for ((var) = 0; (var) < BNX2X_NR_VIRTFN(bp); (var)++)
0223 
0224 #define for_each_vfq(vf, var) \
0225         for ((var) = 0; (var) < vf_rxq_count(vf); (var)++)
0226 
0227 #define for_each_vf_sb(vf, var) \
0228         for ((var) = 0; (var) < vf_sb_count(vf); (var)++)
0229 
0230 #define is_vf_multi(vf) (vf_rxq_count(vf) > 1)
0231 
0232 #define HW_VF_HANDLE(bp, abs_vfid) \
0233     (u16)(BP_ABS_FUNC((bp)) | (1<<3) |  ((u16)(abs_vfid) << 4))
0234 
0235 #define FW_PF_MAX_HANDLE    8
0236 
0237 #define FW_VF_HANDLE(abs_vfid)  \
0238     (abs_vfid + FW_PF_MAX_HANDLE)
0239 
0240 #define GET_NUM_VFS_PER_PATH(bp)    64 /* use max possible value */
0241 #define GET_NUM_VFS_PER_PF(bp)      ((bp)->vfdb ? (bp)->vfdb->sriov.total \
0242                             : 0)
0243 #define VF_MAC_CREDIT_CNT       1
0244 #define VF_VLAN_CREDIT_CNT      2 /* VLAN0 + 'real' VLAN */
0245 
0246 /* locking and unlocking the channel mutex */
0247 void bnx2x_lock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
0248                   enum channel_tlvs tlv);
0249 
0250 void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
0251                 enum channel_tlvs expected_tlv);
0252 
0253 /* VF mail box (aka vf-pf channel) */
0254 
0255 /* a container for the bi-directional vf<-->pf messages.
0256  *  The actual response will be placed according to the offset parameter
0257  *  provided in the request
0258  */
0259 
0260 #define MBX_MSG_ALIGN   8
0261 #define MBX_MSG_ALIGNED_SIZE    (roundup(sizeof(struct bnx2x_vf_mbx_msg), \
0262                 MBX_MSG_ALIGN))
0263 
0264 struct bnx2x_vf_mbx_msg {
0265     union vfpf_tlvs req;
0266     union pfvf_tlvs resp;
0267 };
0268 
0269 struct bnx2x_vf_mbx {
0270     struct bnx2x_vf_mbx_msg *msg;
0271     dma_addr_t msg_mapping;
0272 
0273     /* VF GPA address */
0274     u32 vf_addr_lo;
0275     u32 vf_addr_hi;
0276 
0277     struct vfpf_first_tlv first_tlv;    /* saved VF request header */
0278 };
0279 
0280 struct bnx2x_vf_sp {
0281     union {
0282         struct eth_classify_rules_ramrod_data   e2;
0283     } mac_rdata;
0284 
0285     union {
0286         struct eth_classify_rules_ramrod_data   e2;
0287     } vlan_rdata;
0288 
0289     union {
0290         struct eth_classify_rules_ramrod_data   e2;
0291     } vlan_mac_rdata;
0292 
0293     union {
0294         struct eth_filter_rules_ramrod_data e2;
0295     } rx_mode_rdata;
0296 
0297     union {
0298         struct eth_multicast_rules_ramrod_data  e2;
0299     } mcast_rdata;
0300 
0301     union {
0302         struct client_init_ramrod_data  init_data;
0303         struct client_update_ramrod_data update_data;
0304     } q_data;
0305 
0306     union {
0307         struct eth_rss_update_ramrod_data e2;
0308     } rss_rdata;
0309 };
0310 
0311 struct hw_dma {
0312     void *addr;
0313     dma_addr_t mapping;
0314     size_t size;
0315 };
0316 
0317 struct bnx2x_vfdb {
0318 #define BP_VFDB(bp)     ((bp)->vfdb)
0319     /* vf array */
0320     struct bnx2x_virtf  *vfs;
0321 #define BP_VF(bp, idx)      ((BP_VFDB(bp) && (bp)->vfdb->vfs) ? \
0322                     &((bp)->vfdb->vfs[idx]) : NULL)
0323 #define bnx2x_vf(bp, idx, var)  ((bp)->vfdb->vfs[idx].var)
0324 
0325     /* queue array - for all vfs */
0326     struct bnx2x_vf_queue *vfqs;
0327 
0328     /* vf HW contexts */
0329     struct hw_dma       context[BNX2X_VF_CIDS/ILT_PAGE_CIDS];
0330 #define BP_VF_CXT_PAGE(bp, i)   (&(bp)->vfdb->context[i])
0331 
0332     /* SR-IOV information */
0333     struct bnx2x_sriov  sriov;
0334     struct hw_dma       mbx_dma;
0335 #define BP_VF_MBX_DMA(bp)   (&((bp)->vfdb->mbx_dma))
0336     struct bnx2x_vf_mbx mbxs[BNX2X_MAX_NUM_OF_VFS];
0337 #define BP_VF_MBX(bp, vfid) (&((bp)->vfdb->mbxs[vfid]))
0338 
0339     struct hw_dma       bulletin_dma;
0340 #define BP_VF_BULLETIN_DMA(bp)  (&((bp)->vfdb->bulletin_dma))
0341 #define BP_VF_BULLETIN(bp, vf) \
0342     (((struct pf_vf_bulletin_content *)(BP_VF_BULLETIN_DMA(bp)->addr)) \
0343      + (vf))
0344 
0345     struct hw_dma       sp_dma;
0346 #define bnx2x_vf_sp(bp, vf, field) ((bp)->vfdb->sp_dma.addr +       \
0347         (vf)->index * sizeof(struct bnx2x_vf_sp) +      \
0348         offsetof(struct bnx2x_vf_sp, field))
0349 #define bnx2x_vf_sp_map(bp, vf, field) ((bp)->vfdb->sp_dma.mapping +    \
0350         (vf)->index * sizeof(struct bnx2x_vf_sp) +      \
0351         offsetof(struct bnx2x_vf_sp, field))
0352 
0353 #define FLRD_VFS_DWORDS (BNX2X_MAX_NUM_OF_VFS / 32)
0354     u32 flrd_vfs[FLRD_VFS_DWORDS];
0355 
0356     /* the number of msix vectors belonging to this PF designated for VFs */
0357     u16 vf_sbs_pool;
0358     u16 first_vf_igu_entry;
0359 
0360     /* sp_rtnl synchronization */
0361     struct mutex            event_mutex;
0362     u64             event_occur;
0363 
0364     /* bulletin board update synchronization */
0365     struct mutex            bulletin_mutex;
0366 };
0367 
0368 /* queue access */
0369 static inline struct bnx2x_vf_queue *vfq_get(struct bnx2x_virtf *vf, u8 index)
0370 {
0371     return &(vf->vfqs[index]);
0372 }
0373 
0374 /* FW ids */
0375 static inline u8 vf_igu_sb(struct bnx2x_virtf *vf, u16 sb_idx)
0376 {
0377     return vf->igu_base_id + sb_idx;
0378 }
0379 
0380 static inline u8 vf_hc_qzone(struct bnx2x_virtf *vf, u16 sb_idx)
0381 {
0382     return vf_igu_sb(vf, sb_idx);
0383 }
0384 
0385 static u8 vfq_cl_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
0386 {
0387     return vf->igu_base_id + q->index;
0388 }
0389 
0390 static inline u8 vfq_stat_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
0391 {
0392     if (vf->cfg_flags & VF_CFG_STATS_COALESCE)
0393         return vf->leading_rss;
0394     else
0395         return vfq_cl_id(vf, q);
0396 }
0397 
0398 static inline u8 vfq_qzone_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
0399 {
0400     return vfq_cl_id(vf, q);
0401 }
0402 
0403 /* global iov routines */
0404 int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line);
0405 int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, int num_vfs_param);
0406 void bnx2x_iov_remove_one(struct bnx2x *bp);
0407 void bnx2x_iov_free_mem(struct bnx2x *bp);
0408 int bnx2x_iov_alloc_mem(struct bnx2x *bp);
0409 int bnx2x_iov_nic_init(struct bnx2x *bp);
0410 int bnx2x_iov_chip_cleanup(struct bnx2x *bp);
0411 void bnx2x_iov_init_dq(struct bnx2x *bp);
0412 void bnx2x_iov_init_dmae(struct bnx2x *bp);
0413 void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp, int vf_cid,
0414                 struct bnx2x_queue_sp_obj **q_obj);
0415 int bnx2x_iov_eq_sp_event(struct bnx2x *bp, union event_ring_elem *elem);
0416 void bnx2x_iov_adjust_stats_req(struct bnx2x *bp);
0417 void bnx2x_iov_storm_stats_update(struct bnx2x *bp);
0418 /* global vf mailbox routines */
0419 void bnx2x_vf_mbx(struct bnx2x *bp);
0420 void bnx2x_vf_mbx_schedule(struct bnx2x *bp,
0421                struct vf_pf_event_data *vfpf_event);
0422 void bnx2x_vf_enable_mbx(struct bnx2x *bp, u8 abs_vfid);
0423 
0424 /* CORE VF API */
0425 typedef u8 bnx2x_mac_addr_t[ETH_ALEN];
0426 
0427 /* acquire */
0428 int bnx2x_vf_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf,
0429              struct vf_pf_resc_request *resc);
0430 /* init */
0431 int bnx2x_vf_init(struct bnx2x *bp, struct bnx2x_virtf *vf,
0432           dma_addr_t *sb_map);
0433 
0434 /* VFOP queue construction helpers */
0435 void bnx2x_vfop_qctor_dump_tx(struct bnx2x *bp, struct bnx2x_virtf *vf,
0436                 struct bnx2x_queue_init_params *init_params,
0437                 struct bnx2x_queue_setup_params *setup_params,
0438                 u16 q_idx, u16 sb_idx);
0439 
0440 void bnx2x_vfop_qctor_dump_rx(struct bnx2x *bp, struct bnx2x_virtf *vf,
0441                 struct bnx2x_queue_init_params *init_params,
0442                 struct bnx2x_queue_setup_params *setup_params,
0443                 u16 q_idx, u16 sb_idx);
0444 
0445 void bnx2x_vfop_qctor_prep(struct bnx2x *bp,
0446                struct bnx2x_virtf *vf,
0447                struct bnx2x_vf_queue *q,
0448                struct bnx2x_vf_queue_construct_params *p,
0449                unsigned long q_type);
0450 
0451 int bnx2x_vf_mac_vlan_config_list(struct bnx2x *bp, struct bnx2x_virtf *vf,
0452                   struct bnx2x_vf_mac_vlan_filters *filters,
0453                   int qid, bool drv_only);
0454 
0455 int bnx2x_vf_queue_setup(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid,
0456              struct bnx2x_vf_queue_construct_params *qctor);
0457 
0458 int bnx2x_vf_queue_teardown(struct bnx2x *bp, struct bnx2x_virtf *vf, int qid);
0459 
0460 int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf,
0461            bnx2x_mac_addr_t *mcasts, int mc_num, bool drv_only);
0462 
0463 int bnx2x_vf_rxmode(struct bnx2x *bp, struct bnx2x_virtf *vf,
0464             int qid, unsigned long accept_flags);
0465 
0466 int bnx2x_vf_close(struct bnx2x *bp, struct bnx2x_virtf *vf);
0467 
0468 int bnx2x_vf_free(struct bnx2x *bp, struct bnx2x_virtf *vf);
0469 
0470 int bnx2x_vf_rss_update(struct bnx2x *bp, struct bnx2x_virtf *vf,
0471             struct bnx2x_config_rss_params *rss);
0472 
0473 int bnx2x_vf_tpa_update(struct bnx2x *bp, struct bnx2x_virtf *vf,
0474             struct vfpf_tpa_tlv *tlv,
0475             struct bnx2x_queue_update_tpa_params *params);
0476 
0477 /* VF release ~ VF close + VF release-resources
0478  *
0479  * Release is the ultimate SW shutdown and is called whenever an
0480  * irrecoverable error is encountered.
0481  */
0482 int bnx2x_vf_release(struct bnx2x *bp, struct bnx2x_virtf *vf);
0483 int bnx2x_vf_idx_by_abs_fid(struct bnx2x *bp, u16 abs_vfid);
0484 u8 bnx2x_vf_max_queue_cnt(struct bnx2x *bp, struct bnx2x_virtf *vf);
0485 
0486 /* FLR routines */
0487 
0488 /* VF FLR helpers */
0489 int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp, u8 abs_vfid);
0490 void bnx2x_vf_enable_access(struct bnx2x *bp, u8 abs_vfid);
0491 
0492 /* Handles an FLR (or VF_DISABLE) notification form the MCP */
0493 void bnx2x_vf_handle_flr_event(struct bnx2x *bp);
0494 
0495 bool bnx2x_tlv_supported(u16 tlvtype);
0496 
0497 u32 bnx2x_crc_vf_bulletin(struct pf_vf_bulletin_content *bulletin);
0498 int bnx2x_post_vf_bulletin(struct bnx2x *bp, int vf);
0499 void bnx2x_vf_bulletin_finalize(struct pf_vf_bulletin_content *bulletin,
0500                 bool support_long);
0501 
0502 enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
0503 
0504 /* VF side vfpf channel functions */
0505 int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count);
0506 int bnx2x_vfpf_release(struct bnx2x *bp);
0507 int bnx2x_vfpf_init(struct bnx2x *bp);
0508 void bnx2x_vfpf_close_vf(struct bnx2x *bp);
0509 int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp,
0510                bool is_leading);
0511 int bnx2x_vfpf_config_mac(struct bnx2x *bp, const u8 *addr, u8 vf_qid,
0512               bool set);
0513 int bnx2x_vfpf_config_rss(struct bnx2x *bp,
0514               struct bnx2x_config_rss_params *params);
0515 int bnx2x_vfpf_set_mcast(struct net_device *dev);
0516 int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp);
0517 
0518 static inline void bnx2x_vf_fill_fw_str(struct bnx2x *bp, char *buf,
0519                     size_t buf_len)
0520 {
0521     strlcpy(buf, bp->acquire_resp.pfdev_info.fw_ver, buf_len);
0522 }
0523 
0524 static inline int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp,
0525                            struct bnx2x_fastpath *fp)
0526 {
0527     return PXP_VF_ADDR_USDM_QUEUES_START +
0528         bp->acquire_resp.resc.hw_qid[fp->index] *
0529         sizeof(struct ustorm_queue_zone_data);
0530 }
0531 
0532 enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp);
0533 void bnx2x_timer_sriov(struct bnx2x *bp);
0534 void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp);
0535 void bnx2x_vf_pci_dealloc(struct bnx2x *bp);
0536 int bnx2x_vf_pci_alloc(struct bnx2x *bp);
0537 int bnx2x_enable_sriov(struct bnx2x *bp);
0538 void bnx2x_disable_sriov(struct bnx2x *bp);
0539 static inline int bnx2x_vf_headroom(struct bnx2x *bp)
0540 {
0541     return bp->vfdb->sriov.nr_virtfn * BNX2X_CIDS_PER_VF;
0542 }
0543 void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp);
0544 int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs);
0545 void bnx2x_iov_channel_down(struct bnx2x *bp);
0546 
0547 void bnx2x_iov_task(struct work_struct *work);
0548 
0549 void bnx2x_schedule_iov_task(struct bnx2x *bp, enum bnx2x_iov_flag flag);
0550 
0551 void bnx2x_iov_link_update(struct bnx2x *bp);
0552 int bnx2x_iov_link_update_vf(struct bnx2x *bp, int idx);
0553 
0554 int bnx2x_set_vf_link_state(struct net_device *dev, int vf, int link_state);
0555 
0556 int bnx2x_vfpf_update_vlan(struct bnx2x *bp, u16 vid, u8 vf_qid, bool add);
0557 #else /* CONFIG_BNX2X_SRIOV */
0558 
0559 #define GET_NUM_VFS_PER_PATH(bp)    0
0560 #define GET_NUM_VFS_PER_PF(bp)      0
0561 #define VF_MAC_CREDIT_CNT       0
0562 #define VF_VLAN_CREDIT_CNT      0
0563 
0564 static inline void bnx2x_iov_set_queue_sp_obj(struct bnx2x *bp, int vf_cid,
0565                 struct bnx2x_queue_sp_obj **q_obj) {}
0566 static inline void bnx2x_vf_handle_flr_event(struct bnx2x *bp) {}
0567 static inline int bnx2x_iov_eq_sp_event(struct bnx2x *bp,
0568                     union event_ring_elem *elem) {return 1; }
0569 static inline void bnx2x_vf_mbx(struct bnx2x *bp) {}
0570 static inline void bnx2x_vf_mbx_schedule(struct bnx2x *bp,
0571                      struct vf_pf_event_data *vfpf_event) {}
0572 static inline int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line) {return line; }
0573 static inline void bnx2x_iov_init_dq(struct bnx2x *bp) {}
0574 static inline int bnx2x_iov_alloc_mem(struct bnx2x *bp) {return 0; }
0575 static inline void bnx2x_iov_free_mem(struct bnx2x *bp) {}
0576 static inline int bnx2x_iov_chip_cleanup(struct bnx2x *bp) {return 0; }
0577 static inline void bnx2x_iov_init_dmae(struct bnx2x *bp) {}
0578 static inline int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param,
0579                      int num_vfs_param) {return 0; }
0580 static inline void bnx2x_iov_remove_one(struct bnx2x *bp) {}
0581 static inline int bnx2x_enable_sriov(struct bnx2x *bp) {return 0; }
0582 static inline void bnx2x_disable_sriov(struct bnx2x *bp) {}
0583 static inline int bnx2x_vfpf_acquire(struct bnx2x *bp,
0584                      u8 tx_count, u8 rx_count) {return 0; }
0585 static inline int bnx2x_vfpf_release(struct bnx2x *bp) {return 0; }
0586 static inline int bnx2x_vfpf_init(struct bnx2x *bp) {return 0; }
0587 static inline void bnx2x_vfpf_close_vf(struct bnx2x *bp) {}
0588 static inline int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp, bool is_leading) {return 0; }
0589 static inline int bnx2x_vfpf_config_mac(struct bnx2x *bp, const u8 *addr,
0590                     u8 vf_qid, bool set) {return 0; }
0591 static inline int bnx2x_vfpf_config_rss(struct bnx2x *bp,
0592                     struct bnx2x_config_rss_params *params) {return 0; }
0593 static inline int bnx2x_vfpf_set_mcast(struct net_device *dev) {return 0; }
0594 static inline int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp) {return 0; }
0595 static inline int bnx2x_iov_nic_init(struct bnx2x *bp) {return 0; }
0596 static inline int bnx2x_vf_headroom(struct bnx2x *bp) {return 0; }
0597 static inline void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) {}
0598 static inline void bnx2x_vf_fill_fw_str(struct bnx2x *bp, char *buf,
0599                     size_t buf_len) {}
0600 static inline int bnx2x_vf_ustorm_prods_offset(struct bnx2x *bp,
0601                            struct bnx2x_fastpath *fp) {return 0; }
0602 static inline enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp)
0603 {
0604     return PFVF_BULLETIN_UNCHANGED;
0605 }
0606 static inline void bnx2x_timer_sriov(struct bnx2x *bp) {}
0607 
0608 static inline void __iomem *bnx2x_vf_doorbells(struct bnx2x *bp)
0609 {
0610     return NULL;
0611 }
0612 
0613 static inline void bnx2x_vf_pci_dealloc(struct bnx2x *bp) {}
0614 static inline int bnx2x_vf_pci_alloc(struct bnx2x *bp) {return 0; }
0615 static inline void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp) {}
0616 static inline int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs) {return 0; }
0617 static inline void bnx2x_iov_channel_down(struct bnx2x *bp) {}
0618 
0619 static inline void bnx2x_iov_task(struct work_struct *work) {}
0620 static inline void bnx2x_schedule_iov_task(struct bnx2x *bp, enum bnx2x_iov_flag flag) {}
0621 static inline void bnx2x_iov_link_update(struct bnx2x *bp) {}
0622 static inline int bnx2x_iov_link_update_vf(struct bnx2x *bp, int idx) {return 0; }
0623 
0624 static inline int bnx2x_set_vf_link_state(struct net_device *dev, int vf,
0625                       int link_state) {return 0; }
0626 struct pf_vf_bulletin_content;
0627 static inline void bnx2x_vf_bulletin_finalize(struct pf_vf_bulletin_content *bulletin,
0628                           bool support_long) {}
0629 
0630 static inline int bnx2x_vfpf_update_vlan(struct bnx2x *bp, u16 vid, u8 vf_qid, bool add) {return 0; }
0631 
0632 #endif /* CONFIG_BNX2X_SRIOV */
0633 #endif /* bnx2x_sriov.h */