aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorVladislav Zolotarov <vladz@broadcom.com>2011-01-31 09:39:17 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-31 23:44:46 -0500
commit2ba451421b23636c45fabfa522858c5c124b3673 (patch)
treefc576f3ac8a064b50747533522940f05e39f70c1 /drivers/net
parent0c838ff1ade71162775afffd9e5c6478a60bdca6 (diff)
bnx2x, cnic: Consolidate iSCSI/FCoE shared mem logic in bnx2x
Move all shared mem code to bnx2x to avoid code duplication. bnx2x now performs: - Read the FCoE and iSCSI max connection information. - Read the iSCSI and FCoE MACs from NPAR configuration in shmem. - Block the CNIC for the current function if there is neither FCoE nor iSCSI valid configuration by returning NULL from bnx2x_cnic_probe(). Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bnx2.h2
-rw-r--r--drivers/net/bnx2x/bnx2x.h5
-rw-r--r--drivers/net/bnx2x/bnx2x_hsi.h25
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c112
-rw-r--r--drivers/net/cnic.c143
-rw-r--r--drivers/net/cnic_if.h8
6 files changed, 146 insertions, 149 deletions
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 0132ea959995..7a5e88f831f6 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6207,6 +6207,8 @@ struct l2_fhdr {
6207 6207
6208#define BNX2_CP_SCRATCH 0x001a0000 6208#define BNX2_CP_SCRATCH 0x001a0000
6209 6209
6210#define BNX2_FW_MAX_ISCSI_CONN 0x001a0080
6211
6210 6212
6211/* 6213/*
6212 * mcp_reg definition 6214 * mcp_reg definition
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 04fb72b923b2..ff87ec33d00e 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -976,8 +976,12 @@ struct bnx2x {
976#define MF_FUNC_DIS 0x1000 976#define MF_FUNC_DIS 0x1000
977#define FCOE_MACS_SET 0x2000 977#define FCOE_MACS_SET 0x2000
978#define NO_FCOE_FLAG 0x4000 978#define NO_FCOE_FLAG 0x4000
979#define NO_ISCSI_OOO_FLAG 0x8000
980#define NO_ISCSI_FLAG 0x10000
979 981
980#define NO_FCOE(bp) ((bp)->flags & NO_FCOE_FLAG) 982#define NO_FCOE(bp) ((bp)->flags & NO_FCOE_FLAG)
983#define NO_ISCSI(bp) ((bp)->flags & NO_ISCSI_FLAG)
984#define NO_ISCSI_OOO(bp) ((bp)->flags & NO_ISCSI_OOO_FLAG)
981 985
982 int pf_num; /* absolute PF number */ 986 int pf_num; /* absolute PF number */
983 int pfid; /* per-path PF number */ 987 int pfid; /* per-path PF number */
@@ -1125,7 +1129,6 @@ struct bnx2x {
1125 u16 cnic_kwq_pending; 1129 u16 cnic_kwq_pending;
1126 u16 cnic_spq_pending; 1130 u16 cnic_spq_pending;
1127 struct mutex cnic_mutex; 1131 struct mutex cnic_mutex;
1128 u8 iscsi_mac[ETH_ALEN];
1129 u8 fip_mac[ETH_ALEN]; 1132 u8 fip_mac[ETH_ALEN];
1130#endif 1133#endif
1131 1134
diff --git a/drivers/net/bnx2x/bnx2x_hsi.h b/drivers/net/bnx2x/bnx2x_hsi.h
index 51d69db23a71..be503cc0a50b 100644
--- a/drivers/net/bnx2x/bnx2x_hsi.h
+++ b/drivers/net/bnx2x/bnx2x_hsi.h
@@ -11,20 +11,27 @@
11 11
12#include "bnx2x_fw_defs.h" 12#include "bnx2x_fw_defs.h"
13 13
14#define FW_ENCODE_32BIT_PATTERN 0x1e1e1e1e
15
14struct license_key { 16struct license_key {
15 u32 reserved[6]; 17 u32 reserved[6];
16 18
17#if defined(__BIG_ENDIAN) 19 u32 max_iscsi_conn;
18 u16 max_iscsi_init_conn; 20#define BNX2X_MAX_ISCSI_TRGT_CONN_MASK 0xFFFF
19 u16 max_iscsi_trgt_conn; 21#define BNX2X_MAX_ISCSI_TRGT_CONN_SHIFT 0
20#elif defined(__LITTLE_ENDIAN) 22#define BNX2X_MAX_ISCSI_INIT_CONN_MASK 0xFFFF0000
21 u16 max_iscsi_trgt_conn; 23#define BNX2X_MAX_ISCSI_INIT_CONN_SHIFT 16
22 u16 max_iscsi_init_conn;
23#endif
24 24
25 u32 reserved_a[6]; 25 u32 reserved_a;
26}; 26
27 u32 max_fcoe_conn;
28#define BNX2X_MAX_FCOE_TRGT_CONN_MASK 0xFFFF
29#define BNX2X_MAX_FCOE_TRGT_CONN_SHIFT 0
30#define BNX2X_MAX_FCOE_INIT_CONN_MASK 0xFFFF0000
31#define BNX2X_MAX_FCOE_INIT_CONN_SHIFT 16
27 32
33 u32 reserved_b[4];
34};
28 35
29#define PORT_0 0 36#define PORT_0 0
30#define PORT_1 1 37#define PORT_1 1
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 2215a39f74fb..ae8d20a2b4fc 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -6456,12 +6456,13 @@ static int bnx2x_set_iscsi_eth_mac_addr(struct bnx2x *bp, int set)
6456 u32 iscsi_l2_cl_id = BNX2X_ISCSI_ETH_CL_ID + 6456 u32 iscsi_l2_cl_id = BNX2X_ISCSI_ETH_CL_ID +
6457 BP_E1HVN(bp) * NONE_ETH_CONTEXT_USE; 6457 BP_E1HVN(bp) * NONE_ETH_CONTEXT_USE;
6458 u32 cl_bit_vec = (1 << iscsi_l2_cl_id); 6458 u32 cl_bit_vec = (1 << iscsi_l2_cl_id);
6459 u8 *iscsi_mac = bp->cnic_eth_dev.iscsi_mac;
6459 6460
6460 /* Send a SET_MAC ramrod */ 6461 /* Send a SET_MAC ramrod */
6461 bnx2x_set_mac_addr_gen(bp, set, bp->iscsi_mac, cl_bit_vec, 6462 bnx2x_set_mac_addr_gen(bp, set, iscsi_mac, cl_bit_vec,
6462 cam_offset, 0); 6463 cam_offset, 0);
6463 6464
6464 bnx2x_set_mac_in_nig(bp, set, bp->iscsi_mac, LLH_CAM_ISCSI_ETH_LINE); 6465 bnx2x_set_mac_in_nig(bp, set, iscsi_mac, LLH_CAM_ISCSI_ETH_LINE);
6465 6466
6466 return 0; 6467 return 0;
6467} 6468}
@@ -8385,11 +8386,47 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp)
8385 bp->common.shmem2_base); 8386 bp->common.shmem2_base);
8386} 8387}
8387 8388
8389#ifdef BCM_CNIC
8390static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp)
8391{
8392 u32 max_iscsi_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp,
8393 drv_lic_key[BP_PORT(bp)].max_iscsi_conn);
8394 u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp,
8395 drv_lic_key[BP_PORT(bp)].max_fcoe_conn);
8396
8397 /* Get the number of maximum allowed iSCSI and FCoE connections */
8398 bp->cnic_eth_dev.max_iscsi_conn =
8399 (max_iscsi_conn & BNX2X_MAX_ISCSI_INIT_CONN_MASK) >>
8400 BNX2X_MAX_ISCSI_INIT_CONN_SHIFT;
8401
8402 bp->cnic_eth_dev.max_fcoe_conn =
8403 (max_fcoe_conn & BNX2X_MAX_FCOE_INIT_CONN_MASK) >>
8404 BNX2X_MAX_FCOE_INIT_CONN_SHIFT;
8405
8406 BNX2X_DEV_INFO("max_iscsi_conn 0x%x max_fcoe_conn 0x%x\n",
8407 bp->cnic_eth_dev.max_iscsi_conn,
8408 bp->cnic_eth_dev.max_fcoe_conn);
8409
8410 /* If mamimum allowed number of connections is zero -
8411 * disable the feature.
8412 */
8413 if (!bp->cnic_eth_dev.max_iscsi_conn)
8414 bp->flags |= NO_ISCSI_OOO_FLAG | NO_ISCSI_FLAG;
8415
8416 if (!bp->cnic_eth_dev.max_fcoe_conn)
8417 bp->flags |= NO_FCOE_FLAG;
8418}
8419#endif
8420
8388static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp) 8421static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
8389{ 8422{
8390 u32 val, val2; 8423 u32 val, val2;
8391 int func = BP_ABS_FUNC(bp); 8424 int func = BP_ABS_FUNC(bp);
8392 int port = BP_PORT(bp); 8425 int port = BP_PORT(bp);
8426#ifdef BCM_CNIC
8427 u8 *iscsi_mac = bp->cnic_eth_dev.iscsi_mac;
8428 u8 *fip_mac = bp->fip_mac;
8429#endif
8393 8430
8394 if (BP_NOMCP(bp)) { 8431 if (BP_NOMCP(bp)) {
8395 BNX2X_ERROR("warning: random MAC workaround active\n"); 8432 BNX2X_ERROR("warning: random MAC workaround active\n");
@@ -8402,7 +8439,9 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
8402 bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2); 8439 bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2);
8403 8440
8404#ifdef BCM_CNIC 8441#ifdef BCM_CNIC
8405 /* iSCSI NPAR MAC */ 8442 /* iSCSI and FCoE NPAR MACs: if there is no either iSCSI or
8443 * FCoE MAC then the appropriate feature should be disabled.
8444 */
8406 if (IS_MF_SI(bp)) { 8445 if (IS_MF_SI(bp)) {
8407 u32 cfg = MF_CFG_RD(bp, func_ext_config[func].func_cfg); 8446 u32 cfg = MF_CFG_RD(bp, func_ext_config[func].func_cfg);
8408 if (cfg & MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD) { 8447 if (cfg & MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD) {
@@ -8410,8 +8449,39 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
8410 iscsi_mac_addr_upper); 8449 iscsi_mac_addr_upper);
8411 val = MF_CFG_RD(bp, func_ext_config[func]. 8450 val = MF_CFG_RD(bp, func_ext_config[func].
8412 iscsi_mac_addr_lower); 8451 iscsi_mac_addr_lower);
8413 bnx2x_set_mac_buf(bp->iscsi_mac, val, val2); 8452 BNX2X_DEV_INFO("Read iSCSI MAC: "
8414 } 8453 "0x%x:0x%04x\n", val2, val);
8454 bnx2x_set_mac_buf(iscsi_mac, val, val2);
8455
8456 /* Disable iSCSI OOO if MAC configuration is
8457 * invalid.
8458 */
8459 if (!is_valid_ether_addr(iscsi_mac)) {
8460 bp->flags |= NO_ISCSI_OOO_FLAG |
8461 NO_ISCSI_FLAG;
8462 memset(iscsi_mac, 0, ETH_ALEN);
8463 }
8464 } else
8465 bp->flags |= NO_ISCSI_OOO_FLAG | NO_ISCSI_FLAG;
8466
8467 if (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD) {
8468 val2 = MF_CFG_RD(bp, func_ext_config[func].
8469 fcoe_mac_addr_upper);
8470 val = MF_CFG_RD(bp, func_ext_config[func].
8471 fcoe_mac_addr_lower);
8472 BNX2X_DEV_INFO("Read FCoE MAC to "
8473 "0x%x:0x%04x\n", val2, val);
8474 bnx2x_set_mac_buf(fip_mac, val, val2);
8475
8476 /* Disable FCoE if MAC configuration is
8477 * invalid.
8478 */
8479 if (!is_valid_ether_addr(fip_mac)) {
8480 bp->flags |= NO_FCOE_FLAG;
8481 memset(bp->fip_mac, 0, ETH_ALEN);
8482 }
8483 } else
8484 bp->flags |= NO_FCOE_FLAG;
8415 } 8485 }
8416#endif 8486#endif
8417 } else { 8487 } else {
@@ -8425,7 +8495,7 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
8425 iscsi_mac_upper); 8495 iscsi_mac_upper);
8426 val = SHMEM_RD(bp, dev_info.port_hw_config[port]. 8496 val = SHMEM_RD(bp, dev_info.port_hw_config[port].
8427 iscsi_mac_lower); 8497 iscsi_mac_lower);
8428 bnx2x_set_mac_buf(bp->iscsi_mac, val, val2); 8498 bnx2x_set_mac_buf(iscsi_mac, val, val2);
8429#endif 8499#endif
8430 } 8500 }
8431 8501
@@ -8433,14 +8503,12 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
8433 memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN); 8503 memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN);
8434 8504
8435#ifdef BCM_CNIC 8505#ifdef BCM_CNIC
8436 /* Inform the upper layers about FCoE MAC */ 8506 /* Set the FCoE MAC in modes other then MF_SI */
8437 if (!CHIP_IS_E1x(bp)) { 8507 if (!CHIP_IS_E1x(bp)) {
8438 if (IS_MF_SD(bp)) 8508 if (IS_MF_SD(bp))
8439 memcpy(bp->fip_mac, bp->dev->dev_addr, 8509 memcpy(fip_mac, bp->dev->dev_addr, ETH_ALEN);
8440 sizeof(bp->fip_mac)); 8510 else if (!IS_MF(bp))
8441 else 8511 memcpy(fip_mac, iscsi_mac, ETH_ALEN);
8442 memcpy(bp->fip_mac, bp->iscsi_mac,
8443 sizeof(bp->fip_mac));
8444 } 8512 }
8445#endif 8513#endif
8446} 8514}
@@ -8603,6 +8671,10 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp)
8603 /* Get MAC addresses */ 8671 /* Get MAC addresses */
8604 bnx2x_get_mac_hwinfo(bp); 8672 bnx2x_get_mac_hwinfo(bp);
8605 8673
8674#ifdef BCM_CNIC
8675 bnx2x_get_cnic_info(bp);
8676#endif
8677
8606 return rc; 8678 return rc;
8607} 8679}
8608 8680
@@ -10077,6 +10149,13 @@ struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev)
10077 struct bnx2x *bp = netdev_priv(dev); 10149 struct bnx2x *bp = netdev_priv(dev);
10078 struct cnic_eth_dev *cp = &bp->cnic_eth_dev; 10150 struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
10079 10151
10152 /* If both iSCSI and FCoE are disabled - return NULL in
10153 * order to indicate CNIC that it should not try to work
10154 * with this device.
10155 */
10156 if (NO_ISCSI(bp) && NO_FCOE(bp))
10157 return NULL;
10158
10080 cp->drv_owner = THIS_MODULE; 10159 cp->drv_owner = THIS_MODULE;
10081 cp->chip_id = CHIP_ID(bp); 10160 cp->chip_id = CHIP_ID(bp);
10082 cp->pdev = bp->pdev; 10161 cp->pdev = bp->pdev;
@@ -10097,6 +10176,15 @@ struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev)
10097 BP_E1HVN(bp) * NONE_ETH_CONTEXT_USE; 10176 BP_E1HVN(bp) * NONE_ETH_CONTEXT_USE;
10098 cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID; 10177 cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID;
10099 10178
10179 if (NO_ISCSI_OOO(bp))
10180 cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO;
10181
10182 if (NO_ISCSI(bp))
10183 cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI;
10184
10185 if (NO_FCOE(bp))
10186 cp->drv_state |= CNIC_DRV_STATE_NO_FCOE;
10187
10100 DP(BNX2X_MSG_SP, "page_size %d, tbl_offset %d, tbl_lines %d, " 10188 DP(BNX2X_MSG_SP, "page_size %d, tbl_offset %d, tbl_lines %d, "
10101 "starting cid %d\n", 10189 "starting cid %d\n",
10102 cp->ctx_blk_size, 10190 cp->ctx_blk_size,
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index c82049635139..2d2d28f58e91 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -4179,6 +4179,14 @@ static void cnic_enable_bnx2_int(struct cnic_dev *dev)
4179 BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | cp->last_status_idx); 4179 BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | cp->last_status_idx);
4180} 4180}
4181 4181
4182static void cnic_get_bnx2_iscsi_info(struct cnic_dev *dev)
4183{
4184 u32 max_conn;
4185
4186 max_conn = cnic_reg_rd_ind(dev, BNX2_FW_MAX_ISCSI_CONN);
4187 dev->max_iscsi_conn = max_conn;
4188}
4189
4182static void cnic_disable_bnx2_int_sync(struct cnic_dev *dev) 4190static void cnic_disable_bnx2_int_sync(struct cnic_dev *dev)
4183{ 4191{
4184 struct cnic_local *cp = dev->cnic_priv; 4192 struct cnic_local *cp = dev->cnic_priv;
@@ -4503,6 +4511,8 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
4503 return err; 4511 return err;
4504 } 4512 }
4505 4513
4514 cnic_get_bnx2_iscsi_info(dev);
4515
4506 return 0; 4516 return 0;
4507} 4517}
4508 4518
@@ -4714,129 +4724,6 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev,
4714 cp->rx_cons = *cp->rx_cons_ptr; 4724 cp->rx_cons = *cp->rx_cons_ptr;
4715} 4725}
4716 4726
4717static int cnic_read_bnx2x_iscsi_mac(struct cnic_dev *dev, u32 upper_addr,
4718 u32 lower_addr)
4719{
4720 u32 val;
4721 u8 mac[6];
4722
4723 val = CNIC_RD(dev, upper_addr);
4724
4725 mac[0] = (u8) (val >> 8);
4726 mac[1] = (u8) val;
4727
4728 val = CNIC_RD(dev, lower_addr);
4729
4730 mac[2] = (u8) (val >> 24);
4731 mac[3] = (u8) (val >> 16);
4732 mac[4] = (u8) (val >> 8);
4733 mac[5] = (u8) val;
4734
4735 if (is_valid_ether_addr(mac)) {
4736 memcpy(dev->mac_addr, mac, 6);
4737 return 0;
4738 } else {
4739 return -EINVAL;
4740 }
4741}
4742
4743static void cnic_get_bnx2x_iscsi_info(struct cnic_dev *dev)
4744{
4745 struct cnic_local *cp = dev->cnic_priv;
4746 u32 base, base2, addr, addr1, val;
4747 int port = CNIC_PORT(cp);
4748
4749 dev->max_iscsi_conn = 0;
4750 base = CNIC_RD(dev, MISC_REG_SHARED_MEM_ADDR);
4751 if (base == 0)
4752 return;
4753
4754 base2 = CNIC_RD(dev, (CNIC_PATH(cp) ? MISC_REG_GENERIC_CR_1 :
4755 MISC_REG_GENERIC_CR_0));
4756 addr = BNX2X_SHMEM_ADDR(base,
4757 dev_info.port_hw_config[port].iscsi_mac_upper);
4758
4759 addr1 = BNX2X_SHMEM_ADDR(base,
4760 dev_info.port_hw_config[port].iscsi_mac_lower);
4761
4762 cnic_read_bnx2x_iscsi_mac(dev, addr, addr1);
4763
4764 addr = BNX2X_SHMEM_ADDR(base, validity_map[port]);
4765 val = CNIC_RD(dev, addr);
4766
4767 if (!(val & SHR_MEM_VALIDITY_LIC_NO_KEY_IN_EFFECT)) {
4768 u16 val16;
4769
4770 addr = BNX2X_SHMEM_ADDR(base,
4771 drv_lic_key[port].max_iscsi_init_conn);
4772 val16 = CNIC_RD16(dev, addr);
4773
4774 if (val16)
4775 val16 ^= 0x1e1e;
4776 dev->max_iscsi_conn = val16;
4777 }
4778
4779 if (BNX2X_CHIP_IS_E2(cp->chip_id))
4780 dev->max_fcoe_conn = BNX2X_FCOE_NUM_CONNECTIONS;
4781
4782 if (BNX2X_CHIP_IS_E1H(cp->chip_id) || BNX2X_CHIP_IS_E2(cp->chip_id)) {
4783 int func = CNIC_FUNC(cp);
4784 u32 mf_cfg_addr;
4785
4786 if (BNX2X_SHMEM2_HAS(base2, mf_cfg_addr))
4787 mf_cfg_addr = CNIC_RD(dev, BNX2X_SHMEM2_ADDR(base2,
4788 mf_cfg_addr));
4789 else
4790 mf_cfg_addr = base + BNX2X_SHMEM_MF_BLK_OFFSET;
4791
4792 if (BNX2X_CHIP_IS_E2(cp->chip_id)) {
4793 /* Must determine if the MF is SD vs SI mode */
4794 addr = BNX2X_SHMEM_ADDR(base,
4795 dev_info.shared_feature_config.config);
4796 val = CNIC_RD(dev, addr);
4797 if ((val & SHARED_FEAT_CFG_FORCE_SF_MODE_MASK) ==
4798 SHARED_FEAT_CFG_FORCE_SF_MODE_SWITCH_INDEPT) {
4799 int rc;
4800
4801 /* MULTI_FUNCTION_SI mode */
4802 addr = BNX2X_MF_CFG_ADDR(mf_cfg_addr,
4803 func_ext_config[func].func_cfg);
4804 val = CNIC_RD(dev, addr);
4805 if (!(val & MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD))
4806 dev->max_iscsi_conn = 0;
4807
4808 if (!(val & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD))
4809 dev->max_fcoe_conn = 0;
4810
4811 addr = BNX2X_MF_CFG_ADDR(mf_cfg_addr,
4812 func_ext_config[func].
4813 iscsi_mac_addr_upper);
4814 addr1 = BNX2X_MF_CFG_ADDR(mf_cfg_addr,
4815 func_ext_config[func].
4816 iscsi_mac_addr_lower);
4817 rc = cnic_read_bnx2x_iscsi_mac(dev, addr,
4818 addr1);
4819 if (rc && func > 1)
4820 dev->max_iscsi_conn = 0;
4821
4822 return;
4823 }
4824 }
4825
4826 addr = BNX2X_MF_CFG_ADDR(mf_cfg_addr,
4827 func_mf_config[func].e1hov_tag);
4828
4829 val = CNIC_RD(dev, addr);
4830 val &= FUNC_MF_CFG_E1HOV_TAG_MASK;
4831 if (val != FUNC_MF_CFG_E1HOV_TAG_DEFAULT) {
4832 dev->max_fcoe_conn = 0;
4833 dev->max_iscsi_conn = 0;
4834 }
4835 }
4836 if (!is_valid_ether_addr(dev->mac_addr))
4837 dev->max_iscsi_conn = 0;
4838}
4839
4840static void cnic_init_bnx2x_kcq(struct cnic_dev *dev) 4727static void cnic_init_bnx2x_kcq(struct cnic_dev *dev)
4841{ 4728{
4842 struct cnic_local *cp = dev->cnic_priv; 4729 struct cnic_local *cp = dev->cnic_priv;
@@ -4918,8 +4805,6 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
4918 4805
4919 cnic_init_bnx2x_kcq(dev); 4806 cnic_init_bnx2x_kcq(dev);
4920 4807
4921 cnic_get_bnx2x_iscsi_info(dev);
4922
4923 /* Only 1 EQ */ 4808 /* Only 1 EQ */
4924 CNIC_WR16(dev, cp->kcq1.io_addr, MAX_KCQ_IDX); 4809 CNIC_WR16(dev, cp->kcq1.io_addr, MAX_KCQ_IDX);
4925 CNIC_WR(dev, BAR_CSTRORM_INTMEM + 4810 CNIC_WR(dev, BAR_CSTRORM_INTMEM +
@@ -5352,6 +5237,14 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev)
5352 cdev->pcidev = pdev; 5237 cdev->pcidev = pdev;
5353 cp->chip_id = ethdev->chip_id; 5238 cp->chip_id = ethdev->chip_id;
5354 5239
5240 if (!(ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI))
5241 cdev->max_iscsi_conn = ethdev->max_iscsi_conn;
5242 if (BNX2X_CHIP_IS_E2(cp->chip_id) &&
5243 !(ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE))
5244 cdev->max_fcoe_conn = ethdev->max_fcoe_conn;
5245
5246 memcpy(cdev->mac_addr, ethdev->iscsi_mac, 6);
5247
5355 cp->cnic_ops = &cnic_bnx2x_ops; 5248 cp->cnic_ops = &cnic_bnx2x_ops;
5356 cp->start_hw = cnic_start_bnx2x_hw; 5249 cp->start_hw = cnic_start_bnx2x_hw;
5357 cp->stop_hw = cnic_stop_bnx2x_hw; 5250 cp->stop_hw = cnic_stop_bnx2x_hw;
diff --git a/drivers/net/cnic_if.h b/drivers/net/cnic_if.h
index 9f44e0ffe003..e01b49ee3591 100644
--- a/drivers/net/cnic_if.h
+++ b/drivers/net/cnic_if.h
@@ -12,8 +12,8 @@
12#ifndef CNIC_IF_H 12#ifndef CNIC_IF_H
13#define CNIC_IF_H 13#define CNIC_IF_H
14 14
15#define CNIC_MODULE_VERSION "2.2.12" 15#define CNIC_MODULE_VERSION "2.2.13"
16#define CNIC_MODULE_RELDATE "Jan 03, 2011" 16#define CNIC_MODULE_RELDATE "Jan 31, 2011"
17 17
18#define CNIC_ULP_RDMA 0 18#define CNIC_ULP_RDMA 0
19#define CNIC_ULP_ISCSI 1 19#define CNIC_ULP_ISCSI 1
@@ -159,6 +159,9 @@ struct cnic_eth_dev {
159 u32 drv_state; 159 u32 drv_state;
160#define CNIC_DRV_STATE_REGD 0x00000001 160#define CNIC_DRV_STATE_REGD 0x00000001
161#define CNIC_DRV_STATE_USING_MSIX 0x00000002 161#define CNIC_DRV_STATE_USING_MSIX 0x00000002
162#define CNIC_DRV_STATE_NO_ISCSI_OOO 0x00000004
163#define CNIC_DRV_STATE_NO_ISCSI 0x00000008
164#define CNIC_DRV_STATE_NO_FCOE 0x00000010
162 u32 chip_id; 165 u32 chip_id;
163 u32 max_kwqe_pending; 166 u32 max_kwqe_pending;
164 struct pci_dev *pdev; 167 struct pci_dev *pdev;
@@ -176,6 +179,7 @@ struct cnic_eth_dev {
176 u32 fcoe_init_cid; 179 u32 fcoe_init_cid;
177 u16 iscsi_l2_client_id; 180 u16 iscsi_l2_client_id;
178 u16 iscsi_l2_cid; 181 u16 iscsi_l2_cid;
182 u8 iscsi_mac[ETH_ALEN];
179 183
180 int num_irq; 184 int num_irq;
181 struct cnic_irq irq_arr[MAX_CNIC_VEC]; 185 struct cnic_irq irq_arr[MAX_CNIC_VEC];