bnx2x: Segregate SR-IOV code
PATCH 1/1 bnx2x: Segregate SR-IOV code
In this patch the SR-IOV code is segregated from the main bulk of the bnx2x code. The CONFIG_BNX2X_SRIOV define is added to Broadcom's Kconfig, and allows the elision of the building of all the SR-IOV support code in the driver.
The define is dependant on the kernel CONFIG_PCI_IOV configuration define.
Signed-off-by Ariel Elior <[email protected]>
--- drivers/net/ethernet/broadcom/Kconfig | 9 + drivers/net/ethernet/broadcom/bnx2x/Makefile | 3 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 20 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 92 +--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 18 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 729 +-------------------- drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 208 ++++++- drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h | 97 +++- drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | 618 +++++++++++++++++- drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h | 3 + 10 files changed, 953 insertions(+), 844 deletions(-)
drivers/net/ethernet/broadcom/Kconfig +9 -0
@@ -121,4 +121,13 @@ config BNX2X To compile this driver as a module, choose M here: the module will be called bnx2x. This is recommended. +config BNX2X_SRIOV + bool "Broadcom 578xx and 57712 SR-IOV support" + depends on BNX2X && PCI_IOV + default y + ---help--- + This configuration parameter enables Single Root Input Output + Virtualization support in the 578xx and 57712 products. This + allows for virtual function acceleration in virtual environments. + endif # NET_VENDOR_BROADCOM
drivers/net/ethernet/broadcom/bnx2x/Makefile +2 -1
@@ -4,4 +4,5 @@ obj-$(CONFIG_BNX2X) += bnx2x.o -bnx2x-objs := bnx2x_main.o bnx2x_link.o bnx2x_cmn.o bnx2x_ethtool.o bnx2x_stats.o bnx2x_dcb.o bnx2x_sp.o bnx2x_vfpf.o bnx2x_sriov.o +bnx2x-y := bnx2x_main.o bnx2x_link.o bnx2x_cmn.o bnx2x_ethtool.o bnx2x_stats.o bnx2x_dcb.o bnx2x_sp.o +bnx2x-$(CONFIG_BNX2X_SRIOV) += bnx2x_vfpf.o bnx2x_sriov.o
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +8 -12
@@ -1266,6 +1266,7 @@ struct bnx2x { (vn) * ((CHIP_IS_E1x(bp) || (CHIP_MODE_IS_4_PORT(bp))) ? 2 : 1))#define BP_FW_MB_IDX (bp) BP_FW_MB_IDX_VN(bp, BP_VN(bp)) +#ifdef CONFIG_BNX2X_SRIOV /* vf pf channel mailbox contains request and response buffers */ struct bnx2x_vf_mbx_msg *vf2pf_mbox;dma_addr_t vf2pf_mbox_mapping;
@@ -1278,6 +1279,7 @@ struct bnx2x {dma_addr_t pf2vf_bulletin_mapping;struct pf_vf_bulletin_content old_bulletin; +#endif /* CONFIG_BNX2X_SRIOV */ struct net_device *dev;struct pci_dev *pdev;
@@ -1379,8 +1381,14 @@ struct bnx2x {#define IS_VF_FLAG (1 << 22)#define BP_NOMCP (bp) ((bp)->flags & NO_MCP_FLAG) + +#ifdef CONFIG_BNX2X_SRIOV #define IS_VF (bp) ((bp)->flags & IS_VF_FLAG)#define IS_PF (bp) (!((bp)->flags & IS_VF_FLAG)) +#else +#define IS_VF (bp) false +#define IS_PF (bp) true +#endif #define NO_ISCSI (bp) ((bp)->flags & NO_ISCSI_FLAG)#define NO_ISCSI_OOO (bp) ((bp)->flags & NO_ISCSI_OOO_FLAG)
@@ -2275,18 +2283,6 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,#define GOOD_ME_REG (me_reg) (((me_reg) & ME_REG_VF_VALID) && \ (!((me_reg) & ME_REG_VF_ERR))) -int bnx2x_get_vf_id (struct bnx2x *bp,u32 *vf_id); -int bnx2x_send_msg2pf (struct bnx2x *bp,u8 *done,dma_addr_t msg_mapping); -int bnx2x_vfpf_acquire (struct bnx2x *bp,u8 tx_count,u8 rx_count); -int bnx2x_vfpf_release (struct bnx2x *bp); -int bnx2x_vfpf_init (struct bnx2x *bp); -void bnx2x_vfpf_close_vf (struct bnx2x *bp); -int bnx2x_vfpf_setup_q (struct bnx2x *bp,int fp_idx); -int bnx2x_vfpf_teardown_queue (struct bnx2x *bp,int qidx); -int bnx2x_vfpf_set_mac (struct bnx2x *bp); -int bnx2x_vfpf_set_mcast (struct net_device *dev); -int bnx2x_vfpf_storm_rx_mode (struct bnx2x *bp); -int bnx2x_nic_load_analyze_req (struct bnx2x *bp,u32 load_code);/* Congestion management fairness mode */ #define CMNG_FNS_NONE 0
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +2 -90
116 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +2 -16
@@ -24,6 +24,7 @@#include "bnx2x.h" +#include "bnx2x_sriov.h" /* This is used as a replacement for an MCP if it's not present */ extern int load_count[2 ][3 ];/* per-path: 0-common, 1-port0, 2-port1 */
@@ -1128,22 +1129,7 @@ static inline u8 bnx2x_fp_qzone_id(struct bnx2x_fastpath *fp)return fp->cl_id; } -static inline u32 bnx2x_rx_ustorm_prods_offset (struct bnx2x_fastpath *fp) -{ -struct bnx2x *bp = fp->bp; -u32 offset =BAR_USTRORM_INTMEM ; - -if (IS_VF (bp)) -return PXP_VF_ADDR_USDM_QUEUES_START + - bp->acquire_resp.resc.hw_qid[fp->index] * -sizeof (struct ustorm_queue_zone_data ); -else if (!CHIP_IS_E1x (bp)) - offset +=USTORM_RX_PRODS_E2_OFFSET (fp->cl_qzone_id); -else - offset +=USTORM_RX_PRODS_E1X_OFFSET (BP_PORT (bp), fp->cl_id); - -return offset; -} +u32 bnx2x_rx_ustorm_prods_offset (struct bnx2x_fastpath *fp); static inline void bnx2x_init_txdata(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata, u32 cid,
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +32 -697
784 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +187 -21
229 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +91 -6
110 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +617 -1
630 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h +3 -0
@@ -18,6 +18,8 @@ #ifndef VF_PF_IF_H #define VF_PF_IF_H +#ifdef CONFIG_BNX2X_SRIOV + /* Common definitions for all HVs */ struct vf_pf_resc_request { u8 num_rxqs;
@@ -353,4 +355,5 @@ enum channel_tlvs {CHANNEL_TLV_MAX }; +#endif /* CONFIG_BNX2X_SRIOV */ #endif /* VF_PF_IF_H */
Signature · 1 line
1.7.9.GIT