aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r--drivers/net/cnic.c143
1 files changed, 18 insertions, 125 deletions
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;