Lines Matching full:cp
190 struct cnic_local *cp = dev->cnic_priv; in cnic_ctx_wr() local
191 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_ctx_wr()
205 struct cnic_local *cp = dev->cnic_priv; in cnic_ctx_tbl_wr() local
206 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_ctx_tbl_wr()
219 struct cnic_local *cp = dev->cnic_priv; in cnic_ring_ctl() local
220 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_ring_ctl()
237 struct cnic_local *cp = dev->cnic_priv; in cnic_reg_wr_ind() local
238 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_reg_wr_ind()
251 struct cnic_local *cp = dev->cnic_priv; in cnic_reg_rd_ind() local
252 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_reg_rd_ind()
265 struct cnic_local *cp = dev->cnic_priv; in cnic_ulp_ctl() local
266 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_ulp_ctl()
292 struct cnic_local *cp = dev->cnic_priv; in cnic_spq_completion() local
293 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_spq_completion()
302 static int cnic_get_l5_cid(struct cnic_local *cp, u32 cid, u32 *l5_cid) in cnic_get_l5_cid() argument
306 if (!cp->ctx_tbl) in cnic_get_l5_cid()
309 for (i = 0; i < cp->max_cid_space; i++) { in cnic_get_l5_cid()
310 if (cp->ctx_tbl[i].cid == cid) { in cnic_get_l5_cid()
318 static int cnic_send_nlmsg(struct cnic_local *cp, u32 type, in cnic_send_nlmsg() argument
326 struct cnic_uio_dev *udev = cp->udev; in cnic_send_nlmsg()
355 ulp_ops = rcu_dereference(cp->ulp_ops[CNIC_ULP_ISCSI]); in cnic_send_nlmsg()
358 cp->ulp_handle[CNIC_ULP_ISCSI], in cnic_send_nlmsg()
379 struct cnic_local *cp; in cnic_iscsi_nl_msg_recv() local
388 cp = dev->cnic_priv; in cnic_iscsi_nl_msg_recv()
393 if (!rcu_access_pointer(cp->ulp_ops[CNIC_ULP_L4])) { in cnic_iscsi_nl_msg_recv()
397 csk = &cp->csk_tbl[l5_cid]; in cnic_iscsi_nl_msg_recv()
417 cnic_cm_upcall(cp, csk, in cnic_iscsi_nl_msg_recv()
491 struct cnic_local *cp = dev->cnic_priv; in cnic_register_driver() local
493 clear_bit(ULP_F_INIT, &cp->ulp_flags[ulp_type]); in cnic_register_driver()
504 struct cnic_local *cp = dev->cnic_priv; in cnic_register_driver() local
506 if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[ulp_type])) in cnic_register_driver()
533 struct cnic_local *cp = dev->cnic_priv; in cnic_unregister_driver() local
535 if (rcu_access_pointer(cp->ulp_ops[ulp_type])) { in cnic_unregister_driver()
569 struct cnic_local *cp = dev->cnic_priv; in cnic_register_device() local
583 if (rcu_access_pointer(cp->ulp_ops[ulp_type])) { in cnic_register_device()
590 clear_bit(ULP_F_START, &cp->ulp_flags[ulp_type]); in cnic_register_device()
591 cp->ulp_handle[ulp_type] = ulp_ctx; in cnic_register_device()
593 rcu_assign_pointer(cp->ulp_ops[ulp_type], ulp_ops); in cnic_register_device()
597 if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[ulp_type])) in cnic_register_device()
598 ulp_ops->cnic_start(cp->ulp_handle[ulp_type]); in cnic_register_device()
611 struct cnic_local *cp = dev->cnic_priv; in cnic_unregister_device() local
620 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); in cnic_unregister_device()
623 if (rcu_access_pointer(cp->ulp_ops[ulp_type])) { in cnic_unregister_device()
624 RCU_INIT_POINTER(cp->ulp_ops[ulp_type], NULL); in cnic_unregister_device()
639 while (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]) && in cnic_unregister_device()
644 if (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type])) in cnic_unregister_device()
647 if (test_bit(ULP_F_INIT, &cp->ulp_flags[ulp_type])) in cnic_unregister_device()
788 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_dma() local
816 cp->setup_pgtbl(dev, dma); in cnic_alloc_dma()
827 struct cnic_local *cp = dev->cnic_priv; in cnic_free_context() local
830 for (i = 0; i < cp->ctx_blks; i++) { in cnic_free_context()
831 if (cp->ctx_arr[i].ctx) { in cnic_free_context()
832 dma_free_coherent(&dev->pcidev->dev, cp->ctx_blk_size, in cnic_free_context()
833 cp->ctx_arr[i].ctx, in cnic_free_context()
834 cp->ctx_arr[i].mapping); in cnic_free_context()
835 cp->ctx_arr[i].ctx = NULL; in cnic_free_context()
879 struct cnic_local *cp = dev->cnic_priv; in cnic_free_resc() local
880 struct cnic_uio_dev *udev = cp->udev; in cnic_free_resc()
884 cp->udev = NULL; in cnic_free_resc()
890 kfree(cp->ctx_arr); in cnic_free_resc()
891 cp->ctx_arr = NULL; in cnic_free_resc()
892 cp->ctx_blks = 0; in cnic_free_resc()
894 cnic_free_dma(dev, &cp->gbl_buf_info); in cnic_free_resc()
895 cnic_free_dma(dev, &cp->kwq_info); in cnic_free_resc()
896 cnic_free_dma(dev, &cp->kwq_16_data_info); in cnic_free_resc()
897 cnic_free_dma(dev, &cp->kcq2.dma); in cnic_free_resc()
898 cnic_free_dma(dev, &cp->kcq1.dma); in cnic_free_resc()
899 kfree(cp->iscsi_tbl); in cnic_free_resc()
900 cp->iscsi_tbl = NULL; in cnic_free_resc()
901 kfree(cp->ctx_tbl); in cnic_free_resc()
902 cp->ctx_tbl = NULL; in cnic_free_resc()
904 cnic_free_id_tbl(&cp->fcoe_cid_tbl); in cnic_free_resc()
905 cnic_free_id_tbl(&cp->cid_tbl); in cnic_free_resc()
910 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_context() local
912 if (BNX2_CHIP(cp) == BNX2_CHIP_5709) { in cnic_alloc_context()
915 cp->ctx_blk_size = CNIC_PAGE_SIZE; in cnic_alloc_context()
916 cp->cids_per_blk = CNIC_PAGE_SIZE / 128; in cnic_alloc_context()
917 arr_size = BNX2_MAX_CID / cp->cids_per_blk * in cnic_alloc_context()
919 cp->ctx_arr = kzalloc(arr_size, GFP_KERNEL); in cnic_alloc_context()
920 if (cp->ctx_arr == NULL) in cnic_alloc_context()
935 for (j = lo; j < hi; j += cp->cids_per_blk, k++) in cnic_alloc_context()
936 cp->ctx_arr[k].cid = j; in cnic_alloc_context()
939 cp->ctx_blks = k; in cnic_alloc_context()
940 if (cp->ctx_blks >= (BNX2_MAX_CID / cp->cids_per_blk)) { in cnic_alloc_context()
941 cp->ctx_blks = 0; in cnic_alloc_context()
945 for (i = 0; i < cp->ctx_blks; i++) { in cnic_alloc_context()
946 cp->ctx_arr[i].ctx = in cnic_alloc_context()
949 &cp->ctx_arr[i].mapping, in cnic_alloc_context()
951 if (cp->ctx_arr[i].ctx == NULL) in cnic_alloc_context()
1023 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()
1051 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_uio_rings() local
1061 cp->udev = udev; in cnic_alloc_uio_rings()
1082 cp->udev = udev; in cnic_alloc_uio_rings()
1093 struct cnic_local *cp = dev->cnic_priv; in cnic_init_uio() local
1094 struct cnic_uio_dev *udev = cp->udev; in cnic_init_uio()
1110 uinfo->mem[1].addr = (unsigned long) cp->status_blk.gen & 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].size = sizeof(*cp->bnx2x_def_status_blk); in cnic_init_uio()
1159 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_bnx2_resc() local
1162 ret = cnic_alloc_dma(dev, &cp->kwq_info, KWQ_PAGE_CNT, 1); in cnic_alloc_bnx2_resc()
1165 cp->kwq = (struct kwqe **) cp->kwq_info.pg_arr; in cnic_alloc_bnx2_resc()
1167 ret = cnic_alloc_kcq(dev, &cp->kcq1, true); in cnic_alloc_bnx2_resc()
1192 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_bnx2x_context() local
1194 int ctx_blk_size = cp->ethdev->ctx_blk_size; in cnic_alloc_bnx2x_context()
1197 total_mem = BNX2X_CONTEXT_MEM_SIZE * cp->max_cid_space; in cnic_alloc_bnx2x_context()
1202 if (blks > cp->ethdev->ctx_tbl_len) in cnic_alloc_bnx2x_context()
1205 cp->ctx_arr = kcalloc(blks, sizeof(struct cnic_ctx), GFP_KERNEL); in cnic_alloc_bnx2x_context()
1206 if (cp->ctx_arr == NULL) in cnic_alloc_bnx2x_context()
1209 cp->ctx_blks = blks; in cnic_alloc_bnx2x_context()
1210 cp->ctx_blk_size = ctx_blk_size; in cnic_alloc_bnx2x_context()
1212 cp->ctx_align = 0; in cnic_alloc_bnx2x_context()
1214 cp->ctx_align = ctx_blk_size; in cnic_alloc_bnx2x_context()
1216 cp->cids_per_blk = ctx_blk_size / BNX2X_CONTEXT_MEM_SIZE; in cnic_alloc_bnx2x_context()
1219 cp->ctx_arr[i].ctx = in cnic_alloc_bnx2x_context()
1220 dma_alloc_coherent(&dev->pcidev->dev, cp->ctx_blk_size, in cnic_alloc_bnx2x_context()
1221 &cp->ctx_arr[i].mapping, in cnic_alloc_bnx2x_context()
1223 if (cp->ctx_arr[i].ctx == NULL) in cnic_alloc_bnx2x_context()
1226 if (cp->ctx_align && cp->ctx_blk_size == ctx_blk_size) { in cnic_alloc_bnx2x_context()
1227 if (cp->ctx_arr[i].mapping & (cp->ctx_align - 1)) { in cnic_alloc_bnx2x_context()
1229 cp->ctx_blk_size += cp->ctx_align; in cnic_alloc_bnx2x_context()
1240 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_bnx2x_resc() local
1242 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_alloc_bnx2x_resc()
1245 struct cnic_dma *kwq_16_dma = &cp->kwq_16_data_info; in cnic_alloc_bnx2x_resc()
1247 cp->max_cid_space = MAX_ISCSI_TBL_SZ; in cnic_alloc_bnx2x_resc()
1248 cp->iscsi_start_cid = start_cid; in cnic_alloc_bnx2x_resc()
1249 cp->fcoe_start_cid = start_cid + MAX_ISCSI_TBL_SZ; in cnic_alloc_bnx2x_resc()
1252 cp->max_cid_space += dev->max_fcoe_conn; in cnic_alloc_bnx2x_resc()
1253 cp->fcoe_init_cid = ethdev->fcoe_init_cid; in cnic_alloc_bnx2x_resc()
1254 if (!cp->fcoe_init_cid) in cnic_alloc_bnx2x_resc()
1255 cp->fcoe_init_cid = 0x10; in cnic_alloc_bnx2x_resc()
1258 cp->iscsi_tbl = kcalloc(MAX_ISCSI_TBL_SZ, sizeof(struct cnic_iscsi), in cnic_alloc_bnx2x_resc()
1260 if (!cp->iscsi_tbl) in cnic_alloc_bnx2x_resc()
1263 cp->ctx_tbl = kcalloc(cp->max_cid_space, sizeof(struct cnic_context), in cnic_alloc_bnx2x_resc()
1265 if (!cp->ctx_tbl) in cnic_alloc_bnx2x_resc()
1269 cp->ctx_tbl[i].proto.iscsi = &cp->iscsi_tbl[i]; in cnic_alloc_bnx2x_resc()
1270 cp->ctx_tbl[i].ulp_proto_id = CNIC_ULP_ISCSI; in cnic_alloc_bnx2x_resc()
1273 for (i = MAX_ISCSI_TBL_SZ; i < cp->max_cid_space; i++) in cnic_alloc_bnx2x_resc()
1274 cp->ctx_tbl[i].ulp_proto_id = CNIC_ULP_FCOE; in cnic_alloc_bnx2x_resc()
1276 pages = CNIC_PAGE_ALIGN(cp->max_cid_space * CNIC_KWQ16_DATA_SIZE) / in cnic_alloc_bnx2x_resc()
1284 for (i = 0, j = 0; i < cp->max_cid_space; i++) { in cnic_alloc_bnx2x_resc()
1287 cp->ctx_tbl[i].kwqe_data = kwq_16_dma->pg_arr[j] + off; in cnic_alloc_bnx2x_resc()
1288 cp->ctx_tbl[i].kwqe_data_mapping = kwq_16_dma->pg_map_arr[j] + in cnic_alloc_bnx2x_resc()
1295 ret = cnic_alloc_kcq(dev, &cp->kcq1, false); in cnic_alloc_bnx2x_resc()
1300 ret = cnic_alloc_kcq(dev, &cp->kcq2, true); in cnic_alloc_bnx2x_resc()
1306 ret = cnic_alloc_dma(dev, &cp->gbl_buf_info, pages, 0); in cnic_alloc_bnx2x_resc()
1314 if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI) in cnic_alloc_bnx2x_resc()
1317 cp->bnx2x_def_status_blk = cp->ethdev->irq_arr[1].status_blk; in cnic_alloc_bnx2x_resc()
1319 cp->l2_rx_ring_size = 15; in cnic_alloc_bnx2x_resc()
1336 static inline u32 cnic_kwq_avail(struct cnic_local *cp) in cnic_kwq_avail() argument
1338 return cp->max_kwq_idx - in cnic_kwq_avail()
1339 ((cp->kwq_prod_idx - cp->kwq_con_idx) & cp->max_kwq_idx); in cnic_kwq_avail()
1345 struct cnic_local *cp = dev->cnic_priv; in cnic_submit_bnx2_kwqes() local
1352 spin_lock_bh(&cp->cnic_ulp_lock); in cnic_submit_bnx2_kwqes()
1353 if (num_wqes > cnic_kwq_avail(cp) && in cnic_submit_bnx2_kwqes()
1354 !test_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags)) { in cnic_submit_bnx2_kwqes()
1355 spin_unlock_bh(&cp->cnic_ulp_lock); in cnic_submit_bnx2_kwqes()
1359 clear_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags); in cnic_submit_bnx2_kwqes()
1361 prod = cp->kwq_prod_idx; in cnic_submit_bnx2_kwqes()
1364 prod_qe = &cp->kwq[KWQ_PG(sw_prod)][KWQ_IDX(sw_prod)]; in cnic_submit_bnx2_kwqes()
1369 cp->kwq_prod_idx = prod; in cnic_submit_bnx2_kwqes()
1371 CNIC_WR16(dev, cp->kwq_io_addr, cp->kwq_prod_idx); in cnic_submit_bnx2_kwqes()
1373 spin_unlock_bh(&cp->cnic_ulp_lock); in cnic_submit_bnx2_kwqes()
1377 static void *cnic_get_kwqe_16_data(struct cnic_local *cp, u32 l5_cid, in cnic_get_kwqe_16_data() argument
1380 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_get_kwqe_16_data()
1392 struct cnic_local *cp = dev->cnic_priv; in cnic_submit_kwqe_16() local
1414 spin_lock_bh(&cp->cnic_ulp_lock); in cnic_submit_kwqe_16()
1415 ret = cp->ethdev->drv_submit_kwqes_16(dev->netdev, kwq, 1); in cnic_submit_kwqe_16()
1416 spin_unlock_bh(&cp->cnic_ulp_lock); in cnic_submit_kwqe_16()
1427 struct cnic_local *cp = dev->cnic_priv; in cnic_reply_bnx2x_kcqes() local
1431 ulp_ops = rcu_dereference(cp->ulp_ops[ulp_type]); in cnic_reply_bnx2x_kcqes()
1433 ulp_ops->indicate_kcqes(cp->ulp_handle[ulp_type], in cnic_reply_bnx2x_kcqes()
1462 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_iscsi_init1() local
1468 cp->num_iscsi_tasks = req1->num_tasks_per_conn; in cnic_bnx2x_iscsi_init1()
1469 cp->num_ccells = req1->num_ccells_per_conn; in cnic_bnx2x_iscsi_init1()
1470 cp->task_array_size = BNX2X_ISCSI_TASK_CONTEXT_SIZE * in cnic_bnx2x_iscsi_init1()
1471 cp->num_iscsi_tasks; in cnic_bnx2x_iscsi_init1()
1472 cp->r2tq_size = cp->num_iscsi_tasks * BNX2X_ISCSI_MAX_PENDING_R2TS * in cnic_bnx2x_iscsi_init1()
1474 cp->hq_size = cp->num_ccells * BNX2X_ISCSI_HQ_BD_SIZE; in cnic_bnx2x_iscsi_init1()
1475 pages = CNIC_PAGE_ALIGN(cp->hq_size) / CNIC_PAGE_SIZE; in cnic_bnx2x_iscsi_init1()
1477 cp->num_cqs = req1->num_cqs; in cnic_bnx2x_iscsi_init1()
1509 cp->num_iscsi_tasks * BNX2X_ISCSI_MAX_PENDING_R2TS); in cnic_bnx2x_iscsi_init1()
1524 cp->num_iscsi_tasks * BNX2X_ISCSI_MAX_PENDING_R2TS); in cnic_bnx2x_iscsi_init1()
1590 struct cnic_local *cp = dev->cnic_priv; in cnic_free_bnx2x_conn_resc() local
1591 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_free_bnx2x_conn_resc()
1599 cnic_free_id(&cp->cid_tbl, ctx->cid); in cnic_free_bnx2x_conn_resc()
1601 cnic_free_id(&cp->fcoe_cid_tbl, ctx->cid); in cnic_free_bnx2x_conn_resc()
1611 struct cnic_local *cp = dev->cnic_priv; in cnic_alloc_bnx2x_conn_resc() local
1612 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_alloc_bnx2x_conn_resc()
1616 cid = cnic_alloc_new_id(&cp->fcoe_cid_tbl); in cnic_alloc_bnx2x_conn_resc()
1625 cid = cnic_alloc_new_id(&cp->cid_tbl); in cnic_alloc_bnx2x_conn_resc()
1632 pages = CNIC_PAGE_ALIGN(cp->task_array_size) / CNIC_PAGE_SIZE; in cnic_alloc_bnx2x_conn_resc()
1638 pages = CNIC_PAGE_ALIGN(cp->r2tq_size) / CNIC_PAGE_SIZE; in cnic_alloc_bnx2x_conn_resc()
1643 pages = CNIC_PAGE_ALIGN(cp->hq_size) / CNIC_PAGE_SIZE; in cnic_alloc_bnx2x_conn_resc()
1658 struct cnic_local *cp = dev->cnic_priv; in cnic_get_bnx2x_ctx() local
1659 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_get_bnx2x_ctx()
1660 int blk = (cid - ethdev->starting_cid) / cp->cids_per_blk; in cnic_get_bnx2x_ctx()
1661 int off = (cid - ethdev->starting_cid) % cp->cids_per_blk; in cnic_get_bnx2x_ctx()
1666 if (cp->ctx_align) { in cnic_get_bnx2x_ctx()
1667 unsigned long mask = cp->ctx_align - 1; in cnic_get_bnx2x_ctx()
1669 if (cp->ctx_arr[blk].mapping & mask) in cnic_get_bnx2x_ctx()
1670 align_off = cp->ctx_align - in cnic_get_bnx2x_ctx()
1671 (cp->ctx_arr[blk].mapping & mask); in cnic_get_bnx2x_ctx()
1673 ctx_map = cp->ctx_arr[blk].mapping + align_off + in cnic_get_bnx2x_ctx()
1675 ctx = cp->ctx_arr[blk].ctx + align_off + in cnic_get_bnx2x_ctx()
1688 struct cnic_local *cp = dev->cnic_priv; in cnic_setup_bnx2x_ctx() local
1695 struct cnic_context *ctx = &cp->ctx_tbl[req1->iscsi_conn_id]; in cnic_setup_bnx2x_ctx()
1807 for (i = 1, j = 1; i < cp->num_cqs; i++, j++) { in cnic_setup_bnx2x_ctx()
1830 ictx->ustorm_st_context.num_cqs = cp->num_cqs; in cnic_setup_bnx2x_ctx()
1854 ictx->cstorm_st_context.cq_proc_en_bit_map = (1 << cp->num_cqs) - 1; in cnic_setup_bnx2x_ctx()
1855 for (i = 0; i < cp->num_cqs; i++) { in cnic_setup_bnx2x_ctx()
1877 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_iscsi_ofld1() local
1907 ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_iscsi_ofld1()
1914 if (atomic_inc_return(&cp->iscsi_conn) > dev->max_iscsi_conn) { in cnic_bnx2x_iscsi_ofld1()
1915 atomic_dec(&cp->iscsi_conn); in cnic_bnx2x_iscsi_ofld1()
1920 atomic_dec(&cp->iscsi_conn); in cnic_bnx2x_iscsi_ofld1()
1926 atomic_dec(&cp->iscsi_conn); in cnic_bnx2x_iscsi_ofld1()
1931 kcqe.iscsi_conn_context_id = BNX2X_HW_CID(bp, cp->ctx_tbl[l5_cid].cid); in cnic_bnx2x_iscsi_ofld1()
1942 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_iscsi_update() local
1950 if (cnic_get_l5_cid(cp, cid, &l5_cid) != 0) in cnic_bnx2x_iscsi_update()
1953 data = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data); in cnic_bnx2x_iscsi_update()
1966 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_destroy_ramrod() local
1968 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_destroy_ramrod()
1992 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_iscsi_destroy() local
1996 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_iscsi_destroy()
2011 queue_delayed_work(cnic_wq, &cp->delete_task, delta); in cnic_bnx2x_iscsi_destroy()
2021 atomic_dec(&cp->iscsi_conn); in cnic_bnx2x_iscsi_destroy()
2121 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_connect() local
2130 struct cnic_sock *csk = &cp->csk_tbl[l5_cid]; in cnic_bnx2x_connect()
2131 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_connect()
2153 conn_buf = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data); in cnic_bnx2x_connect()
2259 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_stat() local
2265 cid = BNX2X_HW_CID(bp, cp->fcoe_init_cid); in cnic_bnx2x_fcoe_stat()
2267 fcoe_stat = cnic_get_kwqe_16_data(cp, BNX2X_FCOE_L5_CID_BASE, &l5_data); in cnic_bnx2x_fcoe_stat()
2283 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_init1() local
2312 fcoe_init = cnic_get_kwqe_16_data(cp, BNX2X_FCOE_L5_CID_BASE, &l5_data); in cnic_bnx2x_fcoe_init1()
2320 fcoe_init->eq_pbl_base.lo = cp->kcq2.dma.pgtbl_map & 0xffffffff; in cnic_bnx2x_fcoe_init1()
2321 fcoe_init->eq_pbl_base.hi = (u64) cp->kcq2.dma.pgtbl_map >> 32; in cnic_bnx2x_fcoe_init1()
2322 fcoe_init->eq_pbl_size = cp->kcq2.dma.num_pages; in cnic_bnx2x_fcoe_init1()
2324 fcoe_init->sb_num = cp->status_blk_num; in cnic_bnx2x_fcoe_init1()
2327 cp->kcq2.sw_prod_idx = 0; in cnic_bnx2x_fcoe_init1()
2329 cid = BNX2X_HW_CID(bp, cp->fcoe_init_cid); in cnic_bnx2x_fcoe_init1()
2341 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_ofld1() local
2372 ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_fcoe_ofld1()
2399 fcoe_offload = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data); in cnic_bnx2x_fcoe_ofld1()
2438 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_enable() local
2448 fcoe_enable = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data); in cnic_bnx2x_fcoe_enable()
2466 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_disable() local
2480 fcoe_disable = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data); in cnic_bnx2x_fcoe_disable()
2497 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_destroy() local
2510 ctx = &cp->ctx_tbl[l5_cid]; in cnic_bnx2x_fcoe_destroy()
2527 queue_delayed_work(cnic_wq, &cp->delete_task, msecs_to_jiffies(2000)); in cnic_bnx2x_fcoe_destroy()
2540 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_delete_wait() local
2543 for (i = start_cid; i < cp->max_cid_space; i++) { in cnic_bnx2x_delete_wait()
2544 struct cnic_context *ctx = &cp->ctx_tbl[i]; in cnic_bnx2x_delete_wait()
2565 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_fcoe_fw_destroy() local
2572 cid = BNX2X_HW_CID(bp, cp->fcoe_init_cid); in cnic_bnx2x_fcoe_fw_destroy()
2582 struct cnic_local *cp = dev->cnic_priv; in cnic_bnx2x_kwqe_err() local
2625 cnic_get_l5_cid(cp, BNX2X_SW_CID(cid), &kcqe.kcqe_info0); in cnic_bnx2x_kwqe_err()
2644 cnic_get_l5_cid(cp, BNX2X_SW_CID(cid), &l4kcqe->conn_id); in cnic_bnx2x_kwqe_err()
2828 struct cnic_local *cp = dev->cnic_priv; in service_kcqes() local
2836 u32 kcqe_op_flag = cp->completed_kcq[i]->kcqe_op_flag; in service_kcqes()
2843 u32 next_op = cp->completed_kcq[i + j]->kcqe_op_flag; in service_kcqes()
2870 ulp_ops = rcu_dereference(cp->ulp_ops[ulp_type]); in service_kcqes()
2872 ulp_ops->indicate_kcqes(cp->ulp_handle[ulp_type], in service_kcqes()
2873 cp->completed_kcq + i, j); in service_kcqes()
2887 struct cnic_local *cp = dev->cnic_priv; in cnic_get_kcqes() local
2899 cp->completed_kcq[kcqe_cnt++] = kcqe; in cnic_get_kcqes()
2912 static int cnic_l2_completion(struct cnic_local *cp) in cnic_l2_completion() argument
2915 struct cnic_uio_dev *udev = cp->udev; in cnic_l2_completion()
2921 if (!test_bit(CNIC_F_BNX2X_CLASS, &cp->dev->flags)) in cnic_l2_completion()
2924 hw_cons = *cp->rx_cons_ptr; in cnic_l2_completion()
2928 sw_cons = cp->rx_cons; in cnic_l2_completion()
2946 static void cnic_chk_pkt_rings(struct cnic_local *cp) in cnic_chk_pkt_rings() argument
2951 if (!test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags)) in cnic_chk_pkt_rings()
2954 rx_cons = *cp->rx_cons_ptr; in cnic_chk_pkt_rings()
2955 tx_cons = *cp->tx_cons_ptr; in cnic_chk_pkt_rings()
2956 if (cp->tx_cons != tx_cons || cp->rx_cons != rx_cons) { in cnic_chk_pkt_rings()
2957 if (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags)) in cnic_chk_pkt_rings()
2958 comp = cnic_l2_completion(cp); in cnic_chk_pkt_rings()
2960 cp->tx_cons = tx_cons; in cnic_chk_pkt_rings()
2961 cp->rx_cons = rx_cons; in cnic_chk_pkt_rings()
2963 if (cp->udev) in cnic_chk_pkt_rings()
2964 uio_event_notify(&cp->udev->cnic_uinfo); in cnic_chk_pkt_rings()
2967 clear_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags); in cnic_chk_pkt_rings()
2972 struct cnic_local *cp = dev->cnic_priv; in cnic_service_bnx2_queues() local
2973 u32 status_idx = (u16) *cp->kcq1.status_idx_ptr; in cnic_service_bnx2_queues()
2978 cp->kwq_con_idx = *cp->kwq_con_idx_ptr; in cnic_service_bnx2_queues()
2980 while ((kcqe_cnt = cnic_get_kcqes(dev, &cp->kcq1))) { in cnic_service_bnx2_queues()
2986 status_idx = (u16) *cp->kcq1.status_idx_ptr; in cnic_service_bnx2_queues()
2989 cp->kwq_con_idx = *cp->kwq_con_idx_ptr; in cnic_service_bnx2_queues()
2992 CNIC_WR16(dev, cp->kcq1.io_addr, cp->kcq1.sw_prod_idx); in cnic_service_bnx2_queues()
2994 cnic_chk_pkt_rings(cp); in cnic_service_bnx2_queues()
3014 struct cnic_local *cp = from_tasklet(cp, t, cnic_irq_task); in cnic_service_bnx2_msix() local
3015 struct cnic_dev *dev = cp->dev; in cnic_service_bnx2_msix()
3017 cp->last_status_idx = cnic_service_bnx2_queues(dev); in cnic_service_bnx2_msix()
3019 CNIC_WR(dev, BNX2_PCICFG_INT_ACK_CMD, cp->int_num | in cnic_service_bnx2_msix()
3020 BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | cp->last_status_idx); in cnic_service_bnx2_msix()
3025 struct cnic_local *cp = dev->cnic_priv; in cnic_doirq() local
3028 u16 prod = cp->kcq1.sw_prod_idx & MAX_KCQ_IDX; in cnic_doirq()
3030 prefetch(cp->status_blk.gen); in cnic_doirq()
3031 prefetch(&cp->kcq1.kcq[KCQ_PG(prod)][KCQ_IDX(prod)]); in cnic_doirq()
3033 tasklet_schedule(&cp->cnic_irq_task); in cnic_doirq()
3040 struct cnic_local *cp = dev->cnic_priv; in cnic_irq() local
3042 if (cp->ack_int) in cnic_irq()
3043 cp->ack_int(dev); in cnic_irq()
3086 struct cnic_local *cp = dev->cnic_priv; in cnic_ack_bnx2x_msix() local
3088 cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, CSTORM_ID, 0, in cnic_ack_bnx2x_msix()
3094 struct cnic_local *cp = dev->cnic_priv; in cnic_ack_bnx2x_e2_msix() local
3096 cnic_ack_igu_sb(dev, cp->bnx2x_igu_sb_id, IGU_SEG_ACCESS_DEF, 0, in cnic_ack_bnx2x_e2_msix()
3102 struct cnic_local *cp = dev->cnic_priv; in cnic_arm_bnx2x_msix() local
3104 cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, CSTORM_ID, idx, in cnic_arm_bnx2x_msix()
3110 struct cnic_local *cp = dev->cnic_priv; in cnic_arm_bnx2x_e2_msix() local
3112 cnic_ack_igu_sb(dev, cp->bnx2x_igu_sb_id, IGU_SEG_ACCESS_DEF, idx, in cnic_arm_bnx2x_e2_msix()
3139 struct cnic_local *cp = from_tasklet(cp, t, cnic_irq_task); in cnic_service_bnx2x_bh() local
3140 struct cnic_dev *dev = cp->dev; in cnic_service_bnx2x_bh()
3148 status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq1); in cnic_service_bnx2x_bh()
3150 CNIC_WR16(dev, cp->kcq1.io_addr, in cnic_service_bnx2x_bh()
3151 cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); in cnic_service_bnx2x_bh()
3154 cp->arm_int(dev, status_idx); in cnic_service_bnx2x_bh()
3158 new_status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq2); in cnic_service_bnx2x_bh()
3163 CNIC_WR16(dev, cp->kcq2.io_addr, cp->kcq2.sw_prod_idx + in cnic_service_bnx2x_bh()
3166 cnic_ack_igu_sb(dev, cp->bnx2x_igu_sb_id, IGU_SEG_ACCESS_DEF, in cnic_service_bnx2x_bh()
3176 struct cnic_local *cp = dev->cnic_priv; in cnic_service_bnx2x() local
3178 if (!(cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX)) in cnic_service_bnx2x()
3181 cnic_chk_pkt_rings(cp); in cnic_service_bnx2x()
3186 static void cnic_ulp_stop_one(struct cnic_local *cp, int if_type) in cnic_ulp_stop_one() argument
3191 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); in cnic_ulp_stop_one()
3194 ulp_ops = rcu_dereference_protected(cp->ulp_ops[if_type], in cnic_ulp_stop_one()
3200 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_ulp_stop_one()
3203 if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type])) in cnic_ulp_stop_one()
3204 ulp_ops->cnic_stop(cp->ulp_handle[if_type]); in cnic_ulp_stop_one()
3206 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_ulp_stop_one()
3211 struct cnic_local *cp = dev->cnic_priv; in cnic_ulp_stop() local
3215 cnic_ulp_stop_one(cp, if_type); in cnic_ulp_stop()
3220 struct cnic_local *cp = dev->cnic_priv; in cnic_ulp_start() local
3227 ulp_ops = rcu_dereference_protected(cp->ulp_ops[if_type], in cnic_ulp_start()
3233 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_ulp_start()
3236 if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type])) in cnic_ulp_start()
3237 ulp_ops->cnic_start(cp->ulp_handle[if_type]); in cnic_ulp_start()
3239 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_ulp_start()
3245 struct cnic_local *cp = dev->cnic_priv; in cnic_copy_ulp_stats() local
3250 ulp_ops = rcu_dereference_protected(cp->ulp_ops[ulp_type], in cnic_copy_ulp_stats()
3253 rc = ulp_ops->cnic_get_stats(cp->ulp_handle[ulp_type]); in cnic_copy_ulp_stats()
3283 struct cnic_local *cp = dev->cnic_priv; in cnic_ctl() local
3284 set_bit(CNIC_LCL_FL_STOP_ISCSI, &cp->cnic_local_flags); in cnic_ctl()
3285 queue_delayed_work(cnic_wq, &cp->delete_task, 0); in cnic_ctl()
3292 struct cnic_local *cp = dev->cnic_priv; in cnic_ctl() local
3297 if (cnic_get_l5_cid(cp, cid, &l5_cid) == 0) { in cnic_ctl()
3298 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_ctl()
3330 struct cnic_local *cp = dev->cnic_priv; in cnic_ulp_init() local
3344 if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i])) in cnic_ulp_init()
3354 struct cnic_local *cp = dev->cnic_priv; in cnic_ulp_exit() local
3368 if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i])) in cnic_ulp_exit()
3584 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_create() local
3590 if (cp->ctx_tbl) { in cnic_cm_create()
3591 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_cm_create()
3597 csk1 = &cp->csk_tbl[l5_cid]; in cnic_cm_create()
3629 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_cleanup() local
3631 cnic_free_id(&cp->csk_port_tbl, be16_to_cpu(csk->src_port)); in cnic_cm_cleanup()
3751 struct cnic_local *cp = dev->cnic_priv; in cnic_resolve_addr() local
3753 return cnic_send_nlmsg(cp, ISCSI_KEVENT_PATH_REQ, csk); in cnic_resolve_addr()
3759 struct cnic_local *cp = dev->cnic_priv; in cnic_get_route() local
3807 if (cnic_alloc_id(&cp->csk_port_tbl, port_id)) in cnic_get_route()
3813 port_id = cnic_alloc_new_id(&cp->csk_port_tbl); in cnic_get_route()
3836 struct cnic_local *cp = csk->dev->cnic_priv; in cnic_cm_connect() local
3839 if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI) in cnic_cm_connect()
3865 struct cnic_local *cp = csk->dev->cnic_priv; in cnic_cm_abort() local
3878 cp->close_conn(csk, opcode); in cnic_cm_abort()
3908 static void cnic_cm_upcall(struct cnic_local *cp, struct cnic_sock *csk, in cnic_cm_upcall() argument
3915 ulp_ops = rcu_dereference(cp->ulp_ops[ulp_type]); in cnic_cm_upcall()
3944 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_process_offld_pg() local
3947 struct cnic_sock *csk = &cp->csk_tbl[l5_cid]; in cnic_cm_process_offld_pg()
3960 cnic_cm_upcall(cp, csk, in cnic_cm_process_offld_pg()
3975 struct cnic_local *cp = dev->cnic_priv; in cnic_process_fcoe_term_conn() local
3978 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; in cnic_process_fcoe_term_conn()
3987 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_process_kcqe() local
4009 csk = &cp->csk_tbl[l5_cid]; in cnic_cm_process_kcqe()
4021 cnic_cm_upcall(cp, csk, in cnic_cm_process_kcqe()
4034 cnic_cm_upcall(cp, csk, opcode); in cnic_cm_process_kcqe()
4056 cp->close_conn(csk, opcode); in cnic_cm_process_kcqe()
4064 cp->close_conn(csk, L4_KCQE_OPCODE_VALUE_RESET_COMP); in cnic_cm_process_kcqe()
4066 cnic_cm_upcall(cp, csk, opcode); in cnic_cm_process_kcqe()
4087 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_free_mem() local
4089 kvfree(cp->csk_tbl); in cnic_cm_free_mem()
4090 cp->csk_tbl = NULL; in cnic_cm_free_mem()
4091 cnic_free_id_tbl(&cp->csk_port_tbl); in cnic_cm_free_mem()
4096 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_alloc_mem() local
4100 cp->csk_tbl = kvcalloc(MAX_CM_SK_TBL_SZ, sizeof(struct cnic_sock), in cnic_cm_alloc_mem()
4102 if (!cp->csk_tbl) in cnic_cm_alloc_mem()
4106 atomic_set(&cp->csk_tbl[i].ref_count, 0); in cnic_cm_alloc_mem()
4110 if (cnic_init_id_tbl(&cp->csk_port_tbl, CNIC_LOCAL_PORT_RANGE, in cnic_cm_alloc_mem()
4147 struct cnic_local *cp = dev->cnic_priv; in cnic_close_bnx2_conn() local
4150 cnic_cm_upcall(cp, csk, opcode); in cnic_close_bnx2_conn()
4157 cnic_cm_upcall(cp, csk, opcode); in cnic_close_bnx2_conn()
4176 struct cnic_local *cp = dev->cnic_priv; in cnic_close_bnx2x_conn() local
4177 struct cnic_context *ctx = &cp->ctx_tbl[csk->l5_cid]; in cnic_close_bnx2x_conn()
4210 cnic_cm_upcall(cp, csk, csk->state); in cnic_close_bnx2x_conn()
4216 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_stop_bnx2x_hw() local
4218 if (!cp->ctx_tbl) in cnic_cm_stop_bnx2x_hw()
4226 cancel_delayed_work(&cp->delete_task); in cnic_cm_stop_bnx2x_hw()
4229 if (atomic_read(&cp->iscsi_conn) != 0) in cnic_cm_stop_bnx2x_hw()
4231 atomic_read(&cp->iscsi_conn)); in cnic_cm_stop_bnx2x_hw()
4268 struct cnic_local *cp; in cnic_delete_task() local
4273 cp = container_of(work, struct cnic_local, delete_task.work); in cnic_delete_task()
4274 dev = cp->dev; in cnic_delete_task()
4276 if (test_and_clear_bit(CNIC_LCL_FL_STOP_ISCSI, &cp->cnic_local_flags)) { in cnic_delete_task()
4279 cnic_ulp_stop_one(cp, CNIC_ULP_ISCSI); in cnic_delete_task()
4283 cp->ethdev->drv_ctl(dev->netdev, &info); in cnic_delete_task()
4286 for (i = 0; i < cp->max_cid_space; i++) { in cnic_delete_task()
4287 struct cnic_context *ctx = &cp->ctx_tbl[i]; in cnic_delete_task()
4307 atomic_dec(&cp->iscsi_conn); in cnic_delete_task()
4314 queue_delayed_work(cnic_wq, &cp->delete_task, in cnic_delete_task()
4321 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_open() local
4328 err = cp->start_cm(dev); in cnic_cm_open()
4333 INIT_DELAYED_WORK(&cp->delete_task, cnic_delete_task); in cnic_cm_open()
4342 cp->ulp_handle[CNIC_ULP_L4] = dev; in cnic_cm_open()
4343 rcu_assign_pointer(cp->ulp_ops[CNIC_ULP_L4], &cm_ulp_ops); in cnic_cm_open()
4353 struct cnic_local *cp = dev->cnic_priv; in cnic_cm_shutdown() local
4356 if (!cp->csk_tbl) in cnic_cm_shutdown()
4360 struct cnic_sock *csk = &cp->csk_tbl[i]; in cnic_cm_shutdown()
4383 struct cnic_local *cp = dev->cnic_priv; in cnic_setup_5709_context() local
4387 if (BNX2_CHIP(cp) != BNX2_CHIP_5709) in cnic_setup_5709_context()
4390 for (i = 0; i < cp->ctx_blks; i++) { in cnic_setup_5709_context()
4392 u32 idx = cp->ctx_arr[i].cid / cp->cids_per_blk; in cnic_setup_5709_context()
4395 memset(cp->ctx_arr[i].ctx, 0, CNIC_PAGE_SIZE); in cnic_setup_5709_context()
4398 (cp->ctx_arr[i].mapping & 0xffffffff) | valid_bit); in cnic_setup_5709_context()
4400 (u64) cp->ctx_arr[i].mapping >> 32); in cnic_setup_5709_context()
4420 struct cnic_local *cp = dev->cnic_priv; in cnic_free_irq() local
4421 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_free_irq()
4424 cp->disable_int_sync(dev); in cnic_free_irq()
4425 tasklet_kill(&cp->cnic_irq_task); in cnic_free_irq()
4432 struct cnic_local *cp = dev->cnic_priv; in cnic_request_irq() local
4433 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_request_irq()
4438 tasklet_disable(&cp->cnic_irq_task); in cnic_request_irq()
4445 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2_irq() local
4446 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_init_bnx2_irq()
4450 int sblk_num = cp->status_blk_num; in cnic_init_bnx2_irq()
4460 cp->last_status_idx = cp->status_blk.bnx2->status_idx; in cnic_init_bnx2_irq()
4461 tasklet_setup(&cp->cnic_irq_task, cnic_service_bnx2_msix); in cnic_init_bnx2_irq()
4466 while (cp->status_blk.bnx2->status_completion_producer_index && in cnic_init_bnx2_irq()
4474 if (cp->status_blk.bnx2->status_completion_producer_index) { in cnic_init_bnx2_irq()
4480 struct status_block *sblk = cp->status_blk.gen; in cnic_init_bnx2_irq()
4504 struct cnic_local *cp = dev->cnic_priv; in cnic_enable_bnx2_int() local
4505 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_enable_bnx2_int()
4510 CNIC_WR(dev, BNX2_PCICFG_INT_ACK_CMD, cp->int_num | in cnic_enable_bnx2_int()
4511 BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | cp->last_status_idx); in cnic_enable_bnx2_int()
4516 struct cnic_local *cp = dev->cnic_priv; in cnic_disable_bnx2_int_sync() local
4517 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_disable_bnx2_int_sync()
4522 CNIC_WR(dev, BNX2_PCICFG_INT_ACK_CMD, cp->int_num | in cnic_disable_bnx2_int_sync()
4530 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2_tx_ring() local
4531 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_init_bnx2_tx_ring()
4532 struct cnic_uio_dev *udev = cp->udev; in cnic_init_bnx2_tx_ring()
4538 struct status_block *s_blk = cp->status_blk.gen; in cnic_init_bnx2_tx_ring()
4540 sb_id = cp->status_blk_num; in cnic_init_bnx2_tx_ring()
4542 cp->tx_cons_ptr = &s_blk->status_tx_quick_consumer_index2; in cnic_init_bnx2_tx_ring()
4544 struct status_block_msix *sblk = cp->status_blk.bnx2; in cnic_init_bnx2_tx_ring()
4549 cp->tx_cons_ptr = &sblk->status_tx_quick_consumer_index; in cnic_init_bnx2_tx_ring()
4551 cp->tx_cons = *cp->tx_cons_ptr; in cnic_init_bnx2_tx_ring()
4554 if (BNX2_CHIP(cp) == BNX2_CHIP_5709) { in cnic_init_bnx2_tx_ring()
4597 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2_rx_ring() local
4598 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_init_bnx2_rx_ring()
4599 struct cnic_uio_dev *udev = cp->udev; in cnic_init_bnx2_rx_ring()
4603 struct status_block *s_blk = cp->status_blk.gen; in cnic_init_bnx2_rx_ring()
4606 sb_id = cp->status_blk_num; in cnic_init_bnx2_rx_ring()
4608 cp->rx_cons_ptr = &s_blk->status_rx_quick_consumer_index2; in cnic_init_bnx2_rx_ring()
4612 struct status_block_msix *sblk = cp->status_blk.bnx2; in cnic_init_bnx2_rx_ring()
4614 cp->rx_cons_ptr = &sblk->status_rx_quick_consumer_index; in cnic_init_bnx2_rx_ring()
4619 while (!(*cp->rx_cons_ptr != 0) && i < 10) { in cnic_init_bnx2_rx_ring()
4625 cp->rx_cons = *cp->rx_cons_ptr; in cnic_init_bnx2_rx_ring()
4641 int n = (i % cp->l2_rx_ring_size) + 1; in cnic_init_bnx2_rx_ring()
4643 buf_map = udev->l2_buf_map + (n * cp->l2_single_buf_size); in cnic_init_bnx2_rx_ring()
4644 rxbd->rx_bd_len = cp->l2_single_buf_size; in cnic_init_bnx2_rx_ring()
4675 struct cnic_local *cp = dev->cnic_priv; in cnic_set_bnx2_mac() local
4678 val = cp->func << 2; in cnic_set_bnx2_mac()
4680 cp->shmem_base = cnic_reg_rd_ind(dev, BNX2_SHM_HDR_ADDR_0 + val); in cnic_set_bnx2_mac()
4682 val = cnic_reg_rd_ind(dev, cp->shmem_base + in cnic_set_bnx2_mac()
4689 val = cnic_reg_rd_ind(dev, cp->shmem_base + in cnic_set_bnx2_mac()
4699 if (BNX2_CHIP(cp) != BNX2_CHIP_5709) in cnic_set_bnx2_mac()
4709 struct cnic_local *cp = dev->cnic_priv; in cnic_start_bnx2_hw() local
4710 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_start_bnx2_hw()
4711 struct status_block *sblk = cp->status_blk.gen; in cnic_start_bnx2_hw()
4738 cp->kwq_io_addr = MB_GET_CID_ADDR(KWQ_CID) + L5_KRNLQ_HOST_QIDX; in cnic_start_bnx2_hw()
4740 cp->max_kwq_idx = MAX_KWQ_IDX; in cnic_start_bnx2_hw()
4741 cp->kwq_prod_idx = 0; in cnic_start_bnx2_hw()
4742 cp->kwq_con_idx = 0; in cnic_start_bnx2_hw()
4743 set_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags); in cnic_start_bnx2_hw()
4745 if (BNX2_CHIP(cp) == BNX2_CHIP_5706 || BNX2_CHIP(cp) == BNX2_CHIP_5708) in cnic_start_bnx2_hw()
4746 cp->kwq_con_idx_ptr = &sblk->status_rx_quick_consumer_index15; in cnic_start_bnx2_hw()
4748 cp->kwq_con_idx_ptr = &sblk->status_cmd_consumer_index; in cnic_start_bnx2_hw()
4761 val = (u32) ((u64) cp->kwq_info.pgtbl_map >> 32); in cnic_start_bnx2_hw()
4764 val = (u32) cp->kwq_info.pgtbl_map; in cnic_start_bnx2_hw()
4768 cp->kcq1.io_addr = MB_GET_CID_ADDR(KCQ_CID) + L5_KRNLQ_HOST_QIDX; in cnic_start_bnx2_hw()
4770 cp->kcq1.sw_prod_idx = 0; in cnic_start_bnx2_hw()
4771 cp->kcq1.hw_prod_idx_ptr = in cnic_start_bnx2_hw()
4774 cp->kcq1.status_idx_ptr = &sblk->status_idx; in cnic_start_bnx2_hw()
4787 val = (u32) ((u64) cp->kcq1.dma.pgtbl_map >> 32); in cnic_start_bnx2_hw()
4790 val = (u32) cp->kcq1.dma.pgtbl_map; in cnic_start_bnx2_hw()
4793 cp->int_num = 0; in cnic_start_bnx2_hw()
4795 struct status_block_msix *msblk = cp->status_blk.bnx2; in cnic_start_bnx2_hw()
4796 u32 sb_id = cp->status_blk_num; in cnic_start_bnx2_hw()
4799 cp->kcq1.hw_prod_idx_ptr = in cnic_start_bnx2_hw()
4801 cp->kcq1.status_idx_ptr = &msblk->status_idx; in cnic_start_bnx2_hw()
4802 cp->kwq_con_idx_ptr = &msblk->status_cmd_consumer_index; in cnic_start_bnx2_hw()
4803 cp->int_num = sb_id << BNX2_PCICFG_INT_ACK_CMD_INT_NUM_SHIFT; in cnic_start_bnx2_hw()
4821 /* Set the CP and COM doorbells. These two processors polls the in cnic_start_bnx2_hw()
4845 struct cnic_local *cp = dev->cnic_priv; in cnic_setup_bnx2x_context() local
4846 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_setup_bnx2x_context()
4850 for (i = 0; i < cp->ctx_blks; i++) { in cnic_setup_bnx2x_context()
4851 struct cnic_ctx *ctx = &cp->ctx_arr[i]; in cnic_setup_bnx2x_context()
4854 if (cp->ctx_align) { in cnic_setup_bnx2x_context()
4855 unsigned long mask = cp->ctx_align - 1; in cnic_setup_bnx2x_context()
4866 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2x_irq() local
4867 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_init_bnx2x_irq()
4870 tasklet_setup(&cp->cnic_irq_task, cnic_service_bnx2x_bh); in cnic_init_bnx2x_irq()
4898 struct cnic_local *cp = dev->cnic_priv; in cnic_enable_bnx2x_int() local
4900 u8 sb_id = cp->status_blk_num; in cnic_enable_bnx2x_int()
4917 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2x_tx_ring() local
4919 struct cnic_uio_dev *udev = cp->udev; in cnic_init_bnx2x_tx_ring()
4922 struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; in cnic_init_bnx2x_tx_ring()
4924 u32 cli = cp->ethdev->iscsi_l2_client_id; in cnic_init_bnx2x_tx_ring()
4976 cp->tx_cons_ptr = in cnic_init_bnx2x_tx_ring()
4983 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2x_rx_ring() local
4985 struct cnic_uio_dev *udev = cp->udev; in cnic_init_bnx2x_rx_ring()
4990 struct host_sp_status_block *sb = cp->bnx2x_def_status_blk; in cnic_init_bnx2x_rx_ring()
4992 u32 cli = cp->ethdev->iscsi_l2_client_id; in cnic_init_bnx2x_rx_ring()
5001 data->general.mtu = cpu_to_le16(cp->l2_single_buf_size - 14); in cnic_init_bnx2x_rx_ring()
5006 int n = (i % cp->l2_rx_ring_size) + 1; in cnic_init_bnx2x_rx_ring()
5008 buf_map = udev->l2_buf_map + (n * cp->l2_single_buf_size); in cnic_init_bnx2x_rx_ring()
5037 data->rx.max_bytes_on_bd = cpu_to_le16(cp->l2_single_buf_size); in cnic_init_bnx2x_rx_ring()
5043 cp->rx_cons_ptr = in cnic_init_bnx2x_rx_ring()
5045 cp->rx_cons = *cp->rx_cons_ptr; in cnic_init_bnx2x_rx_ring()
5050 struct cnic_local *cp = dev->cnic_priv; in cnic_init_bnx2x_kcq() local
5054 cp->kcq1.io_addr = BAR_CSTRORM_INTMEM + in cnic_init_bnx2x_kcq()
5056 cp->kcq1.sw_prod_idx = 0; in cnic_init_bnx2x_kcq()
5059 struct host_hc_status_block_e2 *sb = cp->status_blk.gen; in cnic_init_bnx2x_kcq()
5061 cp->kcq1.hw_prod_idx_ptr = in cnic_init_bnx2x_kcq()
5063 cp->kcq1.status_idx_ptr = in cnic_init_bnx2x_kcq()
5066 struct host_hc_status_block_e1x *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()
5075 struct host_hc_status_block_e2 *sb = cp->status_blk.gen; in cnic_init_bnx2x_kcq()
5077 cp->kcq2.io_addr = BAR_USTRORM_INTMEM + in cnic_init_bnx2x_kcq()
5079 cp->kcq2.sw_prod_idx = 0; in cnic_init_bnx2x_kcq()
5080 cp->kcq2.hw_prod_idx_ptr = in cnic_init_bnx2x_kcq()
5082 cp->kcq2.status_idx_ptr = in cnic_init_bnx2x_kcq()
5089 struct cnic_local *cp = dev->cnic_priv; in cnic_start_bnx2x_hw() local
5091 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_start_bnx2x_hw()
5096 cp->func = bp->pf_num; in cnic_start_bnx2x_hw()
5100 ret = cnic_init_id_tbl(&cp->cid_tbl, MAX_ISCSI_TBL_SZ, in cnic_start_bnx2x_hw()
5101 cp->iscsi_start_cid, 0); in cnic_start_bnx2x_hw()
5107 ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl, dev->max_fcoe_conn, in cnic_start_bnx2x_hw()
5108 cp->fcoe_start_cid, 0); in cnic_start_bnx2x_hw()
5114 cp->bnx2x_igu_sb_id = ethdev->irq_arr[0].status_blk_num2; in cnic_start_bnx2x_hw()
5119 CNIC_WR16(dev, cp->kcq1.io_addr, MAX_KCQ_IDX); in cnic_start_bnx2x_hw()
5124 cp->kcq1.dma.pg_map_arr[1] & 0xffffffff); in cnic_start_bnx2x_hw()
5127 (u64) cp->kcq1.dma.pg_map_arr[1] >> 32); in cnic_start_bnx2x_hw()
5130 cp->kcq1.dma.pg_map_arr[0] & 0xffffffff); in cnic_start_bnx2x_hw()
5133 (u64) cp->kcq1.dma.pg_map_arr[0] >> 32); in cnic_start_bnx2x_hw()
5137 CSTORM_ISCSI_EQ_SB_NUM_OFFSET(pfid, 0), cp->status_blk_num); in cnic_start_bnx2x_hw()
5144 cp->gbl_buf_info.pg_map_arr[0] & 0xffffffff); in cnic_start_bnx2x_hw()
5147 (u64) cp->gbl_buf_info.pg_map_arr[0] >> 32); in cnic_start_bnx2x_hw()
5164 struct cnic_local *cp = dev->cnic_priv; in cnic_init_rings() local
5166 struct cnic_uio_dev *udev = cp->udev; in cnic_init_rings()
5168 if (test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags)) in cnic_init_rings()
5174 set_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); in cnic_init_rings()
5176 u32 cli = cp->ethdev->iscsi_l2_client_id; in cnic_init_rings()
5177 u32 cid = cp->ethdev->iscsi_l2_cid; in cnic_init_rings()
5198 set_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags); in cnic_init_rings()
5213 set_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); in cnic_init_rings()
5219 while (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags) && in cnic_init_rings()
5223 if (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags)) in cnic_init_rings()
5236 struct cnic_local *cp = dev->cnic_priv; in cnic_shutdown_rings() local
5237 struct cnic_uio_dev *udev = cp->udev; in cnic_shutdown_rings()
5240 if (!test_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags)) in cnic_shutdown_rings()
5246 u32 cli = cp->ethdev->iscsi_l2_client_id; in cnic_shutdown_rings()
5247 u32 cid = cp->ethdev->iscsi_l2_cid; in cnic_shutdown_rings()
5253 set_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags); in cnic_shutdown_rings()
5260 while (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags) && in cnic_shutdown_rings()
5264 if (test_bit(CNIC_LCL_FL_L2_WAIT, &cp->cnic_local_flags)) in cnic_shutdown_rings()
5274 clear_bit(CNIC_LCL_FL_RINGS_INITED, &cp->cnic_local_flags); in cnic_shutdown_rings()
5281 struct cnic_local *cp = dev->cnic_priv; in cnic_register_netdev() local
5282 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_register_netdev()
5291 err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev); in cnic_register_netdev()
5307 struct cnic_local *cp = dev->cnic_priv; in cnic_unregister_netdev() local
5308 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_unregister_netdev()
5318 struct cnic_local *cp = dev->cnic_priv; in cnic_start_hw() local
5319 struct cnic_eth_dev *ethdev = cp->ethdev; in cnic_start_hw()
5327 cp->func = PCI_FUNC(dev->pcidev->devfn); in cnic_start_hw()
5328 cp->status_blk.gen = ethdev->irq_arr[0].status_blk; in cnic_start_hw()
5329 cp->status_blk_num = ethdev->irq_arr[0].status_blk_num; in cnic_start_hw()
5331 err = cp->alloc_resc(dev); in cnic_start_hw()
5337 err = cp->start_hw(dev); in cnic_start_hw()
5347 cp->enable_int(dev); in cnic_start_hw()
5353 cp->stop_hw(dev); in cnic_start_hw()
5355 cp->free_resc(dev); in cnic_start_hw()
5379 struct cnic_local *cp = dev->cnic_priv; in cnic_stop_bnx2x_hw() local
5382 u32 sb_id = cp->status_blk_num; in cnic_stop_bnx2x_hw()
5402 *cp->kcq1.hw_prod_idx_ptr = 0; in cnic_stop_bnx2x_hw()
5405 CNIC_WR16(dev, cp->kcq1.io_addr, 0); in cnic_stop_bnx2x_hw()
5412 struct cnic_local *cp = dev->cnic_priv; in cnic_stop_hw() local
5418 while (cp->udev && cp->udev->uio_dev != -1 && i < 15) { in cnic_stop_hw()
5423 cp->stop_cm(dev); in cnic_stop_hw()
5424 cp->ethdev->drv_state &= ~CNIC_DRV_STATE_HANDLES_IRQ; in cnic_stop_hw()
5426 RCU_INIT_POINTER(cp->ulp_ops[CNIC_ULP_L4], NULL); in cnic_stop_hw()
5429 cp->stop_hw(dev); in cnic_stop_hw()
5453 struct cnic_local *cp = dev->cnic_priv; in cnic_get_fc_npiv_tbl() local
5463 ret = cp->ethdev->drv_get_fc_npiv_tbl(dev->netdev, npiv_tbl); in cnic_get_fc_npiv_tbl()
5471 struct cnic_local *cp; in cnic_alloc_dev() local
5488 cp = cdev->cnic_priv; in cnic_alloc_dev()
5489 cp->dev = cdev; in cnic_alloc_dev()
5490 cp->l2_single_buf_size = 0x400; in cnic_alloc_dev()
5491 cp->l2_rx_ring_size = 3; in cnic_alloc_dev()
5493 spin_lock_init(&cp->cnic_ulp_lock); in cnic_alloc_dev()
5504 struct cnic_local *cp; in init_bnx2_cnic() local
5535 cp = cdev->cnic_priv; in init_bnx2_cnic()
5536 cp->ethdev = ethdev; in init_bnx2_cnic()
5538 cp->chip_id = ethdev->chip_id; in init_bnx2_cnic()
5542 cp->cnic_ops = &cnic_bnx2_ops; in init_bnx2_cnic()
5543 cp->start_hw = cnic_start_bnx2_hw; in init_bnx2_cnic()
5544 cp->stop_hw = cnic_stop_bnx2_hw; in init_bnx2_cnic()
5545 cp->setup_pgtbl = cnic_setup_page_tbl; in init_bnx2_cnic()
5546 cp->alloc_resc = cnic_alloc_bnx2_resc; in init_bnx2_cnic()
5547 cp->free_resc = cnic_free_resc; in init_bnx2_cnic()
5548 cp->start_cm = cnic_cm_init_bnx2_hw; in init_bnx2_cnic()
5549 cp->stop_cm = cnic_cm_stop_bnx2_hw; in init_bnx2_cnic()
5550 cp->enable_int = cnic_enable_bnx2_int; in init_bnx2_cnic()
5551 cp->disable_int_sync = cnic_disable_bnx2_int_sync; in init_bnx2_cnic()
5552 cp->close_conn = cnic_close_bnx2_conn; in init_bnx2_cnic()
5564 struct cnic_local *cp; in init_bnx2x_cnic() local
5588 cp = cdev->cnic_priv; in init_bnx2x_cnic()
5589 cp->ethdev = ethdev; in init_bnx2x_cnic()
5591 cp->chip_id = ethdev->chip_id; in init_bnx2x_cnic()
5607 cp->cnic_ops = &cnic_bnx2x_ops; in init_bnx2x_cnic()
5608 cp->start_hw = cnic_start_bnx2x_hw; in init_bnx2x_cnic()
5609 cp->stop_hw = cnic_stop_bnx2x_hw; in init_bnx2x_cnic()
5610 cp->setup_pgtbl = cnic_setup_page_tbl_le; in init_bnx2x_cnic()
5611 cp->alloc_resc = cnic_alloc_bnx2x_resc; in init_bnx2x_cnic()
5612 cp->free_resc = cnic_free_resc; in init_bnx2x_cnic()
5613 cp->start_cm = cnic_cm_init_bnx2x_hw; in init_bnx2x_cnic()
5614 cp->stop_cm = cnic_cm_stop_bnx2x_hw; in init_bnx2x_cnic()
5615 cp->enable_int = cnic_enable_bnx2x_int; in init_bnx2x_cnic()
5616 cp->disable_int_sync = cnic_disable_bnx2x_int_sync; in init_bnx2x_cnic()
5618 cp->ack_int = cnic_ack_bnx2x_e2_msix; in init_bnx2x_cnic()
5619 cp->arm_int = cnic_arm_bnx2x_e2_msix; in init_bnx2x_cnic()
5621 cp->ack_int = cnic_ack_bnx2x_msix; in init_bnx2x_cnic()
5622 cp->arm_int = cnic_arm_bnx2x_msix; in init_bnx2x_cnic()
5624 cp->close_conn = cnic_close_bnx2x_conn; in init_bnx2x_cnic()
5650 static void cnic_rcv_netevent(struct cnic_local *cp, unsigned long event, in cnic_rcv_netevent() argument
5660 ulp_ops = rcu_dereference_protected(cp->ulp_ops[if_type], in cnic_rcv_netevent()
5667 ctx = cp->ulp_handle[if_type]; in cnic_rcv_netevent()
5669 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_rcv_netevent()
5674 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); in cnic_rcv_netevent()
5697 struct cnic_local *cp = dev->cnic_priv; in cnic_netdev_event() local
5713 cnic_rcv_netevent(cp, event, 0); in cnic_netdev_event()