bnx2i_hwi.c (04a4e1fdd248d7a19d53e6e90f757e99093e3d29) bnx2i_hwi.c (3f79410c7c9c8ef33ccff60c61e1f1166f5ed64a)
1/* bnx2i_hwi.c: Broadcom NetXtreme II iSCSI driver.
2 *
3 * Copyright (c) 2006 - 2013 Broadcom Corporation
4 * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved.
5 * Copyright (c) 2007, 2008 Mike Christie
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 112 unchanged lines hidden (view full) ---

121 "offload iSCSI connections, dev=%s\n",
122 hba->netdev->name);
123 set_bit(ADAPTER_STATE_INIT_FAILED, &hba->adapter_state);
124}
125
126
127/**
128 * bnx2i_arm_cq_event_coalescing - arms CQ to enable EQ notification
1/* bnx2i_hwi.c: Broadcom NetXtreme II iSCSI driver.
2 *
3 * Copyright (c) 2006 - 2013 Broadcom Corporation
4 * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved.
5 * Copyright (c) 2007, 2008 Mike Christie
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 112 unchanged lines hidden (view full) ---

121 "offload iSCSI connections, dev=%s\n",
122 hba->netdev->name);
123 set_bit(ADAPTER_STATE_INIT_FAILED, &hba->adapter_state);
124}
125
126
127/**
128 * bnx2i_arm_cq_event_coalescing - arms CQ to enable EQ notification
129 * @ep: endpoint (transport indentifier) structure
129 * @ep: endpoint (transport identifier) structure
130 * @action: action, ARM or DISARM. For now only ARM_CQE is used
131 *
132 * Arm'ing CQ will enable chip to generate global EQ events inorder to interrupt
133 * the driver. EQ event is generated CQ index is hit or at least 1 CQ is
134 * outstanding and on chip timer expires
135 */
136int bnx2i_arm_cq_event_coalescing(struct bnx2i_endpoint *ep, u8 action)
137{

--- 613 unchanged lines hidden (view full) ---

751
752 bnx2i_ring_dbell_update_sq_params(cmd->conn, 1);
753}
754
755
756/**
757 * bnx2i_send_conn_destroy - initiates iscsi connection teardown process
758 * @hba: adapter structure pointer
130 * @action: action, ARM or DISARM. For now only ARM_CQE is used
131 *
132 * Arm'ing CQ will enable chip to generate global EQ events inorder to interrupt
133 * the driver. EQ event is generated CQ index is hit or at least 1 CQ is
134 * outstanding and on chip timer expires
135 */
136int bnx2i_arm_cq_event_coalescing(struct bnx2i_endpoint *ep, u8 action)
137{

--- 613 unchanged lines hidden (view full) ---

751
752 bnx2i_ring_dbell_update_sq_params(cmd->conn, 1);
753}
754
755
756/**
757 * bnx2i_send_conn_destroy - initiates iscsi connection teardown process
758 * @hba: adapter structure pointer
759 * @ep: endpoint (transport indentifier) structure
759 * @ep: endpoint (transport identifier) structure
760 *
761 * this routine prepares and posts CONN_OFLD_REQ1/2 KWQE to initiate
762 * iscsi connection context clean-up process
763 */
764int bnx2i_send_conn_destroy(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
765{
766 struct kwqe *kwqe_arr[2];
767 struct iscsi_kwqe_conn_destroy conn_cleanup;

--- 18 unchanged lines hidden (view full) ---

786
787 return rc;
788}
789
790
791/**
792 * bnx2i_570x_send_conn_ofld_req - initiates iscsi conn context setup process
793 * @hba: adapter structure pointer
760 *
761 * this routine prepares and posts CONN_OFLD_REQ1/2 KWQE to initiate
762 * iscsi connection context clean-up process
763 */
764int bnx2i_send_conn_destroy(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
765{
766 struct kwqe *kwqe_arr[2];
767 struct iscsi_kwqe_conn_destroy conn_cleanup;

--- 18 unchanged lines hidden (view full) ---

786
787 return rc;
788}
789
790
791/**
792 * bnx2i_570x_send_conn_ofld_req - initiates iscsi conn context setup process
793 * @hba: adapter structure pointer
794 * @ep: endpoint (transport indentifier) structure
794 * @ep: endpoint (transport identifier) structure
795 *
796 * 5706/5708/5709 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE
797 */
798static int bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba *hba,
799 struct bnx2i_endpoint *ep)
800{
801 struct kwqe *kwqe_arr[2];
802 struct iscsi_kwqe_conn_offload1 ofld_req1;

--- 43 unchanged lines hidden (view full) ---

846
847 return rc;
848}
849
850
851/**
852 * bnx2i_5771x_send_conn_ofld_req - initiates iscsi connection context creation
853 * @hba: adapter structure pointer
795 *
796 * 5706/5708/5709 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE
797 */
798static int bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba *hba,
799 struct bnx2i_endpoint *ep)
800{
801 struct kwqe *kwqe_arr[2];
802 struct iscsi_kwqe_conn_offload1 ofld_req1;

--- 43 unchanged lines hidden (view full) ---

846
847 return rc;
848}
849
850
851/**
852 * bnx2i_5771x_send_conn_ofld_req - initiates iscsi connection context creation
853 * @hba: adapter structure pointer
854 * @ep: endpoint (transport indentifier) structure
854 * @ep: endpoint (transport identifier) structure
855 *
856 * 57710 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE
857 */
858static int bnx2i_5771x_send_conn_ofld_req(struct bnx2i_hba *hba,
859 struct bnx2i_endpoint *ep)
860{
861 struct kwqe *kwqe_arr[5];
862 struct iscsi_kwqe_conn_offload1 ofld_req1;

--- 52 unchanged lines hidden (view full) ---

915
916 return rc;
917}
918
919/**
920 * bnx2i_send_conn_ofld_req - initiates iscsi connection context setup process
921 *
922 * @hba: adapter structure pointer
855 *
856 * 57710 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE
857 */
858static int bnx2i_5771x_send_conn_ofld_req(struct bnx2i_hba *hba,
859 struct bnx2i_endpoint *ep)
860{
861 struct kwqe *kwqe_arr[5];
862 struct iscsi_kwqe_conn_offload1 ofld_req1;

--- 52 unchanged lines hidden (view full) ---

915
916 return rc;
917}
918
919/**
920 * bnx2i_send_conn_ofld_req - initiates iscsi connection context setup process
921 *
922 * @hba: adapter structure pointer
923 * @ep: endpoint (transport indentifier) structure
923 * @ep: endpoint (transport identifier) structure
924 *
925 * this routine prepares and posts CONN_OFLD_REQ1/2 KWQE
926 */
927int bnx2i_send_conn_ofld_req(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
928{
929 int rc;
930
931 if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type))
932 rc = bnx2i_5771x_send_conn_ofld_req(hba, ep);
933 else
934 rc = bnx2i_570x_send_conn_ofld_req(hba, ep);
935
936 return rc;
937}
938
939
940/**
941 * setup_qp_page_tables - iscsi QP page table setup function
924 *
925 * this routine prepares and posts CONN_OFLD_REQ1/2 KWQE
926 */
927int bnx2i_send_conn_ofld_req(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
928{
929 int rc;
930
931 if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type))
932 rc = bnx2i_5771x_send_conn_ofld_req(hba, ep);
933 else
934 rc = bnx2i_570x_send_conn_ofld_req(hba, ep);
935
936 return rc;
937}
938
939
940/**
941 * setup_qp_page_tables - iscsi QP page table setup function
942 * @ep: endpoint (transport indentifier) structure
942 * @ep: endpoint (transport identifier) structure
943 *
944 * Sets up page tables for SQ/RQ/CQ, 1G/sec (5706/5708/5709) devices requires
945 * 64-bit address in big endian format. Whereas 10G/sec (57710) requires
946 * PT in little endian format
947 */
948static void setup_qp_page_tables(struct bnx2i_endpoint *ep)
949{
950 int num_pages;

--- 90 unchanged lines hidden (view full) ---

1041 }
1042 }
1043}
1044
1045
1046/**
1047 * bnx2i_alloc_qp_resc - allocates required resources for QP.
1048 * @hba: adapter structure pointer
943 *
944 * Sets up page tables for SQ/RQ/CQ, 1G/sec (5706/5708/5709) devices requires
945 * 64-bit address in big endian format. Whereas 10G/sec (57710) requires
946 * PT in little endian format
947 */
948static void setup_qp_page_tables(struct bnx2i_endpoint *ep)
949{
950 int num_pages;

--- 90 unchanged lines hidden (view full) ---

1041 }
1042 }
1043}
1044
1045
1046/**
1047 * bnx2i_alloc_qp_resc - allocates required resources for QP.
1048 * @hba: adapter structure pointer
1049 * @ep: endpoint (transport indentifier) structure
1049 * @ep: endpoint (transport identifier) structure
1050 *
1051 * Allocate QP (transport layer for iSCSI connection) resources, DMA'able
1052 * memory for SQ/RQ/CQ and page tables. EP structure elements such
1053 * as producer/consumer indexes/pointers, queue sizes and page table
1054 * contents are setup
1055 */
1056int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
1057{

--- 128 unchanged lines hidden (view full) ---

1186 return -ENOMEM;
1187}
1188
1189
1190
1191/**
1192 * bnx2i_free_qp_resc - free memory resources held by QP
1193 * @hba: adapter structure pointer
1050 *
1051 * Allocate QP (transport layer for iSCSI connection) resources, DMA'able
1052 * memory for SQ/RQ/CQ and page tables. EP structure elements such
1053 * as producer/consumer indexes/pointers, queue sizes and page table
1054 * contents are setup
1055 */
1056int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
1057{

--- 128 unchanged lines hidden (view full) ---

1186 return -ENOMEM;
1187}
1188
1189
1190
1191/**
1192 * bnx2i_free_qp_resc - free memory resources held by QP
1193 * @hba: adapter structure pointer
1194 * @ep: endpoint (transport indentifier) structure
1194 * @ep: endpoint (transport identifier) structure
1195 *
1196 * Free QP resources - SQ/RQ/CQ memory and page tables.
1197 */
1198void bnx2i_free_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
1199{
1200 if (ep->qp.ctx_base) {
1201 iounmap(ep->qp.ctx_base);
1202 ep->qp.ctx_base = NULL;

--- 1530 unchanged lines hidden (view full) ---

2733 u32 config2;
2734 resource_size_t reg_base;
2735
2736 cid_num = bnx2i_get_cid_num(ep);
2737
2738 if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) {
2739 reg_base = pci_resource_start(ep->hba->pcidev,
2740 BNX2X_DOORBELL_PCI_BAR);
1195 *
1196 * Free QP resources - SQ/RQ/CQ memory and page tables.
1197 */
1198void bnx2i_free_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
1199{
1200 if (ep->qp.ctx_base) {
1201 iounmap(ep->qp.ctx_base);
1202 ep->qp.ctx_base = NULL;

--- 1530 unchanged lines hidden (view full) ---

2733 u32 config2;
2734 resource_size_t reg_base;
2735
2736 cid_num = bnx2i_get_cid_num(ep);
2737
2738 if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) {
2739 reg_base = pci_resource_start(ep->hba->pcidev,
2740 BNX2X_DOORBELL_PCI_BAR);
2741 reg_off = (1 << BNX2X_DB_SHIFT) * (cid_num & 0x1FFFF);
2741 reg_off = BNX2I_5771X_DBELL_PAGE_SIZE * (cid_num & 0x1FFFF) +
2742 DPM_TRIGER_TYPE;
2742 ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, 4);
2743 goto arm_cq;
2744 }
2745
2746 if ((test_bit(BNX2I_NX2_DEV_5709, &ep->hba->cnic_dev_type)) &&
2747 (ep->hba->mail_queue_access == BNX2I_MQ_BIN_MODE)) {
2748 config2 = REG_RD(ep->hba, BNX2_MQ_CONFIG2);
2749 first_l4l5 = config2 & BNX2_MQ_CONFIG2_FIRST_L4L5;

--- 20 unchanged lines hidden ---
2743 ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, 4);
2744 goto arm_cq;
2745 }
2746
2747 if ((test_bit(BNX2I_NX2_DEV_5709, &ep->hba->cnic_dev_type)) &&
2748 (ep->hba->mail_queue_access == BNX2I_MQ_BIN_MODE)) {
2749 config2 = REG_RD(ep->hba, BNX2_MQ_CONFIG2);
2750 first_l4l5 = config2 & BNX2_MQ_CONFIG2_FIRST_L4L5;

--- 20 unchanged lines hidden ---