Skip to content

Commit f60e12e

Browse files
Joe EykholtJames Bottomley
authored andcommitted
[SCSI] libfc: track FIP exchanges
When an exchange is received with a FIP encapsulation, we need to know that the response must be sent via FIP and what the original ELS opcode was. This becomes important for VN2VN mode, where we may receive FLOGI or LOGO from several peer VN_ports, and the LS_ACC or LS_RJT must be sent FIP-encapsulated with the correct sub-type. Add a field to the struct fc_frame, fr_encaps, to indicate the encapsulation values. That term is chosen to be neutral and LLD-agnostic in case non-FCoE/FIP LLDs might find it useful. The frame fr_encaps is transferred from the ingress frame to the exchange by fc_exch_recv_req(), and back to the outgoing frame by fc_seq_send(). This is taking the last byte in the skb->cb array. If needed, we could combine the info in sof, eof, flags, and encaps together into one field, but it'd be better to do that if and when its needed. 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 a7b12a2 commit f60e12e

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎drivers/scsi/libfc/fc_exch.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp,
464464

465465
f_ctl = ntoh24(fh->fh_f_ctl);
466466
fc_exch_setup_hdr(ep, fp, f_ctl);
467+
fr_encaps(fp) = ep->encaps;
467468

468469
/*
469470
* update sequence count if this frame is carrying
@@ -1259,6 +1260,7 @@ static void fc_exch_recv_req(struct fc_lport *lport, struct fc_exch_mgr *mp,
12591260
sp = fr_seq(fp); /* sequence will be held */
12601261
ep = fc_seq_exch(sp);
12611262
fc_seq_send_ack(sp, fp);
1263+
ep->encaps = fr_encaps(fp);
12621264

12631265
/*
12641266
* Call the receive function.

‎include/scsi/fc_frame.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#define fr_sof(fp) (fr_cb(fp)->fr_sof)
5252
#define fr_eof(fp) (fr_cb(fp)->fr_eof)
5353
#define fr_flags(fp) (fr_cb(fp)->fr_flags)
54+
#define fr_encaps(fp) (fr_cb(fp)->fr_encaps)
5455
#define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload)
5556
#define fr_fsp(fp) (fr_cb(fp)->fr_fsp)
5657
#define fr_crc(fp) (fr_cb(fp)->fr_crc)
@@ -69,6 +70,7 @@ struct fcoe_rcv_info {
6970
u8 fr_sof; /* start of frame delimiter */
7071
u8 fr_eof; /* end of frame delimiter */
7172
u8 fr_flags; /* flags - see below */
73+
u8 fr_encaps; /* LLD encapsulation info (e.g. FIP) */
7274
u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */
7375
};
7476

@@ -97,6 +99,7 @@ static inline void fc_frame_init(struct fc_frame *fp)
9799
fr_dev(fp) = NULL;
98100
fr_seq(fp) = NULL;
99101
fr_flags(fp) = 0;
102+
fr_encaps(fp) = 0;
100103
}
101104

102105
struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len);

‎include/scsi/libfc.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ struct fc_seq {
412412
* @esb_stat: ESB exchange status
413413
* @r_a_tov: Resouce allocation time out value (in msecs)
414414
* @seq_id: The next sequence ID to use
415+
* @encaps: encapsulation information for lower-level driver
415416
* @f_ctl: F_CTL flags for the sequence
416417
* @fh_type: The frame type
417418
* @class: The class of service
@@ -443,6 +444,7 @@ struct fc_exch {
443444
u32 esb_stat;
444445
u32 r_a_tov;
445446
u8 seq_id;
447+
u8 encaps;
446448
u32 f_ctl;
447449
u8 fh_type;
448450
enum fc_class class;

0 commit comments

Comments
 (0)