Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Joe Eykholt and committed by
James Bottomley
f60e12e9 a7b12a27

+7
+2
drivers/scsi/libfc/fc_exch.c
··· 464 464 465 465 f_ctl = ntoh24(fh->fh_f_ctl); 466 466 fc_exch_setup_hdr(ep, fp, f_ctl); 467 + fr_encaps(fp) = ep->encaps; 467 468 468 469 /* 469 470 * update sequence count if this frame is carrying ··· 1260 1259 sp = fr_seq(fp); /* sequence will be held */ 1261 1260 ep = fc_seq_exch(sp); 1262 1261 fc_seq_send_ack(sp, fp); 1262 + ep->encaps = fr_encaps(fp); 1263 1263 1264 1264 /* 1265 1265 * Call the receive function.
+3
include/scsi/fc_frame.h
··· 51 51 #define fr_sof(fp) (fr_cb(fp)->fr_sof) 52 52 #define fr_eof(fp) (fr_cb(fp)->fr_eof) 53 53 #define fr_flags(fp) (fr_cb(fp)->fr_flags) 54 + #define fr_encaps(fp) (fr_cb(fp)->fr_encaps) 54 55 #define fr_max_payload(fp) (fr_cb(fp)->fr_max_payload) 55 56 #define fr_fsp(fp) (fr_cb(fp)->fr_fsp) 56 57 #define fr_crc(fp) (fr_cb(fp)->fr_crc) ··· 70 69 u8 fr_sof; /* start of frame delimiter */ 71 70 u8 fr_eof; /* end of frame delimiter */ 72 71 u8 fr_flags; /* flags - see below */ 72 + u8 fr_encaps; /* LLD encapsulation info (e.g. FIP) */ 73 73 u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */ 74 74 }; 75 75 ··· 99 97 fr_dev(fp) = NULL; 100 98 fr_seq(fp) = NULL; 101 99 fr_flags(fp) = 0; 100 + fr_encaps(fp) = 0; 102 101 } 103 102 104 103 struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len);
+2
include/scsi/libfc.h
··· 412 412 * @esb_stat: ESB exchange status 413 413 * @r_a_tov: Resouce allocation time out value (in msecs) 414 414 * @seq_id: The next sequence ID to use 415 + * @encaps: encapsulation information for lower-level driver 415 416 * @f_ctl: F_CTL flags for the sequence 416 417 * @fh_type: The frame type 417 418 * @class: The class of service ··· 444 443 u32 esb_stat; 445 444 u32 r_a_tov; 446 445 u8 seq_id; 446 + u8 encaps; 447 447 u32 f_ctl; 448 448 u8 fh_type; 449 449 enum fc_class class;