Skip to content

Commit 1a5c2d7

Browse files
Joe EykholtJames Bottomley
authored andcommitted
[SCSI] libfc: add method for setting handler for incoming exchange
Add a method for setting handler for incoming exchange. For multi-sequence exchanges, this allows the target driver to add a response handler for handling subsequent sequences, and exchange manager resets. The new function is called fc_seq_set_resp(). Signed-off-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
1 parent 96ad846 commit 1a5c2d7

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎drivers/scsi/libfc/fc_exch.c‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,22 @@ static struct fc_seq *fc_seq_start_next(struct fc_seq *sp)
558558
return sp;
559559
}
560560

561+
/*
562+
* Set the response handler for the exchange associated with a sequence.
563+
*/
564+
static void fc_seq_set_resp(struct fc_seq *sp,
565+
void (*resp)(struct fc_seq *, struct fc_frame *,
566+
void *),
567+
void *arg)
568+
{
569+
struct fc_exch *ep = fc_seq_exch(sp);
570+
571+
spin_lock_bh(&ep->ex_lock);
572+
ep->resp = resp;
573+
ep->arg = arg;
574+
spin_unlock_bh(&ep->ex_lock);
575+
}
576+
561577
/**
562578
* fc_seq_exch_abort() - Abort an exchange and sequence
563579
* @req_sp: The sequence to be aborted
@@ -2329,6 +2345,9 @@ int fc_exch_init(struct fc_lport *lport)
23292345
if (!lport->tt.seq_start_next)
23302346
lport->tt.seq_start_next = fc_seq_start_next;
23312347

2348+
if (!lport->tt.seq_set_resp)
2349+
lport->tt.seq_set_resp = fc_seq_set_resp;
2350+
23322351
if (!lport->tt.exch_seq_send)
23332352
lport->tt.exch_seq_send = fc_exch_seq_send;
23342353

‎include/scsi/libfc.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,16 @@ struct libfc_function_template {
554554
*/
555555
struct fc_seq *(*seq_start_next)(struct fc_seq *);
556556

557+
/*
558+
* Set a response handler for the exchange of the sequence.
559+
*
560+
* STATUS: OPTIONAL
561+
*/
562+
void (*seq_set_resp)(struct fc_seq *sp,
563+
void (*resp)(struct fc_seq *, struct fc_frame *,
564+
void *),
565+
void *arg);
566+
557567
/*
558568
* Assign a sequence for an incoming request frame.
559569
*

0 commit comments

Comments
 (0)