cnic.c (9a64e8e0ace51b309fdcff4b4754b3649250382a) | cnic.c (2e499d3cc13365a87815266dda59904dcb8c8d6c) |
---|---|
1/* cnic.c: Broadcom CNIC core network driver. 2 * 3 * Copyright (c) 2006-2012 Broadcom Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation. 8 * --- 242 unchanged lines hidden (view full) --- 251 return io->data; 252} 253 254static void cnic_ulp_ctl(struct cnic_dev *dev, int ulp_type, bool reg) 255{ 256 struct cnic_local *cp = dev->cnic_priv; 257 struct cnic_eth_dev *ethdev = cp->ethdev; 258 struct drv_ctl_info info; | 1/* cnic.c: Broadcom CNIC core network driver. 2 * 3 * Copyright (c) 2006-2012 Broadcom Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation. 8 * --- 242 unchanged lines hidden (view full) --- 251 return io->data; 252} 253 254static void cnic_ulp_ctl(struct cnic_dev *dev, int ulp_type, bool reg) 255{ 256 struct cnic_local *cp = dev->cnic_priv; 257 struct cnic_eth_dev *ethdev = cp->ethdev; 258 struct drv_ctl_info info; |
259 struct fcoe_capabilities *fcoe_cap = 260 &info.data.register_data.fcoe_features; |
|
259 | 261 |
260 if (reg) | 262 if (reg) { |
261 info.cmd = DRV_CTL_ULP_REGISTER_CMD; | 263 info.cmd = DRV_CTL_ULP_REGISTER_CMD; |
262 else | 264 if (ulp_type == CNIC_ULP_FCOE && dev->fcoe_cap) 265 memcpy(fcoe_cap, dev->fcoe_cap, sizeof(*fcoe_cap)); 266 } else { |
263 info.cmd = DRV_CTL_ULP_UNREGISTER_CMD; | 267 info.cmd = DRV_CTL_ULP_UNREGISTER_CMD; |
268 } |
|
264 265 info.data.ulp_type = ulp_type; 266 ethdev->drv_ctl(dev->netdev, &info); 267} 268 269static int cnic_in_use(struct cnic_sock *csk) 270{ 271 return test_bit(SK_F_INUSE, &csk->flags); --- 334 unchanged lines hidden (view full) --- 606 __func__, ulp_type); 607 mutex_unlock(&cnic_lock); 608 return -EINVAL; 609 } 610 mutex_unlock(&cnic_lock); 611 612 if (ulp_type == CNIC_ULP_ISCSI) 613 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); | 269 270 info.data.ulp_type = ulp_type; 271 ethdev->drv_ctl(dev->netdev, &info); 272} 273 274static int cnic_in_use(struct cnic_sock *csk) 275{ 276 return test_bit(SK_F_INUSE, &csk->flags); --- 334 unchanged lines hidden (view full) --- 611 __func__, ulp_type); 612 mutex_unlock(&cnic_lock); 613 return -EINVAL; 614 } 615 mutex_unlock(&cnic_lock); 616 617 if (ulp_type == CNIC_ULP_ISCSI) 618 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); |
619 else if (ulp_type == CNIC_ULP_FCOE) 620 dev->fcoe_cap = NULL; |
|
614 615 synchronize_rcu(); 616 617 while (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]) && 618 i < 20) { 619 msleep(100); 620 i++; 621 } --- 1958 unchanged lines hidden (view full) --- 2580 KCQE_FLAGS_LAYER_MASK_L4; 2581 l4kcqe->status = L4_KCQE_COMPLETION_STATUS_PARITY_ERROR; 2582 l4kcqe->cid = cid; 2583 cnic_get_l5_cid(cp, BNX2X_SW_CID(cid), &l4kcqe->conn_id); 2584 } else { 2585 return; 2586 } 2587 | 621 622 synchronize_rcu(); 623 624 while (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]) && 625 i < 20) { 626 msleep(100); 627 i++; 628 } --- 1958 unchanged lines hidden (view full) --- 2587 KCQE_FLAGS_LAYER_MASK_L4; 2588 l4kcqe->status = L4_KCQE_COMPLETION_STATUS_PARITY_ERROR; 2589 l4kcqe->cid = cid; 2590 cnic_get_l5_cid(cp, BNX2X_SW_CID(cid), &l4kcqe->conn_id); 2591 } else { 2592 return; 2593 } 2594 |
2588 cqes[0] = (struct kcqe *) &kcqe; | 2595 cqes[0] = &kcqe; |
2589 cnic_reply_bnx2x_kcqes(dev, ulp_type, cqes, 1); 2590} 2591 2592static int cnic_submit_bnx2x_iscsi_kwqes(struct cnic_dev *dev, 2593 struct kwqe *wqes[], u32 num_wqes) 2594{ 2595 int i, work, ret; 2596 u32 opcode; --- 2063 unchanged lines hidden (view full) --- 4660 val = (u32) cp->kwq_info.pgtbl_map; 4661 cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_PGTBL_HADDR_LO, val); 4662 4663 kcq_cid_addr = GET_CID_ADDR(KCQ_CID); 4664 cp->kcq1.io_addr = MB_GET_CID_ADDR(KCQ_CID) + L5_KRNLQ_HOST_QIDX; 4665 4666 cp->kcq1.sw_prod_idx = 0; 4667 cp->kcq1.hw_prod_idx_ptr = | 2596 cnic_reply_bnx2x_kcqes(dev, ulp_type, cqes, 1); 2597} 2598 2599static int cnic_submit_bnx2x_iscsi_kwqes(struct cnic_dev *dev, 2600 struct kwqe *wqes[], u32 num_wqes) 2601{ 2602 int i, work, ret; 2603 u32 opcode; --- 2063 unchanged lines hidden (view full) --- 4667 val = (u32) cp->kwq_info.pgtbl_map; 4668 cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_PGTBL_HADDR_LO, val); 4669 4670 kcq_cid_addr = GET_CID_ADDR(KCQ_CID); 4671 cp->kcq1.io_addr = MB_GET_CID_ADDR(KCQ_CID) + L5_KRNLQ_HOST_QIDX; 4672 4673 cp->kcq1.sw_prod_idx = 0; 4674 cp->kcq1.hw_prod_idx_ptr = |
4668 (u16 *) &sblk->status_completion_producer_index; | 4675 &sblk->status_completion_producer_index; |
4669 | 4676 |
4670 cp->kcq1.status_idx_ptr = (u16 *) &sblk->status_idx; | 4677 cp->kcq1.status_idx_ptr = &sblk->status_idx; |
4671 4672 /* Initialize the kernel complete queue context. */ 4673 val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE | 4674 (BCM_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ; 4675 cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_TYPE, val); 4676 4677 val = (BCM_PAGE_SIZE / sizeof(struct kcqe) - 1) << 16; 4678 cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val); --- 9 unchanged lines hidden (view full) --- 4688 4689 cp->int_num = 0; 4690 if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { 4691 struct status_block_msix *msblk = cp->status_blk.bnx2; 4692 u32 sb_id = cp->status_blk_num; 4693 u32 sb = BNX2_L2CTX_L5_STATUSB_NUM(sb_id); 4694 4695 cp->kcq1.hw_prod_idx_ptr = | 4678 4679 /* Initialize the kernel complete queue context. */ 4680 val = KRNLQ_TYPE_TYPE_KRNLQ | KRNLQ_SIZE_TYPE_SIZE | 4681 (BCM_PAGE_BITS - 8) | KRNLQ_FLAGS_QE_SELF_SEQ; 4682 cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_TYPE, val); 4683 4684 val = (BCM_PAGE_SIZE / sizeof(struct kcqe) - 1) << 16; 4685 cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_QE_SELF_SEQ_MAX, val); --- 9 unchanged lines hidden (view full) --- 4695 4696 cp->int_num = 0; 4697 if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { 4698 struct status_block_msix *msblk = cp->status_blk.bnx2; 4699 u32 sb_id = cp->status_blk_num; 4700 u32 sb = BNX2_L2CTX_L5_STATUSB_NUM(sb_id); 4701 4702 cp->kcq1.hw_prod_idx_ptr = |
4696 (u16 *) &msblk->status_completion_producer_index; 4697 cp->kcq1.status_idx_ptr = (u16 *) &msblk->status_idx; 4698 cp->kwq_con_idx_ptr = (u16 *) &msblk->status_cmd_consumer_index; | 4703 &msblk->status_completion_producer_index; 4704 cp->kcq1.status_idx_ptr = &msblk->status_idx; 4705 cp->kwq_con_idx_ptr = &msblk->status_cmd_consumer_index; |
4699 cp->int_num = sb_id << BNX2_PCICFG_INT_ACK_CMD_INT_NUM_SHIFT; 4700 cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_HOST_QIDX, sb); 4701 cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_HOST_QIDX, sb); 4702 } 4703 4704 /* Enable Commnad Scheduler notification when we write to the 4705 * host producer index of the kernel contexts. */ 4706 CNIC_WR(dev, BNX2_MQ_KNL_CMD_MASK1, 2); --- 938 unchanged lines hidden --- | 4706 cp->int_num = sb_id << BNX2_PCICFG_INT_ACK_CMD_INT_NUM_SHIFT; 4707 cnic_ctx_wr(dev, kwq_cid_addr, L5_KRNLQ_HOST_QIDX, sb); 4708 cnic_ctx_wr(dev, kcq_cid_addr, L5_KRNLQ_HOST_QIDX, sb); 4709 } 4710 4711 /* Enable Commnad Scheduler notification when we write to the 4712 * host producer index of the kernel contexts. */ 4713 CNIC_WR(dev, BNX2_MQ_KNL_CMD_MASK1, 2); --- 938 unchanged lines hidden --- |