diff options
-rw-r--r-- | drivers/scsi/libfc/fc_exch.c | 25 | ||||
-rw-r--r-- | include/scsi/libfc.h | 7 |
2 files changed, 32 insertions, 0 deletions
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 61eabd3ce436..027042a6de3b 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c | |||
@@ -1231,6 +1231,28 @@ free: | |||
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | /** | 1233 | /** |
1234 | * fc_seq_assign() - Assign exchange and sequence for incoming request | ||
1235 | * @lport: The local port that received the request | ||
1236 | * @fp: The request frame | ||
1237 | * | ||
1238 | * On success, the sequence pointer will be returned and also in fr_seq(@fp). | ||
1239 | */ | ||
1240 | static struct fc_seq *fc_seq_assign(struct fc_lport *lport, struct fc_frame *fp) | ||
1241 | { | ||
1242 | struct fc_exch_mgr_anchor *ema; | ||
1243 | |||
1244 | WARN_ON(lport != fr_dev(fp)); | ||
1245 | WARN_ON(fr_seq(fp)); | ||
1246 | fr_seq(fp) = NULL; | ||
1247 | |||
1248 | list_for_each_entry(ema, &lport->ema_list, ema_list) | ||
1249 | if ((!ema->match || ema->match(fp)) && | ||
1250 | fc_seq_lookup_recip(lport, ema->mp, fp) != FC_RJT_NONE) | ||
1251 | break; | ||
1252 | return fr_seq(fp); | ||
1253 | } | ||
1254 | |||
1255 | /** | ||
1234 | * fc_exch_recv_req() - Handler for an incoming request where is other | 1256 | * fc_exch_recv_req() - Handler for an incoming request where is other |
1235 | * end is originating the sequence | 1257 | * end is originating the sequence |
1236 | * @lport: The local port that received the request | 1258 | * @lport: The local port that received the request |
@@ -2283,6 +2305,9 @@ int fc_exch_init(struct fc_lport *lport) | |||
2283 | if (!lport->tt.seq_exch_abort) | 2305 | if (!lport->tt.seq_exch_abort) |
2284 | lport->tt.seq_exch_abort = fc_seq_exch_abort; | 2306 | lport->tt.seq_exch_abort = fc_seq_exch_abort; |
2285 | 2307 | ||
2308 | if (!lport->tt.seq_assign) | ||
2309 | lport->tt.seq_assign = fc_seq_assign; | ||
2310 | |||
2286 | return 0; | 2311 | return 0; |
2287 | } | 2312 | } |
2288 | EXPORT_SYMBOL(fc_exch_init); | 2313 | EXPORT_SYMBOL(fc_exch_init); |
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index a6414ec63809..605f1d7861a7 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -556,6 +556,13 @@ struct libfc_function_template { | |||
556 | struct fc_seq *(*seq_start_next)(struct fc_seq *); | 556 | struct fc_seq *(*seq_start_next)(struct fc_seq *); |
557 | 557 | ||
558 | /* | 558 | /* |
559 | * Assign a sequence for an incoming request frame. | ||
560 | * | ||
561 | * STATUS: OPTIONAL | ||
562 | */ | ||
563 | struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *); | ||
564 | |||
565 | /* | ||
559 | * Reset an exchange manager, completing all sequences and exchanges. | 566 | * Reset an exchange manager, completing all sequences and exchanges. |
560 | * If s_id is non-zero, reset only exchanges originating from that FID. | 567 | * If s_id is non-zero, reset only exchanges originating from that FID. |
561 | * If d_id is non-zero, reset only exchanges sending to that FID. | 568 | * If d_id is non-zero, reset only exchanges sending to that FID. |