aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bnx2fc/bnx2fc_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bnx2fc/bnx2fc_io.c')
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_io.c194
1 files changed, 157 insertions, 37 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 45eba6d609c..6cc3789075b 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1,7 +1,7 @@
1/* bnx2fc_io.c: Broadcom NetXtreme II Linux FCoE offload driver. 1/* bnx2fc_io.c: Broadcom NetXtreme II Linux FCoE offload driver.
2 * IO manager and SCSI IO processing. 2 * IO manager and SCSI IO processing.
3 * 3 *
4 * Copyright (c) 2008 - 2010 Broadcom Corporation 4 * Copyright (c) 2008 - 2011 Broadcom Corporation
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -18,8 +18,6 @@ static int bnx2fc_split_bd(struct bnx2fc_cmd *io_req, u64 addr, int sg_len,
18 int bd_index); 18 int bd_index);
19static int bnx2fc_map_sg(struct bnx2fc_cmd *io_req); 19static int bnx2fc_map_sg(struct bnx2fc_cmd *io_req);
20static void bnx2fc_build_bd_list_from_sg(struct bnx2fc_cmd *io_req); 20static void bnx2fc_build_bd_list_from_sg(struct bnx2fc_cmd *io_req);
21static int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
22 struct bnx2fc_cmd *io_req);
23static void bnx2fc_unmap_sg_list(struct bnx2fc_cmd *io_req); 21static void bnx2fc_unmap_sg_list(struct bnx2fc_cmd *io_req);
24static void bnx2fc_free_mp_resc(struct bnx2fc_cmd *io_req); 22static void bnx2fc_free_mp_resc(struct bnx2fc_cmd *io_req);
25static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req, 23static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
@@ -29,10 +27,11 @@ static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
29void bnx2fc_cmd_timer_set(struct bnx2fc_cmd *io_req, 27void bnx2fc_cmd_timer_set(struct bnx2fc_cmd *io_req,
30 unsigned int timer_msec) 28 unsigned int timer_msec)
31{ 29{
32 struct bnx2fc_hba *hba = io_req->port->priv; 30 struct bnx2fc_interface *interface = io_req->port->priv;
33 31
34 if (queue_delayed_work(hba->timer_work_queue, &io_req->timeout_work, 32 if (queue_delayed_work(interface->timer_work_queue,
35 msecs_to_jiffies(timer_msec))) 33 &io_req->timeout_work,
34 msecs_to_jiffies(timer_msec)))
36 kref_get(&io_req->refcount); 35 kref_get(&io_req->refcount);
37} 36}
38 37
@@ -217,6 +216,11 @@ static void bnx2fc_scsi_done(struct bnx2fc_cmd *io_req, int err_code)
217 return; 216 return;
218 217
219 BNX2FC_IO_DBG(io_req, "scsi_done. err_code = 0x%x\n", err_code); 218 BNX2FC_IO_DBG(io_req, "scsi_done. err_code = 0x%x\n", err_code);
219 if (test_bit(BNX2FC_FLAG_CMD_LOST, &io_req->req_flags)) {
220 /* Do not call scsi done for this IO */
221 return;
222 }
223
220 bnx2fc_unmap_sg_list(io_req); 224 bnx2fc_unmap_sg_list(io_req);
221 io_req->sc_cmd = NULL; 225 io_req->sc_cmd = NULL;
222 if (!sc_cmd) { 226 if (!sc_cmd) {
@@ -419,8 +423,8 @@ free_cmgr:
419struct bnx2fc_cmd *bnx2fc_elstm_alloc(struct bnx2fc_rport *tgt, int type) 423struct bnx2fc_cmd *bnx2fc_elstm_alloc(struct bnx2fc_rport *tgt, int type)
420{ 424{
421 struct fcoe_port *port = tgt->port; 425 struct fcoe_port *port = tgt->port;
422 struct bnx2fc_hba *hba = port->priv; 426 struct bnx2fc_interface *interface = port->priv;
423 struct bnx2fc_cmd_mgr *cmd_mgr = hba->cmd_mgr; 427 struct bnx2fc_cmd_mgr *cmd_mgr = interface->hba->cmd_mgr;
424 struct bnx2fc_cmd *io_req; 428 struct bnx2fc_cmd *io_req;
425 struct list_head *listp; 429 struct list_head *listp;
426 struct io_bdt *bd_tbl; 430 struct io_bdt *bd_tbl;
@@ -485,11 +489,12 @@ struct bnx2fc_cmd *bnx2fc_elstm_alloc(struct bnx2fc_rport *tgt, int type)
485 kref_init(&io_req->refcount); 489 kref_init(&io_req->refcount);
486 return io_req; 490 return io_req;
487} 491}
488static struct bnx2fc_cmd *bnx2fc_cmd_alloc(struct bnx2fc_rport *tgt) 492
493struct bnx2fc_cmd *bnx2fc_cmd_alloc(struct bnx2fc_rport *tgt)
489{ 494{
490 struct fcoe_port *port = tgt->port; 495 struct fcoe_port *port = tgt->port;
491 struct bnx2fc_hba *hba = port->priv; 496 struct bnx2fc_interface *interface = port->priv;
492 struct bnx2fc_cmd_mgr *cmd_mgr = hba->cmd_mgr; 497 struct bnx2fc_cmd_mgr *cmd_mgr = interface->hba->cmd_mgr;
493 struct bnx2fc_cmd *io_req; 498 struct bnx2fc_cmd *io_req;
494 struct list_head *listp; 499 struct list_head *listp;
495 struct io_bdt *bd_tbl; 500 struct io_bdt *bd_tbl;
@@ -570,7 +575,8 @@ void bnx2fc_cmd_release(struct kref *ref)
570static void bnx2fc_free_mp_resc(struct bnx2fc_cmd *io_req) 575static void bnx2fc_free_mp_resc(struct bnx2fc_cmd *io_req)
571{ 576{
572 struct bnx2fc_mp_req *mp_req = &(io_req->mp_req); 577 struct bnx2fc_mp_req *mp_req = &(io_req->mp_req);
573 struct bnx2fc_hba *hba = io_req->port->priv; 578 struct bnx2fc_interface *interface = io_req->port->priv;
579 struct bnx2fc_hba *hba = interface->hba;
574 size_t sz = sizeof(struct fcoe_bd_ctx); 580 size_t sz = sizeof(struct fcoe_bd_ctx);
575 581
576 /* clear tm flags */ 582 /* clear tm flags */
@@ -606,7 +612,8 @@ int bnx2fc_init_mp_req(struct bnx2fc_cmd *io_req)
606 struct bnx2fc_mp_req *mp_req; 612 struct bnx2fc_mp_req *mp_req;
607 struct fcoe_bd_ctx *mp_req_bd; 613 struct fcoe_bd_ctx *mp_req_bd;
608 struct fcoe_bd_ctx *mp_resp_bd; 614 struct fcoe_bd_ctx *mp_resp_bd;
609 struct bnx2fc_hba *hba = io_req->port->priv; 615 struct bnx2fc_interface *interface = io_req->port->priv;
616 struct bnx2fc_hba *hba = interface->hba;
610 dma_addr_t addr; 617 dma_addr_t addr;
611 size_t sz; 618 size_t sz;
612 619
@@ -682,7 +689,7 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
682 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); 689 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
683 struct fc_rport_libfc_priv *rp = rport->dd_data; 690 struct fc_rport_libfc_priv *rp = rport->dd_data;
684 struct fcoe_port *port; 691 struct fcoe_port *port;
685 struct bnx2fc_hba *hba; 692 struct bnx2fc_interface *interface;
686 struct bnx2fc_rport *tgt; 693 struct bnx2fc_rport *tgt;
687 struct bnx2fc_cmd *io_req; 694 struct bnx2fc_cmd *io_req;
688 struct bnx2fc_mp_req *tm_req; 695 struct bnx2fc_mp_req *tm_req;
@@ -699,10 +706,10 @@ static int bnx2fc_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
699 706
700 lport = shost_priv(host); 707 lport = shost_priv(host);
701 port = lport_priv(lport); 708 port = lport_priv(lport);
702 hba = port->priv; 709 interface = port->priv;
703 710
704 if (rport == NULL) { 711 if (rport == NULL) {
705 printk(KERN_ALERT PFX "device_reset: rport is NULL\n"); 712 printk(KERN_ERR PFX "device_reset: rport is NULL\n");
706 rc = FAILED; 713 rc = FAILED;
707 goto tmf_err; 714 goto tmf_err;
708 } 715 }
@@ -745,7 +752,9 @@ retry_tmf:
745 rc = bnx2fc_init_mp_req(io_req); 752 rc = bnx2fc_init_mp_req(io_req);
746 if (rc == FAILED) { 753 if (rc == FAILED) {
747 printk(KERN_ERR PFX "Task mgmt MP request init failed\n"); 754 printk(KERN_ERR PFX "Task mgmt MP request init failed\n");
755 spin_lock_bh(&tgt->tgt_lock);
748 kref_put(&io_req->refcount, bnx2fc_cmd_release); 756 kref_put(&io_req->refcount, bnx2fc_cmd_release);
757 spin_unlock_bh(&tgt->tgt_lock);
749 goto tmf_err; 758 goto tmf_err;
750 } 759 }
751 760
@@ -774,7 +783,8 @@ retry_tmf:
774 index = xid % BNX2FC_TASKS_PER_PAGE; 783 index = xid % BNX2FC_TASKS_PER_PAGE;
775 784
776 /* Initialize task context for this IO request */ 785 /* Initialize task context for this IO request */
777 task_page = (struct fcoe_task_ctx_entry *) hba->task_ctx[task_idx]; 786 task_page = (struct fcoe_task_ctx_entry *)
787 interface->hba->task_ctx[task_idx];
778 task = &(task_page[index]); 788 task = &(task_page[index]);
779 bnx2fc_init_mp_task(io_req, task); 789 bnx2fc_init_mp_task(io_req, task);
780 790
@@ -806,10 +816,10 @@ retry_tmf:
806 spin_unlock_bh(&tgt->tgt_lock); 816 spin_unlock_bh(&tgt->tgt_lock);
807 817
808 if (!rc) { 818 if (!rc) {
809 printk(KERN_ERR PFX "task mgmt command failed...\n"); 819 BNX2FC_TGT_DBG(tgt, "task mgmt command failed...\n");
810 rc = FAILED; 820 rc = FAILED;
811 } else { 821 } else {
812 printk(KERN_ERR PFX "task mgmt command success...\n"); 822 BNX2FC_TGT_DBG(tgt, "task mgmt command success...\n");
813 rc = SUCCESS; 823 rc = SUCCESS;
814 } 824 }
815tmf_err: 825tmf_err:
@@ -822,7 +832,7 @@ int bnx2fc_initiate_abts(struct bnx2fc_cmd *io_req)
822 struct bnx2fc_rport *tgt = io_req->tgt; 832 struct bnx2fc_rport *tgt = io_req->tgt;
823 struct fc_rport *rport = tgt->rport; 833 struct fc_rport *rport = tgt->rport;
824 struct fc_rport_priv *rdata = tgt->rdata; 834 struct fc_rport_priv *rdata = tgt->rdata;
825 struct bnx2fc_hba *hba; 835 struct bnx2fc_interface *interface;
826 struct fcoe_port *port; 836 struct fcoe_port *port;
827 struct bnx2fc_cmd *abts_io_req; 837 struct bnx2fc_cmd *abts_io_req;
828 struct fcoe_task_ctx_entry *task; 838 struct fcoe_task_ctx_entry *task;
@@ -839,7 +849,7 @@ int bnx2fc_initiate_abts(struct bnx2fc_cmd *io_req)
839 BNX2FC_IO_DBG(io_req, "Entered bnx2fc_initiate_abts\n"); 849 BNX2FC_IO_DBG(io_req, "Entered bnx2fc_initiate_abts\n");
840 850
841 port = io_req->port; 851 port = io_req->port;
842 hba = port->priv; 852 interface = port->priv;
843 lport = port->lport; 853 lport = port->lport;
844 854
845 if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)) { 855 if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)) {
@@ -849,7 +859,7 @@ int bnx2fc_initiate_abts(struct bnx2fc_cmd *io_req)
849 } 859 }
850 860
851 if (rport == NULL) { 861 if (rport == NULL) {
852 printk(KERN_ALERT PFX "initiate_abts: rport is NULL\n"); 862 printk(KERN_ERR PFX "initiate_abts: rport is NULL\n");
853 rc = FAILED; 863 rc = FAILED;
854 goto abts_err; 864 goto abts_err;
855 } 865 }
@@ -896,7 +906,8 @@ int bnx2fc_initiate_abts(struct bnx2fc_cmd *io_req)
896 index = xid % BNX2FC_TASKS_PER_PAGE; 906 index = xid % BNX2FC_TASKS_PER_PAGE;
897 907
898 /* Initialize task context for this IO request */ 908 /* Initialize task context for this IO request */
899 task_page = (struct fcoe_task_ctx_entry *) hba->task_ctx[task_idx]; 909 task_page = (struct fcoe_task_ctx_entry *)
910 interface->hba->task_ctx[task_idx];
900 task = &(task_page[index]); 911 task = &(task_page[index]);
901 bnx2fc_init_mp_task(abts_io_req, task); 912 bnx2fc_init_mp_task(abts_io_req, task);
902 913
@@ -924,11 +935,81 @@ abts_err:
924 return rc; 935 return rc;
925} 936}
926 937
938int bnx2fc_initiate_seq_cleanup(struct bnx2fc_cmd *orig_io_req, u32 offset,
939 enum fc_rctl r_ctl)
940{
941 struct fc_lport *lport;
942 struct bnx2fc_rport *tgt = orig_io_req->tgt;
943 struct bnx2fc_interface *interface;
944 struct fcoe_port *port;
945 struct bnx2fc_cmd *seq_clnp_req;
946 struct fcoe_task_ctx_entry *task;
947 struct fcoe_task_ctx_entry *task_page;
948 struct bnx2fc_els_cb_arg *cb_arg = NULL;
949 int task_idx, index;
950 u16 xid;
951 int rc = 0;
952
953 BNX2FC_IO_DBG(orig_io_req, "bnx2fc_initiate_seq_cleanup xid = 0x%x\n",
954 orig_io_req->xid);
955 kref_get(&orig_io_req->refcount);
956
957 port = orig_io_req->port;
958 interface = port->priv;
959 lport = port->lport;
960
961 cb_arg = kzalloc(sizeof(struct bnx2fc_els_cb_arg), GFP_ATOMIC);
962 if (!cb_arg) {
963 printk(KERN_ERR PFX "Unable to alloc cb_arg for seq clnup\n");
964 rc = -ENOMEM;
965 goto cleanup_err;
966 }
967
968 seq_clnp_req = bnx2fc_elstm_alloc(tgt, BNX2FC_SEQ_CLEANUP);
969 if (!seq_clnp_req) {
970 printk(KERN_ERR PFX "cleanup: couldnt allocate cmd\n");
971 rc = -ENOMEM;
972 kfree(cb_arg);
973 goto cleanup_err;
974 }
975 /* Initialize rest of io_req fields */
976 seq_clnp_req->sc_cmd = NULL;
977 seq_clnp_req->port = port;
978 seq_clnp_req->tgt = tgt;
979 seq_clnp_req->data_xfer_len = 0; /* No data transfer for cleanup */
980
981 xid = seq_clnp_req->xid;
982
983 task_idx = xid/BNX2FC_TASKS_PER_PAGE;
984 index = xid % BNX2FC_TASKS_PER_PAGE;
985
986 /* Initialize task context for this IO request */
987 task_page = (struct fcoe_task_ctx_entry *)
988 interface->hba->task_ctx[task_idx];
989 task = &(task_page[index]);
990 cb_arg->aborted_io_req = orig_io_req;
991 cb_arg->io_req = seq_clnp_req;
992 cb_arg->r_ctl = r_ctl;
993 cb_arg->offset = offset;
994 seq_clnp_req->cb_arg = cb_arg;
995
996 printk(KERN_ERR PFX "call init_seq_cleanup_task\n");
997 bnx2fc_init_seq_cleanup_task(seq_clnp_req, task, orig_io_req, offset);
998
999 /* Obtain free SQ entry */
1000 bnx2fc_add_2_sq(tgt, xid);
1001
1002 /* Ring doorbell */
1003 bnx2fc_ring_doorbell(tgt);
1004cleanup_err:
1005 return rc;
1006}
1007
927int bnx2fc_initiate_cleanup(struct bnx2fc_cmd *io_req) 1008int bnx2fc_initiate_cleanup(struct bnx2fc_cmd *io_req)
928{ 1009{
929 struct fc_lport *lport; 1010 struct fc_lport *lport;
930 struct bnx2fc_rport *tgt = io_req->tgt; 1011 struct bnx2fc_rport *tgt = io_req->tgt;
931 struct bnx2fc_hba *hba; 1012 struct bnx2fc_interface *interface;
932 struct fcoe_port *port; 1013 struct fcoe_port *port;
933 struct bnx2fc_cmd *cleanup_io_req; 1014 struct bnx2fc_cmd *cleanup_io_req;
934 struct fcoe_task_ctx_entry *task; 1015 struct fcoe_task_ctx_entry *task;
@@ -941,7 +1022,7 @@ int bnx2fc_initiate_cleanup(struct bnx2fc_cmd *io_req)
941 BNX2FC_IO_DBG(io_req, "Entered bnx2fc_initiate_cleanup\n"); 1022 BNX2FC_IO_DBG(io_req, "Entered bnx2fc_initiate_cleanup\n");
942 1023
943 port = io_req->port; 1024 port = io_req->port;
944 hba = port->priv; 1025 interface = port->priv;
945 lport = port->lport; 1026 lport = port->lport;
946 1027
947 cleanup_io_req = bnx2fc_elstm_alloc(tgt, BNX2FC_CLEANUP); 1028 cleanup_io_req = bnx2fc_elstm_alloc(tgt, BNX2FC_CLEANUP);
@@ -963,7 +1044,8 @@ int bnx2fc_initiate_cleanup(struct bnx2fc_cmd *io_req)
963 index = xid % BNX2FC_TASKS_PER_PAGE; 1044 index = xid % BNX2FC_TASKS_PER_PAGE;
964 1045
965 /* Initialize task context for this IO request */ 1046 /* Initialize task context for this IO request */
966 task_page = (struct fcoe_task_ctx_entry *) hba->task_ctx[task_idx]; 1047 task_page = (struct fcoe_task_ctx_entry *)
1048 interface->hba->task_ctx[task_idx];
967 task = &(task_page[index]); 1049 task = &(task_page[index]);
968 orig_xid = io_req->xid; 1050 orig_xid = io_req->xid;
969 1051
@@ -1031,7 +1113,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
1031 1113
1032 lport = shost_priv(sc_cmd->device->host); 1114 lport = shost_priv(sc_cmd->device->host);
1033 if ((lport->state != LPORT_ST_READY) || !(lport->link_up)) { 1115 if ((lport->state != LPORT_ST_READY) || !(lport->link_up)) {
1034 printk(KERN_ALERT PFX "eh_abort: link not ready\n"); 1116 printk(KERN_ERR PFX "eh_abort: link not ready\n");
1035 return rc; 1117 return rc;
1036 } 1118 }
1037 1119
@@ -1062,7 +1144,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
1062 * io_req is no longer in the active_q. 1144 * io_req is no longer in the active_q.
1063 */ 1145 */
1064 if (tgt->flush_in_prog) { 1146 if (tgt->flush_in_prog) {
1065 printk(KERN_ALERT PFX "eh_abort: io_req (xid = 0x%x) " 1147 printk(KERN_ERR PFX "eh_abort: io_req (xid = 0x%x) "
1066 "flush in progress\n", io_req->xid); 1148 "flush in progress\n", io_req->xid);
1067 kref_put(&io_req->refcount, bnx2fc_cmd_release); 1149 kref_put(&io_req->refcount, bnx2fc_cmd_release);
1068 spin_unlock_bh(&tgt->tgt_lock); 1150 spin_unlock_bh(&tgt->tgt_lock);
@@ -1070,7 +1152,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
1070 } 1152 }
1071 1153
1072 if (io_req->on_active_queue == 0) { 1154 if (io_req->on_active_queue == 0) {
1073 printk(KERN_ALERT PFX "eh_abort: io_req (xid = 0x%x) " 1155 printk(KERN_ERR PFX "eh_abort: io_req (xid = 0x%x) "
1074 "not on active_q\n", io_req->xid); 1156 "not on active_q\n", io_req->xid);
1075 /* 1157 /*
1076 * This condition can happen only due to the FW bug, 1158 * This condition can happen only due to the FW bug,
@@ -1108,7 +1190,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
1108 set_bit(BNX2FC_FLAG_EH_ABORT, &io_req->req_flags); 1190 set_bit(BNX2FC_FLAG_EH_ABORT, &io_req->req_flags);
1109 rc = bnx2fc_initiate_abts(io_req); 1191 rc = bnx2fc_initiate_abts(io_req);
1110 } else { 1192 } else {
1111 printk(KERN_ALERT PFX "eh_abort: io_req (xid = 0x%x) " 1193 printk(KERN_ERR PFX "eh_abort: io_req (xid = 0x%x) "
1112 "already in abts processing\n", io_req->xid); 1194 "already in abts processing\n", io_req->xid);
1113 kref_put(&io_req->refcount, bnx2fc_cmd_release); 1195 kref_put(&io_req->refcount, bnx2fc_cmd_release);
1114 spin_unlock_bh(&tgt->tgt_lock); 1196 spin_unlock_bh(&tgt->tgt_lock);
@@ -1149,6 +1231,42 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
1149 return rc; 1231 return rc;
1150} 1232}
1151 1233
1234void bnx2fc_process_seq_cleanup_compl(struct bnx2fc_cmd *seq_clnp_req,
1235 struct fcoe_task_ctx_entry *task,
1236 u8 rx_state)
1237{
1238 struct bnx2fc_els_cb_arg *cb_arg = seq_clnp_req->cb_arg;
1239 struct bnx2fc_cmd *orig_io_req = cb_arg->aborted_io_req;
1240 u32 offset = cb_arg->offset;
1241 enum fc_rctl r_ctl = cb_arg->r_ctl;
1242 int rc = 0;
1243 struct bnx2fc_rport *tgt = orig_io_req->tgt;
1244
1245 BNX2FC_IO_DBG(orig_io_req, "Entered process_cleanup_compl xid = 0x%x"
1246 "cmd_type = %d\n",
1247 seq_clnp_req->xid, seq_clnp_req->cmd_type);
1248
1249 if (rx_state == FCOE_TASK_RX_STATE_IGNORED_SEQUENCE_CLEANUP) {
1250 printk(KERN_ERR PFX "seq cleanup ignored - xid = 0x%x\n",
1251 seq_clnp_req->xid);
1252 goto free_cb_arg;
1253 }
1254 kref_get(&orig_io_req->refcount);
1255
1256 spin_unlock_bh(&tgt->tgt_lock);
1257 rc = bnx2fc_send_srr(orig_io_req, offset, r_ctl);
1258 spin_lock_bh(&tgt->tgt_lock);
1259
1260 if (rc)
1261 printk(KERN_ERR PFX "clnup_compl: Unable to send SRR"
1262 " IO will abort\n");
1263 seq_clnp_req->cb_arg = NULL;
1264 kref_put(&orig_io_req->refcount, bnx2fc_cmd_release);
1265free_cb_arg:
1266 kfree(cb_arg);
1267 return;
1268}
1269
1152void bnx2fc_process_cleanup_compl(struct bnx2fc_cmd *io_req, 1270void bnx2fc_process_cleanup_compl(struct bnx2fc_cmd *io_req,
1153 struct fcoe_task_ctx_entry *task, 1271 struct fcoe_task_ctx_entry *task,
1154 u8 num_rq) 1272 u8 num_rq)
@@ -1378,7 +1496,7 @@ void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req,
1378 fc_hdr->fh_r_ctl); 1496 fc_hdr->fh_r_ctl);
1379 } 1497 }
1380 if (!sc_cmd->SCp.ptr) { 1498 if (!sc_cmd->SCp.ptr) {
1381 printk(KERN_ALERT PFX "tm_compl: SCp.ptr is NULL\n"); 1499 printk(KERN_ERR PFX "tm_compl: SCp.ptr is NULL\n");
1382 return; 1500 return;
1383 } 1501 }
1384 switch (io_req->fcp_status) { 1502 switch (io_req->fcp_status) {
@@ -1410,7 +1528,7 @@ void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req,
1410 io_req->on_tmf_queue = 0; 1528 io_req->on_tmf_queue = 0;
1411 } else { 1529 } else {
1412 1530
1413 printk(KERN_ALERT PFX "Command not on active_cmd_queue!\n"); 1531 printk(KERN_ERR PFX "Command not on active_cmd_queue!\n");
1414 return; 1532 return;
1415 } 1533 }
1416 1534
@@ -1597,7 +1715,7 @@ static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
1597 1715
1598 if (rq_buff_len > num_rq * BNX2FC_RQ_BUF_SZ) { 1716 if (rq_buff_len > num_rq * BNX2FC_RQ_BUF_SZ) {
1599 /* Invalid sense sense length. */ 1717 /* Invalid sense sense length. */
1600 printk(KERN_ALERT PFX "invalid sns length %d\n", 1718 printk(KERN_ERR PFX "invalid sns length %d\n",
1601 rq_buff_len); 1719 rq_buff_len);
1602 /* reset rq_buff_len */ 1720 /* reset rq_buff_len */
1603 rq_buff_len = num_rq * BNX2FC_RQ_BUF_SZ; 1721 rq_buff_len = num_rq * BNX2FC_RQ_BUF_SZ;
@@ -1780,7 +1898,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
1780 scsi_set_resid(sc_cmd, io_req->fcp_resid); 1898 scsi_set_resid(sc_cmd, io_req->fcp_resid);
1781 break; 1899 break;
1782 default: 1900 default:
1783 printk(KERN_ALERT PFX "scsi_cmd_compl: fcp_status = %d\n", 1901 printk(KERN_ERR PFX "scsi_cmd_compl: fcp_status = %d\n",
1784 io_req->fcp_status); 1902 io_req->fcp_status);
1785 break; 1903 break;
1786 } 1904 }
@@ -1789,14 +1907,15 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
1789 kref_put(&io_req->refcount, bnx2fc_cmd_release); 1907 kref_put(&io_req->refcount, bnx2fc_cmd_release);
1790} 1908}
1791 1909
1792static int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, 1910int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
1793 struct bnx2fc_cmd *io_req) 1911 struct bnx2fc_cmd *io_req)
1794{ 1912{
1795 struct fcoe_task_ctx_entry *task; 1913 struct fcoe_task_ctx_entry *task;
1796 struct fcoe_task_ctx_entry *task_page; 1914 struct fcoe_task_ctx_entry *task_page;
1797 struct scsi_cmnd *sc_cmd = io_req->sc_cmd; 1915 struct scsi_cmnd *sc_cmd = io_req->sc_cmd;
1798 struct fcoe_port *port = tgt->port; 1916 struct fcoe_port *port = tgt->port;
1799 struct bnx2fc_hba *hba = port->priv; 1917 struct bnx2fc_interface *interface = port->priv;
1918 struct bnx2fc_hba *hba = interface->hba;
1800 struct fc_lport *lport = port->lport; 1919 struct fc_lport *lport = port->lport;
1801 struct fcoe_dev_stats *stats; 1920 struct fcoe_dev_stats *stats;
1802 int task_idx, index; 1921 int task_idx, index;
@@ -1854,7 +1973,8 @@ static int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
1854 } 1973 }
1855 1974
1856 /* Time IO req */ 1975 /* Time IO req */
1857 bnx2fc_cmd_timer_set(io_req, BNX2FC_IO_TIMEOUT); 1976 if (tgt->io_timeout)
1977 bnx2fc_cmd_timer_set(io_req, BNX2FC_IO_TIMEOUT);
1858 /* Obtain free SQ entry */ 1978 /* Obtain free SQ entry */
1859 bnx2fc_add_2_sq(tgt, xid); 1979 bnx2fc_add_2_sq(tgt, xid);
1860 1980