Lines Matching full:cp
191 struct cnic_local *cp = dev->cnic_priv; in cnic_ctx_wr() local
192 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_ctx_wr()
206 struct cnic_local *cp = dev->cnic_priv; in cnic_ctx_tbl_wr() local
207 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_ctx_tbl_wr()
220 struct cnic_local *cp = dev->cnic_priv; in cnic_ring_ctl() local
221 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_ring_ctl()
238 struct cnic_local *cp = dev->cnic_priv; in cnic_reg_wr_ind() local
239 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_reg_wr_ind()
252 struct cnic_local *cp = dev->cnic_priv; in cnic_reg_rd_ind() local
253 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_reg_rd_ind()
266 struct cnic_local *cp = dev->cnic_priv; in cnic_ulp_ctl() local
267 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_ulp_ctl()
293 struct cnic_local *cp = dev->cnic_priv; in cnic_spq_completion() local
294 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_spq_completion()
303 static int cnic_get_l5_cid(struct cnic_local *cp, u32 cid, u32 *l5_cid) in cnic_get_l5_cid() argument
307 if (!cp->ctx_tbl) in cnic_get_l5_cid()
310 for (i = 0; i < cp->max_cid_space; i++) { in cnic_get_l5_cid()
311 if (cp->ctx_tbl[i].cid == cid) { in cnic_get_l5_cid()
319 static int cnic_send_nlmsg(struct cnic_local *cp, u32 type, in cnic_send_nlmsg() argument
327 struct cnic_uio_dev *udev = cp->udev; in cnic_send_nlmsg()
356 ulp_ops = rcu_dereference(cp->ulp_ops[CNIC_ULP_ISCSI]); in cnic_send_nlmsg()
359 cp->ulp_handle[CNIC_ULP_ISCSI], in cnic_send_nlmsg()
380 struct cnic_local *cp; in cnic_iscsi_nl_msg_recv() local
389 cp = dev->cnic_priv; in cnic_iscsi_nl_msg_recv()
394 if (!rcu_access_pointer(cp->ulp_ops[CNIC_ULP_L4])) { in cnic_iscsi_nl_msg_recv()
398 csk = &cp->csk_tbl[l5_cid]; in cnic_iscsi_nl_msg_recv()
418 cnic_cm_upcall(cp, csk, in cnic_iscsi_nl_msg_recv()
492 struct cnic_local *cp = dev->cnic_priv; in cnic_register_driver() local
494 clear_bit(ULP_F_INIT, &cp->ulp_flags[ulp_type]); in cnic_register_driver()
505 struct cnic_local *cp = dev->cnic_priv; in cnic_register_driver() local
507 if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[ulp_type])) in cnic_register_driver()
534 struct cnic_local *cp = dev->cnic_priv; in cnic_unregister_driver() local
536 if (rcu_access_pointer(cp->ulp_ops[ulp_type])) { in cnic_unregister_driver()
570 struct cnic_local *cp = dev->cnic_priv; in cnic_register_device() local
584 if (rcu_access_pointer(cp->ulp_ops[ulp_type])) { in cnic_register_device()
591 clear_bit(ULP_F_START, &cp->ulp_flags[ulp_type]); in cnic_register_device()
592 cp->ulp_handle[ulp_type] = ulp_ctx; in cnic_register_device()
594 rcu_assign_pointer(cp->ulp_ops[ulp_type], ulp_ops); in cnic_register_device()
598 if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[ulp_type])) in cnic_register_device()
599 ulp_ops->cnic_start(cp->ulp_handle[ulp_type]); in cnic_register_device()
612 struct cnic_local *cp = dev->cnic_priv; in cnic_unregister_device() local
621 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); in cnic_unregister_device()
624 if (rcu_access_pointer(cp->ulp_ops[ulp_type])) { in cnic_unregister_device()
625 RCU_INIT_POINTER(cp->ulp_ops[ulp_type], NULL); in cnic_unregister_device()
640 while (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]) && in cnic_unregister_device()
645 if (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type])) in cnic_unregister_device()
648 if (test_bit(ULP_F_INIT, &cp->ulp_flags[ulp_type])) in cnic_unregister_device()
789 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_dma() local
817 cp->setup_pgtbl(dev, dma); in cnic_alloc_dma()
828 struct cnic_local *cp = dev->cnic_priv; in cnic_free_context() local
831 for (i = 0; i < cp->ctx_blks; i++) { in cnic_free_context()
832 if (cp->ctx_arr[i].ctx) { in cnic_free_context()
833 dma_free_coherent(&dev->pcidev->dev, cp->ctx_blk_size, in cnic_free_context()
834 cp->ctx_arr[i].ctx, in cnic_free_context()
835 cp->ctx_arr[i].mapping); in cnic_free_context()
836 cp->ctx_arr[i].ctx = NULL; in cnic_free_context()
880 struct cnic_local *cp = dev->cnic_priv; in cnic_free_resc() local
881 struct cnic_uio_dev *udev = cp->udev; in cnic_free_resc()
885 cp->udev = NULL; in cnic_free_resc()
891 kfree(cp->ctx_arr); in cnic_free_resc()
892 cp->ctx_arr = NULL; in cnic_free_resc()
893 cp->ctx_blks = 0; in cnic_free_resc()
895 cnic_free_dma(dev, &cp->gbl_buf_info); in cnic_free_resc()
896 cnic_free_dma(dev, &cp->kwq_info); in cnic_free_resc()
897 cnic_free_dma(dev, &cp->kwq_16_data_info); in cnic_free_resc()
898 cnic_free_dma(dev, &cp->kcq2.dma); in cnic_free_resc()
899 cnic_free_dma(dev, &cp->kcq1.dma); in cnic_free_resc()
900 kfree(cp->iscsi_tbl); in cnic_free_resc()
901 cp->iscsi_tbl = NULL; in cnic_free_resc()
902 kfree(cp->ctx_tbl); in cnic_free_resc()
903 cp->ctx_tbl = NULL; in cnic_free_resc()
905 cnic_free_id_tbl(&cp->fcoe_cid_tbl); in cnic_free_resc()
906 cnic_free_id_tbl(&cp->cid_tbl); in cnic_free_resc()
911 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_context() local
913 if (BNX2_CHIP(cp) == BNX2_CHIP_5709) { in cnic_alloc_context()
916 cp->ctx_blk_size = CNIC_PAGE_SIZE; in cnic_alloc_context()
917 cp->cids_per_blk = CNIC_PAGE_SIZE / 128; in cnic_alloc_context()
918 arr_size = BNX2_MAX_CID / cp->cids_per_blk * in cnic_alloc_context()
920 cp->ctx_arr = kzalloc(arr_size, GFP_KERNEL); in cnic_alloc_context()
921 if (cp->ctx_arr == NULL) in cnic_alloc_context()
936 for (j = lo; j < hi; j += cp->cids_per_blk, k++) in cnic_alloc_context()
937 cp->ctx_arr[k].cid = j; in cnic_alloc_context()
940 cp->ctx_blks = k; in cnic_alloc_context()
941 if (cp->ctx_blks >= (BNX2_MAX_CID / cp->cids_per_blk)) { in cnic_alloc_context()
942 cp->ctx_blks = 0; in cnic_alloc_context()
946 for (i = 0; i < cp->ctx_blks; i++) { in cnic_alloc_context()
947 cp->ctx_arr[i].ctx = in cnic_alloc_context()
950 &cp->ctx_arr[i].mapping, in cnic_alloc_context()
952 if (cp->ctx_arr[i].ctx == NULL) in cnic_alloc_context()
1024 struct cnic_local *cp = udev->dev->cnic_priv; in __cnic_alloc_uio_rings() local
1035 udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size; in __cnic_alloc_uio_rings()
1050 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_uio_rings() local
1060 cp->udev = udev; in cnic_alloc_uio_rings()
1081 cp->udev = udev; in cnic_alloc_uio_rings()
1092 struct cnic_local *cp = dev->cnic_priv; in cnic_init_uio() local
1093 struct cnic_uio_dev *udev = cp->udev; in cnic_init_uio()
1109 uinfo->mem[1].addr = (unsigned long) cp->status_blk.gen & in cnic_init_uio()
1111 uinfo->mem[1].dma_addr = cp->status_blk_map; in cnic_init_uio()
1112 if (cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) in cnic_init_uio()
1121 uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk & in cnic_init_uio()
1123 uinfo->mem[1].dma_addr = cp->status_blk_map; in cnic_init_uio()
1124 uinfo->mem[1].size = PAGE_ALIGN(sizeof(*cp->bnx2x_def_status_blk)); in cnic_init_uio()
1165 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_bnx2_resc() local
1168 ret = cnic_alloc_dma(dev, &cp->kwq_info, KWQ_PAGE_CNT, 1); in cnic_alloc_bnx2_resc()
1171 cp->kwq = (struct kwqe **) cp->kwq_info.pg_arr; in cnic_alloc_bnx2_resc()
1173 ret = cnic_alloc_kcq(dev, &cp->kcq1, true); in cnic_alloc_bnx2_resc()
1198 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_bnx2x_context() local
1200 int ctx_blk_size = cp->ethdev->ctx_blk_size; in cnic_alloc_bnx2x_context()
1203 total_mem = BNX2X_CONTEXT_MEM_SIZE * cp->max_cid_space; in cnic_alloc_bnx2x_context()
1208 if (blks > cp->ethdev->ctx_tbl_len) in cnic_alloc_bnx2x_context()
1211 cp->ctx_arr = kcalloc(blks, sizeof(struct cnic_ctx), GFP_KERNEL); in cnic_alloc_bnx2x_context()
1212 if (cp->ctx_arr == NULL) in cnic_alloc_bnx2x_context()
1215 cp->ctx_blks = blks; in cnic_alloc_bnx2x_context()
1216 cp->ctx_blk_size = ctx_blk_size; in cnic_alloc_bnx2x_context()
1218 cp->ctx_align = 0; in cnic_alloc_bnx2x_context()
1220 cp->ctx_align = ctx_blk_size; in cnic_alloc_bnx2x_context()
1222 cp->cids_per_blk = ctx_blk_size / BNX2X_CONTEXT_MEM_SIZE; in cnic_alloc_bnx2x_context()
1225 cp->ctx_arr[i].ctx = in cnic_alloc_bnx2x_context()
1226 dma_alloc_coherent(&dev->pcidev->dev, cp->ctx_blk_size, in cnic_alloc_bnx2x_context()
1227 &cp->ctx_arr[i].mapping, in cnic_alloc_bnx2x_context()
1229 if (cp->ctx_arr[i].ctx == NULL) in cnic_alloc_bnx2x_context()
1232 if (cp->ctx_align && cp->ctx_blk_size == ctx_blk_size) { in cnic_alloc_bnx2x_context()
1233 if (cp->ctx_arr[i].mapping & (cp->ctx_align - 1)) { in cnic_alloc_bnx2x_context()
1235 cp->ctx_blk_size += cp->ctx_align; in cnic_alloc_bnx2x_context()
1246 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_bnx2x_resc() local
1248 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_alloc_bnx2x_resc()
1251 struct cnic_dma *kwq_16_dma = &cp->kwq_16_data_info; in cnic_alloc_bnx2x_resc()
1253 cp->max_cid_space = MAX_ISCSI_TBL_SZ; in cnic_alloc_bnx2x_resc()
1254 cp->iscsi_start_cid = start_cid; in cnic_alloc_bnx2x_resc()
1255 cp->fcoe_start_cid = start_cid + MAX_ISCSI_TBL_SZ; in cnic_alloc_bnx2x_resc()
1258 cp->max_cid_space += dev->max_fcoe_conn; in cnic_alloc_bnx2x_resc()
1259 cp->fcoe_init_cid = ethdev->fcoe_init_cid; in cnic_alloc_bnx2x_resc()
1260 if (!cp->fcoe_init_cid) in cnic_alloc_bnx2x_resc()
1261 cp->fcoe_init_cid = 0x10; in cnic_alloc_bnx2x_resc()
1264 cp->iscsi_tbl = kcalloc(MAX_ISCSI_TBL_SZ, sizeof(struct cnic_iscsi), in cnic_alloc_bnx2x_resc()
1266 if (!cp->iscsi_tbl) in cnic_alloc_bnx2x_resc()
1269 cp->ctx_tbl = kcalloc(cp->max_cid_space, sizeof(struct cnic_context), in cnic_alloc_bnx2x_resc()
1271 if (!cp->ctx_tbl) in cnic_alloc_bnx2x_resc()
1275 cp->ctx_tbl[i].proto.iscsi = &cp->iscsi_tbl[i]; in cnic_alloc_bnx2x_resc()
1276 cp->ctx_tbl[i].ulp_proto_id = CNIC_ULP_ISCSI; in cnic_alloc_bnx2x_resc()
1279 for (i = MAX_ISCSI_TBL_SZ; i < cp->max_cid_space; i++) in cnic_alloc_bnx2x_resc()
1280 cp->ctx_tbl[i].ulp_proto_id = CNIC_ULP_FCOE; in cnic_alloc_bnx2x_resc()
1282 pages = CNIC_PAGE_ALIGN(cp->max_cid_space * CNIC_KWQ16_DATA_SIZE) / in cnic_alloc_bnx2x_resc()
1290 for (i = 0, j = 0; i < cp->max_cid_space; i++) { in cnic_alloc_bnx2x_resc()
1293 cp->ctx_tbl[i].kwqe_data = kwq_16_dma->pg_arr[j] + off; in cnic_alloc_bnx2x_resc()
1294 cp->ctx_tbl[i].kwqe_data_mapping = kwq_16_dma->pg_map_arr[j] + in cnic_alloc_bnx2x_resc()
1301 ret = cnic_alloc_kcq(dev, &cp->kcq1, false); in cnic_alloc_bnx2x_resc()
1306 ret = cnic_alloc_kcq(dev, &cp->kcq2, true); in cnic_alloc_bnx2x_resc()
1312 ret = cnic_alloc_dma(dev, &cp->gbl_buf_info, pages, 0); in cnic_alloc_bnx2x_resc()
1320 if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI) in cnic_alloc_bnx2x_resc()
1323 cp->bnx2x_def_status_blk = cp->ethdev->irq_arr[1].status_blk; in cnic_alloc_bnx2x_resc()
1324 cp->status_blk_map = cp->ethdev->irq_arr[1].status_blk_map; in cnic_alloc_bnx2x_resc()
1326 cp->l2_rx_ring_size = 15; in cnic_alloc_bnx2x_resc()
1343 static inline u32 cnic_kwq_avail(struct cnic_local *cp) in cnic_kwq_avail() argument
1345 return cp->max_kwq_idx - in cnic_kwq_avail()
1346 ((cp->kwq_prod_idx - cp->kwq_con_idx) & cp->max_kwq_idx); in cnic_kwq_avail()
1352 struct cnic_local *cp = dev->cnic_priv; in cnic_submit_bnx2_kwqes() local
1359 spin_lock_bh(&cp->cnic_ulp_lock); in cnic_submit_bnx2_kwqes()
1360 if (num_wqes > cnic_kwq_avail(cp) && in cnic_submit_bnx2_kwqes()
1361 !test_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags)) { in cnic_submit_bnx2_kwqes()
1362 spin_unlock_bh(&cp->cnic_ulp_lock); in cnic_submit_bnx2_kwqes()
1366 clear_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags); in cnic_submit_bnx2_kwqes()
1368 prod = cp->kwq_prod_idx; in cnic_submit_bnx2_kwqes()
1371 prod_qe = &cp->kwq[KWQ_PG(sw_prod)][KWQ_IDX(sw_prod)]; in cnic_submit_bnx2_kwqes()
1376 cp->kwq_prod_idx = prod; in cnic_submit_bnx2_kwqes()
1378 CNIC_WR16(dev, cp->kwq_io_addr, cp->kwq_prod_idx); in cnic_submit_bnx2_kwqes()
1380 spin_unlock_bh(&cp->cnic_ulp_lock); in cnic_submit_bnx2_kwqes()
1384 static void *cnic_get_kwqe_16_data(struct cnic_local *cp, u32 l5_cid, in cnic_get_kwqe_16_data() argument
1387 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_get_kwqe_16_data()
1399 struct cnic_local *cp = dev->cnic_priv; in cnic_submit_kwqe_16() local
1421 spin_lock_bh(&cp->cnic_ulp_lock); in cnic_submit_kwqe_16()
1422 ret = cp->ethdev->drv_submit_kwqes_16(dev->netdev, kwq, 1); in cnic_submit_kwqe_16()
1423 spin_unlock_bh(&cp->cnic_ulp_lock); in cnic_submit_kwqe_16()
1434 struct cnic_local *cp = dev->cnic_priv; in cnic_reply_bnx2x_kcqes() local
1438 ulp_ops = rcu_dereference(cp->ulp_ops[ulp_type]); in cnic_reply_bnx2x_kcqes()
1440 ulp_ops->indicate_kcqes(cp->ulp_handle[ulp_type], in cnic_reply_bnx2x_kcqes()
1469 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_iscsi_init1() local
1475 cp->num_iscsi_tasks = req1->num_tasks_per_conn; in cnic_bnx2x_iscsi_init1()
1476 cp->num_ccells = req1->num_ccells_per_conn; in cnic_bnx2x_iscsi_init1()
1477 cp->task_array_size = BNX2X_ISCSI_TASK_CONTEXT_SIZE * in cnic_bnx2x_iscsi_init1()
1478 cp->num_iscsi_tasks; in cnic_bnx2x_iscsi_init1()
1479 cp->r2tq_size = cp->num_iscsi_tasks * BNX2X_ISCSI_MAX_PENDING_R2TS * in cnic_bnx2x_iscsi_init1()
1481 cp->hq_size = cp->num_ccells * BNX2X_ISCSI_HQ_BD_SIZE; in cnic_bnx2x_iscsi_init1()
1482 pages = CNIC_PAGE_ALIGN(cp->hq_size) / CNIC_PAGE_SIZE; in cnic_bnx2x_iscsi_init1()
1484 cp->num_cqs = req1->num_cqs; in cnic_bnx2x_iscsi_init1()
1516 cp->num_iscsi_tasks * BNX2X_ISCSI_MAX_PENDING_R2TS); in cnic_bnx2x_iscsi_init1()
1531 cp->num_iscsi_tasks * BNX2X_ISCSI_MAX_PENDING_R2TS); in cnic_bnx2x_iscsi_init1()
1597 struct cnic_local *cp = dev->cnic_priv; in cnic_free_bnx2x_conn_resc() local
1598 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_free_bnx2x_conn_resc()
1606 cnic_free_id(&cp->cid_tbl, ctx->cid); in cnic_free_bnx2x_conn_resc()
1608 cnic_free_id(&cp->fcoe_cid_tbl, ctx->cid); in cnic_free_bnx2x_conn_resc()
1618 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_bnx2x_conn_resc() local
1619 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_alloc_bnx2x_conn_resc()
1623 cid = cnic_alloc_new_id(&cp->fcoe_cid_tbl); in cnic_alloc_bnx2x_conn_resc()
1632 cid = cnic_alloc_new_id(&cp->cid_tbl); in cnic_alloc_bnx2x_conn_resc()
1639 pages = CNIC_PAGE_ALIGN(cp->task_array_size) / CNIC_PAGE_SIZE; in cnic_alloc_bnx2x_conn_resc()
1645 pages = CNIC_PAGE_ALIGN(cp->r2tq_size) / CNIC_PAGE_SIZE; in cnic_alloc_bnx2x_conn_resc()
1650 pages = CNIC_PAGE_ALIGN(cp->hq_size) / CNIC_PAGE_SIZE; in cnic_alloc_bnx2x_conn_resc()
1665 struct cnic_local *cp = dev->cnic_priv; in cnic_get_bnx2x_ctx() local
1666 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_get_bnx2x_ctx()
1667 int blk = (cid - ethdev->starting_cid) / cp->cids_per_blk; in cnic_get_bnx2x_ctx()
1668 int off = (cid - ethdev->starting_cid) % cp->cids_per_blk; in cnic_get_bnx2x_ctx()
1673 if (cp->ctx_align) { in cnic_get_bnx2x_ctx()
1674 unsigned long mask = cp->ctx_align - 1; in cnic_get_bnx2x_ctx()
1676 if (cp->ctx_arr[blk].mapping & mask) in cnic_get_bnx2x_ctx()
1677 align_off = cp->ctx_align - in cnic_get_bnx2x_ctx()
1678 (cp->ctx_arr[blk].mapping & mask); in cnic_get_bnx2x_ctx()
1680 ctx_map = cp->ctx_arr[blk].mapping + align_off + in cnic_get_bnx2x_ctx()
1682 ctx = cp->ctx_arr[blk].ctx + align_off + in cnic_get_bnx2x_ctx()
1695 struct cnic_local *cp = dev->cnic_priv; in cnic_setup_bnx2x_ctx() local
1702 struct cnic_context *ctx = &cp->ctx_tbl[req1->iscsi_conn_id]; in cnic_setup_bnx2x_ctx()
1814 for (i = 1, j = 1; i < cp->num_cqs; i++, j++) { in cnic_setup_bnx2x_ctx()
1837 ictx->ustorm_st_context.num_cqs = cp->num_cqs; in cnic_setup_bnx2x_ctx()
1861 ictx->cstorm_st_context.cq_proc_en_bit_map = (1 << cp->num_cqs) - 1; in cnic_setup_bnx2x_ctx()
1862 for (i = 0; i < cp->num_cqs; i++) { in cnic_setup_bnx2x_ctx()
1884 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_iscsi_ofld1() local
1914 ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_iscsi_ofld1()
1921 if (atomic_inc_return(&cp->iscsi_conn) > dev->max_iscsi_conn) { in cnic_bnx2x_iscsi_ofld1()
1922 atomic_dec(&cp->iscsi_conn); in cnic_bnx2x_iscsi_ofld1()
1927 atomic_dec(&cp->iscsi_conn); in cnic_bnx2x_iscsi_ofld1()
1933 atomic_dec(&cp->iscsi_conn); in cnic_bnx2x_iscsi_ofld1()
1938 kcqe.iscsi_conn_context_id = BNX2X_HW_CID(bp, cp->ctx_tbl[l5_cid].cid); in cnic_bnx2x_iscsi_ofld1()
1949 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_iscsi_update() local
1957 if (cnic_get_l5_cid(cp, cid, &l5_cid) != 0) in cnic_bnx2x_iscsi_update()
1960 data = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data); in cnic_bnx2x_iscsi_update()
1973 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_destroy_ramrod() local
1975 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_destroy_ramrod()
1999 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_iscsi_destroy() local
2003 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_iscsi_destroy()
2018 queue_delayed_work(cnic_wq, &cp->delete_task, delta); in cnic_bnx2x_iscsi_destroy()
2028 atomic_dec(&cp->iscsi_conn); in cnic_bnx2x_iscsi_destroy()
2128 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_connect() local
2137 struct cnic_sock *csk = &cp->csk_tbl[l5_cid]; in cnic_bnx2x_connect()
2138 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_connect()
2160 conn_buf = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data); in cnic_bnx2x_connect()
2266 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_stat() local
2272 cid = BNX2X_HW_CID(bp, cp->fcoe_init_cid); in cnic_bnx2x_fcoe_stat()
2274 fcoe_stat = cnic_get_kwqe_16_data(cp, BNX2X_FCOE_L5_CID_BASE, &l5_data); in cnic_bnx2x_fcoe_stat()
2290 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_init1() local
2319 fcoe_init = cnic_get_kwqe_16_data(cp, BNX2X_FCOE_L5_CID_BASE, &l5_data); in cnic_bnx2x_fcoe_init1()
2327 fcoe_init->eq_pbl_base.lo = cp->kcq2.dma.pgtbl_map & 0xffffffff; in cnic_bnx2x_fcoe_init1()
2328 fcoe_init->eq_pbl_base.hi = (u64) cp->kcq2.dma.pgtbl_map >> 32; in cnic_bnx2x_fcoe_init1()
2329 fcoe_init->eq_pbl_size = cp->kcq2.dma.num_pages; in cnic_bnx2x_fcoe_init1()
2331 fcoe_init->sb_num = cp->status_blk_num; in cnic_bnx2x_fcoe_init1()
2334 cp->kcq2.sw_prod_idx = 0; in cnic_bnx2x_fcoe_init1()
2336 cid = BNX2X_HW_CID(bp, cp->fcoe_init_cid); in cnic_bnx2x_fcoe_init1()
2348 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_ofld1() local
2379 ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_fcoe_ofld1()
2406 fcoe_offload = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data); in cnic_bnx2x_fcoe_ofld1()
2445 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_enable() local
2455 fcoe_enable = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data); in cnic_bnx2x_fcoe_enable()
2473 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_disable() local
2487 fcoe_disable = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data); in cnic_bnx2x_fcoe_disable()
2504 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_destroy() local
2517 ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_fcoe_destroy()
2534 queue_delayed_work(cnic_wq, &cp->delete_task, msecs_to_jiffies(2000)); in cnic_bnx2x_fcoe_destroy()
2547 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_delete_wait() local
2550 for (i = start_cid; i < cp->max_cid_space; i++) { in cnic_bnx2x_delete_wait()
2551 struct cnic_context *ctx = &cp->ctx_tbl[i]; in cnic_bnx2x_delete_wait()
2572 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_fw_destroy() local
2579 cid = BNX2X_HW_CID(bp, cp->fcoe_init_cid); in cnic_bnx2x_fcoe_fw_destroy()
2589 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_kwqe_err() local
2632 cnic_get_l5_cid(cp, BNX2X_SW_CID(cid), &kcqe.kcqe_info0); in cnic_bnx2x_kwqe_err()
2651 cnic_get_l5_cid(cp, BNX2X_SW_CID(cid), &l4kcqe->conn_id); in cnic_bnx2x_kwqe_err()
2835 struct cnic_local *cp = dev->cnic_priv; in service_kcqes() local
2843 u32 kcqe_op_flag = cp->completed_kcq[i]->kcqe_op_flag; in service_kcqes()
2850 u32 next_op = cp->completed_kcq[i + j]->kcqe_op_flag; in service_kcqes()
2877 ulp_ops = rcu_dereference(cp->ulp_ops[ulp_type]); in service_kcqes()
2879 ulp_ops->indicate_kcqes(cp->ulp_handle[ulp_type], in service_kcqes()
2880 cp->completed_kcq + i, j); in service_kcqes()
2894 struct cnic_local *cp = dev->cnic_priv; in cnic_get_kcqes() local
2906 cp->completed_kcq[kcqe_cnt++] = kcqe; in cnic_get_kcqes()
2919 static int cnic_l2_completion(struct cnic_local *cp) in cnic_l2_completion() argument
2922 struct cnic_uio_dev *udev = cp->udev; in cnic_l2_completion()
2928 if (!test_bit(CNIC_F_BNX2X_CLASS, &cp->dev->flags)) in cnic_l2_completion()
2931 hw_cons = *cp->rx_cons_ptr; in cnic_l2_completion()
2935 sw_cons = cp->rx_cons; in cnic_l2_completion()
2953 static void cnic_chk_pkt_rings(struct cnic_local *cp) in cnic_chk_pkt_rings() argument
2958 if (!test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags)) in cnic_chk_pkt_rings()
2961 rx_cons = *cp->rx_cons_ptr; in cnic_chk_pkt_rings()
2962 tx_cons = *cp->tx_cons_ptr; in cnic_chk_pkt_rings()
2963 if (cp->tx_cons != tx_cons || cp->rx_cons != rx_cons) { in cnic_chk_pkt_rings()
2964 if (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags)) in cnic_chk_pkt_rings()
2965 comp = cnic_l2_completion(cp); in cnic_chk_pkt_rings()
2967 cp->tx_cons = tx_cons; in cnic_chk_pkt_rings()
2968 cp->rx_cons = rx_cons; in cnic_chk_pkt_rings()
2970 if (cp->udev) in cnic_chk_pkt_rings()
2971 uio_event_notify(&cp->udev->cnic_uinfo); in cnic_chk_pkt_rings()
2974 clear_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags); in cnic_chk_pkt_rings()
2979 struct cnic_local *cp = dev->cnic_priv; in cnic_service_bnx2_queues() local
2980 u32 status_idx = (u16) *cp->kcq1.status_idx_ptr; in cnic_service_bnx2_queues()
2985 cp->kwq_con_idx = *cp->kwq_con_idx_ptr; in cnic_service_bnx2_queues()
2987 while ((kcqe_cnt = cnic_get_kcqes(dev, &cp->kcq1))) { in cnic_service_bnx2_queues()
2993 status_idx = (u16) *cp->kcq1.status_idx_ptr; in cnic_service_bnx2_queues()
2996 cp->kwq_con_idx = *cp->kwq_con_idx_ptr; in cnic_service_bnx2_queues()
2999 CNIC_WR16(dev, cp->kcq1.io_addr, cp->kcq1.sw_prod_idx); in cnic_service_bnx2_queues()
3001 cnic_chk_pkt_rings(cp); in cnic_service_bnx2_queues()
3021 struct cnic_local *cp = from_work(cp, work, cnic_irq_bh_work); in cnic_service_bnx2_msix() local
3022 struct cnic_dev *dev = cp->dev; in cnic_service_bnx2_msix()
3024 cp->last_status_idx = cnic_service_bnx2_queues(dev); in cnic_service_bnx2_msix()
3026 CNIC_WR(dev, BNX2_PCICFG_INT_ACK_CMD, cp->int_num | in cnic_service_bnx2_msix()
3027 BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | cp->last_status_idx); in cnic_service_bnx2_msix()
3032 struct cnic_local *cp = dev->cnic_priv; in cnic_doirq() local
3035 u16 prod = cp->kcq1.sw_prod_idx & MAX_KCQ_IDX; in cnic_doirq()
3037 prefetch(cp->status_blk.gen); in cnic_doirq()
3038 prefetch(&cp->kcq1.kcq[KCQ_PG(prod)][KCQ_IDX(prod)]); in cnic_doirq()
3040 queue_work(system_bh_wq, &cp->cnic_irq_bh_work); in cnic_doirq()
3047 struct cnic_local *cp = dev->cnic_priv; in cnic_irq() local
3049 if (cp->ack_int) in cnic_irq()
3050 cp->ack_int(dev); in cnic_irq()
3093 struct cnic_local *cp = dev->cnic_priv; in cnic_ack_bnx2x_msix() local
3095 cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, CSTORM_ID, 0, in cnic_ack_bnx2x_msix()
3101 struct cnic_local *cp = dev->cnic_priv; in cnic_ack_bnx2x_e2_msix() local
3103 cnic_ack_igu_sb(dev, cp->bnx2x_igu_sb_id, IGU_SEG_ACCESS_DEF, 0, in cnic_ack_bnx2x_e2_msix()
3109 struct cnic_local *cp = dev->cnic_priv; in cnic_arm_bnx2x_msix() local
3111 cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, CSTORM_ID, idx, in cnic_arm_bnx2x_msix()
3117 struct cnic_local *cp = dev->cnic_priv; in cnic_arm_bnx2x_e2_msix() local
3119 cnic_ack_igu_sb(dev, cp->bnx2x_igu_sb_id, IGU_SEG_ACCESS_DEF, idx, in cnic_arm_bnx2x_e2_msix()
3146 struct cnic_local *cp = from_work(cp, work, cnic_irq_bh_work); in cnic_service_bnx2x_bh_work() local
3147 struct cnic_dev *dev = cp->dev; in cnic_service_bnx2x_bh_work()
3155 status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq1); in cnic_service_bnx2x_bh_work()
3157 CNIC_WR16(dev, cp->kcq1.io_addr, in cnic_service_bnx2x_bh_work()
3158 cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); in cnic_service_bnx2x_bh_work()
3161 cp->arm_int(dev, status_idx); in cnic_service_bnx2x_bh_work()
3165 new_status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq2); in cnic_service_bnx2x_bh_work()
3170 CNIC_WR16(dev, cp->kcq2.io_addr, cp->kcq2.sw_prod_idx + in cnic_service_bnx2x_bh_work()
3173 cnic_ack_igu_sb(dev, cp->bnx2x_igu_sb_id, IGU_SEG_ACCESS_DEF, in cnic_service_bnx2x_bh_work()
3183 struct cnic_local *cp = dev->cnic_priv; in cnic_service_bnx2x() local
3185 if (!(cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX)) in cnic_service_bnx2x()
3188 cnic_chk_pkt_rings(cp); in cnic_service_bnx2x()
3193 static void cnic_ulp_stop_one(struct cnic_local *cp, int if_type) in cnic_ulp_stop_one() argument
3198 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); in cnic_ulp_stop_one()
3201 ulp_ops = rcu_dereference_protected(cp->ulp_ops[if_type], in cnic_ulp_stop_one()
3207 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_ulp_stop_one()
3210 if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type])) in cnic_ulp_stop_one()
3211 ulp_ops->cnic_stop(cp->ulp_handle[if_type]); in cnic_ulp_stop_one()
3213 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_ulp_stop_one()
3218 struct cnic_local *cp = dev->cnic_priv; in cnic_ulp_stop() local
3222 cnic_ulp_stop_one(cp, if_type); in cnic_ulp_stop()
3227 struct cnic_local *cp = dev->cnic_priv; in cnic_ulp_start() local
3234 ulp_ops = rcu_dereference_protected(cp->ulp_ops[if_type], in cnic_ulp_start()
3240 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_ulp_start()
3243 if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type])) in cnic_ulp_start()
3244 ulp_ops->cnic_start(cp->ulp_handle[if_type]); in cnic_ulp_start()
3246 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_ulp_start()
3252 struct cnic_local *cp = dev->cnic_priv; in cnic_copy_ulp_stats() local
3257 ulp_ops = rcu_dereference_protected(cp->ulp_ops[ulp_type], in cnic_copy_ulp_stats()
3260 rc = ulp_ops->cnic_get_stats(cp->ulp_handle[ulp_type]); in cnic_copy_ulp_stats()
3290 struct cnic_local *cp = dev->cnic_priv; in cnic_ctl() local
3291 set_bit(CNIC_LCL_FL_STOP_ISCSI, &cp->cnic_local_flags); in cnic_ctl()
3292 queue_delayed_work(cnic_wq, &cp->delete_task, 0); in cnic_ctl()
3299 struct cnic_local *cp = dev->cnic_priv; in cnic_ctl() local
3304 if (cnic_get_l5_cid(cp, cid, &l5_cid) == 0) { in cnic_ctl()
3305 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_ctl()
3337 struct cnic_local *cp = dev->cnic_priv; in cnic_ulp_init() local
3351 if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i])) in cnic_ulp_init()
3361 struct cnic_local *cp = dev->cnic_priv; in cnic_ulp_exit() local
3375 if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i])) in cnic_ulp_exit()
3591 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_create() local
3597 if (cp->ctx_tbl) { in cnic_cm_create()
3598 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_cm_create()
3604 csk1 = &cp->csk_tbl[l5_cid]; in cnic_cm_create()
3636 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_cleanup() local
3638 cnic_free_id(&cp->csk_port_tbl, be16_to_cpu(csk->src_port)); in cnic_cm_cleanup()
3759 struct cnic_local *cp = dev->cnic_priv; in cnic_resolve_addr() local
3761 return cnic_send_nlmsg(cp, ISCSI_KEVENT_PATH_REQ, csk); in cnic_resolve_addr()
3767 struct cnic_local *cp = dev->cnic_priv; in cnic_get_route() local
3815 if (cnic_alloc_id(&cp->csk_port_tbl, port_id)) in cnic_get_route()
3821 port_id = cnic_alloc_new_id(&cp->csk_port_tbl); in cnic_get_route()
3844 struct cnic_local *cp = csk->dev->cnic_priv; in cnic_cm_connect() local
3847 if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI) in cnic_cm_connect()
3873 struct cnic_local *cp = csk->dev->cnic_priv; in cnic_cm_abort() local
3886 cp->close_conn(csk, opcode); in cnic_cm_abort()
3916 static void cnic_cm_upcall(struct cnic_local *cp, struct cnic_sock *csk, in cnic_cm_upcall() argument
3923 ulp_ops = rcu_dereference(cp->ulp_ops[ulp_type]); in cnic_cm_upcall()
3952 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_process_offld_pg() local
3955 struct cnic_sock *csk = &cp->csk_tbl[l5_cid]; in cnic_cm_process_offld_pg()
3968 cnic_cm_upcall(cp, csk, in cnic_cm_process_offld_pg()
3983 struct cnic_local *cp = dev->cnic_priv; in cnic_process_fcoe_term_conn() local
3986 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_process_fcoe_term_conn()
3995 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_process_kcqe() local
4017 csk = &cp->csk_tbl[l5_cid]; in cnic_cm_process_kcqe()
4029 cnic_cm_upcall(cp, csk, in cnic_cm_process_kcqe()
4042 cnic_cm_upcall(cp, csk, opcode); in cnic_cm_process_kcqe()
4064 cp->close_conn(csk, opcode); in cnic_cm_process_kcqe()
4072 cp->close_conn(csk, L4_KCQE_OPCODE_VALUE_RESET_COMP); in cnic_cm_process_kcqe()
4074 cnic_cm_upcall(cp, csk, opcode); in cnic_cm_process_kcqe()
4095 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_free_mem() local
4097 kvfree(cp->csk_tbl); in cnic_cm_free_mem()
4098 cp->csk_tbl = NULL; in cnic_cm_free_mem()
4099 cnic_free_id_tbl(&cp->csk_port_tbl); in cnic_cm_free_mem()
4104 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_alloc_mem() local
4108 cp->csk_tbl = kvcalloc(MAX_CM_SK_TBL_SZ, sizeof(struct cnic_sock), in cnic_cm_alloc_mem()
4110 if (!cp->csk_tbl) in cnic_cm_alloc_mem()
4114 atomic_set(&cp->csk_tbl[i].ref_count, 0); in cnic_cm_alloc_mem()
4117 if (cnic_init_id_tbl(&cp->csk_port_tbl, CNIC_LOCAL_PORT_RANGE, in cnic_cm_alloc_mem()
4154 struct cnic_local *cp = dev->cnic_priv; in cnic_close_bnx2_conn() local
4157 cnic_cm_upcall(cp, csk, opcode); in cnic_close_bnx2_conn()
4164 cnic_cm_upcall(cp, csk, opcode); in cnic_close_bnx2_conn()
4183 struct cnic_local *cp = dev->cnic_priv; in cnic_close_bnx2x_conn() local
4184 struct cnic_context *ctx = &cp->ctx_tbl[csk->l5_cid]; in cnic_close_bnx2x_conn()
4217 cnic_cm_upcall(cp, csk, csk->state); in cnic_close_bnx2x_conn()
4223 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_stop_bnx2x_hw() local
4225 if (!cp->ctx_tbl) in cnic_cm_stop_bnx2x_hw()
4233 cancel_delayed_work(&cp->delete_task); in cnic_cm_stop_bnx2x_hw()
4236 if (atomic_read(&cp->iscsi_conn) != 0) in cnic_cm_stop_bnx2x_hw()
4238 atomic_read(&cp->iscsi_conn)); in cnic_cm_stop_bnx2x_hw()
4275 struct cnic_local *cp; in cnic_delete_task() local
4280 cp = container_of(work, struct cnic_local, delete_task.work); in cnic_delete_task()
4281 dev = cp->dev; in cnic_delete_task()
4283 if (test_and_clear_bit(CNIC_LCL_FL_STOP_ISCSI, &cp->cnic_local_flags)) { in cnic_delete_task()
4286 cnic_ulp_stop_one(cp, CNIC_ULP_ISCSI); in cnic_delete_task()
4290 cp->ethdev->drv_ctl(dev->netdev, &info); in cnic_delete_task()
4293 for (i = 0; i < cp->max_cid_space; i++) { in cnic_delete_task()
4294 struct cnic_context *ctx = &cp->ctx_tbl[i]; in cnic_delete_task()
4314 atomic_dec(&cp->iscsi_conn); in cnic_delete_task()
4321 queue_delayed_work(cnic_wq, &cp->delete_task, in cnic_delete_task()
4328 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_open() local
4335 err = cp->start_cm(dev); in cnic_cm_open()
4340 INIT_DELAYED_WORK(&cp->delete_task, cnic_delete_task); in cnic_cm_open()
4349 cp->ulp_handle[CNIC_ULP_L4] = dev; in cnic_cm_open()
4350 rcu_assign_pointer(cp->ulp_ops[CNIC_ULP_L4], &cm_ulp_ops); in cnic_cm_open()
4360 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_shutdown() local
4363 if (!cp->csk_tbl) in cnic_cm_shutdown()
4367 struct cnic_sock *csk = &cp->csk_tbl[i]; in cnic_cm_shutdown()
4390 struct cnic_local *cp = dev->cnic_priv; in cnic_setup_5709_context() local
4394 if (BNX2_CHIP(cp) != BNX2_CHIP_5709) in cnic_setup_5709_context()
4397 for (i = 0; i < cp->ctx_blks; i++) { in cnic_setup_5709_context()
4399 u32 idx = cp->ctx_arr[i].cid / cp->cids_per_blk; in cnic_setup_5709_context()
4402 memset(cp->ctx_arr[i].ctx, 0, CNIC_PAGE_SIZE); in cnic_setup_5709_context()
4405 (cp->ctx_arr[i].mapping & 0xffffffff) | valid_bit); in cnic_setup_5709_context()
4407 (u64) cp->ctx_arr[i].mapping >> 32); in cnic_setup_5709_context()
4427 struct cnic_local *cp = dev->cnic_priv; in cnic_free_irq() local
4428 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_free_irq()
4431 cp->disable_int_sync(dev); in cnic_free_irq()
4432 cancel_work_sync(&cp->cnic_irq_bh_work); in cnic_free_irq()
4439 struct cnic_local *cp = dev->cnic_priv; in cnic_request_irq() local
4440 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_request_irq()
4445 disable_work_sync(&cp->cnic_irq_bh_work); in cnic_request_irq()
4452 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2_irq() local
4453 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_init_bnx2_irq()
4457 int sblk_num = cp->status_blk_num; in cnic_init_bnx2_irq()
4467 cp->last_status_idx = cp->status_blk.bnx2->status_idx; in cnic_init_bnx2_irq()
4468 INIT_WORK(&cp->cnic_irq_bh_work, cnic_service_bnx2_msix); in cnic_init_bnx2_irq()
4473 while (cp->status_blk.bnx2->status_completion_producer_index && in cnic_init_bnx2_irq()
4481 if (cp->status_blk.bnx2->status_completion_producer_index) { in cnic_init_bnx2_irq()
4487 struct status_block *sblk = cp->status_blk.gen; in cnic_init_bnx2_irq()
4511 struct cnic_local *cp = dev->cnic_priv; in cnic_enable_bnx2_int() local
4512 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_enable_bnx2_int()
4517 CNIC_WR(dev, BNX2_PCICFG_INT_ACK_CMD, cp->int_num | in cnic_enable_bnx2_int()
4518 BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | cp->last_status_idx); in cnic_enable_bnx2_int()
4523 struct cnic_local *cp = dev->cnic_priv; in cnic_disable_bnx2_int_sync() local
4524 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_disable_bnx2_int_sync()
4529 CNIC_WR(dev, BNX2_PCICFG_INT_ACK_CMD, cp->int_num | in cnic_disable_bnx2_int_sync()
4537 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2_tx_ring() local
4538 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_init_bnx2_tx_ring()
4539 struct cnic_uio_dev *udev = cp->udev; in cnic_init_bnx2_tx_ring()
4545 struct status_block *s_blk = cp->status_blk.gen; in cnic_init_bnx2_tx_ring()
4547 sb_id = cp->status_blk_num; in cnic_init_bnx2_tx_ring()
4549 cp->tx_cons_ptr = &s_blk->status_tx_quick_consumer_index2; in cnic_init_bnx2_tx_ring()
4551 struct status_block_msix *sblk = cp->status_blk.bnx2; in cnic_init_bnx2_tx_ring()
4556 cp->tx_cons_ptr = &sblk->status_tx_quick_consumer_index; in cnic_init_bnx2_tx_ring()
4558 cp->tx_cons = *cp->tx_cons_ptr; in cnic_init_bnx2_tx_ring()
4561 if (BNX2_CHIP(cp) == BNX2_CHIP_5709) { in cnic_init_bnx2_tx_ring()
4604 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2_rx_ring() local
4605 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_init_bnx2_rx_ring()
4606 struct cnic_uio_dev *udev = cp->udev; in cnic_init_bnx2_rx_ring()
4610 struct status_block *s_blk = cp->status_blk.gen; in cnic_init_bnx2_rx_ring()
4613 sb_id = cp->status_blk_num; in cnic_init_bnx2_rx_ring()
4615 cp->rx_cons_ptr = &s_blk->status_rx_quick_consumer_index2; in cnic_init_bnx2_rx_ring()
4619 struct status_block_msix *sblk = cp->status_blk.bnx2; in cnic_init_bnx2_rx_ring()
4621 cp->rx_cons_ptr = &sblk->status_rx_quick_consumer_index; in cnic_init_bnx2_rx_ring()
4626 while (!(*cp->rx_cons_ptr != 0) && i < 10) { in cnic_init_bnx2_rx_ring()
4632 cp->rx_cons = *cp->rx_cons_ptr; in cnic_init_bnx2_rx_ring()
4648 int n = (i % cp->l2_rx_ring_size) + 1; in cnic_init_bnx2_rx_ring()
4650 buf_map = udev->l2_buf_map + (n * cp->l2_single_buf_size); in cnic_init_bnx2_rx_ring()
4651 rxbd->rx_bd_len = cp->l2_single_buf_size; in cnic_init_bnx2_rx_ring()
4682 struct cnic_local *cp = dev->cnic_priv; in cnic_set_bnx2_mac() local
4685 val = cp->func << 2; in cnic_set_bnx2_mac()
4687 cp->shmem_base = cnic_reg_rd_ind(dev, BNX2_SHM_HDR_ADDR_0 + val); in cnic_set_bnx2_mac()
4689 val = cnic_reg_rd_ind(dev, cp->shmem_base + in cnic_set_bnx2_mac()
4696 val = cnic_reg_rd_ind(dev, cp->shmem_base + in cnic_set_bnx2_mac()
4706 if (BNX2_CHIP(cp) != BNX2_CHIP_5709) in cnic_set_bnx2_mac()
4716 struct cnic_local *cp = dev->cnic_priv; in cnic_start_bnx2_hw() local
4717 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_start_bnx2_hw()
4718 struct status_block *sblk = cp->status_blk.gen; in cnic_start_bnx2_hw()
4745 cp->kwq_io_addr = MB_GET_CID_ADDR(KWQ_CID) + L5_KRNLQ_HOST_QIDX; in cnic_start_bnx2_hw()
4747 cp->max_kwq_idx = MAX_KWQ_IDX; in cnic_start_bnx2_hw()
4748 cp->kwq_prod_idx = 0; in cnic_start_bnx2_hw()
4749 cp->kwq_con_idx = 0; in cnic_start_bnx2_hw()
4750 set_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags); in cnic_start_bnx2_hw()
4752 if (BNX2_CHIP(cp) == BNX2_CHIP_5706 || BNX2_CHIP(cp) == BNX2_CHIP_5708) in cnic_start_bnx2_hw()
4753 cp->kwq_con_idx_ptr = &sblk->status_rx_quick_consumer_index15; in cnic_start_bnx2_hw()
4755 cp->kwq_con_idx_ptr = &sblk->status_cmd_consumer_index; in cnic_start_bnx2_hw()
4768 val = (u32) ((u64) cp->kwq_info.pgtbl_map >> 32); in cnic_start_bnx2_hw()
4771 val = (u32) cp->kwq_info.pgtbl_map; in cnic_start_bnx2_hw()
4775 cp->kcq1.io_addr = MB_GET_CID_ADDR(KCQ_CID) + L5_KRNLQ_HOST_QIDX; in cnic_start_bnx2_hw()
4777 cp->kcq1.sw_prod_idx = 0; in cnic_start_bnx2_hw()
4778 cp->kcq1.hw_prod_idx_ptr = in cnic_start_bnx2_hw()
4781 cp->kcq1.status_idx_ptr = &sblk->status_idx; in cnic_start_bnx2_hw()
4794 val = (u32) ((u64) cp->kcq1.dma.pgtbl_map >> 32); in cnic_start_bnx2_hw()
4797 val = (u32) cp->kcq1.dma.pgtbl_map; in cnic_start_bnx2_hw()
4800 cp->int_num = 0; in cnic_start_bnx2_hw()
4802 struct status_block_msix *msblk = cp->status_blk.bnx2; in cnic_start_bnx2_hw()
4803 u32 sb_id = cp->status_blk_num; in cnic_start_bnx2_hw()
4806 cp->kcq1.hw_prod_idx_ptr = in cnic_start_bnx2_hw()
4808 cp->kcq1.status_idx_ptr = &msblk->status_idx; in cnic_start_bnx2_hw()
4809 cp->kwq_con_idx_ptr = &msblk->status_cmd_consumer_index; in cnic_start_bnx2_hw()
4810 cp->int_num = sb_id << BNX2_PCICFG_INT_ACK_CMD_INT_NUM_SHIFT; in cnic_start_bnx2_hw()
4828 /* Set the CP and COM doorbells. These two processors polls the in cnic_start_bnx2_hw()
4852 struct cnic_local *cp = dev->cnic_priv; in cnic_setup_bnx2x_context() local
4853 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_setup_bnx2x_context()
4857 for (i = 0; i < cp->ctx_blks; i++) { in cnic_setup_bnx2x_context()
4858 struct cnic_ctx *ctx = &cp->ctx_arr[i]; in cnic_setup_bnx2x_context()
4861 if (cp->ctx_align) { in cnic_setup_bnx2x_context()
4862 unsigned long mask = cp->ctx_align - 1; in cnic_setup_bnx2x_context()
4873 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2x_irq() local
4874 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_init_bnx2x_irq()
4877 INIT_WORK(&cp->cnic_irq_bh_work, cnic_service_bnx2x_bh_work); in cnic_init_bnx2x_irq()
4905 struct cnic_local *cp = dev->cnic_priv; in cnic_enable_bnx2x_int() local
4907 u8 sb_id = cp->status_blk_num; in cnic_enable_bnx2x_int()
4924 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2x_tx_ring() local
4926 struct cnic_uio_dev *udev = cp->udev; in cnic_init_bnx2x_tx_ring()
4929 struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; in cnic_init_bnx2x_tx_ring()
4931 u32 cli = cp->ethdev->iscsi_l2_client_id; in cnic_init_bnx2x_tx_ring()
4983 cp->tx_cons_ptr = in cnic_init_bnx2x_tx_ring()
4990 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2x_rx_ring() local
4992 struct cnic_uio_dev *udev = cp->udev; in cnic_init_bnx2x_rx_ring()
4997 struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; in cnic_init_bnx2x_rx_ring()
4999 u32 cli = cp->ethdev->iscsi_l2_client_id; in cnic_init_bnx2x_rx_ring()
5008 data->general.mtu = cpu_to_le16(cp->l2_single_buf_size - 14); in cnic_init_bnx2x_rx_ring()
5013 int n = (i % cp->l2_rx_ring_size) + 1; in cnic_init_bnx2x_rx_ring()
5015 buf_map = udev->l2_buf_map + (n * cp->l2_single_buf_size); in cnic_init_bnx2x_rx_ring()
5044 data->rx.max_bytes_on_bd = cpu_to_le16(cp->l2_single_buf_size); in cnic_init_bnx2x_rx_ring()
5050 cp->rx_cons_ptr = in cnic_init_bnx2x_rx_ring()
5052 cp->rx_cons = *cp->rx_cons_ptr; in cnic_init_bnx2x_rx_ring()
5057 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2x_kcq() local
5061 cp->kcq1.io_addr = BAR_CSTRORM_INTMEM + in cnic_init_bnx2x_kcq()
5063 cp->kcq1.sw_prod_idx = 0; in cnic_init_bnx2x_kcq()
5066 struct host_hc_status_block_e2 *sb = cp->status_blk.gen; in cnic_init_bnx2x_kcq()
5068 cp->kcq1.hw_prod_idx_ptr = in cnic_init_bnx2x_kcq()
5070 cp->kcq1.status_idx_ptr = in cnic_init_bnx2x_kcq()
5073 struct host_hc_status_block_e1x *sb = cp->status_blk.gen; in cnic_init_bnx2x_kcq()
5075 cp->kcq1.hw_prod_idx_ptr = in cnic_init_bnx2x_kcq()
5077 cp->kcq1.status_idx_ptr = in cnic_init_bnx2x_kcq()
5082 struct host_hc_status_block_e2 *sb = cp->status_blk.gen; in cnic_init_bnx2x_kcq()
5084 cp->kcq2.io_addr = BAR_USTRORM_INTMEM + in cnic_init_bnx2x_kcq()
5086 cp->kcq2.sw_prod_idx = 0; in cnic_init_bnx2x_kcq()
5087 cp->kcq2.hw_prod_idx_ptr = in cnic_init_bnx2x_kcq()
5089 cp->kcq2.status_idx_ptr = in cnic_init_bnx2x_kcq()
5096 struct cnic_local *cp = dev->cnic_priv; in cnic_start_bnx2x_hw() local
5098 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_start_bnx2x_hw()
5103 cp->func = bp->pf_num; in cnic_start_bnx2x_hw()
5107 ret = cnic_init_id_tbl(&cp->cid_tbl, MAX_ISCSI_TBL_SZ, in cnic_start_bnx2x_hw()
5108 cp->iscsi_start_cid, 0); in cnic_start_bnx2x_hw()
5114 ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl, dev->max_fcoe_conn, in cnic_start_bnx2x_hw()
5115 cp->fcoe_start_cid, 0); in cnic_start_bnx2x_hw()
5121 cp->bnx2x_igu_sb_id = ethdev->irq_arr[0].status_blk_num2; in cnic_start_bnx2x_hw()
5126 CNIC_WR16(dev, cp->kcq1.io_addr, MAX_KCQ_IDX); in cnic_start_bnx2x_hw()
5131 cp->kcq1.dma.pg_map_arr[1] & 0xffffffff); in cnic_start_bnx2x_hw()
5134 (u64) cp->kcq1.dma.pg_map_arr[1] >> 32); in cnic_start_bnx2x_hw()
5137 cp->kcq1.dma.pg_map_arr[0] & 0xffffffff); in cnic_start_bnx2x_hw()
5140 (u64) cp->kcq1.dma.pg_map_arr[0] >> 32); in cnic_start_bnx2x_hw()
5144 CSTORM_ISCSI_EQ_SB_NUM_OFFSET(pfid, 0), cp->status_blk_num); in cnic_start_bnx2x_hw()
5151 cp->gbl_buf_info.pg_map_arr[0] & 0xffffffff); in cnic_start_bnx2x_hw()
5154 (u64) cp->gbl_buf_info.pg_map_arr[0] >> 32); in cnic_start_bnx2x_hw()
5171 struct cnic_local *cp = dev->cnic_priv; in cnic_init_rings() local
5173 struct cnic_uio_dev *udev = cp->udev; in cnic_init_rings()
5175 if (test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags)) in cnic_init_rings()
5181 set_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); in cnic_init_rings()
5183 u32 cli = cp->ethdev->iscsi_l2_client_id; in cnic_init_rings()
5184 u32 cid = cp->ethdev->iscsi_l2_cid; in cnic_init_rings()
5205 set_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags); in cnic_init_rings()
5220 set_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); in cnic_init_rings()
5226 while (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags) && in cnic_init_rings()
5230 if (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags)) in cnic_init_rings()
5243 struct cnic_local *cp = dev->cnic_priv; in cnic_shutdown_rings() local
5244 struct cnic_uio_dev *udev = cp->udev; in cnic_shutdown_rings()
5247 if (!test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags)) in cnic_shutdown_rings()
5253 u32 cli = cp->ethdev->iscsi_l2_client_id; in cnic_shutdown_rings()
5254 u32 cid = cp->ethdev->iscsi_l2_cid; in cnic_shutdown_rings()
5260 set_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags); in cnic_shutdown_rings()
5267 while (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags) && in cnic_shutdown_rings()
5271 if (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags)) in cnic_shutdown_rings()
5281 clear_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); in cnic_shutdown_rings()
5288 struct cnic_local *cp = dev->cnic_priv; in cnic_register_netdev() local
5289 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_register_netdev()
5298 err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev); in cnic_register_netdev()
5314 struct cnic_local *cp = dev->cnic_priv; in cnic_unregister_netdev() local
5315 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_unregister_netdev()
5325 struct cnic_local *cp = dev->cnic_priv; in cnic_start_hw() local
5326 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_start_hw()
5334 cp->func = PCI_FUNC(dev->pcidev->devfn); in cnic_start_hw()
5335 cp->status_blk.gen = ethdev->irq_arr[0].status_blk; in cnic_start_hw()
5336 cp->status_blk_map = ethdev->irq_arr[0].status_blk_map; in cnic_start_hw()
5337 cp->status_blk_num = ethdev->irq_arr[0].status_blk_num; in cnic_start_hw()
5339 err = cp->alloc_resc(dev); in cnic_start_hw()
5345 err = cp->start_hw(dev); in cnic_start_hw()
5355 cp->enable_int(dev); in cnic_start_hw()
5361 cp->stop_hw(dev); in cnic_start_hw()
5363 cp->free_resc(dev); in cnic_start_hw()
5387 struct cnic_local *cp = dev->cnic_priv; in cnic_stop_bnx2x_hw() local
5390 u32 sb_id = cp->status_blk_num; in cnic_stop_bnx2x_hw()
5410 *cp->kcq1.hw_prod_idx_ptr = 0; in cnic_stop_bnx2x_hw()
5413 CNIC_WR16(dev, cp->kcq1.io_addr, 0); in cnic_stop_bnx2x_hw()
5420 struct cnic_local *cp = dev->cnic_priv; in cnic_stop_hw() local
5426 while (cp->udev && cp->udev->uio_dev != -1 && i < 15) { in cnic_stop_hw()
5431 cp->stop_cm(dev); in cnic_stop_hw()
5432 cp->ethdev->drv_state &= ~CNIC_DRV_STATE_HANDLES_IRQ; in cnic_stop_hw()
5434 RCU_INIT_POINTER(cp->ulp_ops[CNIC_ULP_L4], NULL); in cnic_stop_hw()
5437 cp->stop_hw(dev); in cnic_stop_hw()
5461 struct cnic_local *cp = dev->cnic_priv; in cnic_get_fc_npiv_tbl() local
5471 ret = cp->ethdev->drv_get_fc_npiv_tbl(dev->netdev, npiv_tbl); in cnic_get_fc_npiv_tbl()
5479 struct cnic_local *cp; in cnic_alloc_dev() local
5496 cp = cdev->cnic_priv; in cnic_alloc_dev()
5497 cp->dev = cdev; in cnic_alloc_dev()
5498 cp->l2_single_buf_size = 0x400; in cnic_alloc_dev()
5499 cp->l2_rx_ring_size = 3; in cnic_alloc_dev()
5501 spin_lock_init(&cp->cnic_ulp_lock); in cnic_alloc_dev()
5512 struct cnic_local *cp; in init_bnx2_cnic() local
5543 cp = cdev->cnic_priv; in init_bnx2_cnic()
5544 cp->ethdev = ethdev; in init_bnx2_cnic()
5546 cp->chip_id = ethdev->chip_id; in init_bnx2_cnic()
5550 cp->cnic_ops = &cnic_bnx2_ops; in init_bnx2_cnic()
5551 cp->start_hw = cnic_start_bnx2_hw; in init_bnx2_cnic()
5552 cp->stop_hw = cnic_stop_bnx2_hw; in init_bnx2_cnic()
5553 cp->setup_pgtbl = cnic_setup_page_tbl; in init_bnx2_cnic()
5554 cp->alloc_resc = cnic_alloc_bnx2_resc; in init_bnx2_cnic()
5555 cp->free_resc = cnic_free_resc; in init_bnx2_cnic()
5556 cp->start_cm = cnic_cm_init_bnx2_hw; in init_bnx2_cnic()
5557 cp->stop_cm = cnic_cm_stop_bnx2_hw; in init_bnx2_cnic()
5558 cp->enable_int = cnic_enable_bnx2_int; in init_bnx2_cnic()
5559 cp->disable_int_sync = cnic_disable_bnx2_int_sync; in init_bnx2_cnic()
5560 cp->close_conn = cnic_close_bnx2_conn; in init_bnx2_cnic()
5572 struct cnic_local *cp; in init_bnx2x_cnic() local
5596 cp = cdev->cnic_priv; in init_bnx2x_cnic()
5597 cp->ethdev = ethdev; in init_bnx2x_cnic()
5599 cp->chip_id = ethdev->chip_id; in init_bnx2x_cnic()
5615 cp->cnic_ops = &cnic_bnx2x_ops; in init_bnx2x_cnic()
5616 cp->start_hw = cnic_start_bnx2x_hw; in init_bnx2x_cnic()
5617 cp->stop_hw = cnic_stop_bnx2x_hw; in init_bnx2x_cnic()
5618 cp->setup_pgtbl = cnic_setup_page_tbl_le; in init_bnx2x_cnic()
5619 cp->alloc_resc = cnic_alloc_bnx2x_resc; in init_bnx2x_cnic()
5620 cp->free_resc = cnic_free_resc; in init_bnx2x_cnic()
5621 cp->start_cm = cnic_cm_init_bnx2x_hw; in init_bnx2x_cnic()
5622 cp->stop_cm = cnic_cm_stop_bnx2x_hw; in init_bnx2x_cnic()
5623 cp->enable_int = cnic_enable_bnx2x_int; in init_bnx2x_cnic()
5624 cp->disable_int_sync = cnic_disable_bnx2x_int_sync; in init_bnx2x_cnic()
5626 cp->ack_int = cnic_ack_bnx2x_e2_msix; in init_bnx2x_cnic()
5627 cp->arm_int = cnic_arm_bnx2x_e2_msix; in init_bnx2x_cnic()
5629 cp->ack_int = cnic_ack_bnx2x_msix; in init_bnx2x_cnic()
5630 cp->arm_int = cnic_arm_bnx2x_msix; in init_bnx2x_cnic()
5632 cp->close_conn = cnic_close_bnx2x_conn; in init_bnx2x_cnic()
5658 static void cnic_rcv_netevent(struct cnic_local *cp, unsigned long event, in cnic_rcv_netevent() argument
5668 ulp_ops = rcu_dereference_protected(cp->ulp_ops[if_type], in cnic_rcv_netevent()
5675 ctx = cp->ulp_handle[if_type]; in cnic_rcv_netevent()
5677 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_rcv_netevent()
5682 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_rcv_netevent()
5705 struct cnic_local *cp = dev->cnic_priv; in cnic_netdev_event() local
5721 cnic_rcv_netevent(cp, event, 0); in cnic_netdev_event()