diff options
-rw-r--r-- | drivers/net/ethernet/broadcom/cnic.c | 50 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/cnic.h | 16 |
2 files changed, 20 insertions, 46 deletions
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 57780986f6cc..b8650939a4be 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
@@ -42,6 +42,7 @@ | |||
42 | 42 | ||
43 | #include "cnic_if.h" | 43 | #include "cnic_if.h" |
44 | #include "bnx2.h" | 44 | #include "bnx2.h" |
45 | #include "bnx2x/bnx2x.h" | ||
45 | #include "bnx2x/bnx2x_reg.h" | 46 | #include "bnx2x/bnx2x_reg.h" |
46 | #include "bnx2x/bnx2x_fw_defs.h" | 47 | #include "bnx2x/bnx2x_fw_defs.h" |
47 | #include "bnx2x/bnx2x_hsi.h" | 48 | #include "bnx2x/bnx2x_hsi.h" |
@@ -51,10 +52,10 @@ | |||
51 | #include "cnic.h" | 52 | #include "cnic.h" |
52 | #include "cnic_defs.h" | 53 | #include "cnic_defs.h" |
53 | 54 | ||
54 | #define DRV_MODULE_NAME "cnic" | 55 | #define CNIC_MODULE_NAME "cnic" |
55 | 56 | ||
56 | static char version[] = | 57 | static char version[] = |
57 | "Broadcom NetXtreme II CNIC Driver " DRV_MODULE_NAME " v" CNIC_MODULE_VERSION " (" CNIC_MODULE_RELDATE ")\n"; | 58 | "Broadcom NetXtreme II CNIC Driver " CNIC_MODULE_NAME " v" CNIC_MODULE_VERSION " (" CNIC_MODULE_RELDATE ")\n"; |
58 | 59 | ||
59 | MODULE_AUTHOR("Michael Chan <mchan@broadcom.com> and John(Zongxi) " | 60 | MODULE_AUTHOR("Michael Chan <mchan@broadcom.com> and John(Zongxi) " |
60 | "Chen (zongxi@broadcom.com"); | 61 | "Chen (zongxi@broadcom.com"); |
@@ -1234,8 +1235,6 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) | |||
1234 | int i, j, n, ret, pages; | 1235 | int i, j, n, ret, pages; |
1235 | struct cnic_dma *kwq_16_dma = &cp->kwq_16_data_info; | 1236 | struct cnic_dma *kwq_16_dma = &cp->kwq_16_data_info; |
1236 | 1237 | ||
1237 | cp->iro_arr = ethdev->iro_arr; | ||
1238 | |||
1239 | cp->max_cid_space = MAX_ISCSI_TBL_SZ; | 1238 | cp->max_cid_space = MAX_ISCSI_TBL_SZ; |
1240 | cp->iscsi_start_cid = start_cid; | 1239 | cp->iscsi_start_cid = start_cid; |
1241 | cp->fcoe_start_cid = start_cid + MAX_ISCSI_TBL_SZ; | 1240 | cp->fcoe_start_cid = start_cid + MAX_ISCSI_TBL_SZ; |
@@ -1430,6 +1429,7 @@ static void cnic_reply_bnx2x_kcqes(struct cnic_dev *dev, int ulp_type, | |||
1430 | static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) | 1429 | static int cnic_bnx2x_iscsi_init1(struct cnic_dev *dev, struct kwqe *kwqe) |
1431 | { | 1430 | { |
1432 | struct cnic_local *cp = dev->cnic_priv; | 1431 | struct cnic_local *cp = dev->cnic_priv; |
1432 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
1433 | struct iscsi_kwqe_init1 *req1 = (struct iscsi_kwqe_init1 *) kwqe; | 1433 | struct iscsi_kwqe_init1 *req1 = (struct iscsi_kwqe_init1 *) kwqe; |
1434 | int hq_bds, pages; | 1434 | int hq_bds, pages; |
1435 | u32 pfid = cp->pfid; | 1435 | u32 pfid = cp->pfid; |
@@ -1512,6 +1512,7 @@ static int cnic_bnx2x_iscsi_init2(struct cnic_dev *dev, struct kwqe *kwqe) | |||
1512 | { | 1512 | { |
1513 | struct iscsi_kwqe_init2 *req2 = (struct iscsi_kwqe_init2 *) kwqe; | 1513 | struct iscsi_kwqe_init2 *req2 = (struct iscsi_kwqe_init2 *) kwqe; |
1514 | struct cnic_local *cp = dev->cnic_priv; | 1514 | struct cnic_local *cp = dev->cnic_priv; |
1515 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
1515 | u32 pfid = cp->pfid; | 1516 | u32 pfid = cp->pfid; |
1516 | struct iscsi_kcqe kcqe; | 1517 | struct iscsi_kcqe kcqe; |
1517 | struct kcqe *cqes[1]; | 1518 | struct kcqe *cqes[1]; |
@@ -2048,6 +2049,7 @@ static void cnic_init_storm_conn_bufs(struct cnic_dev *dev, | |||
2048 | static void cnic_init_bnx2x_mac(struct cnic_dev *dev) | 2049 | static void cnic_init_bnx2x_mac(struct cnic_dev *dev) |
2049 | { | 2050 | { |
2050 | struct cnic_local *cp = dev->cnic_priv; | 2051 | struct cnic_local *cp = dev->cnic_priv; |
2052 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
2051 | u32 pfid = cp->pfid; | 2053 | u32 pfid = cp->pfid; |
2052 | u8 *mac = dev->mac_addr; | 2054 | u8 *mac = dev->mac_addr; |
2053 | 2055 | ||
@@ -2084,6 +2086,7 @@ static void cnic_init_bnx2x_mac(struct cnic_dev *dev) | |||
2084 | static void cnic_bnx2x_set_tcp_timestamp(struct cnic_dev *dev, int tcp_ts) | 2086 | static void cnic_bnx2x_set_tcp_timestamp(struct cnic_dev *dev, int tcp_ts) |
2085 | { | 2087 | { |
2086 | struct cnic_local *cp = dev->cnic_priv; | 2088 | struct cnic_local *cp = dev->cnic_priv; |
2089 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
2087 | u8 xstorm_flags = XSTORM_L5CM_TCP_FLAGS_WND_SCL_EN; | 2090 | u8 xstorm_flags = XSTORM_L5CM_TCP_FLAGS_WND_SCL_EN; |
2088 | u16 tstorm_flags = 0; | 2091 | u16 tstorm_flags = 0; |
2089 | 2092 | ||
@@ -2103,6 +2106,7 @@ static int cnic_bnx2x_connect(struct cnic_dev *dev, struct kwqe *wqes[], | |||
2103 | u32 num, int *work) | 2106 | u32 num, int *work) |
2104 | { | 2107 | { |
2105 | struct cnic_local *cp = dev->cnic_priv; | 2108 | struct cnic_local *cp = dev->cnic_priv; |
2109 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
2106 | struct l4_kwq_connect_req1 *kwqe1 = | 2110 | struct l4_kwq_connect_req1 *kwqe1 = |
2107 | (struct l4_kwq_connect_req1 *) wqes[0]; | 2111 | (struct l4_kwq_connect_req1 *) wqes[0]; |
2108 | struct l4_kwq_connect_req3 *kwqe3; | 2112 | struct l4_kwq_connect_req3 *kwqe3; |
@@ -4209,6 +4213,7 @@ static void cnic_cm_stop_bnx2x_hw(struct cnic_dev *dev) | |||
4209 | static int cnic_cm_init_bnx2x_hw(struct cnic_dev *dev) | 4213 | static int cnic_cm_init_bnx2x_hw(struct cnic_dev *dev) |
4210 | { | 4214 | { |
4211 | struct cnic_local *cp = dev->cnic_priv; | 4215 | struct cnic_local *cp = dev->cnic_priv; |
4216 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
4212 | u32 pfid = cp->pfid; | 4217 | u32 pfid = cp->pfid; |
4213 | u32 port = CNIC_PORT(cp); | 4218 | u32 port = CNIC_PORT(cp); |
4214 | 4219 | ||
@@ -4852,6 +4857,7 @@ static inline void cnic_storm_memset_hc_disable(struct cnic_dev *dev, | |||
4852 | u16 sb_id, u8 sb_index, | 4857 | u16 sb_id, u8 sb_index, |
4853 | u8 disable) | 4858 | u8 disable) |
4854 | { | 4859 | { |
4860 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
4855 | 4861 | ||
4856 | u32 addr = BAR_CSTRORM_INTMEM + | 4862 | u32 addr = BAR_CSTRORM_INTMEM + |
4857 | CSTORM_STATUS_BLOCK_DATA_OFFSET(sb_id) + | 4863 | CSTORM_STATUS_BLOCK_DATA_OFFSET(sb_id) + |
@@ -4869,6 +4875,7 @@ static inline void cnic_storm_memset_hc_disable(struct cnic_dev *dev, | |||
4869 | static void cnic_enable_bnx2x_int(struct cnic_dev *dev) | 4875 | static void cnic_enable_bnx2x_int(struct cnic_dev *dev) |
4870 | { | 4876 | { |
4871 | struct cnic_local *cp = dev->cnic_priv; | 4877 | struct cnic_local *cp = dev->cnic_priv; |
4878 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
4872 | u8 sb_id = cp->status_blk_num; | 4879 | u8 sb_id = cp->status_blk_num; |
4873 | 4880 | ||
4874 | CNIC_WR8(dev, BAR_CSTRORM_INTMEM + | 4881 | CNIC_WR8(dev, BAR_CSTRORM_INTMEM + |
@@ -5018,6 +5025,7 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev, | |||
5018 | static void cnic_init_bnx2x_kcq(struct cnic_dev *dev) | 5025 | static void cnic_init_bnx2x_kcq(struct cnic_dev *dev) |
5019 | { | 5026 | { |
5020 | struct cnic_local *cp = dev->cnic_priv; | 5027 | struct cnic_local *cp = dev->cnic_priv; |
5028 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
5021 | u32 pfid = cp->pfid; | 5029 | u32 pfid = cp->pfid; |
5022 | 5030 | ||
5023 | cp->kcq1.io_addr = BAR_CSTRORM_INTMEM + | 5031 | cp->kcq1.io_addr = BAR_CSTRORM_INTMEM + |
@@ -5056,37 +5064,17 @@ static void cnic_init_bnx2x_kcq(struct cnic_dev *dev) | |||
5056 | static int cnic_start_bnx2x_hw(struct cnic_dev *dev) | 5064 | static int cnic_start_bnx2x_hw(struct cnic_dev *dev) |
5057 | { | 5065 | { |
5058 | struct cnic_local *cp = dev->cnic_priv; | 5066 | struct cnic_local *cp = dev->cnic_priv; |
5067 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
5059 | struct cnic_eth_dev *ethdev = cp->ethdev; | 5068 | struct cnic_eth_dev *ethdev = cp->ethdev; |
5060 | int func = CNIC_FUNC(cp), ret; | 5069 | int func, ret; |
5061 | u32 pfid; | 5070 | u32 pfid; |
5062 | 5071 | ||
5063 | dev->stats_addr = ethdev->addr_drv_info_to_mcp; | 5072 | dev->stats_addr = ethdev->addr_drv_info_to_mcp; |
5064 | cp->port_mode = CHIP_PORT_MODE_NONE; | 5073 | cp->port_mode = bp->common.chip_port_mode; |
5065 | 5074 | cp->pfid = bp->pfid; | |
5066 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { | 5075 | cp->func = bp->pf_num; |
5067 | u32 val; | ||
5068 | |||
5069 | pci_read_config_dword(dev->pcidev, PCICFG_ME_REGISTER, &val); | ||
5070 | cp->func = (u8) ((val & ME_REG_ABS_PF_NUM) >> | ||
5071 | ME_REG_ABS_PF_NUM_SHIFT); | ||
5072 | func = CNIC_FUNC(cp); | ||
5073 | 5076 | ||
5074 | val = CNIC_RD(dev, MISC_REG_PORT4MODE_EN_OVWR); | 5077 | func = CNIC_FUNC(cp); |
5075 | if (!(val & 1)) | ||
5076 | val = CNIC_RD(dev, MISC_REG_PORT4MODE_EN); | ||
5077 | else | ||
5078 | val = (val >> 1) & 1; | ||
5079 | |||
5080 | if (val) { | ||
5081 | cp->port_mode = CHIP_4_PORT_MODE; | ||
5082 | cp->pfid = func >> 1; | ||
5083 | } else { | ||
5084 | cp->port_mode = CHIP_2_PORT_MODE; | ||
5085 | cp->pfid = func & 0x6; | ||
5086 | } | ||
5087 | } else { | ||
5088 | cp->pfid = func; | ||
5089 | } | ||
5090 | pfid = cp->pfid; | 5078 | pfid = cp->pfid; |
5091 | 5079 | ||
5092 | ret = cnic_init_id_tbl(&cp->cid_tbl, MAX_ISCSI_TBL_SZ, | 5080 | ret = cnic_init_id_tbl(&cp->cid_tbl, MAX_ISCSI_TBL_SZ, |
@@ -5153,6 +5141,7 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev) | |||
5153 | static void cnic_init_rings(struct cnic_dev *dev) | 5141 | static void cnic_init_rings(struct cnic_dev *dev) |
5154 | { | 5142 | { |
5155 | struct cnic_local *cp = dev->cnic_priv; | 5143 | struct cnic_local *cp = dev->cnic_priv; |
5144 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
5156 | struct cnic_uio_dev *udev = cp->udev; | 5145 | struct cnic_uio_dev *udev = cp->udev; |
5157 | 5146 | ||
5158 | if (test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags)) | 5147 | if (test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags)) |
@@ -5353,6 +5342,7 @@ static void cnic_stop_bnx2_hw(struct cnic_dev *dev) | |||
5353 | static void cnic_stop_bnx2x_hw(struct cnic_dev *dev) | 5342 | static void cnic_stop_bnx2x_hw(struct cnic_dev *dev) |
5354 | { | 5343 | { |
5355 | struct cnic_local *cp = dev->cnic_priv; | 5344 | struct cnic_local *cp = dev->cnic_priv; |
5345 | struct bnx2x *bp = netdev_priv(dev->netdev); | ||
5356 | u32 hc_index = HC_INDEX_ISCSI_EQ_CONS; | 5346 | u32 hc_index = HC_INDEX_ISCSI_EQ_CONS; |
5357 | u32 sb_id = cp->status_blk_num; | 5347 | u32 sb_id = cp->status_blk_num; |
5358 | u32 idx_off, syn_off; | 5348 | u32 idx_off, syn_off; |
diff --git a/drivers/net/ethernet/broadcom/cnic.h b/drivers/net/ethernet/broadcom/cnic.h index 6fa7a989606a..62c670619ae6 100644 --- a/drivers/net/ethernet/broadcom/cnic.h +++ b/drivers/net/ethernet/broadcom/cnic.h | |||
@@ -186,14 +186,6 @@ struct kcq_info { | |||
186 | u16 (*hw_idx)(u16); | 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 | struct cnic_uio_dev { | 189 | struct cnic_uio_dev { |
198 | struct uio_info cnic_uinfo; | 190 | struct uio_info cnic_uinfo; |
199 | u32 uio_dev; | 191 | u32 uio_dev; |
@@ -241,9 +233,6 @@ struct cnic_local { | |||
241 | u16 rx_cons; | 233 | u16 rx_cons; |
242 | u16 tx_cons; | 234 | u16 tx_cons; |
243 | 235 | ||
244 | const struct iro *iro_arr; | ||
245 | #define IRO (((struct cnic_local *) dev->cnic_priv)->iro_arr) | ||
246 | |||
247 | struct cnic_dma kwq_info; | 236 | struct cnic_dma kwq_info; |
248 | struct kwqe **kwq; | 237 | struct kwqe **kwq; |
249 | 238 | ||
@@ -316,9 +305,6 @@ struct cnic_local { | |||
316 | int func; | 305 | int func; |
317 | u32 pfid; | 306 | u32 pfid; |
318 | u8 port_mode; | 307 | u8 port_mode; |
319 | #define CHIP_4_PORT_MODE 0 | ||
320 | #define CHIP_2_PORT_MODE 1 | ||
321 | #define CHIP_PORT_MODE_NONE 2 | ||
322 | 308 | ||
323 | u32 shmem_base; | 309 | u32 shmem_base; |
324 | 310 | ||
@@ -420,8 +406,6 @@ struct bnx2x_bd_chain_next { | |||
420 | BNX2X_CHIP_IS_57840(x)) | 406 | BNX2X_CHIP_IS_57840(x)) |
421 | #define BNX2X_CHIP_IS_E2_PLUS(x) (BNX2X_CHIP_IS_E2(x) || BNX2X_CHIP_IS_E3(x)) | 407 | #define BNX2X_CHIP_IS_E2_PLUS(x) (BNX2X_CHIP_IS_E2(x) || BNX2X_CHIP_IS_E3(x)) |
422 | 408 | ||
423 | #define IS_E1H_OFFSET BNX2X_CHIP_IS_E1H(cp->chip_id) | ||
424 | |||
425 | #define BNX2X_RX_DESC_CNT (BNX2_PAGE_SIZE / \ | 409 | #define BNX2X_RX_DESC_CNT (BNX2_PAGE_SIZE / \ |
426 | sizeof(struct eth_rx_bd)) | 410 | sizeof(struct eth_rx_bd)) |
427 | #define BNX2X_MAX_RX_DESC_CNT (BNX2X_RX_DESC_CNT - 2) | 411 | #define BNX2X_MAX_RX_DESC_CNT (BNX2X_RX_DESC_CNT - 2) |