mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-19 19:51:27 +00:00
The individual patches are a subset of the earlier ones, with only line number changes to apply cleanly. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1922 d57e44dd-8a1f-0410-8b47-8ef2f437770f
85 lines
2.5 KiB
Plaintext
85 lines
2.5 KiB
Plaintext
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>
|
|
|
|
---
|
|
drivers/scsi/libfc/fc_exch.c | 19 +++++++++++++++++++
|
|
include/scsi/libfc.h | 11 ++++++++++-
|
|
2 files changed, 29 insertions(+), 1 deletions(-)
|
|
|
|
|
|
---
|
|
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
|
|
index 104e0fb..1828d1d 100644
|
|
--- a/drivers/scsi/libfc/fc_exch.c
|
|
+++ b/drivers/scsi/libfc/fc_exch.c
|
|
@@ -545,6 +545,22 @@ static struct fc_seq *fc_seq_start_next(struct fc_seq *sp)
|
|
return sp;
|
|
}
|
|
|
|
+/*
|
|
+ * Set the response handler for the exchange associated with a sequence.
|
|
+ */
|
|
+static void fc_seq_set_resp(struct fc_seq *sp,
|
|
+ void (*resp)(struct fc_seq *, struct fc_frame *,
|
|
+ void *),
|
|
+ void *arg)
|
|
+{
|
|
+ struct fc_exch *ep = fc_seq_exch(sp);
|
|
+
|
|
+ spin_lock_bh(&ep->ex_lock);
|
|
+ ep->resp = resp;
|
|
+ ep->arg = arg;
|
|
+ spin_unlock_bh(&ep->ex_lock);
|
|
+}
|
|
+
|
|
/**
|
|
* fc_seq_exch_abort() - Abort an exchange and sequence
|
|
* @req_sp: The sequence to be aborted
|
|
@@ -2263,6 +2279,9 @@ int fc_exch_init(struct fc_lport *lport)
|
|
if (!lport->tt.seq_start_next)
|
|
lport->tt.seq_start_next = fc_seq_start_next;
|
|
|
|
+ if (!lport->tt.seq_set_resp)
|
|
+ lport->tt.seq_set_resp = fc_seq_set_resp;
|
|
+
|
|
if (!lport->tt.exch_seq_send)
|
|
lport->tt.exch_seq_send = fc_exch_seq_send;
|
|
|
|
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
|
|
index 4ac290f..64a4756 100644
|
|
--- a/include/scsi/libfc.h
|
|
+++ b/include/scsi/libfc.h
|
|
@@ -571,6 +571,16 @@ struct libfc_function_template {
|
|
struct fc_seq *(*seq_start_next)(struct fc_seq *);
|
|
|
|
/*
|
|
+ * Set a response handler for the exchange of the sequence.
|
|
+ *
|
|
+ * STATUS: OPTIONAL
|
|
+ */
|
|
+ void (*seq_set_resp)(struct fc_seq *sp,
|
|
+ void (*resp)(struct fc_seq *, struct fc_frame *,
|
|
+ void *),
|
|
+ void *arg);
|
|
+
|
|
+ /*
|
|
* Reset an exchange manager, completing all sequences and exchanges.
|
|
* If s_id is non-zero, reset only exchanges originating from that FID.
|
|
* If d_id is non-zero, reset only exchanges sending to that FID.
|
|
@@ -1056,7 +1066,6 @@ struct fc_seq *fc_elsct_send(struct fc_lport *, u32 did,
|
|
void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *);
|
|
void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *);
|
|
|
|
-
|
|
/*
|
|
* EXCHANGE MANAGER LAYER
|
|
*****************************/
|