aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/libfc/fc_exch.c14
-rw-r--r--include/scsi/libfc.h7
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 1f124c0351b4..a3d640289dcc 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -1282,6 +1282,8 @@ free:
1282 * @fp: The request frame 1282 * @fp: The request frame
1283 * 1283 *
1284 * On success, the sequence pointer will be returned and also in fr_seq(@fp). 1284 * On success, the sequence pointer will be returned and also in fr_seq(@fp).
1285 * A reference will be held on the exchange/sequence for the caller, which
1286 * must call fc_seq_release().
1285 */ 1287 */
1286static struct fc_seq *fc_seq_assign(struct fc_lport *lport, struct fc_frame *fp) 1288static struct fc_seq *fc_seq_assign(struct fc_lport *lport, struct fc_frame *fp)
1287{ 1289{
@@ -1299,6 +1301,15 @@ static struct fc_seq *fc_seq_assign(struct fc_lport *lport, struct fc_frame *fp)
1299} 1301}
1300 1302
1301/** 1303/**
1304 * fc_seq_release() - Release the hold
1305 * @sp: The sequence.
1306 */
1307static void fc_seq_release(struct fc_seq *sp)
1308{
1309 fc_exch_release(fc_seq_exch(sp));
1310}
1311
1312/**
1302 * fc_exch_recv_req() - Handler for an incoming request 1313 * fc_exch_recv_req() - Handler for an incoming request
1303 * @lport: The local port that received the request 1314 * @lport: The local port that received the request
1304 * @mp: The EM that the exchange is on 1315 * @mp: The EM that the exchange is on
@@ -2369,6 +2380,9 @@ int fc_exch_init(struct fc_lport *lport)
2369 if (!lport->tt.seq_assign) 2380 if (!lport->tt.seq_assign)
2370 lport->tt.seq_assign = fc_seq_assign; 2381 lport->tt.seq_assign = fc_seq_assign;
2371 2382
2383 if (!lport->tt.seq_release)
2384 lport->tt.seq_release = fc_seq_release;
2385
2372 return 0; 2386 return 0;
2373} 2387}
2374EXPORT_SYMBOL(fc_exch_init); 2388EXPORT_SYMBOL(fc_exch_init);
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 79d1c76b4269..6d64e44bc3bf 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -572,6 +572,13 @@ struct libfc_function_template {
572 struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *); 572 struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *);
573 573
574 /* 574 /*
575 * Release the reference on the sequence returned by seq_assign().
576 *
577 * STATUS: OPTIONAL
578 */
579 void (*seq_release)(struct fc_seq *);
580
581 /*
575 * Reset an exchange manager, completing all sequences and exchanges. 582 * Reset an exchange manager, completing all sequences and exchanges.
576 * If s_id is non-zero, reset only exchanges originating from that FID. 583 * If s_id is non-zero, reset only exchanges originating from that FID.
577 * If d_id is non-zero, reset only exchanges sending to that FID. 584 * If d_id is non-zero, reset only exchanges sending to that FID.