diff options
author | Jayamohan Kallickal <jayamohank@gmail.com> | 2013-04-05 23:38:32 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-05-02 11:15:03 -0400 |
commit | a7909b396ba79a5d2975d37fe60e1ad53c22e206 (patch) | |
tree | 6101263f75283010571016e2a2d03c1789f73e0d /drivers | |
parent | 4a4a11b98a39f479cdccef879635a72b0422049b (diff) |
[SCSI] be2iscsi: Fix dynamic CID allocation Mechanism in driver
Number of CID assigned to a function from adapter can be dynamic. The CID count
for each function was fixed number before. Code Fix done so that adapters with
fixed/dynamic CID count will work with the driver.
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/be2iscsi/be_iscsi.c | 38 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.c | 150 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.h | 15 |
3 files changed, 133 insertions, 70 deletions
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c index 5b64fd4b3c35..1bf0285061ff 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.c +++ b/drivers/scsi/be2iscsi/be_iscsi.c | |||
@@ -161,7 +161,9 @@ static int beiscsi_bindconn_cid(struct beiscsi_hba *phba, | |||
161 | struct beiscsi_conn *beiscsi_conn, | 161 | struct beiscsi_conn *beiscsi_conn, |
162 | unsigned int cid) | 162 | unsigned int cid) |
163 | { | 163 | { |
164 | if (phba->conn_table[cid]) { | 164 | uint16_t cri_index = BE_GET_CRI_FROM_CID(cid); |
165 | |||
166 | if (phba->conn_table[cri_index]) { | ||
165 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, | 167 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, |
166 | "BS_%d : Connection table already occupied. Detected clash\n"); | 168 | "BS_%d : Connection table already occupied. Detected clash\n"); |
167 | 169 | ||
@@ -169,9 +171,9 @@ static int beiscsi_bindconn_cid(struct beiscsi_hba *phba, | |||
169 | } else { | 171 | } else { |
170 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, | 172 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, |
171 | "BS_%d : phba->conn_table[%d]=%p(beiscsi_conn)\n", | 173 | "BS_%d : phba->conn_table[%d]=%p(beiscsi_conn)\n", |
172 | cid, beiscsi_conn); | 174 | cri_index, beiscsi_conn); |
173 | 175 | ||
174 | phba->conn_table[cid] = beiscsi_conn; | 176 | phba->conn_table[cri_index] = beiscsi_conn; |
175 | } | 177 | } |
176 | return 0; | 178 | return 0; |
177 | } | 179 | } |
@@ -994,6 +996,8 @@ static void beiscsi_free_ep(struct beiscsi_endpoint *beiscsi_ep) | |||
994 | 996 | ||
995 | beiscsi_put_cid(phba, beiscsi_ep->ep_cid); | 997 | beiscsi_put_cid(phba, beiscsi_ep->ep_cid); |
996 | beiscsi_ep->phba = NULL; | 998 | beiscsi_ep->phba = NULL; |
999 | phba->ep_array[BE_GET_CRI_FROM_CID | ||
1000 | (beiscsi_ep->ep_cid)] = NULL; | ||
997 | 1001 | ||
998 | /** | 1002 | /** |
999 | * Check if any connection resource allocated by driver | 1003 | * Check if any connection resource allocated by driver |
@@ -1044,15 +1048,8 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, | |||
1044 | "BS_%d : In beiscsi_open_conn, ep_cid=%d\n", | 1048 | "BS_%d : In beiscsi_open_conn, ep_cid=%d\n", |
1045 | beiscsi_ep->ep_cid); | 1049 | beiscsi_ep->ep_cid); |
1046 | 1050 | ||
1047 | phba->ep_array[beiscsi_ep->ep_cid - | 1051 | phba->ep_array[BE_GET_CRI_FROM_CID |
1048 | phba->fw_config.iscsi_cid_start] = ep; | 1052 | (beiscsi_ep->ep_cid)] = ep; |
1049 | if (beiscsi_ep->ep_cid > (phba->fw_config.iscsi_cid_start + | ||
1050 | phba->params.cxns_per_ctrl * 2)) { | ||
1051 | |||
1052 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, | ||
1053 | "BS_%d : Failed in allocate iscsi cid\n"); | ||
1054 | goto free_ep; | ||
1055 | } | ||
1056 | 1053 | ||
1057 | beiscsi_ep->cid_vld = 0; | 1054 | beiscsi_ep->cid_vld = 0; |
1058 | nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev, | 1055 | nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev, |
@@ -1064,7 +1061,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, | |||
1064 | "BS_%d : Failed to allocate memory for" | 1061 | "BS_%d : Failed to allocate memory for" |
1065 | " mgmt_open_connection\n"); | 1062 | " mgmt_open_connection\n"); |
1066 | 1063 | ||
1067 | beiscsi_put_cid(phba, beiscsi_ep->ep_cid); | 1064 | beiscsi_free_ep(beiscsi_ep); |
1068 | return -ENOMEM; | 1065 | return -ENOMEM; |
1069 | } | 1066 | } |
1070 | nonemb_cmd.size = sizeof(struct tcp_connect_and_offload_in); | 1067 | nonemb_cmd.size = sizeof(struct tcp_connect_and_offload_in); |
@@ -1075,9 +1072,9 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, | |||
1075 | "BS_%d : mgmt_open_connection Failed for cid=%d\n", | 1072 | "BS_%d : mgmt_open_connection Failed for cid=%d\n", |
1076 | beiscsi_ep->ep_cid); | 1073 | beiscsi_ep->ep_cid); |
1077 | 1074 | ||
1078 | beiscsi_put_cid(phba, beiscsi_ep->ep_cid); | ||
1079 | pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | 1075 | pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, |
1080 | nonemb_cmd.va, nonemb_cmd.dma); | 1076 | nonemb_cmd.va, nonemb_cmd.dma); |
1077 | beiscsi_free_ep(beiscsi_ep); | ||
1081 | return -EAGAIN; | 1078 | return -EAGAIN; |
1082 | } | 1079 | } |
1083 | 1080 | ||
@@ -1089,7 +1086,8 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, | |||
1089 | 1086 | ||
1090 | pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | 1087 | pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, |
1091 | nonemb_cmd.va, nonemb_cmd.dma); | 1088 | nonemb_cmd.va, nonemb_cmd.dma); |
1092 | goto free_ep; | 1089 | beiscsi_free_ep(beiscsi_ep); |
1090 | return -EBUSY; | ||
1093 | } | 1091 | } |
1094 | 1092 | ||
1095 | ptcpcnct_out = (struct tcp_connect_and_offload_out *)nonemb_cmd.va; | 1093 | ptcpcnct_out = (struct tcp_connect_and_offload_out *)nonemb_cmd.va; |
@@ -1102,10 +1100,6 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, | |||
1102 | pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | 1100 | pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, |
1103 | nonemb_cmd.va, nonemb_cmd.dma); | 1101 | nonemb_cmd.va, nonemb_cmd.dma); |
1104 | return 0; | 1102 | return 0; |
1105 | |||
1106 | free_ep: | ||
1107 | beiscsi_free_ep(beiscsi_ep); | ||
1108 | return -EBUSY; | ||
1109 | } | 1103 | } |
1110 | 1104 | ||
1111 | /** | 1105 | /** |
@@ -1216,8 +1210,10 @@ static int beiscsi_close_conn(struct beiscsi_endpoint *beiscsi_ep, int flag) | |||
1216 | static int beiscsi_unbind_conn_to_cid(struct beiscsi_hba *phba, | 1210 | static int beiscsi_unbind_conn_to_cid(struct beiscsi_hba *phba, |
1217 | unsigned int cid) | 1211 | unsigned int cid) |
1218 | { | 1212 | { |
1219 | if (phba->conn_table[cid]) | 1213 | uint16_t cri_index = BE_GET_CRI_FROM_CID(cid); |
1220 | phba->conn_table[cid] = NULL; | 1214 | |
1215 | if (phba->conn_table[cri_index]) | ||
1216 | phba->conn_table[cri_index] = NULL; | ||
1221 | else { | 1217 | else { |
1222 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, | 1218 | beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, |
1223 | "BS_%d : Connection table Not occupied.\n"); | 1219 | "BS_%d : Connection table Not occupied.\n"); |
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index a60a43d4d947..01439a5bbd72 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -706,7 +706,7 @@ static void beiscsi_get_params(struct beiscsi_hba *phba) | |||
706 | + BE2_TMFS | 706 | + BE2_TMFS |
707 | + BE2_NOPOUT_REQ)); | 707 | + BE2_NOPOUT_REQ)); |
708 | phba->params.cxns_per_ctrl = phba->fw_config.iscsi_cid_count; | 708 | phba->params.cxns_per_ctrl = phba->fw_config.iscsi_cid_count; |
709 | phba->params.asyncpdus_per_ctrl = phba->fw_config.iscsi_cid_count * 2; | 709 | phba->params.asyncpdus_per_ctrl = phba->fw_config.iscsi_cid_count; |
710 | phba->params.icds_per_ctrl = phba->fw_config.iscsi_icd_count; | 710 | phba->params.icds_per_ctrl = phba->fw_config.iscsi_icd_count; |
711 | phba->params.num_sge_per_io = BE2_SGE; | 711 | phba->params.num_sge_per_io = BE2_SGE; |
712 | phba->params.defpdu_hdr_sz = BE2_DEFPDU_HDR_SZ; | 712 | phba->params.defpdu_hdr_sz = BE2_DEFPDU_HDR_SZ; |
@@ -1036,7 +1036,6 @@ static void hwi_ring_cq_db(struct beiscsi_hba *phba, | |||
1036 | static unsigned int | 1036 | static unsigned int |
1037 | beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn, | 1037 | beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn, |
1038 | struct beiscsi_hba *phba, | 1038 | struct beiscsi_hba *phba, |
1039 | unsigned short cid, | ||
1040 | struct pdu_base *ppdu, | 1039 | struct pdu_base *ppdu, |
1041 | unsigned long pdu_len, | 1040 | unsigned long pdu_len, |
1042 | void *pbuffer, unsigned long buf_len) | 1041 | void *pbuffer, unsigned long buf_len) |
@@ -1148,9 +1147,10 @@ struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid) | |||
1148 | struct hwi_wrb_context *pwrb_context; | 1147 | struct hwi_wrb_context *pwrb_context; |
1149 | struct hwi_controller *phwi_ctrlr; | 1148 | struct hwi_controller *phwi_ctrlr; |
1150 | struct wrb_handle *pwrb_handle, *pwrb_handle_tmp; | 1149 | struct wrb_handle *pwrb_handle, *pwrb_handle_tmp; |
1150 | uint16_t cri_index = BE_GET_CRI_FROM_CID(cid); | ||
1151 | 1151 | ||
1152 | phwi_ctrlr = phba->phwi_ctrlr; | 1152 | phwi_ctrlr = phba->phwi_ctrlr; |
1153 | pwrb_context = &phwi_ctrlr->wrb_context[cid]; | 1153 | pwrb_context = &phwi_ctrlr->wrb_context[cri_index]; |
1154 | if (pwrb_context->wrb_handles_available >= 2) { | 1154 | if (pwrb_context->wrb_handles_available >= 2) { |
1155 | pwrb_handle = pwrb_context->pwrb_handle_base[ | 1155 | pwrb_handle = pwrb_context->pwrb_handle_base[ |
1156 | pwrb_context->alloc_index]; | 1156 | pwrb_context->alloc_index]; |
@@ -1367,7 +1367,7 @@ hwi_complete_drvr_msgs(struct beiscsi_conn *beiscsi_conn, | |||
1367 | struct hwi_controller *phwi_ctrlr; | 1367 | struct hwi_controller *phwi_ctrlr; |
1368 | struct iscsi_task *task; | 1368 | struct iscsi_task *task; |
1369 | struct beiscsi_io_task *io_task; | 1369 | struct beiscsi_io_task *io_task; |
1370 | uint16_t wrb_index, cid; | 1370 | uint16_t wrb_index, cid, cri_index; |
1371 | 1371 | ||
1372 | phwi_ctrlr = phba->phwi_ctrlr; | 1372 | phwi_ctrlr = phba->phwi_ctrlr; |
1373 | if (is_chip_be2_be3r(phba)) { | 1373 | if (is_chip_be2_be3r(phba)) { |
@@ -1382,8 +1382,8 @@ hwi_complete_drvr_msgs(struct beiscsi_conn *beiscsi_conn, | |||
1382 | cid, psol); | 1382 | cid, psol); |
1383 | } | 1383 | } |
1384 | 1384 | ||
1385 | pwrb_context = &phwi_ctrlr->wrb_context[ | 1385 | cri_index = BE_GET_CRI_FROM_CID(cid); |
1386 | cid - phba->fw_config.iscsi_cid_start]; | 1386 | pwrb_context = &phwi_ctrlr->wrb_context[cri_index]; |
1387 | pwrb_handle = pwrb_context->pwrb_handle_basestd[wrb_index]; | 1387 | pwrb_handle = pwrb_context->pwrb_handle_basestd[wrb_index]; |
1388 | task = pwrb_handle->pio_handle; | 1388 | task = pwrb_handle->pio_handle; |
1389 | 1389 | ||
@@ -1478,14 +1478,15 @@ static void hwi_complete_cmd(struct beiscsi_conn *beiscsi_conn, | |||
1478 | struct iscsi_conn *conn = beiscsi_conn->conn; | 1478 | struct iscsi_conn *conn = beiscsi_conn->conn; |
1479 | struct iscsi_session *session = conn->session; | 1479 | struct iscsi_session *session = conn->session; |
1480 | struct common_sol_cqe csol_cqe = {0}; | 1480 | struct common_sol_cqe csol_cqe = {0}; |
1481 | uint16_t cri_index = 0; | ||
1481 | 1482 | ||
1482 | phwi_ctrlr = phba->phwi_ctrlr; | 1483 | phwi_ctrlr = phba->phwi_ctrlr; |
1483 | 1484 | ||
1484 | /* Copy the elements to a common structure */ | 1485 | /* Copy the elements to a common structure */ |
1485 | adapter_get_sol_cqe(phba, psol, &csol_cqe); | 1486 | adapter_get_sol_cqe(phba, psol, &csol_cqe); |
1486 | 1487 | ||
1487 | pwrb_context = &phwi_ctrlr->wrb_context[ | 1488 | cri_index = BE_GET_CRI_FROM_CID(csol_cqe.cid); |
1488 | csol_cqe.cid - phba->fw_config.iscsi_cid_start]; | 1489 | pwrb_context = &phwi_ctrlr->wrb_context[cri_index]; |
1489 | 1490 | ||
1490 | pwrb_handle = pwrb_context->pwrb_handle_basestd[ | 1491 | pwrb_handle = pwrb_context->pwrb_handle_basestd[ |
1491 | csol_cqe.wrb_index]; | 1492 | csol_cqe.wrb_index]; |
@@ -1611,8 +1612,8 @@ hwi_get_async_handle(struct beiscsi_hba *phba, | |||
1611 | 1612 | ||
1612 | WARN_ON(!pasync_handle); | 1613 | WARN_ON(!pasync_handle); |
1613 | 1614 | ||
1614 | pasync_handle->cri = (unsigned short)beiscsi_conn->beiscsi_conn_cid - | 1615 | pasync_handle->cri = |
1615 | phba->fw_config.iscsi_cid_start; | 1616 | BE_GET_CRI_FROM_CID(beiscsi_conn->beiscsi_conn_cid); |
1616 | pasync_handle->is_header = is_header; | 1617 | pasync_handle->is_header = is_header; |
1617 | pasync_handle->buffer_len = dpl; | 1618 | pasync_handle->buffer_len = dpl; |
1618 | *pcq_index = index; | 1619 | *pcq_index = index; |
@@ -1854,8 +1855,6 @@ hwi_fwd_async_msg(struct beiscsi_conn *beiscsi_conn, | |||
1854 | } | 1855 | } |
1855 | 1856 | ||
1856 | status = beiscsi_process_async_pdu(beiscsi_conn, phba, | 1857 | status = beiscsi_process_async_pdu(beiscsi_conn, phba, |
1857 | (beiscsi_conn->beiscsi_conn_cid - | ||
1858 | phba->fw_config.iscsi_cid_start), | ||
1859 | phdr, hdr_len, pfirst_buffer, | 1858 | phdr, hdr_len, pfirst_buffer, |
1860 | offset); | 1859 | offset); |
1861 | 1860 | ||
@@ -2009,6 +2008,7 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq) | |||
2009 | unsigned int num_processed = 0; | 2008 | unsigned int num_processed = 0; |
2010 | unsigned int tot_nump = 0; | 2009 | unsigned int tot_nump = 0; |
2011 | unsigned short code = 0, cid = 0; | 2010 | unsigned short code = 0, cid = 0; |
2011 | uint16_t cri_index = 0; | ||
2012 | struct beiscsi_conn *beiscsi_conn; | 2012 | struct beiscsi_conn *beiscsi_conn; |
2013 | struct beiscsi_endpoint *beiscsi_ep; | 2013 | struct beiscsi_endpoint *beiscsi_ep; |
2014 | struct iscsi_endpoint *ep; | 2014 | struct iscsi_endpoint *ep; |
@@ -2040,7 +2040,8 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq) | |||
2040 | cid, sol); | 2040 | cid, sol); |
2041 | } | 2041 | } |
2042 | 2042 | ||
2043 | ep = phba->ep_array[cid - phba->fw_config.iscsi_cid_start]; | 2043 | cri_index = BE_GET_CRI_FROM_CID(cid); |
2044 | ep = phba->ep_array[cri_index]; | ||
2044 | beiscsi_ep = ep->dd_data; | 2045 | beiscsi_ep = ep->dd_data; |
2045 | beiscsi_conn = beiscsi_ep->conn; | 2046 | beiscsi_conn = beiscsi_ep->conn; |
2046 | 2047 | ||
@@ -2537,8 +2538,9 @@ static void beiscsi_find_mem_req(struct beiscsi_hba *phba) | |||
2537 | 2538 | ||
2538 | static int beiscsi_alloc_mem(struct beiscsi_hba *phba) | 2539 | static int beiscsi_alloc_mem(struct beiscsi_hba *phba) |
2539 | { | 2540 | { |
2540 | struct be_mem_descriptor *mem_descr; | ||
2541 | dma_addr_t bus_add; | 2541 | dma_addr_t bus_add; |
2542 | struct hwi_controller *phwi_ctrlr; | ||
2543 | struct be_mem_descriptor *mem_descr; | ||
2542 | struct mem_array *mem_arr, *mem_arr_orig; | 2544 | struct mem_array *mem_arr, *mem_arr_orig; |
2543 | unsigned int i, j, alloc_size, curr_alloc_size; | 2545 | unsigned int i, j, alloc_size, curr_alloc_size; |
2544 | 2546 | ||
@@ -2546,9 +2548,18 @@ static int beiscsi_alloc_mem(struct beiscsi_hba *phba) | |||
2546 | if (!phba->phwi_ctrlr) | 2548 | if (!phba->phwi_ctrlr) |
2547 | return -ENOMEM; | 2549 | return -ENOMEM; |
2548 | 2550 | ||
2551 | /* Allocate memory for wrb_context */ | ||
2552 | phwi_ctrlr = phba->phwi_ctrlr; | ||
2553 | phwi_ctrlr->wrb_context = kzalloc(sizeof(struct hwi_wrb_context) * | ||
2554 | phba->params.cxns_per_ctrl, | ||
2555 | GFP_KERNEL); | ||
2556 | if (!phwi_ctrlr->wrb_context) | ||
2557 | return -ENOMEM; | ||
2558 | |||
2549 | phba->init_mem = kcalloc(SE_MEM_MAX, sizeof(*mem_descr), | 2559 | phba->init_mem = kcalloc(SE_MEM_MAX, sizeof(*mem_descr), |
2550 | GFP_KERNEL); | 2560 | GFP_KERNEL); |
2551 | if (!phba->init_mem) { | 2561 | if (!phba->init_mem) { |
2562 | kfree(phwi_ctrlr->wrb_context); | ||
2552 | kfree(phba->phwi_ctrlr); | 2563 | kfree(phba->phwi_ctrlr); |
2553 | return -ENOMEM; | 2564 | return -ENOMEM; |
2554 | } | 2565 | } |
@@ -2557,6 +2568,7 @@ static int beiscsi_alloc_mem(struct beiscsi_hba *phba) | |||
2557 | GFP_KERNEL); | 2568 | GFP_KERNEL); |
2558 | if (!mem_arr_orig) { | 2569 | if (!mem_arr_orig) { |
2559 | kfree(phba->init_mem); | 2570 | kfree(phba->init_mem); |
2571 | kfree(phwi_ctrlr->wrb_context); | ||
2560 | kfree(phba->phwi_ctrlr); | 2572 | kfree(phba->phwi_ctrlr); |
2561 | return -ENOMEM; | 2573 | return -ENOMEM; |
2562 | } | 2574 | } |
@@ -2627,6 +2639,7 @@ free_mem: | |||
2627 | } | 2639 | } |
2628 | kfree(mem_arr_orig); | 2640 | kfree(mem_arr_orig); |
2629 | kfree(phba->init_mem); | 2641 | kfree(phba->init_mem); |
2642 | kfree(phba->phwi_ctrlr->wrb_context); | ||
2630 | kfree(phba->phwi_ctrlr); | 2643 | kfree(phba->phwi_ctrlr); |
2631 | return -ENOMEM; | 2644 | return -ENOMEM; |
2632 | } | 2645 | } |
@@ -2665,6 +2678,7 @@ static void iscsi_init_global_templates(struct beiscsi_hba *phba) | |||
2665 | static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba) | 2678 | static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba) |
2666 | { | 2679 | { |
2667 | struct be_mem_descriptor *mem_descr_wrbh, *mem_descr_wrb; | 2680 | struct be_mem_descriptor *mem_descr_wrbh, *mem_descr_wrb; |
2681 | struct hwi_context_memory *phwi_ctxt; | ||
2668 | struct wrb_handle *pwrb_handle = NULL; | 2682 | struct wrb_handle *pwrb_handle = NULL; |
2669 | struct hwi_controller *phwi_ctrlr; | 2683 | struct hwi_controller *phwi_ctrlr; |
2670 | struct hwi_wrb_context *pwrb_context; | 2684 | struct hwi_wrb_context *pwrb_context; |
@@ -2679,7 +2693,18 @@ static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba) | |||
2679 | mem_descr_wrb += HWI_MEM_WRB; | 2693 | mem_descr_wrb += HWI_MEM_WRB; |
2680 | phwi_ctrlr = phba->phwi_ctrlr; | 2694 | phwi_ctrlr = phba->phwi_ctrlr; |
2681 | 2695 | ||
2682 | for (index = 0; index < phba->params.cxns_per_ctrl * 2; index += 2) { | 2696 | /* Allocate memory for WRBQ */ |
2697 | phwi_ctxt = phwi_ctrlr->phwi_ctxt; | ||
2698 | phwi_ctxt->be_wrbq = kzalloc(sizeof(struct be_queue_info) * | ||
2699 | phba->fw_config.iscsi_cid_count, | ||
2700 | GFP_KERNEL); | ||
2701 | if (!phwi_ctxt->be_wrbq) { | ||
2702 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, | ||
2703 | "BM_%d : WRBQ Mem Alloc Failed\n"); | ||
2704 | return -ENOMEM; | ||
2705 | } | ||
2706 | |||
2707 | for (index = 0; index < phba->params.cxns_per_ctrl; index++) { | ||
2683 | pwrb_context = &phwi_ctrlr->wrb_context[index]; | 2708 | pwrb_context = &phwi_ctrlr->wrb_context[index]; |
2684 | pwrb_context->pwrb_handle_base = | 2709 | pwrb_context->pwrb_handle_base = |
2685 | kzalloc(sizeof(struct wrb_handle *) * | 2710 | kzalloc(sizeof(struct wrb_handle *) * |
@@ -2722,7 +2747,7 @@ static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba) | |||
2722 | } | 2747 | } |
2723 | } | 2748 | } |
2724 | idx = 0; | 2749 | idx = 0; |
2725 | for (index = 0; index < phba->params.cxns_per_ctrl * 2; index += 2) { | 2750 | for (index = 0; index < phba->params.cxns_per_ctrl; index++) { |
2726 | pwrb_context = &phwi_ctrlr->wrb_context[index]; | 2751 | pwrb_context = &phwi_ctrlr->wrb_context[index]; |
2727 | if (!num_cxn_wrb) { | 2752 | if (!num_cxn_wrb) { |
2728 | pwrb = mem_descr_wrb->mem_array[idx].virtual_address; | 2753 | pwrb = mem_descr_wrb->mem_array[idx].virtual_address; |
@@ -2751,7 +2776,7 @@ init_wrb_hndl_failed: | |||
2751 | return -ENOMEM; | 2776 | return -ENOMEM; |
2752 | } | 2777 | } |
2753 | 2778 | ||
2754 | static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba) | 2779 | static int hwi_init_async_pdu_ctx(struct beiscsi_hba *phba) |
2755 | { | 2780 | { |
2756 | struct hwi_controller *phwi_ctrlr; | 2781 | struct hwi_controller *phwi_ctrlr; |
2757 | struct hba_parameters *p = &phba->params; | 2782 | struct hba_parameters *p = &phba->params; |
@@ -2769,6 +2794,15 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba) | |||
2769 | pasync_ctx = phwi_ctrlr->phwi_ctxt->pasync_ctx; | 2794 | pasync_ctx = phwi_ctrlr->phwi_ctxt->pasync_ctx; |
2770 | memset(pasync_ctx, 0, sizeof(*pasync_ctx)); | 2795 | memset(pasync_ctx, 0, sizeof(*pasync_ctx)); |
2771 | 2796 | ||
2797 | pasync_ctx->async_entry = kzalloc(sizeof(struct hwi_async_entry) * | ||
2798 | phba->fw_config.iscsi_cid_count, | ||
2799 | GFP_KERNEL); | ||
2800 | if (!pasync_ctx->async_entry) { | ||
2801 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, | ||
2802 | "BM_%d : hwi_init_async_pdu_ctx Mem Alloc Failed\n"); | ||
2803 | return -ENOMEM; | ||
2804 | } | ||
2805 | |||
2772 | pasync_ctx->num_entries = p->asyncpdus_per_ctrl; | 2806 | pasync_ctx->num_entries = p->asyncpdus_per_ctrl; |
2773 | pasync_ctx->buffer_size = p->defpdu_hdr_sz; | 2807 | pasync_ctx->buffer_size = p->defpdu_hdr_sz; |
2774 | 2808 | ||
@@ -2933,6 +2967,8 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba) | |||
2933 | pasync_ctx->async_header.ep_read_ptr = -1; | 2967 | pasync_ctx->async_header.ep_read_ptr = -1; |
2934 | pasync_ctx->async_data.host_write_ptr = 0; | 2968 | pasync_ctx->async_data.host_write_ptr = 0; |
2935 | pasync_ctx->async_data.ep_read_ptr = -1; | 2969 | pasync_ctx->async_data.ep_read_ptr = -1; |
2970 | |||
2971 | return 0; | ||
2936 | } | 2972 | } |
2937 | 2973 | ||
2938 | static int | 2974 | static int |
@@ -3292,6 +3328,7 @@ beiscsi_create_wrb_rings(struct beiscsi_hba *phba, | |||
3292 | void *wrb_vaddr; | 3328 | void *wrb_vaddr; |
3293 | struct be_dma_mem sgl; | 3329 | struct be_dma_mem sgl; |
3294 | struct be_mem_descriptor *mem_descr; | 3330 | struct be_mem_descriptor *mem_descr; |
3331 | struct hwi_wrb_context *pwrb_context; | ||
3295 | int status; | 3332 | int status; |
3296 | 3333 | ||
3297 | idx = 0; | 3334 | idx = 0; |
@@ -3350,8 +3387,9 @@ beiscsi_create_wrb_rings(struct beiscsi_hba *phba, | |||
3350 | kfree(pwrb_arr); | 3387 | kfree(pwrb_arr); |
3351 | return status; | 3388 | return status; |
3352 | } | 3389 | } |
3353 | phwi_ctrlr->wrb_context[i * 2].cid = phwi_context->be_wrbq[i]. | 3390 | pwrb_context = &phwi_ctrlr->wrb_context[i]; |
3354 | id; | 3391 | pwrb_context->cid = phwi_context->be_wrbq[i].id; |
3392 | BE_SET_CID_TO_CRI(i, pwrb_context->cid); | ||
3355 | } | 3393 | } |
3356 | kfree(pwrb_arr); | 3394 | kfree(pwrb_arr); |
3357 | return 0; | 3395 | return 0; |
@@ -3364,7 +3402,7 @@ static void free_wrb_handles(struct beiscsi_hba *phba) | |||
3364 | struct hwi_wrb_context *pwrb_context; | 3402 | struct hwi_wrb_context *pwrb_context; |
3365 | 3403 | ||
3366 | phwi_ctrlr = phba->phwi_ctrlr; | 3404 | phwi_ctrlr = phba->phwi_ctrlr; |
3367 | for (index = 0; index < phba->params.cxns_per_ctrl * 2; index += 2) { | 3405 | for (index = 0; index < phba->params.cxns_per_ctrl; index++) { |
3368 | pwrb_context = &phwi_ctrlr->wrb_context[index]; | 3406 | pwrb_context = &phwi_ctrlr->wrb_context[index]; |
3369 | kfree(pwrb_context->pwrb_handle_base); | 3407 | kfree(pwrb_context->pwrb_handle_base); |
3370 | kfree(pwrb_context->pwrb_handle_basestd); | 3408 | kfree(pwrb_context->pwrb_handle_basestd); |
@@ -3393,6 +3431,7 @@ static void hwi_cleanup(struct beiscsi_hba *phba) | |||
3393 | struct be_ctrl_info *ctrl = &phba->ctrl; | 3431 | struct be_ctrl_info *ctrl = &phba->ctrl; |
3394 | struct hwi_controller *phwi_ctrlr; | 3432 | struct hwi_controller *phwi_ctrlr; |
3395 | struct hwi_context_memory *phwi_context; | 3433 | struct hwi_context_memory *phwi_context; |
3434 | struct hwi_async_pdu_context *pasync_ctx; | ||
3396 | int i, eq_num; | 3435 | int i, eq_num; |
3397 | 3436 | ||
3398 | phwi_ctrlr = phba->phwi_ctrlr; | 3437 | phwi_ctrlr = phba->phwi_ctrlr; |
@@ -3402,6 +3441,7 @@ static void hwi_cleanup(struct beiscsi_hba *phba) | |||
3402 | if (q->created) | 3441 | if (q->created) |
3403 | beiscsi_cmd_q_destroy(ctrl, q, QTYPE_WRBQ); | 3442 | beiscsi_cmd_q_destroy(ctrl, q, QTYPE_WRBQ); |
3404 | } | 3443 | } |
3444 | kfree(phwi_context->be_wrbq); | ||
3405 | free_wrb_handles(phba); | 3445 | free_wrb_handles(phba); |
3406 | 3446 | ||
3407 | q = &phwi_context->be_def_hdrq; | 3447 | q = &phwi_context->be_def_hdrq; |
@@ -3429,6 +3469,9 @@ static void hwi_cleanup(struct beiscsi_hba *phba) | |||
3429 | beiscsi_cmd_q_destroy(ctrl, q, QTYPE_EQ); | 3469 | beiscsi_cmd_q_destroy(ctrl, q, QTYPE_EQ); |
3430 | } | 3470 | } |
3431 | be_mcc_queues_destroy(phba); | 3471 | be_mcc_queues_destroy(phba); |
3472 | |||
3473 | pasync_ctx = phwi_ctrlr->phwi_ctxt->pasync_ctx; | ||
3474 | kfree(pasync_ctx->async_entry); | ||
3432 | be_cmd_fw_uninit(ctrl); | 3475 | be_cmd_fw_uninit(ctrl); |
3433 | } | 3476 | } |
3434 | 3477 | ||
@@ -3607,7 +3650,12 @@ static int hwi_init_controller(struct beiscsi_hba *phba) | |||
3607 | if (beiscsi_init_wrb_handle(phba)) | 3650 | if (beiscsi_init_wrb_handle(phba)) |
3608 | return -ENOMEM; | 3651 | return -ENOMEM; |
3609 | 3652 | ||
3610 | hwi_init_async_pdu_ctx(phba); | 3653 | if (hwi_init_async_pdu_ctx(phba)) { |
3654 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, | ||
3655 | "BM_%d : hwi_init_async_pdu_ctx failed\n"); | ||
3656 | return -ENOMEM; | ||
3657 | } | ||
3658 | |||
3611 | if (hwi_init_port(phba) != 0) { | 3659 | if (hwi_init_port(phba) != 0) { |
3612 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, | 3660 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, |
3613 | "BM_%d : hwi_init_controller failed\n"); | 3661 | "BM_%d : hwi_init_controller failed\n"); |
@@ -3637,6 +3685,7 @@ static void beiscsi_free_mem(struct beiscsi_hba *phba) | |||
3637 | mem_descr++; | 3685 | mem_descr++; |
3638 | } | 3686 | } |
3639 | kfree(phba->init_mem); | 3687 | kfree(phba->init_mem); |
3688 | kfree(phba->phwi_ctrlr->wrb_context); | ||
3640 | kfree(phba->phwi_ctrlr); | 3689 | kfree(phba->phwi_ctrlr); |
3641 | } | 3690 | } |
3642 | 3691 | ||
@@ -3769,7 +3818,7 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba) | |||
3769 | 3818 | ||
3770 | static int hba_setup_cid_tbls(struct beiscsi_hba *phba) | 3819 | static int hba_setup_cid_tbls(struct beiscsi_hba *phba) |
3771 | { | 3820 | { |
3772 | int i, new_cid; | 3821 | int i; |
3773 | 3822 | ||
3774 | phba->cid_array = kzalloc(sizeof(void *) * phba->params.cxns_per_ctrl, | 3823 | phba->cid_array = kzalloc(sizeof(void *) * phba->params.cxns_per_ctrl, |
3775 | GFP_KERNEL); | 3824 | GFP_KERNEL); |
@@ -3780,19 +3829,33 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba) | |||
3780 | return -ENOMEM; | 3829 | return -ENOMEM; |
3781 | } | 3830 | } |
3782 | phba->ep_array = kzalloc(sizeof(struct iscsi_endpoint *) * | 3831 | phba->ep_array = kzalloc(sizeof(struct iscsi_endpoint *) * |
3783 | phba->params.cxns_per_ctrl * 2, GFP_KERNEL); | 3832 | phba->params.cxns_per_ctrl, GFP_KERNEL); |
3784 | if (!phba->ep_array) { | 3833 | if (!phba->ep_array) { |
3785 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, | 3834 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, |
3786 | "BM_%d : Failed to allocate memory in " | 3835 | "BM_%d : Failed to allocate memory in " |
3787 | "hba_setup_cid_tbls\n"); | 3836 | "hba_setup_cid_tbls\n"); |
3788 | kfree(phba->cid_array); | 3837 | kfree(phba->cid_array); |
3838 | phba->cid_array = NULL; | ||
3789 | return -ENOMEM; | 3839 | return -ENOMEM; |
3790 | } | 3840 | } |
3791 | new_cid = phba->fw_config.iscsi_cid_start; | 3841 | |
3792 | for (i = 0; i < phba->params.cxns_per_ctrl; i++) { | 3842 | phba->conn_table = kzalloc(sizeof(struct beiscsi_conn *) * |
3793 | phba->cid_array[i] = new_cid; | 3843 | phba->params.cxns_per_ctrl, GFP_KERNEL); |
3794 | new_cid += 2; | 3844 | if (!phba->conn_table) { |
3845 | beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, | ||
3846 | "BM_%d : Failed to allocate memory in" | ||
3847 | "hba_setup_cid_tbls\n"); | ||
3848 | |||
3849 | kfree(phba->cid_array); | ||
3850 | kfree(phba->ep_array); | ||
3851 | phba->cid_array = NULL; | ||
3852 | phba->ep_array = NULL; | ||
3853 | return -ENOMEM; | ||
3795 | } | 3854 | } |
3855 | |||
3856 | for (i = 0; i < phba->params.cxns_per_ctrl; i++) | ||
3857 | phba->cid_array[i] = phba->phwi_ctrlr->wrb_context[i].cid; | ||
3858 | |||
3796 | phba->avlbl_cids = phba->params.cxns_per_ctrl; | 3859 | phba->avlbl_cids = phba->params.cxns_per_ctrl; |
3797 | return 0; | 3860 | return 0; |
3798 | } | 3861 | } |
@@ -4062,6 +4125,7 @@ static void beiscsi_clean_port(struct beiscsi_hba *phba) | |||
4062 | kfree(phba->eh_sgl_hndl_base); | 4125 | kfree(phba->eh_sgl_hndl_base); |
4063 | kfree(phba->cid_array); | 4126 | kfree(phba->cid_array); |
4064 | kfree(phba->ep_array); | 4127 | kfree(phba->ep_array); |
4128 | kfree(phba->conn_table); | ||
4065 | } | 4129 | } |
4066 | 4130 | ||
4067 | /** | 4131 | /** |
@@ -4079,11 +4143,12 @@ beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn, | |||
4079 | struct beiscsi_hba *phba = beiscsi_conn->phba; | 4143 | struct beiscsi_hba *phba = beiscsi_conn->phba; |
4080 | struct hwi_wrb_context *pwrb_context; | 4144 | struct hwi_wrb_context *pwrb_context; |
4081 | struct hwi_controller *phwi_ctrlr; | 4145 | struct hwi_controller *phwi_ctrlr; |
4146 | uint16_t cri_index = BE_GET_CRI_FROM_CID( | ||
4147 | beiscsi_conn->beiscsi_conn_cid); | ||
4082 | 4148 | ||
4083 | phwi_ctrlr = phba->phwi_ctrlr; | 4149 | phwi_ctrlr = phba->phwi_ctrlr; |
4084 | pwrb_context = &phwi_ctrlr->wrb_context | 4150 | pwrb_context = &phwi_ctrlr->wrb_context[cri_index]; |
4085 | [beiscsi_conn->beiscsi_conn_cid | 4151 | |
4086 | - phba->fw_config.iscsi_cid_start]; | ||
4087 | io_task = task->dd_data; | 4152 | io_task = task->dd_data; |
4088 | 4153 | ||
4089 | if (io_task->pwrb_handle) { | 4154 | if (io_task->pwrb_handle) { |
@@ -4123,10 +4188,11 @@ static void beiscsi_cleanup_task(struct iscsi_task *task) | |||
4123 | struct beiscsi_session *beiscsi_sess = beiscsi_conn->beiscsi_sess; | 4188 | struct beiscsi_session *beiscsi_sess = beiscsi_conn->beiscsi_sess; |
4124 | struct hwi_wrb_context *pwrb_context; | 4189 | struct hwi_wrb_context *pwrb_context; |
4125 | struct hwi_controller *phwi_ctrlr; | 4190 | struct hwi_controller *phwi_ctrlr; |
4191 | uint16_t cri_index = BE_GET_CRI_FROM_CID( | ||
4192 | beiscsi_conn->beiscsi_conn_cid); | ||
4126 | 4193 | ||
4127 | phwi_ctrlr = phba->phwi_ctrlr; | 4194 | phwi_ctrlr = phba->phwi_ctrlr; |
4128 | pwrb_context = &phwi_ctrlr->wrb_context[beiscsi_conn->beiscsi_conn_cid | 4195 | pwrb_context = &phwi_ctrlr->wrb_context[cri_index]; |
4129 | - phba->fw_config.iscsi_cid_start]; | ||
4130 | 4196 | ||
4131 | if (io_task->cmd_bhs) { | 4197 | if (io_task->cmd_bhs) { |
4132 | pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs, | 4198 | pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs, |
@@ -4172,8 +4238,7 @@ beiscsi_offload_connection(struct beiscsi_conn *beiscsi_conn, | |||
4172 | beiscsi_cleanup_task(task); | 4238 | beiscsi_cleanup_task(task); |
4173 | spin_unlock_bh(&session->lock); | 4239 | spin_unlock_bh(&session->lock); |
4174 | 4240 | ||
4175 | pwrb_handle = alloc_wrb_handle(phba, (beiscsi_conn->beiscsi_conn_cid - | 4241 | pwrb_handle = alloc_wrb_handle(phba, beiscsi_conn->beiscsi_conn_cid); |
4176 | phba->fw_config.iscsi_cid_start)); | ||
4177 | 4242 | ||
4178 | /* Check for the adapter family */ | 4243 | /* Check for the adapter family */ |
4179 | if (is_chip_be2_be3r(phba)) | 4244 | if (is_chip_be2_be3r(phba)) |
@@ -4220,6 +4285,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) | |||
4220 | struct hwi_wrb_context *pwrb_context; | 4285 | struct hwi_wrb_context *pwrb_context; |
4221 | struct hwi_controller *phwi_ctrlr; | 4286 | struct hwi_controller *phwi_ctrlr; |
4222 | itt_t itt; | 4287 | itt_t itt; |
4288 | uint16_t cri_index = 0; | ||
4223 | struct beiscsi_session *beiscsi_sess = beiscsi_conn->beiscsi_sess; | 4289 | struct beiscsi_session *beiscsi_sess = beiscsi_conn->beiscsi_sess; |
4224 | dma_addr_t paddr; | 4290 | dma_addr_t paddr; |
4225 | 4291 | ||
@@ -4249,8 +4315,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) | |||
4249 | goto free_hndls; | 4315 | goto free_hndls; |
4250 | } | 4316 | } |
4251 | io_task->pwrb_handle = alloc_wrb_handle(phba, | 4317 | io_task->pwrb_handle = alloc_wrb_handle(phba, |
4252 | beiscsi_conn->beiscsi_conn_cid - | 4318 | beiscsi_conn->beiscsi_conn_cid); |
4253 | phba->fw_config.iscsi_cid_start); | ||
4254 | if (!io_task->pwrb_handle) { | 4319 | if (!io_task->pwrb_handle) { |
4255 | beiscsi_log(phba, KERN_ERR, | 4320 | beiscsi_log(phba, KERN_ERR, |
4256 | BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG, | 4321 | BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG, |
@@ -4284,8 +4349,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) | |||
4284 | io_task->psgl_handle; | 4349 | io_task->psgl_handle; |
4285 | io_task->pwrb_handle = | 4350 | io_task->pwrb_handle = |
4286 | alloc_wrb_handle(phba, | 4351 | alloc_wrb_handle(phba, |
4287 | beiscsi_conn->beiscsi_conn_cid - | 4352 | beiscsi_conn->beiscsi_conn_cid); |
4288 | phba->fw_config.iscsi_cid_start); | ||
4289 | if (!io_task->pwrb_handle) { | 4353 | if (!io_task->pwrb_handle) { |
4290 | beiscsi_log(phba, KERN_ERR, | 4354 | beiscsi_log(phba, KERN_ERR, |
4291 | BEISCSI_LOG_IO | | 4355 | BEISCSI_LOG_IO | |
@@ -4321,8 +4385,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) | |||
4321 | } | 4385 | } |
4322 | io_task->pwrb_handle = | 4386 | io_task->pwrb_handle = |
4323 | alloc_wrb_handle(phba, | 4387 | alloc_wrb_handle(phba, |
4324 | beiscsi_conn->beiscsi_conn_cid - | 4388 | beiscsi_conn->beiscsi_conn_cid); |
4325 | phba->fw_config.iscsi_cid_start); | ||
4326 | if (!io_task->pwrb_handle) { | 4389 | if (!io_task->pwrb_handle) { |
4327 | beiscsi_log(phba, KERN_ERR, | 4390 | beiscsi_log(phba, KERN_ERR, |
4328 | BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG, | 4391 | BEISCSI_LOG_IO | BEISCSI_LOG_CONFIG, |
@@ -4350,12 +4413,13 @@ free_io_hndls: | |||
4350 | free_mgmt_hndls: | 4413 | free_mgmt_hndls: |
4351 | spin_lock(&phba->mgmt_sgl_lock); | 4414 | spin_lock(&phba->mgmt_sgl_lock); |
4352 | free_mgmt_sgl_handle(phba, io_task->psgl_handle); | 4415 | free_mgmt_sgl_handle(phba, io_task->psgl_handle); |
4416 | io_task->psgl_handle = NULL; | ||
4353 | spin_unlock(&phba->mgmt_sgl_lock); | 4417 | spin_unlock(&phba->mgmt_sgl_lock); |
4354 | free_hndls: | 4418 | free_hndls: |
4355 | phwi_ctrlr = phba->phwi_ctrlr; | 4419 | phwi_ctrlr = phba->phwi_ctrlr; |
4356 | pwrb_context = &phwi_ctrlr->wrb_context[ | 4420 | cri_index = BE_GET_CRI_FROM_CID( |
4357 | beiscsi_conn->beiscsi_conn_cid - | 4421 | beiscsi_conn->beiscsi_conn_cid); |
4358 | phba->fw_config.iscsi_cid_start]; | 4422 | pwrb_context = &phwi_ctrlr->wrb_context[cri_index]; |
4359 | if (io_task->pwrb_handle) | 4423 | if (io_task->pwrb_handle) |
4360 | free_wrb_handle(phba, pwrb_context, io_task->pwrb_handle); | 4424 | free_wrb_handle(phba, pwrb_context, io_task->pwrb_handle); |
4361 | io_task->pwrb_handle = NULL; | 4425 | io_task->pwrb_handle = NULL; |
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h index ac4ef34d80b1..6d83ad8ca948 100644 --- a/drivers/scsi/be2iscsi/be_main.h +++ b/drivers/scsi/be2iscsi/be_main.h | |||
@@ -307,10 +307,15 @@ struct beiscsi_hba { | |||
307 | unsigned short avlbl_cids; | 307 | unsigned short avlbl_cids; |
308 | unsigned short cid_alloc; | 308 | unsigned short cid_alloc; |
309 | unsigned short cid_free; | 309 | unsigned short cid_free; |
310 | struct beiscsi_conn *conn_table[BE2_MAX_SESSIONS * 2]; | ||
311 | struct list_head hba_queue; | 310 | struct list_head hba_queue; |
311 | #define BE_MAX_SESSION 2048 | ||
312 | #define BE_SET_CID_TO_CRI(cri_index, cid) \ | ||
313 | (phba->cid_to_cri_map[cid] = cri_index) | ||
314 | #define BE_GET_CRI_FROM_CID(cid) (phba->cid_to_cri_map[cid]) | ||
315 | unsigned short cid_to_cri_map[BE_MAX_SESSION]; | ||
312 | unsigned short *cid_array; | 316 | unsigned short *cid_array; |
313 | struct iscsi_endpoint **ep_array; | 317 | struct iscsi_endpoint **ep_array; |
318 | struct beiscsi_conn **conn_table; | ||
314 | struct iscsi_boot_kset *boot_kset; | 319 | struct iscsi_boot_kset *boot_kset; |
315 | struct Scsi_Host *shost; | 320 | struct Scsi_Host *shost; |
316 | struct iscsi_iface *ipv4_iface; | 321 | struct iscsi_iface *ipv4_iface; |
@@ -567,7 +572,7 @@ struct hwi_async_pdu_context { | |||
567 | * This is a varying size list! Do not add anything | 572 | * This is a varying size list! Do not add anything |
568 | * after this entry!! | 573 | * after this entry!! |
569 | */ | 574 | */ |
570 | struct hwi_async_entry async_entry[BE2_MAX_SESSIONS * 2]; | 575 | struct hwi_async_entry *async_entry; |
571 | }; | 576 | }; |
572 | 577 | ||
573 | #define PDUCQE_CODE_MASK 0x0000003F | 578 | #define PDUCQE_CODE_MASK 0x0000003F |
@@ -939,7 +944,7 @@ struct hwi_controller { | |||
939 | struct sgl_handle *psgl_handle_base; | 944 | struct sgl_handle *psgl_handle_base; |
940 | unsigned int wrb_mem_index; | 945 | unsigned int wrb_mem_index; |
941 | 946 | ||
942 | struct hwi_wrb_context wrb_context[BE2_MAX_SESSIONS * 2]; | 947 | struct hwi_wrb_context *wrb_context; |
943 | struct mcc_wrb *pmcc_wrb_base; | 948 | struct mcc_wrb *pmcc_wrb_base; |
944 | struct be_ring default_pdu_hdr; | 949 | struct be_ring default_pdu_hdr; |
945 | struct be_ring default_pdu_data; | 950 | struct be_ring default_pdu_data; |
@@ -976,9 +981,7 @@ struct hwi_context_memory { | |||
976 | struct be_queue_info be_def_hdrq; | 981 | struct be_queue_info be_def_hdrq; |
977 | struct be_queue_info be_def_dataq; | 982 | struct be_queue_info be_def_dataq; |
978 | 983 | ||
979 | struct be_queue_info be_wrbq[BE2_MAX_SESSIONS]; | 984 | struct be_queue_info *be_wrbq; |
980 | struct be_mcc_wrb_context *pbe_mcc_context; | ||
981 | |||
982 | struct hwi_async_pdu_context *pasync_ctx; | 985 | struct hwi_async_pdu_context *pasync_ctx; |
983 | }; | 986 | }; |
984 | 987 | ||