Commit a104c844 authored by Vasu Dev's avatar Vasu Dev Committed by James Bottomley

[SCSI] libfc: fixes unnecessary seq id jump

In some cases seq is incremented twice causing unnecessary
seq jump, for instance fc_exch_recv_seq_resp increments
seq id when fc_sof_is_init is true and that is true for
each incoming xfer ready but then fc_fcp_send_data does
another seq increment to send data for xfer ready.

This patch removes all such seq id jumps, at least it
eliminates few calls to fc_seq_start_next using ex_lock.

Also removes seq id update with incoming frame's seq id
as this is not needed since each end (I or T) just need
to send incremented their own seq id on each TSI from
other end & before sending new sequence within a
exchange.
Signed-off-by: default avatarVasu Dev <vasu.dev@intel.com>
Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent cc3593d3
...@@ -920,12 +920,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport, ...@@ -920,12 +920,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport,
* Find or create the sequence. * Find or create the sequence.
*/ */
if (fc_sof_is_init(fr_sof(fp))) { if (fc_sof_is_init(fr_sof(fp))) {
sp = fc_seq_start_next(&ep->seq); sp = &ep->seq;
if (!sp) {
reject = FC_RJT_SEQ_XS; /* exchange shortage */
goto rel;
}
sp->id = fh->fh_seq_id;
sp->ssb_stat |= SSB_ST_RESP; sp->ssb_stat |= SSB_ST_RESP;
} else { } else {
sp = &ep->seq; sp = &ep->seq;
...@@ -1336,17 +1331,14 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) ...@@ -1336,17 +1331,14 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
goto rel; goto rel;
} }
sof = fr_sof(fp); sof = fr_sof(fp);
if (fc_sof_is_init(sof)) {
sp = fc_seq_start_next(&ep->seq);
sp->id = fh->fh_seq_id;
sp->ssb_stat |= SSB_ST_RESP;
} else {
sp = &ep->seq; sp = &ep->seq;
if (sp->id != fh->fh_seq_id) { if (fc_sof_is_init(sof))
sp->ssb_stat |= SSB_ST_RESP;
else if (sp->id != fh->fh_seq_id) {
atomic_inc(&mp->stats.seq_not_found); atomic_inc(&mp->stats.seq_not_found);
goto rel; goto rel;
} }
}
f_ctl = ntoh24(fh->fh_f_ctl); f_ctl = ntoh24(fh->fh_f_ctl);
fr_seq(fp) = sp; fr_seq(fp) = sp;
if (f_ctl & FC_FC_SEQ_INIT) if (f_ctl & FC_FC_SEQ_INIT)
...@@ -1763,7 +1755,6 @@ static void fc_exch_els_rec(struct fc_seq *sp, struct fc_frame *rfp) ...@@ -1763,7 +1755,6 @@ static void fc_exch_els_rec(struct fc_seq *sp, struct fc_frame *rfp)
fc_exch_done(sp); fc_exch_done(sp);
goto out; goto out;
} }
sp = fc_seq_start_next(sp);
acc = fc_frame_payload_get(fp, sizeof(*acc)); acc = fc_frame_payload_get(fp, sizeof(*acc));
memset(acc, 0, sizeof(*acc)); memset(acc, 0, sizeof(*acc));
acc->reca_cmd = ELS_LS_ACC; acc->reca_cmd = ELS_LS_ACC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment