Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cnic: Include bnx2x.h

by removing duplicate symbols and removing some redundant code.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Michael Chan and committed by
David S. Miller
68c64d20 4ce45e02

+20 -46
+20 -30
drivers/net/ethernet/broadcom/cnic.c
··· 42 42 43 43 #include "cnic_if.h" 44 44 #include "bnx2.h" 45 + #include "bnx2x/bnx2x.h" 45 46 #include "bnx2x/bnx2x_reg.h" 46 47 #include "bnx2x/bnx2x_fw_defs.h" 47 48 #include "bnx2x/bnx2x_hsi.h" ··· 52 51 #include "cnic.h" 53 52 #include "cnic_defs.h" 54 53 55 - #define DRV_MODULE_NAME "cnic" 54 + #define CNIC_MODULE_NAME "cnic" 56 55 57 56 static char version[] = 58 - "Broadcom NetXtreme II CNIC Driver " DRV_MODULE_NAME " v" CNIC_MODULE_VERSION " (" CNIC_MODULE_RELDATE ")\n"; 57 + "Broadcom NetXtreme II CNIC Driver " CNIC_MODULE_NAME " v" CNIC_MODULE_VERSION " (" CNIC_MODULE_RELDATE ")\n"; 59 58 60 59 MODULE_AUTHOR("Michael Chan <mchan@broadcom.com> and John(Zongxi) " 61 60 "Chen (zongxi@broadcom.com"); ··· 1235 1234 int i, j, n, ret, pages; 1236 1235 struct cnic_dma *kwq_16_dma = &cp->kwq_16_data_info; 1237 1236 1238 - cp->iro_arr = ethdev->iro_arr; 1239 - 1240 1237 cp->max_cid_space = MAX_ISCSI_TBL_SZ; 1241 1238 cp->iscsi_start_cid = start_cid; 1242 1239 cp->fcoe_start_cid = start_cid + MAX_ISCSI_TBL_SZ; ··· 1429 1430 static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) 1430 1431 { 1431 1432 struct cnic_local *cp = dev->cnic_priv; 1433 + struct bnx2x *bp = netdev_priv(dev->netdev); 1432 1434 struct iscsi_kwqe_init1 *req1 = (struct iscsi_kwqe_init1 *) kwqe; 1433 1435 int hq_bds, pages; 1434 1436 u32 pfid = cp->pfid; ··· 1512 1512 { 1513 1513 struct iscsi_kwqe_init2 *req2 = (struct iscsi_kwqe_init2 *) kwqe; 1514 1514 struct cnic_local *cp = dev->cnic_priv; 1515 + struct bnx2x *bp = netdev_priv(dev->netdev); 1515 1516 u32 pfid = cp->pfid; 1516 1517 struct iscsi_kcqe kcqe; 1517 1518 struct kcqe *cqes[1]; ··· 2049 2048 static void cnic_init_bnx2x_mac(struct cnic_dev *dev) 2050 2049 { 2051 2050 struct cnic_local *cp = dev->cnic_priv; 2051 + struct bnx2x *bp = netdev_priv(dev->netdev); 2052 2052 u32 pfid = cp->pfid; 2053 2053 u8 *mac = dev->mac_addr; 2054 2054 ··· 2086 2084 static void cnic_bnx2x_set_tcp_timestamp(struct cnic_dev *dev, int tcp_ts) 2087 2085 { 2088 2086 struct cnic_local *cp = dev->cnic_priv; 2087 + struct bnx2x *bp = netdev_priv(dev->netdev); 2089 2088 u8 xstorm_flags = XSTORM_L5CM_TCP_FLAGS_WND_SCL_EN; 2090 2089 u16 tstorm_flags = 0; 2091 2090 ··· 2106 2103 u32 num, int *work) 2107 2104 { 2108 2105 struct cnic_local *cp = dev->cnic_priv; 2106 + struct bnx2x *bp = netdev_priv(dev->netdev); 2109 2107 struct l4_kwq_connect_req1 *kwqe1 = 2110 2108 (struct l4_kwq_connect_req1 *) wqes[0]; 2111 2109 struct l4_kwq_connect_req3 *kwqe3; ··· 4213 4209 static int cnic_cm_init_bnx2x_hw(struct cnic_dev *dev) 4214 4210 { 4215 4211 struct cnic_local *cp = dev->cnic_priv; 4212 + struct bnx2x *bp = netdev_priv(dev->netdev); 4216 4213 u32 pfid = cp->pfid; 4217 4214 u32 port = CNIC_PORT(cp); 4218 4215 ··· 4857 4852 u16 sb_id, u8 sb_index, 4858 4853 u8 disable) 4859 4854 { 4855 + struct bnx2x *bp = netdev_priv(dev->netdev); 4860 4856 4861 4857 u32 addr = BAR_CSTRORM_INTMEM + 4862 4858 CSTORM_STATUS_BLOCK_DATA_OFFSET(sb_id) + ··· 4875 4869 static void cnic_enable_bnx2x_int(struct cnic_dev *dev) 4876 4870 { 4877 4871 struct cnic_local *cp = dev->cnic_priv; 4872 + struct bnx2x *bp = netdev_priv(dev->netdev); 4878 4873 u8 sb_id = cp->status_blk_num; 4879 4874 4880 4875 CNIC_WR8(dev, BAR_CSTRORM_INTMEM + ··· 5025 5018 static void cnic_init_bnx2x_kcq(struct cnic_dev *dev) 5026 5019 { 5027 5020 struct cnic_local *cp = dev->cnic_priv; 5021 + struct bnx2x *bp = netdev_priv(dev->netdev); 5028 5022 u32 pfid = cp->pfid; 5029 5023 5030 5024 cp->kcq1.io_addr = BAR_CSTRORM_INTMEM + ··· 5064 5056 static int cnic_start_bnx2x_hw(struct cnic_dev *dev) 5065 5057 { 5066 5058 struct cnic_local *cp = dev->cnic_priv; 5059 + struct bnx2x *bp = netdev_priv(dev->netdev); 5067 5060 struct cnic_eth_dev *ethdev = cp->ethdev; 5068 - int func = CNIC_FUNC(cp), ret; 5061 + int func, ret; 5069 5062 u32 pfid; 5070 5063 5071 5064 dev->stats_addr = ethdev->addr_drv_info_to_mcp; 5072 - cp->port_mode = CHIP_PORT_MODE_NONE; 5065 + cp->port_mode = bp->common.chip_port_mode; 5066 + cp->pfid = bp->pfid; 5067 + cp->func = bp->pf_num; 5073 5068 5074 - if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { 5075 - u32 val; 5076 - 5077 - pci_read_config_dword(dev->pcidev, PCICFG_ME_REGISTER, &val); 5078 - cp->func = (u8) ((val & ME_REG_ABS_PF_NUM) >> 5079 - ME_REG_ABS_PF_NUM_SHIFT); 5080 - func = CNIC_FUNC(cp); 5081 - 5082 - val = CNIC_RD(dev, MISC_REG_PORT4MODE_EN_OVWR); 5083 - if (!(val & 1)) 5084 - val = CNIC_RD(dev, MISC_REG_PORT4MODE_EN); 5085 - else 5086 - val = (val >> 1) & 1; 5087 - 5088 - if (val) { 5089 - cp->port_mode = CHIP_4_PORT_MODE; 5090 - cp->pfid = func >> 1; 5091 - } else { 5092 - cp->port_mode = CHIP_2_PORT_MODE; 5093 - cp->pfid = func & 0x6; 5094 - } 5095 - } else { 5096 - cp->pfid = func; 5097 - } 5069 + func = CNIC_FUNC(cp); 5098 5070 pfid = cp->pfid; 5099 5071 5100 5072 ret = cnic_init_id_tbl(&cp->cid_tbl, MAX_ISCSI_TBL_SZ, ··· 5141 5153 static void cnic_init_rings(struct cnic_dev *dev) 5142 5154 { 5143 5155 struct cnic_local *cp = dev->cnic_priv; 5156 + struct bnx2x *bp = netdev_priv(dev->netdev); 5144 5157 struct cnic_uio_dev *udev = cp->udev; 5145 5158 5146 5159 if (test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags)) ··· 5342 5353 static void cnic_stop_bnx2x_hw(struct cnic_dev *dev) 5343 5354 { 5344 5355 struct cnic_local *cp = dev->cnic_priv; 5356 + struct bnx2x *bp = netdev_priv(dev->netdev); 5345 5357 u32 hc_index = HC_INDEX_ISCSI_EQ_CONS; 5346 5358 u32 sb_id = cp->status_blk_num; 5347 5359 u32 idx_off, syn_off;
-16
drivers/net/ethernet/broadcom/cnic.h
··· 186 186 u16 (*hw_idx)(u16); 187 187 }; 188 188 189 - struct iro { 190 - u32 base; 191 - u16 m1; 192 - u16 m2; 193 - u16 m3; 194 - u16 size; 195 - }; 196 - 197 189 struct cnic_uio_dev { 198 190 struct uio_info cnic_uinfo; 199 191 u32 uio_dev; ··· 232 240 u16 *tx_cons_ptr; 233 241 u16 rx_cons; 234 242 u16 tx_cons; 235 - 236 - const struct iro *iro_arr; 237 - #define IRO (((struct cnic_local *) dev->cnic_priv)->iro_arr) 238 243 239 244 struct cnic_dma kwq_info; 240 245 struct kwqe **kwq; ··· 305 316 int func; 306 317 u32 pfid; 307 318 u8 port_mode; 308 - #define CHIP_4_PORT_MODE 0 309 - #define CHIP_2_PORT_MODE 1 310 - #define CHIP_PORT_MODE_NONE 2 311 319 312 320 u32 shmem_base; 313 321 ··· 405 419 (BNX2X_CHIP_IS_57800(x) || BNX2X_CHIP_IS_57810(x) || \ 406 420 BNX2X_CHIP_IS_57840(x)) 407 421 #define BNX2X_CHIP_IS_E2_PLUS(x) (BNX2X_CHIP_IS_E2(x) || BNX2X_CHIP_IS_E3(x)) 408 - 409 - #define IS_E1H_OFFSET BNX2X_CHIP_IS_E1H(cp->chip_id) 410 422 411 423 #define BNX2X_RX_DESC_CNT (BNX2_PAGE_SIZE / \ 412 424 sizeof(struct eth_rx_bd))