aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/be2iscsi')
-rw-r--r--drivers/scsi/be2iscsi/be_main.c181
1 files changed, 33 insertions, 148 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d611a13dabf0..522e7d526331 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -40,7 +40,6 @@
40static unsigned int be_iopoll_budget = 10; 40static unsigned int be_iopoll_budget = 10;
41static unsigned int be_max_phys_size = 64; 41static unsigned int be_max_phys_size = 64;
42static unsigned int enable_msix = 1; 42static unsigned int enable_msix = 1;
43static unsigned int ring_mode;
44 43
45MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table); 44MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
46MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR); 45MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR);
@@ -671,9 +670,7 @@ static void
671free_wrb_handle(struct beiscsi_hba *phba, struct hwi_wrb_context *pwrb_context, 670free_wrb_handle(struct beiscsi_hba *phba, struct hwi_wrb_context *pwrb_context,
672 struct wrb_handle *pwrb_handle) 671 struct wrb_handle *pwrb_handle)
673{ 672{
674 if (!ring_mode) 673 pwrb_context->pwrb_handle_base[pwrb_context->free_index] = pwrb_handle;
675 pwrb_context->pwrb_handle_base[pwrb_context->free_index] =
676 pwrb_handle;
677 pwrb_context->wrb_handles_available++; 674 pwrb_context->wrb_handles_available++;
678 if (pwrb_context->free_index == (phba->params.wrbs_per_cxn - 1)) 675 if (pwrb_context->free_index == (phba->params.wrbs_per_cxn - 1))
679 pwrb_context->free_index = 0; 676 pwrb_context->free_index = 0;
@@ -865,7 +862,6 @@ hwi_complete_drvr_msgs(struct beiscsi_conn *beiscsi_conn,
865{ 862{
866 struct hwi_wrb_context *pwrb_context; 863 struct hwi_wrb_context *pwrb_context;
867 struct wrb_handle *pwrb_handle = NULL; 864 struct wrb_handle *pwrb_handle = NULL;
868 struct sgl_handle *psgl_handle = NULL;
869 struct hwi_controller *phwi_ctrlr; 865 struct hwi_controller *phwi_ctrlr;
870 struct iscsi_task *task; 866 struct iscsi_task *task;
871 struct beiscsi_io_task *io_task; 867 struct beiscsi_io_task *io_task;
@@ -873,23 +869,14 @@ hwi_complete_drvr_msgs(struct beiscsi_conn *beiscsi_conn,
873 struct iscsi_session *session = conn->session; 869 struct iscsi_session *session = conn->session;
874 870
875 phwi_ctrlr = phba->phwi_ctrlr; 871 phwi_ctrlr = phba->phwi_ctrlr;
876 if (ring_mode) { 872 pwrb_context = &phwi_ctrlr->wrb_context[((psol->
877 psgl_handle = phba->sgl_hndl_array[((psol->
878 dw[offsetof(struct amap_sol_cqe_ring, icd_index) /
879 32] & SOL_ICD_INDEX_MASK) >> 6)];
880 pwrb_context = &phwi_ctrlr->wrb_context[psgl_handle->cid];
881 task = psgl_handle->task;
882 pwrb_handle = NULL;
883 } else {
884 pwrb_context = &phwi_ctrlr->wrb_context[((psol->
885 dw[offsetof(struct amap_sol_cqe, cid) / 32] & 873 dw[offsetof(struct amap_sol_cqe, cid) / 32] &
886 SOL_CID_MASK) >> 6) - 874 SOL_CID_MASK) >> 6) -
887 phba->fw_config.iscsi_cid_start]; 875 phba->fw_config.iscsi_cid_start];
888 pwrb_handle = pwrb_context->pwrb_handle_basestd[((psol-> 876 pwrb_handle = pwrb_context->pwrb_handle_basestd[((psol->
889 dw[offsetof(struct amap_sol_cqe, wrb_index) / 877 dw[offsetof(struct amap_sol_cqe, wrb_index) /
890 32] & SOL_WRB_INDEX_MASK) >> 16)]; 878 32] & SOL_WRB_INDEX_MASK) >> 16)];
891 task = pwrb_handle->pio_handle; 879 task = pwrb_handle->pio_handle;
892 }
893 880
894 io_task = task->dd_data; 881 io_task = task->dd_data;
895 spin_lock(&phba->mgmt_sgl_lock); 882 spin_lock(&phba->mgmt_sgl_lock);
@@ -930,32 +917,23 @@ static void hwi_complete_cmd(struct beiscsi_conn *beiscsi_conn,
930 struct iscsi_wrb *pwrb = NULL; 917 struct iscsi_wrb *pwrb = NULL;
931 struct hwi_controller *phwi_ctrlr; 918 struct hwi_controller *phwi_ctrlr;
932 struct iscsi_task *task; 919 struct iscsi_task *task;
933 struct sgl_handle *psgl_handle = NULL;
934 unsigned int type; 920 unsigned int type;
935 struct iscsi_conn *conn = beiscsi_conn->conn; 921 struct iscsi_conn *conn = beiscsi_conn->conn;
936 struct iscsi_session *session = conn->session; 922 struct iscsi_session *session = conn->session;
937 923
938 phwi_ctrlr = phba->phwi_ctrlr; 924 phwi_ctrlr = phba->phwi_ctrlr;
939 if (ring_mode) { 925 pwrb_context = &phwi_ctrlr->wrb_context[((psol->dw[offsetof
940 psgl_handle = phba->sgl_hndl_array[((psol->
941 dw[offsetof(struct amap_sol_cqe_ring, icd_index) /
942 32] & SOL_ICD_INDEX_MASK) >> 6)];
943 task = psgl_handle->task;
944 type = psgl_handle->type;
945 } else {
946 pwrb_context = &phwi_ctrlr->
947 wrb_context[((psol->dw[offsetof
948 (struct amap_sol_cqe, cid) / 32] 926 (struct amap_sol_cqe, cid) / 32]
949 & SOL_CID_MASK) >> 6) - 927 & SOL_CID_MASK) >> 6) -
950 phba->fw_config.iscsi_cid_start]; 928 phba->fw_config.iscsi_cid_start];
951 pwrb_handle = pwrb_context->pwrb_handle_basestd[((psol-> 929 pwrb_handle = pwrb_context->pwrb_handle_basestd[((psol->
952 dw[offsetof(struct amap_sol_cqe, wrb_index) / 930 dw[offsetof(struct amap_sol_cqe, wrb_index) /
953 32] & SOL_WRB_INDEX_MASK) >> 16)]; 931 32] & SOL_WRB_INDEX_MASK) >> 16)];
954 task = pwrb_handle->pio_handle; 932 task = pwrb_handle->pio_handle;
955 pwrb = pwrb_handle->pwrb; 933 pwrb = pwrb_handle->pwrb;
956 type = (pwrb->dw[offsetof(struct amap_iscsi_wrb, type) / 32] & 934 type = (pwrb->dw[offsetof(struct amap_iscsi_wrb, type) / 32] &
957 WRB_TYPE_MASK) >> 28; 935 WRB_TYPE_MASK) >> 28;
958 } 936
959 spin_lock_bh(&session->lock); 937 spin_lock_bh(&session->lock);
960 switch (type) { 938 switch (type) {
961 case HWH_TYPE_IO: 939 case HWH_TYPE_IO:
@@ -986,15 +964,7 @@ static void hwi_complete_cmd(struct beiscsi_conn *beiscsi_conn,
986 break; 964 break;
987 965
988 default: 966 default:
989 if (ring_mode) 967 shost_printk(KERN_WARNING, phba->shost,
990 shost_printk(KERN_WARNING, phba->shost,
991 "In hwi_complete_cmd, unknown type = %d"
992 "icd_index 0x%x CID 0x%x\n", type,
993 ((psol->dw[offsetof(struct amap_sol_cqe_ring,
994 icd_index) / 32] & SOL_ICD_INDEX_MASK) >> 6),
995 psgl_handle->cid);
996 else
997 shost_printk(KERN_WARNING, phba->shost,
998 "In hwi_complete_cmd, unknown type = %d" 968 "In hwi_complete_cmd, unknown type = %d"
999 "wrb_index 0x%x CID 0x%x\n", type, 969 "wrb_index 0x%x CID 0x%x\n", type,
1000 ((psol->dw[offsetof(struct amap_iscsi_wrb, 970 ((psol->dw[offsetof(struct amap_iscsi_wrb,
@@ -1483,7 +1453,6 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
1483 unsigned int num_processed = 0; 1453 unsigned int num_processed = 0;
1484 unsigned int tot_nump = 0; 1454 unsigned int tot_nump = 0;
1485 struct beiscsi_conn *beiscsi_conn; 1455 struct beiscsi_conn *beiscsi_conn;
1486 struct sgl_handle *psgl_handle = NULL;
1487 struct beiscsi_endpoint *beiscsi_ep; 1456 struct beiscsi_endpoint *beiscsi_ep;
1488 struct iscsi_endpoint *ep; 1457 struct iscsi_endpoint *ep;
1489 struct beiscsi_hba *phba; 1458 struct beiscsi_hba *phba;
@@ -1496,18 +1465,11 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
1496 CQE_VALID_MASK) { 1465 CQE_VALID_MASK) {
1497 be_dws_le_to_cpu(sol, sizeof(struct sol_cqe)); 1466 be_dws_le_to_cpu(sol, sizeof(struct sol_cqe));
1498 1467
1499 if (ring_mode) { 1468 ep = phba->ep_array[(u32) ((sol->
1500 psgl_handle = phba->sgl_hndl_array[((sol->
1501 dw[offsetof(struct amap_sol_cqe_ring,
1502 icd_index) / 32] & SOL_ICD_INDEX_MASK)
1503 >> 6)];
1504 ep = phba->ep_array[psgl_handle->cid];
1505 } else {
1506 ep = phba->ep_array[(u32) ((sol->
1507 dw[offsetof(struct amap_sol_cqe, cid) / 32] & 1469 dw[offsetof(struct amap_sol_cqe, cid) / 32] &
1508 SOL_CID_MASK) >> 6) - 1470 SOL_CID_MASK) >> 6) -
1509 phba->fw_config.iscsi_cid_start]; 1471 phba->fw_config.iscsi_cid_start];
1510 } 1472
1511 beiscsi_ep = ep->dd_data; 1473 beiscsi_ep = ep->dd_data;
1512 beiscsi_conn = beiscsi_ep->conn; 1474 beiscsi_conn = beiscsi_ep->conn;
1513 1475
@@ -1553,21 +1515,13 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
1553 case CMD_CXN_KILLED_ITT_INVALID: 1515 case CMD_CXN_KILLED_ITT_INVALID:
1554 case CMD_CXN_KILLED_SEQ_OUTOFORDER: 1516 case CMD_CXN_KILLED_SEQ_OUTOFORDER:
1555 case CMD_CXN_KILLED_INVALID_DATASN_RCVD: 1517 case CMD_CXN_KILLED_INVALID_DATASN_RCVD:
1556 if (ring_mode) { 1518 SE_DEBUG(DBG_LVL_1,
1557 SE_DEBUG(DBG_LVL_1,
1558 "CQ Error notification for cmd.. "
1559 "code %d cid 0x%x\n",
1560 sol->dw[offsetof(struct amap_sol_cqe, code) /
1561 32] & CQE_CODE_MASK, psgl_handle->cid);
1562 } else {
1563 SE_DEBUG(DBG_LVL_1,
1564 "CQ Error notification for cmd.. " 1519 "CQ Error notification for cmd.. "
1565 "code %d cid 0x%x\n", 1520 "code %d cid 0x%x\n",
1566 sol->dw[offsetof(struct amap_sol_cqe, code) / 1521 sol->dw[offsetof(struct amap_sol_cqe, code) /
1567 32] & CQE_CODE_MASK, 1522 32] & CQE_CODE_MASK,
1568 (sol->dw[offsetof(struct amap_sol_cqe, cid) / 1523 (sol->dw[offsetof(struct amap_sol_cqe, cid) /
1569 32] & SOL_CID_MASK)); 1524 32] & SOL_CID_MASK));
1570 }
1571 break; 1525 break;
1572 case UNSOL_DATA_DIGEST_ERROR_NOTIFY: 1526 case UNSOL_DATA_DIGEST_ERROR_NOTIFY:
1573 SE_DEBUG(DBG_LVL_1, 1527 SE_DEBUG(DBG_LVL_1,
@@ -1589,37 +1543,23 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq)
1589 case CXN_KILLED_OVER_RUN_RESIDUAL: 1543 case CXN_KILLED_OVER_RUN_RESIDUAL:
1590 case CXN_KILLED_UNDER_RUN_RESIDUAL: 1544 case CXN_KILLED_UNDER_RUN_RESIDUAL:
1591 case CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN: 1545 case CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN:
1592 if (ring_mode) { 1546 SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset CID "
1593 SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset CID "
1594 "0x%x...\n",
1595 sol->dw[offsetof(struct amap_sol_cqe, code) /
1596 32] & CQE_CODE_MASK, psgl_handle->cid);
1597 } else {
1598 SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset CID "
1599 "0x%x...\n", 1547 "0x%x...\n",
1600 sol->dw[offsetof(struct amap_sol_cqe, code) / 1548 sol->dw[offsetof(struct amap_sol_cqe, code) /
1601 32] & CQE_CODE_MASK, 1549 32] & CQE_CODE_MASK,
1602 (sol->dw[offsetof(struct amap_sol_cqe, cid) / 1550 (sol->dw[offsetof(struct amap_sol_cqe, cid) /
1603 32] & CQE_CID_MASK)); 1551 32] & CQE_CID_MASK));
1604 }
1605 iscsi_conn_failure(beiscsi_conn->conn, 1552 iscsi_conn_failure(beiscsi_conn->conn,
1606 ISCSI_ERR_CONN_FAILED); 1553 ISCSI_ERR_CONN_FAILED);
1607 break; 1554 break;
1608 case CXN_KILLED_RST_SENT: 1555 case CXN_KILLED_RST_SENT:
1609 case CXN_KILLED_RST_RCVD: 1556 case CXN_KILLED_RST_RCVD:
1610 if (ring_mode) { 1557 SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset"
1611 SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset"
1612 "received/sent on CID 0x%x...\n",
1613 sol->dw[offsetof(struct amap_sol_cqe, code) /
1614 32] & CQE_CODE_MASK, psgl_handle->cid);
1615 } else {
1616 SE_DEBUG(DBG_LVL_1, "CQ Error %d, reset"
1617 "received/sent on CID 0x%x...\n", 1558 "received/sent on CID 0x%x...\n",
1618 sol->dw[offsetof(struct amap_sol_cqe, code) / 1559 sol->dw[offsetof(struct amap_sol_cqe, code) /
1619 32] & CQE_CODE_MASK, 1560 32] & CQE_CODE_MASK,
1620 (sol->dw[offsetof(struct amap_sol_cqe, cid) / 1561 (sol->dw[offsetof(struct amap_sol_cqe, cid) /
1621 32] & CQE_CID_MASK)); 1562 32] & CQE_CID_MASK));
1622 }
1623 iscsi_conn_failure(beiscsi_conn->conn, 1563 iscsi_conn_failure(beiscsi_conn->conn,
1624 ISCSI_ERR_CONN_FAILED); 1564 ISCSI_ERR_CONN_FAILED);
1625 break; 1565 break;
@@ -2848,11 +2788,6 @@ static int hwi_init_port(struct beiscsi_hba *phba)
2848 goto error; 2788 goto error;
2849 } 2789 }
2850 2790
2851 if (phba->fw_config.iscsi_features == 0x1)
2852 ring_mode = 1;
2853 else
2854 ring_mode = 0;
2855
2856 status = beiscsi_create_cqs(phba, phwi_context); 2791 status = beiscsi_create_cqs(phba, phwi_context);
2857 if (status != 0) { 2792 if (status != 0) {
2858 shost_printk(KERN_ERR, phba->shost, "CQ not created\n"); 2793 shost_printk(KERN_ERR, phba->shost, "CQ not created\n");
@@ -2980,17 +2915,6 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
2980 phba->io_sgl_hndl_avbl = 0; 2915 phba->io_sgl_hndl_avbl = 0;
2981 phba->eh_sgl_hndl_avbl = 0; 2916 phba->eh_sgl_hndl_avbl = 0;
2982 2917
2983 if (ring_mode) {
2984 phba->sgl_hndl_array = kzalloc(sizeof(struct sgl_handle *) *
2985 phba->params.icds_per_ctrl,
2986 GFP_KERNEL);
2987 if (!phba->sgl_hndl_array) {
2988 shost_printk(KERN_ERR, phba->shost,
2989 "Mem Alloc Failed. Failing to load\n");
2990 return -ENOMEM;
2991 }
2992 }
2993
2994 mem_descr_sglh = phba->init_mem; 2918 mem_descr_sglh = phba->init_mem;
2995 mem_descr_sglh += HWI_MEM_SGLH; 2919 mem_descr_sglh += HWI_MEM_SGLH;
2996 if (1 == mem_descr_sglh->num_elements) { 2920 if (1 == mem_descr_sglh->num_elements) {
@@ -2998,8 +2922,6 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
2998 phba->params.ios_per_ctrl, 2922 phba->params.ios_per_ctrl,
2999 GFP_KERNEL); 2923 GFP_KERNEL);
3000 if (!phba->io_sgl_hndl_base) { 2924 if (!phba->io_sgl_hndl_base) {
3001 if (ring_mode)
3002 kfree(phba->sgl_hndl_array);
3003 shost_printk(KERN_ERR, phba->shost, 2925 shost_printk(KERN_ERR, phba->shost,
3004 "Mem Alloc Failed. Failing to load\n"); 2926 "Mem Alloc Failed. Failing to load\n");
3005 return -ENOMEM; 2927 return -ENOMEM;
@@ -3184,8 +3106,6 @@ static int beiscsi_init_port(struct beiscsi_hba *phba)
3184 if (hba_setup_cid_tbls(phba)) { 3106 if (hba_setup_cid_tbls(phba)) {
3185 shost_printk(KERN_ERR, phba->shost, 3107 shost_printk(KERN_ERR, phba->shost,
3186 "Failed in hba_setup_cid_tbls\n"); 3108 "Failed in hba_setup_cid_tbls\n");
3187 if (ring_mode)
3188 kfree(phba->sgl_hndl_array);
3189 kfree(phba->io_sgl_hndl_base); 3109 kfree(phba->io_sgl_hndl_base);
3190 kfree(phba->eh_sgl_hndl_base); 3110 kfree(phba->eh_sgl_hndl_base);
3191 goto do_cleanup_ctrlr; 3111 goto do_cleanup_ctrlr;
@@ -3242,8 +3162,6 @@ static void beiscsi_clean_port(struct beiscsi_hba *phba)
3242 3162
3243 hwi_purge_eq(phba); 3163 hwi_purge_eq(phba);
3244 hwi_cleanup(phba); 3164 hwi_cleanup(phba);
3245 if (ring_mode)
3246 kfree(phba->sgl_hndl_array);
3247 kfree(phba->io_sgl_hndl_base); 3165 kfree(phba->io_sgl_hndl_base);
3248 kfree(phba->eh_sgl_hndl_base); 3166 kfree(phba->eh_sgl_hndl_base);
3249 kfree(phba->cid_array); 3167 kfree(phba->cid_array);
@@ -3329,8 +3247,7 @@ beiscsi_offload_connection(struct beiscsi_conn *beiscsi_conn,
3329 be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_target_context_update_wrb)); 3247 be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_target_context_update_wrb));
3330 3248
3331 doorbell |= beiscsi_conn->beiscsi_conn_cid & DB_WRB_POST_CID_MASK; 3249 doorbell |= beiscsi_conn->beiscsi_conn_cid & DB_WRB_POST_CID_MASK;
3332 if (!ring_mode) 3250 doorbell |= (pwrb_handle->wrb_index & DB_DEF_PDU_WRB_INDEX_MASK)
3333 doorbell |= (pwrb_handle->wrb_index & DB_DEF_PDU_WRB_INDEX_MASK)
3334 << DB_DEF_PDU_WRB_INDEX_SHIFT; 3251 << DB_DEF_PDU_WRB_INDEX_SHIFT;
3335 doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT; 3252 doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT;
3336 3253
@@ -3417,15 +3334,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)
3417 itt = (itt_t) cpu_to_be32(((unsigned int)io_task->pwrb_handle-> 3334 itt = (itt_t) cpu_to_be32(((unsigned int)io_task->pwrb_handle->
3418 wrb_index << 16) | (unsigned int) 3335 wrb_index << 16) | (unsigned int)
3419 (io_task->psgl_handle->sgl_index)); 3336 (io_task->psgl_handle->sgl_index));
3420 if (ring_mode) { 3337 io_task->pwrb_handle->pio_handle = task;
3421 phba->sgl_hndl_array[io_task->psgl_handle->sgl_index -
3422 phba->fw_config.iscsi_icd_start] =
3423 io_task->psgl_handle;
3424 io_task->psgl_handle->task = task;
3425 io_task->psgl_handle->cid = beiscsi_conn->beiscsi_conn_cid -
3426 phba->fw_config.iscsi_cid_start;
3427 } else
3428 io_task->pwrb_handle->pio_handle = task;
3429 3338
3430 io_task->cmd_bhs->iscsi_hdr.itt = itt; 3339 io_task->cmd_bhs->iscsi_hdr.itt = itt;
3431 return 0; 3340 return 0;
@@ -3511,18 +3420,12 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg,
3511 ISCSI_OPCODE_SCSI_DATA_OUT); 3420 ISCSI_OPCODE_SCSI_DATA_OUT);
3512 AMAP_SET_BITS(struct amap_pdu_data_out, final_bit, 3421 AMAP_SET_BITS(struct amap_pdu_data_out, final_bit,
3513 &io_task->cmd_bhs->iscsi_data_pdu, 1); 3422 &io_task->cmd_bhs->iscsi_data_pdu, 1);
3514 if (ring_mode) 3423 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3515 io_task->psgl_handle->type = INI_WR_CMD; 3424 INI_WR_CMD);
3516 else
3517 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3518 INI_WR_CMD);
3519 AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 1); 3425 AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 1);
3520 } else { 3426 } else {
3521 if (ring_mode) 3427 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3522 io_task->psgl_handle->type = INI_RD_CMD; 3428 INI_RD_CMD);
3523 else
3524 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3525 INI_RD_CMD);
3526 AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 0); 3429 AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 0);
3527 } 3430 }
3528 memcpy(&io_task->cmd_bhs->iscsi_data_pdu. 3431 memcpy(&io_task->cmd_bhs->iscsi_data_pdu.
@@ -3547,8 +3450,7 @@ static int beiscsi_iotask(struct iscsi_task *task, struct scatterlist *sg,
3547 be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_wrb)); 3450 be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_wrb));
3548 3451
3549 doorbell |= beiscsi_conn->beiscsi_conn_cid & DB_WRB_POST_CID_MASK; 3452 doorbell |= beiscsi_conn->beiscsi_conn_cid & DB_WRB_POST_CID_MASK;
3550 if (!ring_mode) 3453 doorbell |= (io_task->pwrb_handle->wrb_index &
3551 doorbell |= (io_task->pwrb_handle->wrb_index &
3552 DB_DEF_PDU_WRB_INDEX_MASK) << DB_DEF_PDU_WRB_INDEX_SHIFT; 3454 DB_DEF_PDU_WRB_INDEX_MASK) << DB_DEF_PDU_WRB_INDEX_SHIFT;
3553 doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT; 3455 doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT;
3554 3456
@@ -3583,21 +3485,15 @@ static int beiscsi_mtask(struct iscsi_task *task)
3583 3485
3584 switch (task->hdr->opcode & ISCSI_OPCODE_MASK) { 3486 switch (task->hdr->opcode & ISCSI_OPCODE_MASK) {
3585 case ISCSI_OP_LOGIN: 3487 case ISCSI_OP_LOGIN:
3586 if (ring_mode) 3488 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3587 io_task->psgl_handle->type = TGT_DM_CMD; 3489 TGT_DM_CMD);
3588 else
3589 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3590 TGT_DM_CMD);
3591 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0); 3490 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
3592 AMAP_SET_BITS(struct amap_iscsi_wrb, cmdsn_itt, pwrb, 1); 3491 AMAP_SET_BITS(struct amap_iscsi_wrb, cmdsn_itt, pwrb, 1);
3593 hwi_write_buffer(pwrb, task); 3492 hwi_write_buffer(pwrb, task);
3594 break; 3493 break;
3595 case ISCSI_OP_NOOP_OUT: 3494 case ISCSI_OP_NOOP_OUT:
3596 if (ring_mode) 3495 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3597 io_task->psgl_handle->type = INI_RD_CMD; 3496 INI_RD_CMD);
3598 else
3599 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3600 INI_RD_CMD);
3601 if (task->hdr->ttt == ISCSI_RESERVED_TAG) 3497 if (task->hdr->ttt == ISCSI_RESERVED_TAG)
3602 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0); 3498 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
3603 else 3499 else
@@ -3605,11 +3501,8 @@ static int beiscsi_mtask(struct iscsi_task *task)
3605 hwi_write_buffer(pwrb, task); 3501 hwi_write_buffer(pwrb, task);
3606 break; 3502 break;
3607 case ISCSI_OP_TEXT: 3503 case ISCSI_OP_TEXT:
3608 if (ring_mode) 3504 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3609 io_task->psgl_handle->type = INI_WR_CMD; 3505 INI_WR_CMD);
3610 else
3611 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3612 INI_WR_CMD);
3613 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0); 3506 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
3614 AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 1); 3507 AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 1);
3615 hwi_write_buffer(pwrb, task); 3508 hwi_write_buffer(pwrb, task);
@@ -3642,19 +3535,13 @@ static int beiscsi_mtask(struct iscsi_task *task)
3642 phba->ctrl.mcc_numtag[tag]); 3535 phba->ctrl.mcc_numtag[tag]);
3643 free_mcc_tag(&phba->ctrl, tag); 3536 free_mcc_tag(&phba->ctrl, tag);
3644 } 3537 }
3645 if (ring_mode) 3538 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3646 io_task->psgl_handle->type = INI_TMF_CMD; 3539 INI_TMF_CMD);
3647 else
3648 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3649 INI_TMF_CMD);
3650 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0); 3540 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
3651 hwi_write_buffer(pwrb, task); 3541 hwi_write_buffer(pwrb, task);
3652 break; 3542 break;
3653 case ISCSI_OP_LOGOUT: 3543 case ISCSI_OP_LOGOUT:
3654 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0); 3544 AMAP_SET_BITS(struct amap_iscsi_wrb, dmsg, pwrb, 0);
3655 if (ring_mode)
3656 io_task->psgl_handle->type = HWH_TYPE_LOGOUT;
3657 else
3658 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb, 3545 AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
3659 HWH_TYPE_LOGOUT); 3546 HWH_TYPE_LOGOUT);
3660 hwi_write_buffer(pwrb, task); 3547 hwi_write_buffer(pwrb, task);
@@ -3673,8 +3560,7 @@ static int beiscsi_mtask(struct iscsi_task *task)
3673 be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_wrb)); 3560 be_dws_le_to_cpu(pwrb, sizeof(struct iscsi_wrb));
3674 3561
3675 doorbell |= cid & DB_WRB_POST_CID_MASK; 3562 doorbell |= cid & DB_WRB_POST_CID_MASK;
3676 if (!ring_mode) 3563 doorbell |= (io_task->pwrb_handle->wrb_index &
3677 doorbell |= (io_task->pwrb_handle->wrb_index &
3678 DB_DEF_PDU_WRB_INDEX_MASK) << DB_DEF_PDU_WRB_INDEX_SHIFT; 3564 DB_DEF_PDU_WRB_INDEX_MASK) << DB_DEF_PDU_WRB_INDEX_SHIFT;
3679 doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT; 3565 doorbell |= 1 << DB_DEF_PDU_NUM_POSTED_SHIFT;
3680 iowrite32(doorbell, phba->db_va + DB_TXULP0_OFFSET); 3566 iowrite32(doorbell, phba->db_va + DB_TXULP0_OFFSET);
@@ -3999,7 +3885,6 @@ static int __init beiscsi_module_init(void)
3999 "beiscsi pci driver.\n"); 3885 "beiscsi pci driver.\n");
4000 goto unregister_iscsi_transport; 3886 goto unregister_iscsi_transport;
4001 } 3887 }
4002 ring_mode = 0;
4003 return 0; 3888 return 0;
4004 3889
4005unregister_iscsi_transport: 3890unregister_iscsi_transport: