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.c285
1 files changed, 138 insertions, 147 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 4e9d4ae1f303..80259815af06 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -942,7 +942,7 @@ static int cnic_alloc_uio(struct cnic_dev *dev) {
942 } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) { 942 } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) {
943 uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk & 943 uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk &
944 PAGE_MASK; 944 PAGE_MASK;
945 uinfo->mem[1].size = sizeof(struct host_def_status_block); 945 uinfo->mem[1].size = sizeof(*cp->bnx2x_def_status_blk);
946 946
947 uinfo->name = "bnx2x_cnic"; 947 uinfo->name = "bnx2x_cnic";
948 } 948 }
@@ -1063,6 +1063,8 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev)
1063 int i, j, n, ret, pages; 1063 int i, j, n, ret, pages;
1064 struct cnic_dma *kwq_16_dma = &cp->kwq_16_data_info; 1064 struct cnic_dma *kwq_16_dma = &cp->kwq_16_data_info;
1065 1065
1066 cp->iro_arr = ethdev->iro_arr;
1067
1066 cp->max_cid_space = MAX_ISCSI_TBL_SZ; 1068 cp->max_cid_space = MAX_ISCSI_TBL_SZ;
1067 cp->iscsi_start_cid = start_cid; 1069 cp->iscsi_start_cid = start_cid;
1068 if (start_cid < BNX2X_ISCSI_START_CID) { 1070 if (start_cid < BNX2X_ISCSI_START_CID) {
@@ -1127,8 +1129,6 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev)
1127 1129
1128 cp->bnx2x_def_status_blk = cp->ethdev->irq_arr[1].status_blk; 1130 cp->bnx2x_def_status_blk = cp->ethdev->irq_arr[1].status_blk;
1129 1131
1130 memset(cp->status_blk.bnx2x, 0, sizeof(*cp->status_blk.bnx2x));
1131
1132 cp->l2_rx_ring_size = 15; 1132 cp->l2_rx_ring_size = 15;
1133 1133
1134 ret = cnic_alloc_l2_rings(dev, 4); 1134 ret = cnic_alloc_l2_rings(dev, 4);
@@ -1211,7 +1211,7 @@ static int cnic_submit_kwqe_16(struct cnic_dev *dev, u32 cmd, u32 cid,
1211 cpu_to_le32(((cmd << SPE_HDR_CMD_ID_SHIFT) | 1211 cpu_to_le32(((cmd << SPE_HDR_CMD_ID_SHIFT) |
1212 BNX2X_HW_CID(cp, cid))); 1212 BNX2X_HW_CID(cp, cid)));
1213 kwqe.hdr.type = cpu_to_le16(type); 1213 kwqe.hdr.type = cpu_to_le16(type);
1214 kwqe.hdr.reserved = 0; 1214 kwqe.hdr.reserved1 = 0;
1215 kwqe.data.phy_address.lo = cpu_to_le32(l5_data->phy_address.lo); 1215 kwqe.data.phy_address.lo = cpu_to_le32(l5_data->phy_address.lo);
1216 kwqe.data.phy_address.hi = cpu_to_le32(l5_data->phy_address.hi); 1216 kwqe.data.phy_address.hi = cpu_to_le32(l5_data->phy_address.hi);
1217 1217
@@ -1527,8 +1527,10 @@ static int cnic_setup_bnx2x_ctx(struct cnic_dev *dev, struct kwqe *wqes[],
1527 ictx->tstorm_st_context.tcp.cwnd = 0x5A8; 1527 ictx->tstorm_st_context.tcp.cwnd = 0x5A8;
1528 ictx->tstorm_st_context.tcp.flags2 |= 1528 ictx->tstorm_st_context.tcp.flags2 |=
1529 TSTORM_TCP_ST_CONTEXT_SECTION_DA_EN; 1529 TSTORM_TCP_ST_CONTEXT_SECTION_DA_EN;
1530 ictx->tstorm_st_context.tcp.ooo_support_mode =
1531 TCP_TSTORM_OOO_DROP_AND_PROC_ACK;
1530 1532
1531 ictx->timers_context.flags |= ISCSI_TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG; 1533 ictx->timers_context.flags |= TIMERS_BLOCK_CONTEXT_CONN_VALID_FLG;
1532 1534
1533 ictx->ustorm_st_context.ring.rq.pbl_base.lo = 1535 ictx->ustorm_st_context.ring.rq.pbl_base.lo =
1534 req2->rq_page_table_addr_lo; 1536 req2->rq_page_table_addr_lo;
@@ -1717,6 +1719,7 @@ static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
1717 int ret = 0; 1719 int ret = 0;
1718 struct iscsi_kcqe kcqe; 1720 struct iscsi_kcqe kcqe;
1719 struct kcqe *cqes[1]; 1721 struct kcqe *cqes[1];
1722 u32 hw_cid, type;
1720 1723
1721 if (!(ctx->ctx_flags & CTX_FL_OFFLD_START)) 1724 if (!(ctx->ctx_flags & CTX_FL_OFFLD_START))
1722 goto skip_cfc_delete; 1725 goto skip_cfc_delete;
@@ -1727,11 +1730,15 @@ static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
1727 init_waitqueue_head(&ctx->waitq); 1730 init_waitqueue_head(&ctx->waitq);
1728 ctx->wait_cond = 0; 1731 ctx->wait_cond = 0;
1729 memset(&l5_data, 0, sizeof(l5_data)); 1732 memset(&l5_data, 0, sizeof(l5_data));
1730 ret = cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_ETH_CFC_DEL, 1733 hw_cid = BNX2X_HW_CID(cp, ctx->cid);
1731 req->context_id, 1734 type = (NONE_CONNECTION_TYPE << SPE_HDR_CONN_TYPE_SHIFT)
1732 ETH_CONNECTION_TYPE | 1735 & SPE_HDR_CONN_TYPE;
1733 (1 << SPE_HDR_COMMON_RAMROD_SHIFT), 1736 type |= ((cp->pfid << SPE_HDR_FUNCTION_ID_SHIFT) &
1734 &l5_data); 1737 SPE_HDR_FUNCTION_ID);
1738
1739 ret = cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_COMMON_CFC_DEL,
1740 hw_cid, type, &l5_data);
1741
1735 if (ret == 0) 1742 if (ret == 0)
1736 wait_event(ctx->waitq, ctx->wait_cond); 1743 wait_event(ctx->waitq, ctx->wait_cond);
1737 1744
@@ -2322,7 +2329,7 @@ static void cnic_ack_bnx2x_msix(struct cnic_dev *dev)
2322{ 2329{
2323 struct cnic_local *cp = dev->cnic_priv; 2330 struct cnic_local *cp = dev->cnic_priv;
2324 2331
2325 cnic_ack_bnx2x_int(dev, cp->status_blk_num, CSTORM_ID, 0, 2332 cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, CSTORM_ID, 0,
2326 IGU_INT_DISABLE, 0); 2333 IGU_INT_DISABLE, 0);
2327} 2334}
2328 2335
@@ -2357,7 +2364,7 @@ static void cnic_service_bnx2x_bh(unsigned long data)
2357 status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq1); 2364 status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq1);
2358 2365
2359 CNIC_WR16(dev, cp->kcq1.io_addr, cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); 2366 CNIC_WR16(dev, cp->kcq1.io_addr, cp->kcq1.sw_prod_idx + MAX_KCQ_IDX);
2360 cnic_ack_bnx2x_int(dev, cp->status_blk_num, CSTORM_ID, 2367 cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, USTORM_ID,
2361 status_idx, IGU_INT_ENABLE, 1); 2368 status_idx, IGU_INT_ENABLE, 1);
2362} 2369}
2363 2370
@@ -3285,6 +3292,7 @@ static int cnic_cm_init_bnx2x_hw(struct cnic_dev *dev)
3285{ 3292{
3286 struct cnic_local *cp = dev->cnic_priv; 3293 struct cnic_local *cp = dev->cnic_priv;
3287 u32 pfid = cp->pfid; 3294 u32 pfid = cp->pfid;
3295 u32 port = CNIC_PORT(cp);
3288 3296
3289 cnic_init_bnx2x_mac(dev); 3297 cnic_init_bnx2x_mac(dev);
3290 cnic_bnx2x_set_tcp_timestamp(dev, 1); 3298 cnic_bnx2x_set_tcp_timestamp(dev, 1);
@@ -3293,9 +3301,9 @@ static int cnic_cm_init_bnx2x_hw(struct cnic_dev *dev)
3293 XSTORM_ISCSI_LOCAL_VLAN_OFFSET(pfid), 0); 3301 XSTORM_ISCSI_LOCAL_VLAN_OFFSET(pfid), 0);
3294 3302
3295 CNIC_WR(dev, BAR_XSTRORM_INTMEM + 3303 CNIC_WR(dev, BAR_XSTRORM_INTMEM +
3296 XSTORM_TCP_GLOBAL_DEL_ACK_COUNTER_ENABLED_OFFSET(pfid), 1); 3304 XSTORM_TCP_GLOBAL_DEL_ACK_COUNTER_ENABLED_OFFSET(port), 1);
3297 CNIC_WR(dev, BAR_XSTRORM_INTMEM + 3305 CNIC_WR(dev, BAR_XSTRORM_INTMEM +
3298 XSTORM_TCP_GLOBAL_DEL_ACK_COUNTER_MAX_COUNT_OFFSET(pfid), 3306 XSTORM_TCP_GLOBAL_DEL_ACK_COUNTER_MAX_COUNT_OFFSET(port),
3299 DEF_MAX_DA_COUNT); 3307 DEF_MAX_DA_COUNT);
3300 3308
3301 CNIC_WR8(dev, BAR_XSTRORM_INTMEM + 3309 CNIC_WR8(dev, BAR_XSTRORM_INTMEM +
@@ -3859,32 +3867,48 @@ static int cnic_init_bnx2x_irq(struct cnic_dev *dev)
3859 return err; 3867 return err;
3860} 3868}
3861 3869
3870static inline void cnic_storm_memset_hc_disable(struct cnic_dev *dev,
3871 u16 sb_id, u8 sb_index,
3872 u8 disable)
3873{
3874
3875 u32 addr = BAR_CSTRORM_INTMEM +
3876 CSTORM_STATUS_BLOCK_DATA_OFFSET(sb_id) +
3877 offsetof(struct hc_status_block_data_e1x, index_data) +
3878 sizeof(struct hc_index_data)*sb_index +
3879 offsetof(struct hc_index_data, flags);
3880 u16 flags = CNIC_RD16(dev, addr);
3881 /* clear and set */
3882 flags &= ~HC_INDEX_DATA_HC_ENABLED;
3883 flags |= (((~disable) << HC_INDEX_DATA_HC_ENABLED_SHIFT) &
3884 HC_INDEX_DATA_HC_ENABLED);
3885 CNIC_WR16(dev, addr, flags);
3886}
3887
3862static void cnic_enable_bnx2x_int(struct cnic_dev *dev) 3888static void cnic_enable_bnx2x_int(struct cnic_dev *dev)
3863{ 3889{
3864 struct cnic_local *cp = dev->cnic_priv; 3890 struct cnic_local *cp = dev->cnic_priv;
3865 u8 sb_id = cp->status_blk_num; 3891 u8 sb_id = cp->status_blk_num;
3866 int port = CNIC_PORT(cp);
3867 3892
3868 CNIC_WR8(dev, BAR_CSTRORM_INTMEM + 3893 CNIC_WR8(dev, BAR_CSTRORM_INTMEM +
3869 CSTORM_SB_HC_TIMEOUT_C_OFFSET(port, sb_id, 3894 CSTORM_STATUS_BLOCK_DATA_OFFSET(sb_id) +
3870 HC_INDEX_C_ISCSI_EQ_CONS), 3895 offsetof(struct hc_status_block_data_e1x, index_data) +
3871 64 / 12); 3896 sizeof(struct hc_index_data)*HC_INDEX_ISCSI_EQ_CONS +
3872 CNIC_WR16(dev, BAR_CSTRORM_INTMEM + 3897 offsetof(struct hc_index_data, timeout), 64 / 12);
3873 CSTORM_SB_HC_DISABLE_C_OFFSET(port, sb_id, 3898 cnic_storm_memset_hc_disable(dev, sb_id, HC_INDEX_ISCSI_EQ_CONS, 0);
3874 HC_INDEX_C_ISCSI_EQ_CONS), 0);
3875} 3899}
3876 3900
3877static void cnic_disable_bnx2x_int_sync(struct cnic_dev *dev) 3901static void cnic_disable_bnx2x_int_sync(struct cnic_dev *dev)
3878{ 3902{
3879} 3903}
3880 3904
3881static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev) 3905static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev,
3906 struct client_init_ramrod_data *data)
3882{ 3907{
3883 struct cnic_local *cp = dev->cnic_priv; 3908 struct cnic_local *cp = dev->cnic_priv;
3884 union eth_tx_bd_types *txbd = (union eth_tx_bd_types *) cp->l2_ring; 3909 union eth_tx_bd_types *txbd = (union eth_tx_bd_types *) cp->l2_ring;
3885 struct eth_context *context; 3910 dma_addr_t buf_map, ring_map = cp->l2_ring_map;
3886 struct regpair context_addr; 3911 struct host_sp_status_block *sb = cp->bnx2x_def_status_blk;
3887 dma_addr_t buf_map;
3888 int port = CNIC_PORT(cp); 3912 int port = CNIC_PORT(cp);
3889 int i; 3913 int i;
3890 int cli = BNX2X_ISCSI_CL_ID(CNIC_E1HVN(cp)); 3914 int cli = BNX2X_ISCSI_CL_ID(CNIC_E1HVN(cp));
@@ -3909,33 +3933,23 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev)
3909 start_bd->general_data |= (1 << ETH_TX_START_BD_HDR_NBDS_SHIFT); 3933 start_bd->general_data |= (1 << ETH_TX_START_BD_HDR_NBDS_SHIFT);
3910 3934
3911 } 3935 }
3912 context = cnic_get_bnx2x_ctx(dev, BNX2X_ISCSI_L2_CID, 1, &context_addr);
3913 3936
3914 val = (u64) cp->l2_ring_map >> 32; 3937 val = (u64) ring_map >> 32;
3915 txbd->next_bd.addr_hi = cpu_to_le32(val); 3938 txbd->next_bd.addr_hi = cpu_to_le32(val);
3916 3939
3917 context->xstorm_st_context.tx_bd_page_base_hi = val; 3940 data->tx.tx_bd_page_base.hi = cpu_to_le32(val);
3918 3941
3919 val = (u64) cp->l2_ring_map & 0xffffffff; 3942 val = (u64) ring_map & 0xffffffff;
3920 txbd->next_bd.addr_lo = cpu_to_le32(val); 3943 txbd->next_bd.addr_lo = cpu_to_le32(val);
3921 3944
3922 context->xstorm_st_context.tx_bd_page_base_lo = val; 3945 data->tx.tx_bd_page_base.lo = cpu_to_le32(val);
3923
3924 context->cstorm_st_context.sb_index_number =
3925 HC_INDEX_DEF_C_ETH_ISCSI_CQ_CONS;
3926 context->cstorm_st_context.status_block_id = BNX2X_DEF_SB_ID;
3927
3928 if (cli < MAX_X_STAT_COUNTER_ID)
3929 context->xstorm_st_context.statistics_data = cli |
3930 XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE;
3931 3946
3932 context->xstorm_ag_context.cdu_reserved = 3947 /* Other ramrod params */
3933 CDU_RSRVD_VALUE_TYPE_A(BNX2X_HW_CID(cp, BNX2X_ISCSI_L2_CID), 3948 data->tx.tx_sb_index_number = HC_SP_INDEX_ETH_ISCSI_CQ_CONS;
3934 CDU_REGION_NUMBER_XCM_AG, 3949 data->tx.tx_status_block_id = BNX2X_DEF_SB_ID;
3935 ETH_CONNECTION_TYPE);
3936 3950
3937 /* reset xstorm per client statistics */ 3951 /* reset xstorm per client statistics */
3938 if (cli < MAX_X_STAT_COUNTER_ID) { 3952 if (cli < MAX_STAT_COUNTER_ID) {
3939 val = BAR_XSTRORM_INTMEM + 3953 val = BAR_XSTRORM_INTMEM +
3940 XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); 3954 XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli);
3941 for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++) 3955 for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++)
@@ -3943,24 +3957,31 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev)
3943 } 3957 }
3944 3958
3945 cp->tx_cons_ptr = 3959 cp->tx_cons_ptr =
3946 &cp->bnx2x_def_status_blk->c_def_status_block.index_values[ 3960 &sb->sp_sb.index_values[HC_SP_INDEX_ETH_ISCSI_CQ_CONS];
3947 HC_INDEX_DEF_C_ETH_ISCSI_CQ_CONS];
3948} 3961}
3949 3962
3950static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev) 3963static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev,
3964 struct client_init_ramrod_data *data)
3951{ 3965{
3952 struct cnic_local *cp = dev->cnic_priv; 3966 struct cnic_local *cp = dev->cnic_priv;
3953 struct eth_rx_bd *rxbd = (struct eth_rx_bd *) (cp->l2_ring + 3967 struct eth_rx_bd *rxbd = (struct eth_rx_bd *) (cp->l2_ring +
3954 BCM_PAGE_SIZE); 3968 BCM_PAGE_SIZE);
3955 struct eth_rx_cqe_next_page *rxcqe = (struct eth_rx_cqe_next_page *) 3969 struct eth_rx_cqe_next_page *rxcqe = (struct eth_rx_cqe_next_page *)
3956 (cp->l2_ring + (2 * BCM_PAGE_SIZE)); 3970 (cp->l2_ring + (2 * BCM_PAGE_SIZE));
3957 struct eth_context *context; 3971 struct host_sp_status_block *sb = cp->bnx2x_def_status_blk;
3958 struct regpair context_addr;
3959 int i; 3972 int i;
3960 int port = CNIC_PORT(cp); 3973 int port = CNIC_PORT(cp);
3961 int cli = BNX2X_ISCSI_CL_ID(CNIC_E1HVN(cp)); 3974 int cli = BNX2X_ISCSI_CL_ID(CNIC_E1HVN(cp));
3975 int cl_qzone_id = BNX2X_CL_QZONE_ID(cp, cli);
3962 u32 val; 3976 u32 val;
3963 struct tstorm_eth_client_config tstorm_client = {0}; 3977 dma_addr_t ring_map = cp->l2_ring_map;
3978
3979 /* General data */
3980 data->general.client_id = cli;
3981 data->general.statistics_en_flg = 1;
3982 data->general.statistics_counter_id = cli;
3983 data->general.activate_flg = 1;
3984 data->general.sp_client_id = cli;
3964 3985
3965 for (i = 0; i < BNX2X_MAX_RX_DESC_CNT; i++, rxbd++) { 3986 for (i = 0; i < BNX2X_MAX_RX_DESC_CNT; i++, rxbd++) {
3966 dma_addr_t buf_map; 3987 dma_addr_t buf_map;
@@ -3970,83 +3991,42 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev)
3970 rxbd->addr_hi = cpu_to_le32((u64) buf_map >> 32); 3991 rxbd->addr_hi = cpu_to_le32((u64) buf_map >> 32);
3971 rxbd->addr_lo = cpu_to_le32(buf_map & 0xffffffff); 3992 rxbd->addr_lo = cpu_to_le32(buf_map & 0xffffffff);
3972 } 3993 }
3973 context = cnic_get_bnx2x_ctx(dev, BNX2X_ISCSI_L2_CID, 0, &context_addr);
3974 3994
3975 val = (u64) (cp->l2_ring_map + BCM_PAGE_SIZE) >> 32; 3995 val = (u64) (ring_map + BCM_PAGE_SIZE) >> 32;
3976 rxbd->addr_hi = cpu_to_le32(val); 3996 rxbd->addr_hi = cpu_to_le32(val);
3997 data->rx.bd_page_base.hi = cpu_to_le32(val);
3977 3998
3978 context->ustorm_st_context.common.bd_page_base_hi = val; 3999 val = (u64) (ring_map + BCM_PAGE_SIZE) & 0xffffffff;
3979
3980 val = (u64) (cp->l2_ring_map + BCM_PAGE_SIZE) & 0xffffffff;
3981 rxbd->addr_lo = cpu_to_le32(val); 4000 rxbd->addr_lo = cpu_to_le32(val);
3982 4001 data->rx.bd_page_base.lo = cpu_to_le32(val);
3983 context->ustorm_st_context.common.bd_page_base_lo = val;
3984
3985 context->ustorm_st_context.common.sb_index_numbers =
3986 BNX2X_ISCSI_RX_SB_INDEX_NUM;
3987 context->ustorm_st_context.common.clientId = cli;
3988 context->ustorm_st_context.common.status_block_id = BNX2X_DEF_SB_ID;
3989 if (cli < MAX_U_STAT_COUNTER_ID) {
3990 context->ustorm_st_context.common.flags =
3991 USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS;
3992 context->ustorm_st_context.common.statistics_counter_id = cli;
3993 }
3994 context->ustorm_st_context.common.mc_alignment_log_size = 0;
3995 context->ustorm_st_context.common.bd_buff_size =
3996 cp->l2_single_buf_size;
3997
3998 context->ustorm_ag_context.cdu_usage =
3999 CDU_RSRVD_VALUE_TYPE_A(BNX2X_HW_CID(cp, BNX2X_ISCSI_L2_CID),
4000 CDU_REGION_NUMBER_UCM_AG,
4001 ETH_CONNECTION_TYPE);
4002 4002
4003 rxcqe += BNX2X_MAX_RCQ_DESC_CNT; 4003 rxcqe += BNX2X_MAX_RCQ_DESC_CNT;
4004 val = (u64) (cp->l2_ring_map + (2 * BCM_PAGE_SIZE)) >> 32; 4004 val = (u64) (ring_map + (2 * BCM_PAGE_SIZE)) >> 32;
4005 rxcqe->addr_hi = cpu_to_le32(val); 4005 rxcqe->addr_hi = cpu_to_le32(val);
4006 data->rx.cqe_page_base.hi = cpu_to_le32(val);
4006 4007
4007 CNIC_WR(dev, BAR_USTRORM_INTMEM + 4008 val = (u64) (ring_map + (2 * BCM_PAGE_SIZE)) & 0xffffffff;
4008 USTORM_CQE_PAGE_BASE_OFFSET(port, cli) + 4, val);
4009
4010 CNIC_WR(dev, BAR_USTRORM_INTMEM +
4011 USTORM_CQE_PAGE_NEXT_OFFSET(port, cli) + 4, val);
4012
4013 val = (u64) (cp->l2_ring_map + (2 * BCM_PAGE_SIZE)) & 0xffffffff;
4014 rxcqe->addr_lo = cpu_to_le32(val); 4009 rxcqe->addr_lo = cpu_to_le32(val);
4010 data->rx.cqe_page_base.lo = cpu_to_le32(val);
4015 4011
4016 CNIC_WR(dev, BAR_USTRORM_INTMEM + 4012 /* Other ramrod params */
4017 USTORM_CQE_PAGE_BASE_OFFSET(port, cli), val); 4013 data->rx.client_qzone_id = cl_qzone_id;
4018 4014 data->rx.rx_sb_index_number = HC_SP_INDEX_ETH_ISCSI_RX_CQ_CONS;
4019 CNIC_WR(dev, BAR_USTRORM_INTMEM + 4015 data->rx.status_block_id = BNX2X_DEF_SB_ID;
4020 USTORM_CQE_PAGE_NEXT_OFFSET(port, cli), val);
4021
4022 /* client tstorm info */
4023 tstorm_client.mtu = cp->l2_single_buf_size - 14;
4024 tstorm_client.config_flags = TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE;
4025
4026 if (cli < MAX_T_STAT_COUNTER_ID) {
4027 tstorm_client.config_flags |=
4028 TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE;
4029 tstorm_client.statistics_counter_id = cli;
4030 }
4031 4016
4032 CNIC_WR(dev, BAR_TSTRORM_INTMEM + 4017 data->rx.cache_line_alignment_log_size = L1_CACHE_SHIFT;
4033 TSTORM_CLIENT_CONFIG_OFFSET(port, cli), 4018 data->rx.bd_buff_size = cpu_to_le16(cp->l2_single_buf_size);
4034 ((u32 *)&tstorm_client)[0]);
4035 CNIC_WR(dev, BAR_TSTRORM_INTMEM +
4036 TSTORM_CLIENT_CONFIG_OFFSET(port, cli) + 4,
4037 ((u32 *)&tstorm_client)[1]);
4038 4019
4039 /* reset tstorm per client statistics */ 4020 data->rx.mtu = cpu_to_le16(cp->l2_single_buf_size - 14);
4040 if (cli < MAX_T_STAT_COUNTER_ID) { 4021 data->rx.outer_vlan_removal_enable_flg = 1;
4041 4022
4023 /* reset tstorm and ustorm per client statistics */
4024 if (cli < MAX_STAT_COUNTER_ID) {
4042 val = BAR_TSTRORM_INTMEM + 4025 val = BAR_TSTRORM_INTMEM +
4043 TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); 4026 TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli);
4044 for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++) 4027 for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++)
4045 CNIC_WR(dev, val + i * 4, 0); 4028 CNIC_WR(dev, val + i * 4, 0);
4046 }
4047 4029
4048 /* reset ustorm per client statistics */
4049 if (cli < MAX_U_STAT_COUNTER_ID) {
4050 val = BAR_USTRORM_INTMEM + 4030 val = BAR_USTRORM_INTMEM +
4051 USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); 4031 USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli);
4052 for (i = 0; i < sizeof(struct ustorm_per_client_stats) / 4; i++) 4032 for (i = 0; i < sizeof(struct ustorm_per_client_stats) / 4; i++)
@@ -4054,8 +4034,7 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev)
4054 } 4034 }
4055 4035
4056 cp->rx_cons_ptr = 4036 cp->rx_cons_ptr =
4057 &cp->bnx2x_def_status_blk->u_def_status_block.index_values[ 4037 &sb->sp_sb.index_values[HC_SP_INDEX_ETH_ISCSI_RX_CQ_CONS];
4058 HC_INDEX_DEF_U_ETH_ISCSI_RX_CQ_CONS];
4059} 4038}
4060 4039
4061static void cnic_get_bnx2x_iscsi_info(struct cnic_dev *dev) 4040static void cnic_get_bnx2x_iscsi_info(struct cnic_dev *dev)
@@ -4066,7 +4045,7 @@ static void cnic_get_bnx2x_iscsi_info(struct cnic_dev *dev)
4066 4045
4067 dev->max_iscsi_conn = 0; 4046 dev->max_iscsi_conn = 0;
4068 base = CNIC_RD(dev, MISC_REG_SHARED_MEM_ADDR); 4047 base = CNIC_RD(dev, MISC_REG_SHARED_MEM_ADDR);
4069 if (base < 0xa0000 || base >= 0xc0000) 4048 if (base == 0)
4070 return; 4049 return;
4071 4050
4072 addr = BNX2X_SHMEM_ADDR(base, 4051 addr = BNX2X_SHMEM_ADDR(base,
@@ -4103,14 +4082,19 @@ static void cnic_get_bnx2x_iscsi_info(struct cnic_dev *dev)
4103 } 4082 }
4104 if (BNX2X_CHIP_IS_E1H(cp->chip_id)) { 4083 if (BNX2X_CHIP_IS_E1H(cp->chip_id)) {
4105 int func = CNIC_FUNC(cp); 4084 int func = CNIC_FUNC(cp);
4085 u32 mf_cfg_addr;
4086
4087 mf_cfg_addr = base + BNX2X_SHMEM_MF_BLK_OFFSET;
4088
4089 addr = mf_cfg_addr +
4090 offsetof(struct mf_cfg, func_mf_config[func].e1hov_tag);
4106 4091
4107 addr = BNX2X_SHMEM_ADDR(base,
4108 mf_cfg.func_mf_config[func].e1hov_tag);
4109 val = CNIC_RD(dev, addr); 4092 val = CNIC_RD(dev, addr);
4110 val &= FUNC_MF_CFG_E1HOV_TAG_MASK; 4093 val &= FUNC_MF_CFG_E1HOV_TAG_MASK;
4111 if (val != FUNC_MF_CFG_E1HOV_TAG_DEFAULT) { 4094 if (val != FUNC_MF_CFG_E1HOV_TAG_DEFAULT) {
4112 addr = BNX2X_SHMEM_ADDR(base, 4095 addr = mf_cfg_addr +
4113 mf_cfg.func_mf_config[func].config); 4096 offsetof(struct mf_cfg,
4097 func_mf_config[func].config);
4114 val = CNIC_RD(dev, addr); 4098 val = CNIC_RD(dev, addr);
4115 val &= FUNC_MF_CFG_PROTOCOL_MASK; 4099 val &= FUNC_MF_CFG_PROTOCOL_MASK;
4116 if (val != FUNC_MF_CFG_PROTOCOL_ISCSI) 4100 if (val != FUNC_MF_CFG_PROTOCOL_ISCSI)
@@ -4122,11 +4106,10 @@ static void cnic_get_bnx2x_iscsi_info(struct cnic_dev *dev)
4122static int cnic_start_bnx2x_hw(struct cnic_dev *dev) 4106static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
4123{ 4107{
4124 struct cnic_local *cp = dev->cnic_priv; 4108 struct cnic_local *cp = dev->cnic_priv;
4109 struct cnic_eth_dev *ethdev = cp->ethdev;
4125 int func = CNIC_FUNC(cp), ret, i; 4110 int func = CNIC_FUNC(cp), ret, i;
4126 int port = CNIC_PORT(cp);
4127 u32 pfid; 4111 u32 pfid;
4128 u16 eq_idx; 4112 struct host_hc_status_block_e1x *sb = cp->status_blk.gen;
4129 u8 sb_id = cp->status_blk_num;
4130 4113
4131 cp->pfid = func; 4114 cp->pfid = func;
4132 pfid = cp->pfid; 4115 pfid = cp->pfid;
@@ -4137,15 +4120,16 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
4137 if (ret) 4120 if (ret)
4138 return -ENOMEM; 4121 return -ENOMEM;
4139 4122
4123 cp->bnx2x_igu_sb_id = ethdev->irq_arr[0].status_blk_num2;
4124
4140 cp->kcq1.io_addr = BAR_CSTRORM_INTMEM + 4125 cp->kcq1.io_addr = BAR_CSTRORM_INTMEM +
4141 CSTORM_ISCSI_EQ_PROD_OFFSET(pfid, 0); 4126 CSTORM_ISCSI_EQ_PROD_OFFSET(pfid, 0);
4142 cp->kcq1.sw_prod_idx = 0; 4127 cp->kcq1.sw_prod_idx = 0;
4143 4128
4144 cp->kcq1.hw_prod_idx_ptr = 4129 cp->kcq1.hw_prod_idx_ptr =
4145 &cp->status_blk.bnx2x->c_status_block.index_values[ 4130 &sb->sb.index_values[HC_INDEX_ISCSI_EQ_CONS];
4146 HC_INDEX_C_ISCSI_EQ_CONS];
4147 cp->kcq1.status_idx_ptr = 4131 cp->kcq1.status_idx_ptr =
4148 &cp->status_blk.bnx2x->c_status_block.status_block_index; 4132 &sb->sb.running_index[SM_RX_ID];
4149 4133
4150 cnic_get_bnx2x_iscsi_info(dev); 4134 cnic_get_bnx2x_iscsi_info(dev);
4151 4135
@@ -4171,7 +4155,7 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
4171 CSTORM_ISCSI_EQ_SB_NUM_OFFSET(pfid, 0), cp->status_blk_num); 4155 CSTORM_ISCSI_EQ_SB_NUM_OFFSET(pfid, 0), cp->status_blk_num);
4172 CNIC_WR8(dev, BAR_CSTRORM_INTMEM + 4156 CNIC_WR8(dev, BAR_CSTRORM_INTMEM +
4173 CSTORM_ISCSI_EQ_SB_INDEX_OFFSET(pfid, 0), 4157 CSTORM_ISCSI_EQ_SB_INDEX_OFFSET(pfid, 0),
4174 HC_INDEX_C_ISCSI_EQ_CONS); 4158 HC_INDEX_ISCSI_EQ_CONS);
4175 4159
4176 for (i = 0; i < cp->conn_buf_info.num_pages; i++) { 4160 for (i = 0; i < cp->conn_buf_info.num_pages; i++) {
4177 CNIC_WR(dev, BAR_TSTRORM_INTMEM + 4161 CNIC_WR(dev, BAR_TSTRORM_INTMEM +
@@ -4189,16 +4173,11 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
4189 USTORM_ISCSI_GLOBAL_BUF_PHYS_ADDR_OFFSET(pfid) + 4, 4173 USTORM_ISCSI_GLOBAL_BUF_PHYS_ADDR_OFFSET(pfid) + 4,
4190 (u64) cp->gbl_buf_info.pg_map_arr[0] >> 32); 4174 (u64) cp->gbl_buf_info.pg_map_arr[0] >> 32);
4191 4175
4176 CNIC_WR(dev, BAR_TSTRORM_INTMEM +
4177 TSTORM_ISCSI_TCP_LOCAL_ADV_WND_OFFSET(pfid), DEF_RCV_BUF);
4178
4192 cnic_setup_bnx2x_context(dev); 4179 cnic_setup_bnx2x_context(dev);
4193 4180
4194 eq_idx = CNIC_RD16(dev, BAR_CSTRORM_INTMEM +
4195 CSTORM_SB_HOST_STATUS_BLOCK_C_OFFSET(port, sb_id) +
4196 offsetof(struct cstorm_status_block_c,
4197 index_values[HC_INDEX_C_ISCSI_EQ_CONS]));
4198 if (eq_idx != 0) {
4199 netdev_err(dev->netdev, "EQ cons index %x != 0\n", eq_idx);
4200 return -EBUSY;
4201 }
4202 ret = cnic_init_bnx2x_irq(dev); 4181 ret = cnic_init_bnx2x_irq(dev);
4203 if (ret) 4182 if (ret)
4204 return ret; 4183 return ret;
@@ -4218,8 +4197,9 @@ static void cnic_init_rings(struct cnic_dev *dev)
4218 cnic_init_bnx2_rx_ring(dev); 4197 cnic_init_bnx2_rx_ring(dev);
4219 set_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); 4198 set_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags);
4220 } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) { 4199 } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) {
4221 struct cnic_local *cp = dev->cnic_priv;
4222 u32 cli = BNX2X_ISCSI_CL_ID(CNIC_E1HVN(cp)); 4200 u32 cli = BNX2X_ISCSI_CL_ID(CNIC_E1HVN(cp));
4201 u32 cl_qzone_id, type;
4202 struct client_init_ramrod_data *data;
4223 union l5cm_specific_data l5_data; 4203 union l5cm_specific_data l5_data;
4224 struct ustorm_eth_rx_producers rx_prods = {0}; 4204 struct ustorm_eth_rx_producers rx_prods = {0};
4225 u32 off, i; 4205 u32 off, i;
@@ -4228,23 +4208,36 @@ static void cnic_init_rings(struct cnic_dev *dev)
4228 rx_prods.cqe_prod = BNX2X_MAX_RCQ_DESC_CNT; 4208 rx_prods.cqe_prod = BNX2X_MAX_RCQ_DESC_CNT;
4229 barrier(); 4209 barrier();
4230 4210
4211 cl_qzone_id = BNX2X_CL_QZONE_ID(cp, cli);
4212
4231 off = BAR_USTRORM_INTMEM + 4213 off = BAR_USTRORM_INTMEM +
4232 USTORM_RX_PRODS_OFFSET(CNIC_PORT(cp), cli); 4214 USTORM_RX_PRODS_E1X_OFFSET(CNIC_PORT(cp), cli);
4233 4215
4234 for (i = 0; i < sizeof(struct ustorm_eth_rx_producers) / 4; i++) 4216 for (i = 0; i < sizeof(struct ustorm_eth_rx_producers) / 4; i++)
4235 CNIC_WR(dev, off + i * 4, ((u32 *) &rx_prods)[i]); 4217 CNIC_WR(dev, off + i * 4, ((u32 *) &rx_prods)[i]);
4236 4218
4237 set_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags); 4219 set_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags);
4238 4220
4239 cnic_init_bnx2x_tx_ring(dev); 4221 data = cp->l2_buf;
4240 cnic_init_bnx2x_rx_ring(dev); 4222
4223 memset(data, 0, sizeof(*data));
4224
4225 cnic_init_bnx2x_tx_ring(dev, data);
4226 cnic_init_bnx2x_rx_ring(dev, data);
4227
4228 l5_data.phy_address.lo = cp->l2_buf_map & 0xffffffff;
4229 l5_data.phy_address.hi = (u64) cp->l2_buf_map >> 32;
4230
4231 type = (ETH_CONNECTION_TYPE << SPE_HDR_CONN_TYPE_SHIFT)
4232 & SPE_HDR_CONN_TYPE;
4233 type |= ((cp->pfid << SPE_HDR_FUNCTION_ID_SHIFT) &
4234 SPE_HDR_FUNCTION_ID);
4241 4235
4242 set_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); 4236 set_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags);
4243 4237
4244 l5_data.phy_address.lo = cli;
4245 l5_data.phy_address.hi = 0;
4246 cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_ETH_CLIENT_SETUP, 4238 cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_ETH_CLIENT_SETUP,
4247 BNX2X_ISCSI_L2_CID, ETH_CONNECTION_TYPE, &l5_data); 4239 BNX2X_ISCSI_L2_CID, type, &l5_data);
4240
4248 i = 0; 4241 i = 0;
4249 while (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags) && 4242 while (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags) &&
4250 ++i < 10) 4243 ++i < 10)
@@ -4272,6 +4265,7 @@ static void cnic_shutdown_rings(struct cnic_dev *dev)
4272 u32 cli = BNX2X_ISCSI_CL_ID(CNIC_E1HVN(cp)); 4265 u32 cli = BNX2X_ISCSI_CL_ID(CNIC_E1HVN(cp));
4273 union l5cm_specific_data l5_data; 4266 union l5cm_specific_data l5_data;
4274 int i; 4267 int i;
4268 u32 type;
4275 4269
4276 cnic_ring_ctl(dev, BNX2X_ISCSI_L2_CID, cli, 0); 4270 cnic_ring_ctl(dev, BNX2X_ISCSI_L2_CID, cli, 0);
4277 4271
@@ -4292,9 +4286,12 @@ static void cnic_shutdown_rings(struct cnic_dev *dev)
4292 cnic_kwq_completion(dev, 1); 4286 cnic_kwq_completion(dev, 1);
4293 4287
4294 memset(&l5_data, 0, sizeof(l5_data)); 4288 memset(&l5_data, 0, sizeof(l5_data));
4295 cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_ETH_CFC_DEL, 4289 type = (NONE_CONNECTION_TYPE << SPE_HDR_CONN_TYPE_SHIFT)
4296 BNX2X_ISCSI_L2_CID, ETH_CONNECTION_TYPE | 4290 & SPE_HDR_CONN_TYPE;
4297 (1 << SPE_HDR_COMMON_RAMROD_SHIFT), &l5_data); 4291 type |= ((cp->pfid << SPE_HDR_FUNCTION_ID_SHIFT) &
4292 SPE_HDR_FUNCTION_ID);
4293 cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_COMMON_CFC_DEL,
4294 BNX2X_ISCSI_L2_CID, type, &l5_data);
4298 msleep(10); 4295 msleep(10);
4299 } 4296 }
4300 clear_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); 4297 clear_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags);
@@ -4392,15 +4389,9 @@ static void cnic_stop_bnx2_hw(struct cnic_dev *dev)
4392static void cnic_stop_bnx2x_hw(struct cnic_dev *dev) 4389static void cnic_stop_bnx2x_hw(struct cnic_dev *dev)
4393{ 4390{
4394 struct cnic_local *cp = dev->cnic_priv; 4391 struct cnic_local *cp = dev->cnic_priv;
4395 u8 sb_id = cp->status_blk_num;
4396 int port = CNIC_PORT(cp);
4397 4392
4398 cnic_free_irq(dev); 4393 cnic_free_irq(dev);
4399 CNIC_WR16(dev, BAR_CSTRORM_INTMEM + 4394 *cp->kcq1.hw_prod_idx_ptr = 0;
4400 CSTORM_SB_HOST_STATUS_BLOCK_C_OFFSET(port, sb_id) +
4401 offsetof(struct cstorm_status_block_c,
4402 index_values[HC_INDEX_C_ISCSI_EQ_CONS]),
4403 0);
4404 CNIC_WR(dev, BAR_CSTRORM_INTMEM + 4395 CNIC_WR(dev, BAR_CSTRORM_INTMEM +
4405 CSTORM_ISCSI_EQ_CONS_OFFSET(cp->pfid, 0), 0); 4396 CSTORM_ISCSI_EQ_CONS_OFFSET(cp->pfid, 0), 0);
4406 CNIC_WR16(dev, cp->kcq1.io_addr, 0); 4397 CNIC_WR16(dev, cp->kcq1.io_addr, 0);