aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_exch.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libfc/fc_exch.c')
-rw-r--r--drivers/scsi/libfc/fc_exch.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 66db08a5f27f..505825b6124d 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -32,8 +32,6 @@
32#include <scsi/libfc.h> 32#include <scsi/libfc.h>
33#include <scsi/fc_encode.h> 33#include <scsi/fc_encode.h>
34 34
35#define FC_DEF_R_A_TOV (10 * 1000) /* resource allocation timeout */
36
37/* 35/*
38 * fc_exch_debug can be set in debugger or at compile time to get more logs. 36 * fc_exch_debug can be set in debugger or at compile time to get more logs.
39 */ 37 */
@@ -627,7 +625,6 @@ static struct fc_exch *fc_exch_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
627{ 625{
628 struct fc_exch *ep; 626 struct fc_exch *ep;
629 struct fc_frame_header *fh; 627 struct fc_frame_header *fh;
630 u16 rxid;
631 628
632 ep = mp->lp->tt.exch_get(mp->lp, fp); 629 ep = mp->lp->tt.exch_get(mp->lp, fp);
633 if (ep) { 630 if (ep) {
@@ -654,18 +651,6 @@ static struct fc_exch *fc_exch_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
654 if ((ntoh24(fh->fh_f_ctl) & FC_FC_SEQ_INIT) == 0) 651 if ((ntoh24(fh->fh_f_ctl) & FC_FC_SEQ_INIT) == 0)
655 ep->esb_stat &= ~ESB_ST_SEQ_INIT; 652 ep->esb_stat &= ~ESB_ST_SEQ_INIT;
656 653
657 /*
658 * Set the responder ID in the frame header.
659 * The old one should've been 0xffff.
660 * If it isn't, don't assign one.
661 * Incoming basic link service frames may specify
662 * a referenced RX_ID.
663 */
664 if (fh->fh_type != FC_TYPE_BLS) {
665 rxid = ntohs(fh->fh_rx_id);
666 WARN_ON(rxid != FC_XID_UNKNOWN);
667 fh->fh_rx_id = htons(ep->rxid);
668 }
669 fc_exch_hold(ep); /* hold for caller */ 654 fc_exch_hold(ep); /* hold for caller */
670 spin_unlock_bh(&ep->ex_lock); /* lock from exch_get */ 655 spin_unlock_bh(&ep->ex_lock); /* lock from exch_get */
671 } 656 }
@@ -677,8 +662,8 @@ static struct fc_exch *fc_exch_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
677 * If fc_pf_rjt_reason is FC_RJT_NONE then this function will have a hold 662 * If fc_pf_rjt_reason is FC_RJT_NONE then this function will have a hold
678 * on the ep that should be released by the caller. 663 * on the ep that should be released by the caller.
679 */ 664 */
680static enum fc_pf_rjt_reason 665static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_exch_mgr *mp,
681fc_seq_lookup_recip(struct fc_exch_mgr *mp, struct fc_frame *fp) 666 struct fc_frame *fp)
682{ 667{
683 struct fc_frame_header *fh = fc_frame_header_get(fp); 668 struct fc_frame_header *fh = fc_frame_header_get(fp);
684 struct fc_exch *ep = NULL; 669 struct fc_exch *ep = NULL;
@@ -996,9 +981,9 @@ static void fc_seq_send_ack(struct fc_seq *sp, const struct fc_frame *rx_fp)
996 * Send BLS Reject. 981 * Send BLS Reject.
997 * This is for rejecting BA_ABTS only. 982 * This is for rejecting BA_ABTS only.
998 */ 983 */
999static void 984static void fc_exch_send_ba_rjt(struct fc_frame *rx_fp,
1000fc_exch_send_ba_rjt(struct fc_frame *rx_fp, enum fc_ba_rjt_reason reason, 985 enum fc_ba_rjt_reason reason,
1001 enum fc_ba_rjt_explan explan) 986 enum fc_ba_rjt_explan explan)
1002{ 987{
1003 struct fc_frame *fp; 988 struct fc_frame *fp;
1004 struct fc_frame_header *rx_fh; 989 struct fc_frame_header *rx_fh;
@@ -1096,7 +1081,7 @@ static void fc_exch_recv_abts(struct fc_exch *ep, struct fc_frame *rx_fp)
1096 ap->ba_high_seq_cnt = fh->fh_seq_cnt; 1081 ap->ba_high_seq_cnt = fh->fh_seq_cnt;
1097 ap->ba_low_seq_cnt = htons(sp->cnt); 1082 ap->ba_low_seq_cnt = htons(sp->cnt);
1098 } 1083 }
1099 sp = fc_seq_start_next(sp); 1084 sp = fc_seq_start_next_locked(sp);
1100 spin_unlock_bh(&ep->ex_lock); 1085 spin_unlock_bh(&ep->ex_lock);
1101 fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS); 1086 fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS);
1102 fc_frame_free(rx_fp); 1087 fc_frame_free(rx_fp);
@@ -1480,10 +1465,11 @@ static void fc_exch_reset(struct fc_exch *ep)
1480 * If sid is non-zero, reset only exchanges we source from that FID. 1465 * If sid is non-zero, reset only exchanges we source from that FID.
1481 * If did is non-zero, reset only exchanges destined to that FID. 1466 * If did is non-zero, reset only exchanges destined to that FID.
1482 */ 1467 */
1483void fc_exch_mgr_reset(struct fc_exch_mgr *mp, u32 sid, u32 did) 1468void fc_exch_mgr_reset(struct fc_lport *lp, u32 sid, u32 did)
1484{ 1469{
1485 struct fc_exch *ep; 1470 struct fc_exch *ep;
1486 struct fc_exch *next; 1471 struct fc_exch *next;
1472 struct fc_exch_mgr *mp = lp->emp;
1487 1473
1488 spin_lock_bh(&mp->em_lock); 1474 spin_lock_bh(&mp->em_lock);
1489restart: 1475restart:
@@ -1607,7 +1593,7 @@ static void fc_exch_rrq_resp(struct fc_seq *sp, struct fc_frame *fp, void *arg)
1607 if (IS_ERR(fp)) { 1593 if (IS_ERR(fp)) {
1608 int err = PTR_ERR(fp); 1594 int err = PTR_ERR(fp);
1609 1595
1610 if (err == -FC_EX_CLOSED) 1596 if (err == -FC_EX_CLOSED || err == -FC_EX_TIMEOUT)
1611 goto cleanup; 1597 goto cleanup;
1612 FC_DBG("Cannot process RRQ, because of frame error %d\n", err); 1598 FC_DBG("Cannot process RRQ, because of frame error %d\n", err);
1613 return; 1599 return;