Commit f95b35cf authored by Bart Van Assche's avatar Bart Van Assche Committed by Robert Love

libfc: Reduce exchange lock contention in fc_exch_recv_abts()

Reduce the time during which the exchange lock is held by allocating
a frame before obtaining the exchange lock.
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
parent cae7b6dd
...@@ -1307,9 +1307,16 @@ static void fc_exch_recv_abts(struct fc_exch *ep, struct fc_frame *rx_fp) ...@@ -1307,9 +1307,16 @@ static void fc_exch_recv_abts(struct fc_exch *ep, struct fc_frame *rx_fp)
if (!ep) if (!ep)
goto reject; goto reject;
fp = fc_frame_alloc(ep->lp, sizeof(*ap));
if (!fp)
goto free;
spin_lock_bh(&ep->ex_lock); spin_lock_bh(&ep->ex_lock);
if (ep->esb_stat & ESB_ST_COMPLETE) { if (ep->esb_stat & ESB_ST_COMPLETE) {
spin_unlock_bh(&ep->ex_lock); spin_unlock_bh(&ep->ex_lock);
fc_frame_free(fp);
goto reject; goto reject;
} }
if (!(ep->esb_stat & ESB_ST_REC_QUAL)) { if (!(ep->esb_stat & ESB_ST_REC_QUAL)) {
...@@ -1317,12 +1324,6 @@ static void fc_exch_recv_abts(struct fc_exch *ep, struct fc_frame *rx_fp) ...@@ -1317,12 +1324,6 @@ static void fc_exch_recv_abts(struct fc_exch *ep, struct fc_frame *rx_fp)
fc_exch_hold(ep); /* hold for REC_QUAL */ fc_exch_hold(ep); /* hold for REC_QUAL */
} }
fc_exch_timer_set_locked(ep, ep->r_a_tov); fc_exch_timer_set_locked(ep, ep->r_a_tov);
fp = fc_frame_alloc(ep->lp, sizeof(*ap));
if (!fp) {
spin_unlock_bh(&ep->ex_lock);
goto free;
}
fh = fc_frame_header_get(fp); fh = fc_frame_header_get(fp);
ap = fc_frame_payload_get(fp, sizeof(*ap)); ap = fc_frame_payload_get(fp, sizeof(*ap));
memset(ap, 0, sizeof(*ap)); memset(ap, 0, sizeof(*ap));
...@@ -1338,13 +1339,14 @@ static void fc_exch_recv_abts(struct fc_exch *ep, struct fc_frame *rx_fp) ...@@ -1338,13 +1339,14 @@ static void fc_exch_recv_abts(struct fc_exch *ep, struct fc_frame *rx_fp)
fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS); fc_seq_send_last(sp, fp, FC_RCTL_BA_ACC, FC_TYPE_BLS);
ep->esb_stat |= ESB_ST_ABNORMAL; ep->esb_stat |= ESB_ST_ABNORMAL;
spin_unlock_bh(&ep->ex_lock); spin_unlock_bh(&ep->ex_lock);
free:
fc_frame_free(rx_fp); fc_frame_free(rx_fp);
return; return;
reject: reject:
fc_exch_send_ba_rjt(rx_fp, FC_BA_RJT_UNABLE, FC_BA_RJT_INV_XID); fc_exch_send_ba_rjt(rx_fp, FC_BA_RJT_UNABLE, FC_BA_RJT_INV_XID);
free: goto free;
fc_frame_free(rx_fp);
} }
/** /**
......
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