diff options
author | Vlad Zolotarov <vladz@broadcom.com> | 2011-06-14 07:33:44 -0400 |
---|---|---|
committer | David S. Miller <davem@conan.davemloft.net> | 2011-06-15 10:56:37 -0400 |
commit | 619c5cb6885b936c44ae1422ef805b69c6291485 (patch) | |
tree | 4604ae08f1eb12c6ad1f65106879c2e73946ae12 /drivers/net/cnic.c | |
parent | 042181f5aa8833a8918e1a91cfaf292146ffc62c (diff) |
New 7.0 FW: bnx2x, cnic, bnx2i, bnx2fc
New FW/HSI (7.0):
- Added support to 578xx chips
- Improved HSI - much less driver's direct access to the FW internal
memory needed.
New implementation of the HSI handling layer in the bnx2x (bnx2x_sp.c):
- Introduced chip dependent objects that have chip independent interfaces
for configuration of MACs, multicast addresses, Rx mode, indirection table,
fast path queues and function initialization/cleanup.
- Objects functionality is based on the private function pointers, which
allows not only a per-chip but also PF/VF differentiation while still
preserving the same interface towards the driver.
- Objects interface is not influenced by the HSI changes which do not require
providing new parameters keeping the code outside the bnx2x_sp.c invariant
with regard to such HSI chnages.
Changes in a CNIC, bnx2fc and bnx2i modules due to the new HSI.
Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@conan.davemloft.net>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r-- | drivers/net/cnic.c | 164 |
1 files changed, 84 insertions, 80 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 07f1b13c8dce..e66c3d9ab2c6 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* cnic.c: Broadcom CNIC core network driver. | 1 | /* cnic.c: Broadcom CNIC core network driver. |
2 | * | 2 | * |
3 | * Copyright (c) 2006-2010 Broadcom Corporation | 3 | * Copyright (c) 2006-2011 Broadcom Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -836,7 +836,6 @@ static void cnic_free_resc(struct cnic_dev *dev) | |||
836 | cp->ctx_blks = 0; | 836 | cp->ctx_blks = 0; |
837 | 837 | ||
838 | cnic_free_dma(dev, &cp->gbl_buf_info); | 838 | cnic_free_dma(dev, &cp->gbl_buf_info); |
839 | cnic_free_dma(dev, &cp->conn_buf_info); | ||
840 | cnic_free_dma(dev, &cp->kwq_info); | 839 | cnic_free_dma(dev, &cp->kwq_info); |
841 | cnic_free_dma(dev, &cp->kwq_16_data_info); | 840 | cnic_free_dma(dev, &cp->kwq_16_data_info); |
842 | cnic_free_dma(dev, &cp->kcq2.dma); | 841 | cnic_free_dma(dev, &cp->kcq2.dma); |
@@ -1176,7 +1175,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) | |||
1176 | cp->iscsi_start_cid = start_cid; | 1175 | cp->iscsi_start_cid = start_cid; |
1177 | cp->fcoe_start_cid = start_cid + MAX_ISCSI_TBL_SZ; | 1176 | cp->fcoe_start_cid = start_cid + MAX_ISCSI_TBL_SZ; |
1178 | 1177 | ||
1179 | if (BNX2X_CHIP_IS_E2(cp->chip_id)) { | 1178 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { |
1180 | cp->max_cid_space += BNX2X_FCOE_NUM_CONNECTIONS; | 1179 | cp->max_cid_space += BNX2X_FCOE_NUM_CONNECTIONS; |
1181 | cp->fcoe_init_cid = ethdev->fcoe_init_cid; | 1180 | cp->fcoe_init_cid = ethdev->fcoe_init_cid; |
1182 | if (!cp->fcoe_init_cid) | 1181 | if (!cp->fcoe_init_cid) |
@@ -1232,18 +1231,12 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) | |||
1232 | if (ret) | 1231 | if (ret) |
1233 | goto error; | 1232 | goto error; |
1234 | 1233 | ||
1235 | if (BNX2X_CHIP_IS_E2(cp->chip_id)) { | 1234 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { |
1236 | ret = cnic_alloc_kcq(dev, &cp->kcq2, false); | 1235 | ret = cnic_alloc_kcq(dev, &cp->kcq2, true); |
1237 | if (ret) | 1236 | if (ret) |
1238 | goto error; | 1237 | goto error; |
1239 | } | 1238 | } |
1240 | 1239 | ||
1241 | pages = PAGE_ALIGN(BNX2X_ISCSI_NUM_CONNECTIONS * | ||
1242 | BNX2X_ISCSI_CONN_BUF_SIZE) / PAGE_SIZE; | ||
1243 | ret = cnic_alloc_dma(dev, &cp->conn_buf_info, pages, 1); | ||
1244 | if (ret) | ||
1245 | goto error; | ||
1246 | |||
1247 | pages = PAGE_ALIGN(BNX2X_ISCSI_GLB_BUF_SIZE) / PAGE_SIZE; | 1240 | pages = PAGE_ALIGN(BNX2X_ISCSI_GLB_BUF_SIZE) / PAGE_SIZE; |
1248 | ret = cnic_alloc_dma(dev, &cp->gbl_buf_info, pages, 0); | 1241 | ret = cnic_alloc_dma(dev, &cp->gbl_buf_info, pages, 0); |
1249 | if (ret) | 1242 | if (ret) |
@@ -1610,6 +1603,7 @@ static int cnic_setup_bnx2x_ctx(struct cnic_dev *dev, struct kwqe *wqes[], | |||
1610 | struct iscsi_context *ictx; | 1603 | struct iscsi_context *ictx; |
1611 | struct regpair context_addr; | 1604 | struct regpair context_addr; |
1612 | int i, j, n = 2, n_max; | 1605 | int i, j, n = 2, n_max; |
1606 | u8 port = CNIC_PORT(cp); | ||
1613 | 1607 | ||
1614 | ctx->ctx_flags = 0; | 1608 | ctx->ctx_flags = 0; |
1615 | if (!req2->num_additional_wqes) | 1609 | if (!req2->num_additional_wqes) |
@@ -1661,6 +1655,17 @@ static int cnic_setup_bnx2x_ctx(struct cnic_dev *dev, struct kwqe *wqes[], | |||
1661 | XSTORM_ISCSI_CONTEXT_FLAGS_B_IMMEDIATE_DATA; | 1655 | XSTORM_ISCSI_CONTEXT_FLAGS_B_IMMEDIATE_DATA; |
1662 | ictx->xstorm_st_context.iscsi.flags.flags |= | 1656 | ictx->xstorm_st_context.iscsi.flags.flags |= |
1663 | XSTORM_ISCSI_CONTEXT_FLAGS_B_INITIAL_R2T; | 1657 | XSTORM_ISCSI_CONTEXT_FLAGS_B_INITIAL_R2T; |
1658 | ictx->xstorm_st_context.common.ethernet.reserved_vlan_type = | ||
1659 | ETH_P_8021Q; | ||
1660 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id) && | ||
1661 | cp->port_mode == CHIP_2_PORT_MODE) { | ||
1662 | |||
1663 | port = 0; | ||
1664 | } | ||
1665 | ictx->xstorm_st_context.common.flags = | ||
1666 | 1 << XSTORM_COMMON_CONTEXT_SECTION_PHYSQ_INITIALIZED_SHIFT; | ||
1667 | ictx->xstorm_st_context.common.flags = | ||
1668 | port << XSTORM_COMMON_CONTEXT_SECTION_PBF_PORT_SHIFT; | ||
1664 | 1669 | ||
1665 | ictx->tstorm_st_context.iscsi.hdr_bytes_2_fetch = ISCSI_HEADER_SIZE; | 1670 | ictx->tstorm_st_context.iscsi.hdr_bytes_2_fetch = ISCSI_HEADER_SIZE; |
1666 | /* TSTORM requires the base address of RQ DB & not PTE */ | 1671 | /* TSTORM requires the base address of RQ DB & not PTE */ |
@@ -1876,8 +1881,11 @@ static int cnic_bnx2x_destroy_ramrod(struct cnic_dev *dev, u32 l5_cid) | |||
1876 | ret = cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_COMMON_CFC_DEL, | 1881 | ret = cnic_submit_kwqe_16(dev, RAMROD_CMD_ID_COMMON_CFC_DEL, |
1877 | hw_cid, NONE_CONNECTION_TYPE, &l5_data); | 1882 | hw_cid, NONE_CONNECTION_TYPE, &l5_data); |
1878 | 1883 | ||
1879 | if (ret == 0) | 1884 | if (ret == 0) { |
1880 | wait_event(ctx->waitq, ctx->wait_cond); | 1885 | wait_event(ctx->waitq, ctx->wait_cond); |
1886 | if (unlikely(test_bit(CTX_FL_CID_ERROR, &ctx->ctx_flags))) | ||
1887 | return -EBUSY; | ||
1888 | } | ||
1881 | 1889 | ||
1882 | return ret; | 1890 | return ret; |
1883 | } | 1891 | } |
@@ -1912,8 +1920,10 @@ static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe) | |||
1912 | skip_cfc_delete: | 1920 | skip_cfc_delete: |
1913 | cnic_free_bnx2x_conn_resc(dev, l5_cid); | 1921 | cnic_free_bnx2x_conn_resc(dev, l5_cid); |
1914 | 1922 | ||
1915 | atomic_dec(&cp->iscsi_conn); | 1923 | if (!ret) { |
1916 | clear_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags); | 1924 | atomic_dec(&cp->iscsi_conn); |
1925 | clear_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags); | ||
1926 | } | ||
1917 | 1927 | ||
1918 | destroy_reply: | 1928 | destroy_reply: |
1919 | memset(&kcqe, 0, sizeof(kcqe)); | 1929 | memset(&kcqe, 0, sizeof(kcqe)); |
@@ -1972,8 +1982,6 @@ static void cnic_init_storm_conn_bufs(struct cnic_dev *dev, | |||
1972 | tstorm_buf->ka_interval = kwqe3->ka_interval; | 1982 | tstorm_buf->ka_interval = kwqe3->ka_interval; |
1973 | tstorm_buf->ka_max_probe_count = kwqe3->ka_max_probe_count; | 1983 | tstorm_buf->ka_max_probe_count = kwqe3->ka_max_probe_count; |
1974 | } | 1984 | } |
1975 | tstorm_buf->rcv_buf = kwqe3->rcv_buf; | ||
1976 | tstorm_buf->snd_buf = kwqe3->snd_buf; | ||
1977 | tstorm_buf->max_rt_time = 0xffffffff; | 1985 | tstorm_buf->max_rt_time = 0xffffffff; |
1978 | } | 1986 | } |
1979 | 1987 | ||
@@ -2002,15 +2010,14 @@ static void cnic_init_bnx2x_mac(struct cnic_dev *dev) | |||
2002 | TSTORM_ISCSI_TCP_VARS_LSB_LOCAL_MAC_ADDR_OFFSET(pfid) + 1, | 2010 | TSTORM_ISCSI_TCP_VARS_LSB_LOCAL_MAC_ADDR_OFFSET(pfid) + 1, |
2003 | mac[4]); | 2011 | mac[4]); |
2004 | CNIC_WR8(dev, BAR_TSTRORM_INTMEM + | 2012 | CNIC_WR8(dev, BAR_TSTRORM_INTMEM + |
2005 | TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfid), mac[3]); | 2013 | TSTORM_ISCSI_TCP_VARS_MID_LOCAL_MAC_ADDR_OFFSET(pfid), mac[3]); |
2006 | CNIC_WR8(dev, BAR_TSTRORM_INTMEM + | 2014 | CNIC_WR8(dev, BAR_TSTRORM_INTMEM + |
2007 | TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfid) + 1, | 2015 | TSTORM_ISCSI_TCP_VARS_MID_LOCAL_MAC_ADDR_OFFSET(pfid) + 1, |
2008 | mac[2]); | 2016 | mac[2]); |
2009 | CNIC_WR8(dev, BAR_TSTRORM_INTMEM + | 2017 | CNIC_WR8(dev, BAR_TSTRORM_INTMEM + |
2010 | TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfid) + 2, | 2018 | TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfid), mac[1]); |
2011 | mac[1]); | ||
2012 | CNIC_WR8(dev, BAR_TSTRORM_INTMEM + | 2019 | CNIC_WR8(dev, BAR_TSTRORM_INTMEM + |
2013 | TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfid) + 3, | 2020 | TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfid) + 1, |
2014 | mac[0]); | 2021 | mac[0]); |
2015 | } | 2022 | } |
2016 | 2023 | ||
@@ -2189,7 +2196,7 @@ static int cnic_bnx2x_fcoe_stat(struct cnic_dev *dev, struct kwqe *kwqe) | |||
2189 | memset(fcoe_stat, 0, sizeof(*fcoe_stat)); | 2196 | memset(fcoe_stat, 0, sizeof(*fcoe_stat)); |
2190 | memcpy(&fcoe_stat->stat_kwqe, req, sizeof(*req)); | 2197 | memcpy(&fcoe_stat->stat_kwqe, req, sizeof(*req)); |
2191 | 2198 | ||
2192 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_STAT, cid, | 2199 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_STAT_FUNC, cid, |
2193 | FCOE_CONNECTION_TYPE, &l5_data); | 2200 | FCOE_CONNECTION_TYPE, &l5_data); |
2194 | return ret; | 2201 | return ret; |
2195 | } | 2202 | } |
@@ -2234,12 +2241,9 @@ static int cnic_bnx2x_fcoe_init1(struct cnic_dev *dev, struct kwqe *wqes[], | |||
2234 | memcpy(&fcoe_init->init_kwqe1, req1, sizeof(*req1)); | 2241 | memcpy(&fcoe_init->init_kwqe1, req1, sizeof(*req1)); |
2235 | memcpy(&fcoe_init->init_kwqe2, req2, sizeof(*req2)); | 2242 | memcpy(&fcoe_init->init_kwqe2, req2, sizeof(*req2)); |
2236 | memcpy(&fcoe_init->init_kwqe3, req3, sizeof(*req3)); | 2243 | memcpy(&fcoe_init->init_kwqe3, req3, sizeof(*req3)); |
2237 | fcoe_init->eq_addr.lo = cp->kcq2.dma.pg_map_arr[0] & 0xffffffff; | 2244 | fcoe_init->eq_pbl_base.lo = cp->kcq2.dma.pgtbl_map & 0xffffffff; |
2238 | fcoe_init->eq_addr.hi = (u64) cp->kcq2.dma.pg_map_arr[0] >> 32; | 2245 | fcoe_init->eq_pbl_base.hi = (u64) cp->kcq2.dma.pgtbl_map >> 32; |
2239 | fcoe_init->eq_next_page_addr.lo = | 2246 | fcoe_init->eq_pbl_size = cp->kcq2.dma.num_pages; |
2240 | cp->kcq2.dma.pg_map_arr[1] & 0xffffffff; | ||
2241 | fcoe_init->eq_next_page_addr.hi = | ||
2242 | (u64) cp->kcq2.dma.pg_map_arr[1] >> 32; | ||
2243 | 2247 | ||
2244 | fcoe_init->sb_num = cp->status_blk_num; | 2248 | fcoe_init->sb_num = cp->status_blk_num; |
2245 | fcoe_init->eq_prod = MAX_KCQ_IDX; | 2249 | fcoe_init->eq_prod = MAX_KCQ_IDX; |
@@ -2247,7 +2251,7 @@ static int cnic_bnx2x_fcoe_init1(struct cnic_dev *dev, struct kwqe *wqes[], | |||
2247 | cp->kcq2.sw_prod_idx = 0; | 2251 | cp->kcq2.sw_prod_idx = 0; |
2248 | 2252 | ||
2249 | cid = BNX2X_HW_CID(cp, cp->fcoe_init_cid); | 2253 | cid = BNX2X_HW_CID(cp, cp->fcoe_init_cid); |
2250 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_INIT, cid, | 2254 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_INIT_FUNC, cid, |
2251 | FCOE_CONNECTION_TYPE, &l5_data); | 2255 | FCOE_CONNECTION_TYPE, &l5_data); |
2252 | *work = 3; | 2256 | *work = 3; |
2253 | return ret; | 2257 | return ret; |
@@ -2463,7 +2467,7 @@ static int cnic_bnx2x_fcoe_fw_destroy(struct cnic_dev *dev, struct kwqe *kwqe) | |||
2463 | cid = BNX2X_HW_CID(cp, cp->fcoe_init_cid); | 2467 | cid = BNX2X_HW_CID(cp, cp->fcoe_init_cid); |
2464 | 2468 | ||
2465 | memset(&l5_data, 0, sizeof(l5_data)); | 2469 | memset(&l5_data, 0, sizeof(l5_data)); |
2466 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_DESTROY, cid, | 2470 | ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_DESTROY_FUNC, cid, |
2467 | FCOE_CONNECTION_TYPE, &l5_data); | 2471 | FCOE_CONNECTION_TYPE, &l5_data); |
2468 | return ret; | 2472 | return ret; |
2469 | } | 2473 | } |
@@ -2544,7 +2548,7 @@ static int cnic_submit_bnx2x_fcoe_kwqes(struct cnic_dev *dev, | |||
2544 | if (!test_bit(CNIC_F_CNIC_UP, &dev->flags)) | 2548 | if (!test_bit(CNIC_F_CNIC_UP, &dev->flags)) |
2545 | return -EAGAIN; /* bnx2 is down */ | 2549 | return -EAGAIN; /* bnx2 is down */ |
2546 | 2550 | ||
2547 | if (BNX2X_CHIP_NUM(cp->chip_id) == BNX2X_CHIP_NUM_57710) | 2551 | if (!BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) |
2548 | return -EINVAL; | 2552 | return -EINVAL; |
2549 | 2553 | ||
2550 | for (i = 0; i < num_wqes; ) { | 2554 | for (i = 0; i < num_wqes; ) { |
@@ -2935,7 +2939,7 @@ static void cnic_service_bnx2x_bh(unsigned long data) | |||
2935 | CNIC_WR16(dev, cp->kcq1.io_addr, | 2939 | CNIC_WR16(dev, cp->kcq1.io_addr, |
2936 | cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); | 2940 | cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); |
2937 | 2941 | ||
2938 | if (!BNX2X_CHIP_IS_E2(cp->chip_id)) { | 2942 | if (!BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { |
2939 | cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, USTORM_ID, | 2943 | cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, USTORM_ID, |
2940 | status_idx, IGU_INT_ENABLE, 1); | 2944 | status_idx, IGU_INT_ENABLE, 1); |
2941 | break; | 2945 | break; |
@@ -3054,13 +3058,21 @@ static int cnic_ctl(void *data, struct cnic_ctl_info *info) | |||
3054 | break; | 3058 | break; |
3055 | } | 3059 | } |
3056 | case CNIC_CTL_COMPLETION_CMD: { | 3060 | case CNIC_CTL_COMPLETION_CMD: { |
3057 | u32 cid = BNX2X_SW_CID(info->data.comp.cid); | 3061 | struct cnic_ctl_completion *comp = &info->data.comp; |
3062 | u32 cid = BNX2X_SW_CID(comp->cid); | ||
3058 | u32 l5_cid; | 3063 | u32 l5_cid; |
3059 | struct cnic_local *cp = dev->cnic_priv; | 3064 | struct cnic_local *cp = dev->cnic_priv; |
3060 | 3065 | ||
3061 | if (cnic_get_l5_cid(cp, cid, &l5_cid) == 0) { | 3066 | if (cnic_get_l5_cid(cp, cid, &l5_cid) == 0) { |
3062 | struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; | 3067 | struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; |
3063 | 3068 | ||
3069 | if (unlikely(comp->error)) { | ||
3070 | set_bit(CTX_FL_CID_ERROR, &ctx->ctx_flags); | ||
3071 | netdev_err(dev->netdev, | ||
3072 | "CID %x CFC delete comp error %x\n", | ||
3073 | cid, comp->error); | ||
3074 | } | ||
3075 | |||
3064 | ctx->wait_cond = 1; | 3076 | ctx->wait_cond = 1; |
3065 | wake_up(&ctx->waitq); | 3077 | wake_up(&ctx->waitq); |
3066 | } | 3078 | } |
@@ -3935,10 +3947,17 @@ static void cnic_cm_stop_bnx2x_hw(struct cnic_dev *dev) | |||
3935 | 3947 | ||
3936 | for (i = 0; i < cp->max_cid_space; i++) { | 3948 | for (i = 0; i < cp->max_cid_space; i++) { |
3937 | struct cnic_context *ctx = &cp->ctx_tbl[i]; | 3949 | struct cnic_context *ctx = &cp->ctx_tbl[i]; |
3950 | int j; | ||
3938 | 3951 | ||
3939 | while (test_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags)) | 3952 | while (test_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags)) |
3940 | msleep(10); | 3953 | msleep(10); |
3941 | 3954 | ||
3955 | for (j = 0; j < 5; j++) { | ||
3956 | if (!test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags)) | ||
3957 | break; | ||
3958 | msleep(20); | ||
3959 | } | ||
3960 | |||
3942 | if (test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags)) | 3961 | if (test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags)) |
3943 | netdev_warn(dev->netdev, "CID %x not deleted\n", | 3962 | netdev_warn(dev->netdev, "CID %x not deleted\n", |
3944 | ctx->cid); | 3963 | ctx->cid); |
@@ -4005,6 +4024,7 @@ static void cnic_delete_task(struct work_struct *work) | |||
4005 | 4024 | ||
4006 | for (i = 0; i < cp->max_cid_space; i++) { | 4025 | for (i = 0; i < cp->max_cid_space; i++) { |
4007 | struct cnic_context *ctx = &cp->ctx_tbl[i]; | 4026 | struct cnic_context *ctx = &cp->ctx_tbl[i]; |
4027 | int err; | ||
4008 | 4028 | ||
4009 | if (!test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags) || | 4029 | if (!test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags) || |
4010 | !test_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags)) | 4030 | !test_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags)) |
@@ -4018,13 +4038,15 @@ static void cnic_delete_task(struct work_struct *work) | |||
4018 | if (!test_and_clear_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags)) | 4038 | if (!test_and_clear_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags)) |
4019 | continue; | 4039 | continue; |
4020 | 4040 | ||
4021 | cnic_bnx2x_destroy_ramrod(dev, i); | 4041 | err = cnic_bnx2x_destroy_ramrod(dev, i); |
4022 | 4042 | ||
4023 | cnic_free_bnx2x_conn_resc(dev, i); | 4043 | cnic_free_bnx2x_conn_resc(dev, i); |
4024 | if (ctx->ulp_proto_id == CNIC_ULP_ISCSI) | 4044 | if (!err) { |
4025 | atomic_dec(&cp->iscsi_conn); | 4045 | if (ctx->ulp_proto_id == CNIC_ULP_ISCSI) |
4046 | atomic_dec(&cp->iscsi_conn); | ||
4026 | 4047 | ||
4027 | clear_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags); | 4048 | clear_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags); |
4049 | } | ||
4028 | } | 4050 | } |
4029 | 4051 | ||
4030 | if (need_resched) | 4052 | if (need_resched) |
@@ -4620,7 +4642,7 @@ static void cnic_enable_bnx2x_int(struct cnic_dev *dev) | |||
4620 | CSTORM_STATUS_BLOCK_DATA_OFFSET(sb_id) + | 4642 | CSTORM_STATUS_BLOCK_DATA_OFFSET(sb_id) + |
4621 | offsetof(struct hc_status_block_data_e1x, index_data) + | 4643 | offsetof(struct hc_status_block_data_e1x, index_data) + |
4622 | sizeof(struct hc_index_data)*HC_INDEX_ISCSI_EQ_CONS + | 4644 | sizeof(struct hc_index_data)*HC_INDEX_ISCSI_EQ_CONS + |
4623 | offsetof(struct hc_index_data, timeout), 64 / 12); | 4645 | offsetof(struct hc_index_data, timeout), 64 / 4); |
4624 | cnic_storm_memset_hc_disable(dev, sb_id, HC_INDEX_ISCSI_EQ_CONS, 0); | 4646 | cnic_storm_memset_hc_disable(dev, sb_id, HC_INDEX_ISCSI_EQ_CONS, 0); |
4625 | } | 4647 | } |
4626 | 4648 | ||
@@ -4636,7 +4658,6 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev, | |||
4636 | union eth_tx_bd_types *txbd = (union eth_tx_bd_types *) udev->l2_ring; | 4658 | union eth_tx_bd_types *txbd = (union eth_tx_bd_types *) udev->l2_ring; |
4637 | dma_addr_t buf_map, ring_map = udev->l2_ring_map; | 4659 | dma_addr_t buf_map, ring_map = udev->l2_ring_map; |
4638 | struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; | 4660 | struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; |
4639 | int port = CNIC_PORT(cp); | ||
4640 | int i; | 4661 | int i; |
4641 | u32 cli = cp->ethdev->iscsi_l2_client_id; | 4662 | u32 cli = cp->ethdev->iscsi_l2_client_id; |
4642 | u32 val; | 4663 | u32 val; |
@@ -4677,10 +4698,9 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev, | |||
4677 | 4698 | ||
4678 | /* reset xstorm per client statistics */ | 4699 | /* reset xstorm per client statistics */ |
4679 | if (cli < MAX_STAT_COUNTER_ID) { | 4700 | if (cli < MAX_STAT_COUNTER_ID) { |
4680 | val = BAR_XSTRORM_INTMEM + | 4701 | data->general.statistics_zero_flg = 1; |
4681 | XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); | 4702 | data->general.statistics_en_flg = 1; |
4682 | for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++) | 4703 | data->general.statistics_counter_id = cli; |
4683 | CNIC_WR(dev, val + i * 4, 0); | ||
4684 | } | 4704 | } |
4685 | 4705 | ||
4686 | cp->tx_cons_ptr = | 4706 | cp->tx_cons_ptr = |
@@ -4698,7 +4718,6 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev, | |||
4698 | (udev->l2_ring + (2 * BCM_PAGE_SIZE)); | 4718 | (udev->l2_ring + (2 * BCM_PAGE_SIZE)); |
4699 | struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; | 4719 | struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; |
4700 | int i; | 4720 | int i; |
4701 | int port = CNIC_PORT(cp); | ||
4702 | u32 cli = cp->ethdev->iscsi_l2_client_id; | 4721 | u32 cli = cp->ethdev->iscsi_l2_client_id; |
4703 | int cl_qzone_id = BNX2X_CL_QZONE_ID(cp, cli); | 4722 | int cl_qzone_id = BNX2X_CL_QZONE_ID(cp, cli); |
4704 | u32 val; | 4723 | u32 val; |
@@ -4706,10 +4725,10 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev, | |||
4706 | 4725 | ||
4707 | /* General data */ | 4726 | /* General data */ |
4708 | data->general.client_id = cli; | 4727 | data->general.client_id = cli; |
4709 | data->general.statistics_en_flg = 1; | ||
4710 | data->general.statistics_counter_id = cli; | ||
4711 | data->general.activate_flg = 1; | 4728 | data->general.activate_flg = 1; |
4712 | data->general.sp_client_id = cli; | 4729 | data->general.sp_client_id = cli; |
4730 | data->general.mtu = cpu_to_le16(cp->l2_single_buf_size - 14); | ||
4731 | data->general.func_id = cp->pfid; | ||
4713 | 4732 | ||
4714 | for (i = 0; i < BNX2X_MAX_RX_DESC_CNT; i++, rxbd++) { | 4733 | for (i = 0; i < BNX2X_MAX_RX_DESC_CNT; i++, rxbd++) { |
4715 | dma_addr_t buf_map; | 4734 | dma_addr_t buf_map; |
@@ -4743,23 +4762,12 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev, | |||
4743 | data->rx.status_block_id = BNX2X_DEF_SB_ID; | 4762 | data->rx.status_block_id = BNX2X_DEF_SB_ID; |
4744 | 4763 | ||
4745 | data->rx.cache_line_alignment_log_size = L1_CACHE_SHIFT; | 4764 | data->rx.cache_line_alignment_log_size = L1_CACHE_SHIFT; |
4746 | data->rx.bd_buff_size = cpu_to_le16(cp->l2_single_buf_size); | ||
4747 | 4765 | ||
4748 | data->rx.mtu = cpu_to_le16(cp->l2_single_buf_size - 14); | 4766 | data->rx.max_bytes_on_bd = cpu_to_le16(cp->l2_single_buf_size); |
4749 | data->rx.outer_vlan_removal_enable_flg = 1; | 4767 | data->rx.outer_vlan_removal_enable_flg = 1; |
4750 | 4768 | data->rx.silent_vlan_removal_flg = 1; | |
4751 | /* reset tstorm and ustorm per client statistics */ | 4769 | data->rx.silent_vlan_value = 0; |
4752 | if (cli < MAX_STAT_COUNTER_ID) { | 4770 | data->rx.silent_vlan_mask = 0xffff; |
4753 | val = BAR_TSTRORM_INTMEM + | ||
4754 | TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); | ||
4755 | for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++) | ||
4756 | CNIC_WR(dev, val + i * 4, 0); | ||
4757 | |||
4758 | val = BAR_USTRORM_INTMEM + | ||
4759 | USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); | ||
4760 | for (i = 0; i < sizeof(struct ustorm_per_client_stats) / 4; i++) | ||
4761 | CNIC_WR(dev, val + i * 4, 0); | ||
4762 | } | ||
4763 | 4771 | ||
4764 | cp->rx_cons_ptr = | 4772 | cp->rx_cons_ptr = |
4765 | &sb->sp_sb.index_values[HC_SP_INDEX_ETH_ISCSI_RX_CQ_CONS]; | 4773 | &sb->sp_sb.index_values[HC_SP_INDEX_ETH_ISCSI_RX_CQ_CONS]; |
@@ -4775,7 +4783,7 @@ static void cnic_init_bnx2x_kcq(struct cnic_dev *dev) | |||
4775 | CSTORM_ISCSI_EQ_PROD_OFFSET(pfid, 0); | 4783 | CSTORM_ISCSI_EQ_PROD_OFFSET(pfid, 0); |
4776 | cp->kcq1.sw_prod_idx = 0; | 4784 | cp->kcq1.sw_prod_idx = 0; |
4777 | 4785 | ||
4778 | if (BNX2X_CHIP_IS_E2(cp->chip_id)) { | 4786 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { |
4779 | struct host_hc_status_block_e2 *sb = cp->status_blk.gen; | 4787 | struct host_hc_status_block_e2 *sb = cp->status_blk.gen; |
4780 | 4788 | ||
4781 | cp->kcq1.hw_prod_idx_ptr = | 4789 | cp->kcq1.hw_prod_idx_ptr = |
@@ -4791,7 +4799,7 @@ static void cnic_init_bnx2x_kcq(struct cnic_dev *dev) | |||
4791 | &sb->sb.running_index[SM_RX_ID]; | 4799 | &sb->sb.running_index[SM_RX_ID]; |
4792 | } | 4800 | } |
4793 | 4801 | ||
4794 | if (BNX2X_CHIP_IS_E2(cp->chip_id)) { | 4802 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { |
4795 | struct host_hc_status_block_e2 *sb = cp->status_blk.gen; | 4803 | struct host_hc_status_block_e2 *sb = cp->status_blk.gen; |
4796 | 4804 | ||
4797 | cp->kcq2.io_addr = BAR_USTRORM_INTMEM + | 4805 | cp->kcq2.io_addr = BAR_USTRORM_INTMEM + |
@@ -4808,10 +4816,12 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev) | |||
4808 | { | 4816 | { |
4809 | struct cnic_local *cp = dev->cnic_priv; | 4817 | struct cnic_local *cp = dev->cnic_priv; |
4810 | struct cnic_eth_dev *ethdev = cp->ethdev; | 4818 | struct cnic_eth_dev *ethdev = cp->ethdev; |
4811 | int func = CNIC_FUNC(cp), ret, i; | 4819 | int func = CNIC_FUNC(cp), ret; |
4812 | u32 pfid; | 4820 | u32 pfid; |
4813 | 4821 | ||
4814 | if (BNX2X_CHIP_IS_E2(cp->chip_id)) { | 4822 | cp->port_mode = CHIP_PORT_MODE_NONE; |
4823 | |||
4824 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { | ||
4815 | u32 val = CNIC_RD(dev, MISC_REG_PORT4MODE_EN_OVWR); | 4825 | u32 val = CNIC_RD(dev, MISC_REG_PORT4MODE_EN_OVWR); |
4816 | 4826 | ||
4817 | if (!(val & 1)) | 4827 | if (!(val & 1)) |
@@ -4819,10 +4829,13 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev) | |||
4819 | else | 4829 | else |
4820 | val = (val >> 1) & 1; | 4830 | val = (val >> 1) & 1; |
4821 | 4831 | ||
4822 | if (val) | 4832 | if (val) { |
4833 | cp->port_mode = CHIP_4_PORT_MODE; | ||
4823 | cp->pfid = func >> 1; | 4834 | cp->pfid = func >> 1; |
4824 | else | 4835 | } else { |
4836 | cp->port_mode = CHIP_4_PORT_MODE; | ||
4825 | cp->pfid = func & 0x6; | 4837 | cp->pfid = func & 0x6; |
4838 | } | ||
4826 | } else { | 4839 | } else { |
4827 | cp->pfid = func; | 4840 | cp->pfid = func; |
4828 | } | 4841 | } |
@@ -4834,7 +4847,7 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev) | |||
4834 | if (ret) | 4847 | if (ret) |
4835 | return -ENOMEM; | 4848 | return -ENOMEM; |
4836 | 4849 | ||
4837 | if (BNX2X_CHIP_IS_E2(cp->chip_id)) { | 4850 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) { |
4838 | ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl, | 4851 | ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl, |
4839 | BNX2X_FCOE_NUM_CONNECTIONS, | 4852 | BNX2X_FCOE_NUM_CONNECTIONS, |
4840 | cp->fcoe_start_cid, 0); | 4853 | cp->fcoe_start_cid, 0); |
@@ -4871,15 +4884,6 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev) | |||
4871 | CSTORM_ISCSI_EQ_SB_INDEX_OFFSET(pfid, 0), | 4884 | CSTORM_ISCSI_EQ_SB_INDEX_OFFSET(pfid, 0), |
4872 | HC_INDEX_ISCSI_EQ_CONS); | 4885 | HC_INDEX_ISCSI_EQ_CONS); |
4873 | 4886 | ||
4874 | for (i = 0; i < cp->conn_buf_info.num_pages; i++) { | ||
4875 | CNIC_WR(dev, BAR_TSTRORM_INTMEM + | ||
4876 | TSTORM_ISCSI_CONN_BUF_PBL_OFFSET(pfid, i), | ||
4877 | cp->conn_buf_info.pgtbl[2 * i]); | ||
4878 | CNIC_WR(dev, BAR_TSTRORM_INTMEM + | ||
4879 | TSTORM_ISCSI_CONN_BUF_PBL_OFFSET(pfid, i) + 4, | ||
4880 | cp->conn_buf_info.pgtbl[(2 * i) + 1]); | ||
4881 | } | ||
4882 | |||
4883 | CNIC_WR(dev, BAR_USTRORM_INTMEM + | 4887 | CNIC_WR(dev, BAR_USTRORM_INTMEM + |
4884 | USTORM_ISCSI_GLOBAL_BUF_PHYS_ADDR_OFFSET(pfid), | 4888 | USTORM_ISCSI_GLOBAL_BUF_PHYS_ADDR_OFFSET(pfid), |
4885 | cp->gbl_buf_info.pg_map_arr[0] & 0xffffffff); | 4889 | cp->gbl_buf_info.pg_map_arr[0] & 0xffffffff); |
@@ -4927,7 +4931,7 @@ static void cnic_init_rings(struct cnic_dev *dev) | |||
4927 | cl_qzone_id = BNX2X_CL_QZONE_ID(cp, cli); | 4931 | cl_qzone_id = BNX2X_CL_QZONE_ID(cp, cli); |
4928 | 4932 | ||
4929 | off = BAR_USTRORM_INTMEM + | 4933 | off = BAR_USTRORM_INTMEM + |
4930 | (BNX2X_CHIP_IS_E2(cp->chip_id) ? | 4934 | (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id) ? |
4931 | USTORM_RX_PRODS_E2_OFFSET(cl_qzone_id) : | 4935 | USTORM_RX_PRODS_E2_OFFSET(cl_qzone_id) : |
4932 | USTORM_RX_PRODS_E1X_OFFSET(CNIC_PORT(cp), cli)); | 4936 | USTORM_RX_PRODS_E1X_OFFSET(CNIC_PORT(cp), cli)); |
4933 | 4937 | ||
@@ -5277,7 +5281,7 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev) | |||
5277 | 5281 | ||
5278 | if (!(ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI)) | 5282 | if (!(ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI)) |
5279 | cdev->max_iscsi_conn = ethdev->max_iscsi_conn; | 5283 | cdev->max_iscsi_conn = ethdev->max_iscsi_conn; |
5280 | if (BNX2X_CHIP_IS_E2(cp->chip_id) && | 5284 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id) && |
5281 | !(ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE)) | 5285 | !(ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE)) |
5282 | cdev->max_fcoe_conn = ethdev->max_fcoe_conn; | 5286 | cdev->max_fcoe_conn = ethdev->max_fcoe_conn; |
5283 | 5287 | ||
@@ -5293,7 +5297,7 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev) | |||
5293 | cp->stop_cm = cnic_cm_stop_bnx2x_hw; | 5297 | cp->stop_cm = cnic_cm_stop_bnx2x_hw; |
5294 | cp->enable_int = cnic_enable_bnx2x_int; | 5298 | cp->enable_int = cnic_enable_bnx2x_int; |
5295 | cp->disable_int_sync = cnic_disable_bnx2x_int_sync; | 5299 | cp->disable_int_sync = cnic_disable_bnx2x_int_sync; |
5296 | if (BNX2X_CHIP_IS_E2(cp->chip_id)) | 5300 | if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) |
5297 | cp->ack_int = cnic_ack_bnx2x_e2_msix; | 5301 | cp->ack_int = cnic_ack_bnx2x_e2_msix; |
5298 | else | 5302 | else |
5299 | cp->ack_int = cnic_ack_bnx2x_msix; | 5303 | cp->ack_int = cnic_ack_bnx2x_msix; |