From: t_jeang Date: Tue, 6 Jan 2009 12:05:58 +0000 (+0000) Subject: imported patch bnx2-disable-bnx2x-cnic X-Git-Tag: bnx2-tune-interrupt-load X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=65275a0459f8afe1a2c109570d08a6c4a1f2d473;p=xenclient%2Fkernel.git imported patch bnx2-disable-bnx2x-cnic --- diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index a96a019c..096874e5 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c @@ -54,13 +54,17 @@ #endif #include "cnic_drv.h" #include "bnx2.h" +#ifdef BCM_BNX2X #include "bnx2x_reg.h" #include "bnx2x_fw_defs.h" #include "bnx2x_hsi.h" +#endif #include "cnic_if.h" #include "cnic.h" #include "cnic_defs.h" +#ifdef BCM_BNX2X #include "5710_hsi_cnic.h" +#endif #include "57xx_iscsi_constants.h" #define DRV_MODULE_NAME "cnic" @@ -81,7 +85,9 @@ static DEFINE_MUTEX(cnic_lock); struct cnic_ulp_ops *cnic_ulp_tbl[MAX_CNIC_ULP_TYPE]; static int cnic_service_bnx2(void *, void *); +#ifdef BCM_BNX2X static int cnic_service_bnx2x(void *, void *); +#endif static int cnic_ctl(void *, struct cnic_ctl_info *); static struct cnic_ops cnic_bnx2_ops = { @@ -90,11 +96,13 @@ static struct cnic_ops cnic_bnx2_ops = { .cnic_ctl = cnic_ctl, }; +#ifdef BCM_BNX2X static struct cnic_ops cnic_bnx2x_ops = { .cnic_owner = THIS_MODULE, .cnic_handler = cnic_service_bnx2x, .cnic_ctl = cnic_ctl, }; +#endif static inline void cnic_hold(struct cnic_dev *dev) { @@ -130,6 +138,7 @@ static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val) ethdev->drv_ctl(dev->netdev, &info); } +#ifdef BCM_BNX2X static void cnic_ctx_tbl_wr(struct cnic_dev *dev, u32 off, dma_addr_t addr) { struct cnic_local *cp = dev->cnic_priv; @@ -142,6 +151,7 @@ static void cnic_ctx_tbl_wr(struct cnic_dev *dev, u32 off, dma_addr_t addr) io->dma_addr = addr; ethdev->drv_ctl(dev->netdev, &info); } +#endif static void cnic_reg_wr_ind(struct cnic_dev *dev, u32 off, u32 val) { @@ -180,6 +190,7 @@ static void cnic_kwq_completion(struct cnic_dev *dev, u32 count) ethdev->drv_ctl(dev->netdev, &info); } +#ifdef BCM_BNX2X static int cnic_get_l5_cid(struct cnic_local *cp, u32 cid, u32 *l5_cid) { u32 i; @@ -192,6 +203,7 @@ static int cnic_get_l5_cid(struct cnic_local *cp, u32 cid, u32 *l5_cid) } return -EINVAL; } +#endif static int cnic_in_use(struct cnic_sock *csk) @@ -432,6 +444,7 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) return 0; } +#ifdef BCM_BNX2X static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 max, u32 reserved) { int i; @@ -449,6 +462,7 @@ static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 max, u32 reserved) return 0; } +#endif static void cnic_free_id_tbl(struct cnic_id_tbl *id_tbl) { @@ -456,6 +470,7 @@ static void cnic_free_id_tbl(struct cnic_id_tbl *id_tbl) id_tbl->table = NULL; } +#ifdef BCM_BNX2X /* Returns -1 if not successful */ static u32 cnic_alloc_cid(struct cnic_id_tbl *id_tbl) { @@ -478,6 +493,7 @@ static u32 cnic_alloc_cid(struct cnic_id_tbl *id_tbl) return cid; } +#endif void cnic_free_cid(struct cnic_id_tbl *id_tbl, u32 cid) { @@ -525,6 +541,7 @@ static void cnic_setup_page_tbl(struct cnic_dev *dev, struct cnic_dma *dma) } } +#ifdef BCM_BNX2X static void cnic_setup_page_tbl_le(struct cnic_dev *dev, struct cnic_dma *dma) { int i; @@ -538,6 +555,7 @@ static void cnic_setup_page_tbl_le(struct cnic_dev *dev, struct cnic_dma *dma) page_table++; } } +#endif static int cnic_alloc_dma(struct cnic_dev *dev, struct cnic_dma *dma, int pages, int use_pg_tbl) @@ -684,6 +702,7 @@ error: return ret; } +#ifdef BCM_BNX2X static int cnic_alloc_bnx2x_context(struct cnic_dev *dev) { struct cnic_local *cp = dev->cnic_priv; @@ -794,6 +813,7 @@ error: cnic_free_resc(dev); return -ENOMEM; } +#endif static inline u32 cnic_kwq_avail(struct cnic_local *cp) { @@ -823,7 +843,7 @@ static int cnic_submit_bnx2_kwqes(struct cnic_dev *dev, struct kwqe *wqes[], prod = cp->kwq_prod_idx; sw_prod = prod & MAX_KWQ_IDX; for (i = 0; i < num_wqes; i++) { - prod_qe = &cp->kwq[KWQ_PG(sw_prod)][KWQ_IDX(sw_prod)]; + prod_qe = &cp->kwq[KWQ_PG(sw_prod)][KWQ_IDX(sw_prod)]; memcpy(prod_qe, wqes[i], sizeof(struct kwqe)); prod++; sw_prod = prod & MAX_KWQ_IDX; @@ -836,6 +856,7 @@ static int cnic_submit_bnx2_kwqes(struct cnic_dev *dev, struct kwqe *wqes[], return 0; } +#ifdef BCM_BNX2X static void *cnic_get_kwqe_16_data(struct cnic_local *cp, u32 l5_cid, union l5cm_specific_data *l5_data) { @@ -1656,6 +1677,7 @@ static int cnic_submit_bnx2x_kwqes(struct cnic_dev *dev, struct kwqe *wqes[], } return 0; } +#endif static void service_kcqes(struct cnic_dev *dev, int num_cqes) { @@ -1715,6 +1737,7 @@ end: return; } +#ifdef BCM_BNX2X static void cnic_bnx2x_kcqe_hook(struct cnic_local *cp, struct kcqe *kcqe) { u32 opcode = KCQE_OPCODE(kcqe->kcqe_op_flag); @@ -1725,6 +1748,7 @@ printk(KERN_ALERT "completion bit not set for opcode %x\n", opcode); BUG(); } } +#endif static u16 cnic_bnx2_next_idx(u16 idx) { @@ -1736,6 +1760,7 @@ static u16 cnic_bnx2_hw_idx(u16 idx) return idx; } +#ifdef BCM_BNX2X static u16 cnic_bnx2x_next_idx(u16 idx) { idx++; @@ -1751,6 +1776,7 @@ static u16 cnic_bnx2x_hw_idx(u16 idx) idx++; return idx; } +#endif static int cnic_get_kcqes(struct cnic_dev *dev, u16 hw_prod, u16 *sw_prod) { @@ -1878,6 +1904,7 @@ static irqreturn_t cnic_irq(int irq, void *dev_instance, struct pt_regs *regs) return IRQ_HANDLED; } +#ifdef BCM_BNX2X static inline void cnic_ack_bnx2x_int(struct cnic_dev *dev, u8 id, u8 storm, u16 index, u8 op, u8 update) { @@ -1959,6 +1986,7 @@ static int cnic_service_bnx2x(void *data, void *status_blk) tasklet_schedule(&cp->cnic_irq_task); return 0; } +#endif static void cnic_ulp_stop(struct cnic_dev *dev) { @@ -2026,6 +2054,7 @@ static int cnic_ctl(void *data, struct cnic_ctl_info *info) mutex_unlock(&cnic_lock); cnic_put(dev); break; +#ifdef BCM_BNX2X case CNIC_CTL_COMPLETION_CMD: { u32 cid = BNX2X_SW_CID(info->data.comp.cid); u32 l5_cid; @@ -2039,6 +2068,7 @@ static int cnic_ctl(void *data, struct cnic_ctl_info *info) } break; } +#endif default: return -EINVAL; } @@ -3275,6 +3305,7 @@ static int cnic_cm_init_bnx2_hw(struct cnic_dev *dev) return 0; } +#ifdef BCM_BNX2X static void cnic_close_bnx2x_conn(struct cnic_sock *csk, u32 opcode) { struct cnic_dev *dev = csk->dev; @@ -3359,6 +3390,7 @@ static int cnic_cm_init_bnx2x_hw(struct cnic_dev *dev) DEF_MAX_CWND); return 0; } +#endif static int cnic_cm_open(struct cnic_dev *dev) { @@ -3709,6 +3741,7 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev) return 0; } +#ifdef BCM_BNX2X static void cnic_setup_bnx2x_context(struct cnic_dev *dev) { struct cnic_local *cp = dev->cnic_priv; @@ -3835,6 +3868,7 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev) return 0; } +#endif static int cnic_start_hw(struct cnic_dev *dev) { @@ -3914,6 +3948,7 @@ static void cnic_stop_bnx2_hw(struct cnic_dev *dev) cnic_free_resc(dev); } +#ifdef BCM_BNX2X static void cnic_stop_bnx2x_hw(struct cnic_dev *dev) { struct cnic_local *cp = dev->cnic_priv; @@ -3929,6 +3964,7 @@ static void cnic_stop_bnx2x_hw(struct cnic_dev *dev) 0); cnic_free_resc(dev); } +#endif static void cnic_stop_hw(struct cnic_dev *dev) { @@ -4049,6 +4085,7 @@ cnic_err: return NULL; } +#ifdef BCM_BNX2X static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev) { struct pci_dev *pdev; @@ -4108,6 +4145,7 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev) cp->hw_idx = cnic_bnx2x_hw_idx; return cdev; } +#endif static struct cnic_dev *is_cnic_dev(struct net_device *dev) { @@ -4120,8 +4158,10 @@ static struct cnic_dev *is_cnic_dev(struct net_device *dev) if (!strcmp(drvinfo.driver, "bnx2")) cdev = init_bnx2_cnic(dev); +#ifdef BCM_BNX2X if (!strcmp(drvinfo.driver, "bnx2x")) cdev = init_bnx2x_cnic(dev); +#endif if (cdev) { #ifndef __VMKLNX__ write_lock(&cnic_dev_lock); diff --git a/drivers/net/cnic.h b/drivers/net/cnic.h index b0e57923..a6eaef7f 100644 --- a/drivers/net/cnic.h +++ b/drivers/net/cnic.h @@ -106,6 +106,7 @@ struct cnic_work_node { #define KCQ_PG(x) (((x) & ~MAX_KCQE_CNT) >> (BCM_PAGE_BITS - 5)) #define KCQ_IDX(x) ((x) & MAX_KCQE_CNT) +#ifdef BCM_BNX2X #define BNX2X_NEXT_KCQE(x) (((x) & (MAX_KCQE_CNT - 1)) == \ (MAX_KCQE_CNT - 1)) ? \ (x) + 2 : (x) + 1 @@ -114,6 +115,7 @@ struct cnic_work_node { #define BNX2X_KWQ_DATA_IDX(cp, x) ((x) % (cp)->kwq_16_data_pp) #define BNX2X_KWQ_DATA(cp, x) \ &(cp)->kwq_16_data[BNX2X_KWQ_DATA_PG(cp, x)][BNX2X_KWQ_DATA_IDX(cp, x)] +#endif #define DEF_IPID_COUNT 0xc001 @@ -223,7 +225,9 @@ struct cnic_local { void *status_blk; struct status_block_msix *bnx2_status_blk; +#ifdef BCM_BNX2X struct host_status_block *bnx2x_status_blk; +#endif u32 status_blk_num; u32 int_num; @@ -293,6 +297,7 @@ struct cnic_local { u16 (*hw_idx)(u16); }; +#ifdef BCM_BNX2X struct bnx2x_bd_chain_next { u32 addr_lo; u32 addr_hi; @@ -374,6 +379,7 @@ static u8 calc_crc8( u32 data, u8 crc) #define BNX2X_CHIP_IS_E1H(x) \ (BNX2X_CHIP_IS_57711(x) || BNX2X_CHIP_IS_57712(x)) #define IS_E1H_OFFSET BNX2X_CHIP_IS_E1H(cp->chip_id) +#endif #endif