diff options
-rw-r--r-- | MAINTAINERS | 2 | ||||
-rw-r--r-- | drivers/scsi/fcoe/fcoe_ctlr.c | 15 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_exch.c | 37 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_rport.c | 2 |
4 files changed, 31 insertions, 25 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 3d7782b9f90d..778fceac27e4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3220,7 +3220,7 @@ F: lib/fault-inject.c | |||
3220 | 3220 | ||
3221 | FCOE SUBSYSTEM (libfc, libfcoe, fcoe) | 3221 | FCOE SUBSYSTEM (libfc, libfcoe, fcoe) |
3222 | M: Robert Love <robert.w.love@intel.com> | 3222 | M: Robert Love <robert.w.love@intel.com> |
3223 | L: devel@open-fcoe.org | 3223 | L: fcoe-devel@open-fcoe.org |
3224 | W: www.Open-FCoE.org | 3224 | W: www.Open-FCoE.org |
3225 | S: Supported | 3225 | S: Supported |
3226 | F: drivers/scsi/libfc/ | 3226 | F: drivers/scsi/libfc/ |
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c index cd743c545ce9..795843dde8ec 100644 --- a/drivers/scsi/fcoe/fcoe_ctlr.c +++ b/drivers/scsi/fcoe/fcoe_ctlr.c | |||
@@ -1548,9 +1548,6 @@ static struct fcoe_fcf *fcoe_ctlr_select(struct fcoe_ctlr *fip) | |||
1548 | { | 1548 | { |
1549 | struct fcoe_fcf *fcf; | 1549 | struct fcoe_fcf *fcf; |
1550 | struct fcoe_fcf *best = fip->sel_fcf; | 1550 | struct fcoe_fcf *best = fip->sel_fcf; |
1551 | struct fcoe_fcf *first; | ||
1552 | |||
1553 | first = list_first_entry(&fip->fcfs, struct fcoe_fcf, list); | ||
1554 | 1551 | ||
1555 | list_for_each_entry(fcf, &fip->fcfs, list) { | 1552 | list_for_each_entry(fcf, &fip->fcfs, list) { |
1556 | LIBFCOE_FIP_DBG(fip, "consider FCF fab %16.16llx " | 1553 | LIBFCOE_FIP_DBG(fip, "consider FCF fab %16.16llx " |
@@ -1568,17 +1565,15 @@ static struct fcoe_fcf *fcoe_ctlr_select(struct fcoe_ctlr *fip) | |||
1568 | "" : "un"); | 1565 | "" : "un"); |
1569 | continue; | 1566 | continue; |
1570 | } | 1567 | } |
1571 | if (fcf->fabric_name != first->fabric_name || | 1568 | if (!best || fcf->pri < best->pri || best->flogi_sent) |
1572 | fcf->vfid != first->vfid || | 1569 | best = fcf; |
1573 | fcf->fc_map != first->fc_map) { | 1570 | if (fcf->fabric_name != best->fabric_name || |
1571 | fcf->vfid != best->vfid || | ||
1572 | fcf->fc_map != best->fc_map) { | ||
1574 | LIBFCOE_FIP_DBG(fip, "Conflicting fabric, VFID, " | 1573 | LIBFCOE_FIP_DBG(fip, "Conflicting fabric, VFID, " |
1575 | "or FC-MAP\n"); | 1574 | "or FC-MAP\n"); |
1576 | return NULL; | 1575 | return NULL; |
1577 | } | 1576 | } |
1578 | if (fcf->flogi_sent) | ||
1579 | continue; | ||
1580 | if (!best || fcf->pri < best->pri || best->flogi_sent) | ||
1581 | best = fcf; | ||
1582 | } | 1577 | } |
1583 | fip->sel_fcf = best; | 1578 | fip->sel_fcf = best; |
1584 | if (best) { | 1579 | if (best) { |
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index c772d8d27159..8b928c67e4b9 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c | |||
@@ -463,13 +463,7 @@ static void fc_exch_delete(struct fc_exch *ep) | |||
463 | fc_exch_release(ep); /* drop hold for exch in mp */ | 463 | fc_exch_release(ep); /* drop hold for exch in mp */ |
464 | } | 464 | } |
465 | 465 | ||
466 | /** | 466 | static int fc_seq_send_locked(struct fc_lport *lport, struct fc_seq *sp, |
467 | * fc_seq_send() - Send a frame using existing sequence/exchange pair | ||
468 | * @lport: The local port that the exchange will be sent on | ||
469 | * @sp: The sequence to be sent | ||
470 | * @fp: The frame to be sent on the exchange | ||
471 | */ | ||
472 | static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, | ||
473 | struct fc_frame *fp) | 467 | struct fc_frame *fp) |
474 | { | 468 | { |
475 | struct fc_exch *ep; | 469 | struct fc_exch *ep; |
@@ -479,7 +473,7 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, | |||
479 | u8 fh_type = fh->fh_type; | 473 | u8 fh_type = fh->fh_type; |
480 | 474 | ||
481 | ep = fc_seq_exch(sp); | 475 | ep = fc_seq_exch(sp); |
482 | WARN_ON((ep->esb_stat & ESB_ST_SEQ_INIT) != ESB_ST_SEQ_INIT); | 476 | WARN_ON(!(ep->esb_stat & ESB_ST_SEQ_INIT)); |
483 | 477 | ||
484 | f_ctl = ntoh24(fh->fh_f_ctl); | 478 | f_ctl = ntoh24(fh->fh_f_ctl); |
485 | fc_exch_setup_hdr(ep, fp, f_ctl); | 479 | fc_exch_setup_hdr(ep, fp, f_ctl); |
@@ -502,17 +496,34 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, | |||
502 | error = lport->tt.frame_send(lport, fp); | 496 | error = lport->tt.frame_send(lport, fp); |
503 | 497 | ||
504 | if (fh_type == FC_TYPE_BLS) | 498 | if (fh_type == FC_TYPE_BLS) |
505 | return error; | 499 | goto out; |
506 | 500 | ||
507 | /* | 501 | /* |
508 | * Update the exchange and sequence flags, | 502 | * Update the exchange and sequence flags, |
509 | * assuming all frames for the sequence have been sent. | 503 | * assuming all frames for the sequence have been sent. |
510 | * We can only be called to send once for each sequence. | 504 | * We can only be called to send once for each sequence. |
511 | */ | 505 | */ |
512 | spin_lock_bh(&ep->ex_lock); | ||
513 | ep->f_ctl = f_ctl & ~FC_FC_FIRST_SEQ; /* not first seq */ | 506 | ep->f_ctl = f_ctl & ~FC_FC_FIRST_SEQ; /* not first seq */ |
514 | if (f_ctl & FC_FC_SEQ_INIT) | 507 | if (f_ctl & FC_FC_SEQ_INIT) |
515 | ep->esb_stat &= ~ESB_ST_SEQ_INIT; | 508 | ep->esb_stat &= ~ESB_ST_SEQ_INIT; |
509 | out: | ||
510 | return error; | ||
511 | } | ||
512 | |||
513 | /** | ||
514 | * fc_seq_send() - Send a frame using existing sequence/exchange pair | ||
515 | * @lport: The local port that the exchange will be sent on | ||
516 | * @sp: The sequence to be sent | ||
517 | * @fp: The frame to be sent on the exchange | ||
518 | */ | ||
519 | static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp, | ||
520 | struct fc_frame *fp) | ||
521 | { | ||
522 | struct fc_exch *ep; | ||
523 | int error; | ||
524 | ep = fc_seq_exch(sp); | ||
525 | spin_lock_bh(&ep->ex_lock); | ||
526 | error = fc_seq_send_locked(lport, sp, fp); | ||
516 | spin_unlock_bh(&ep->ex_lock); | 527 | spin_unlock_bh(&ep->ex_lock); |
517 | return error; | 528 | return error; |
518 | } | 529 | } |
@@ -629,7 +640,7 @@ static int fc_exch_abort_locked(struct fc_exch *ep, | |||
629 | if (fp) { | 640 | if (fp) { |
630 | fc_fill_fc_hdr(fp, FC_RCTL_BA_ABTS, ep->did, ep->sid, | 641 | fc_fill_fc_hdr(fp, FC_RCTL_BA_ABTS, ep->did, ep->sid, |
631 | FC_TYPE_BLS, FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); | 642 | FC_TYPE_BLS, FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); |
632 | error = fc_seq_send(ep->lp, sp, fp); | 643 | error = fc_seq_send_locked(ep->lp, sp, fp); |
633 | } else | 644 | } else |
634 | error = -ENOBUFS; | 645 | error = -ENOBUFS; |
635 | return error; | 646 | return error; |
@@ -1132,7 +1143,7 @@ static void fc_seq_send_last(struct fc_seq *sp, struct fc_frame *fp, | |||
1132 | f_ctl = FC_FC_LAST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT; | 1143 | f_ctl = FC_FC_LAST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT; |
1133 | f_ctl |= ep->f_ctl; | 1144 | f_ctl |= ep->f_ctl; |
1134 | fc_fill_fc_hdr(fp, rctl, ep->did, ep->sid, fh_type, f_ctl, 0); | 1145 | fc_fill_fc_hdr(fp, rctl, ep->did, ep->sid, fh_type, f_ctl, 0); |
1135 | fc_seq_send(ep->lp, sp, fp); | 1146 | fc_seq_send_locked(ep->lp, sp, fp); |
1136 | } | 1147 | } |
1137 | 1148 | ||
1138 | /** | 1149 | /** |
@@ -1307,8 +1318,8 @@ static void fc_exch_recv_abts(struct fc_exch *ep, struct fc_frame *rx_fp) | |||
1307 | ap->ba_low_seq_cnt = htons(sp->cnt); | 1318 | ap->ba_low_seq_cnt = htons(sp->cnt); |
1308 | } | 1319 | } |
1309 | sp = fc_seq_start_next_locked(sp); | 1320 | sp = fc_seq_start_next_locked(sp); |
1310 | spin_unlock_bh(&ep->ex_lock); | ||
1311 | fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS); | 1321 | fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS); |
1322 | spin_unlock_bh(&ep->ex_lock); | ||
1312 | fc_frame_free(rx_fp); | 1323 | fc_frame_free(rx_fp); |
1313 | return; | 1324 | return; |
1314 | 1325 | ||
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c index d518d17e940f..6bbb9447b75d 100644 --- a/drivers/scsi/libfc/fc_rport.c +++ b/drivers/scsi/libfc/fc_rport.c | |||
@@ -1962,7 +1962,7 @@ static int fc_rport_fcp_prli(struct fc_rport_priv *rdata, u32 spp_len, | |||
1962 | rdata->flags |= FC_RP_FLAGS_RETRY; | 1962 | rdata->flags |= FC_RP_FLAGS_RETRY; |
1963 | rdata->supported_classes = FC_COS_CLASS3; | 1963 | rdata->supported_classes = FC_COS_CLASS3; |
1964 | 1964 | ||
1965 | if (!(lport->service_params & FC_RPORT_ROLE_FCP_INITIATOR)) | 1965 | if (!(lport->service_params & FCP_SPPF_INIT_FCN)) |
1966 | return 0; | 1966 | return 0; |
1967 | 1967 | ||
1968 | spp->spp_flags |= rspp->spp_flags & FC_SPP_EST_IMG_PAIR; | 1968 | spp->spp_flags |= rspp->spp_flags & FC_SPP_EST_IMG_PAIR; |