]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[SCSI] libfc: track FIP exchanges
authorJoe Eykholt <jeykholt@cisco.com>
Tue, 20 Jul 2010 22:20:14 +0000 (15:20 -0700)
committerJames Bottomley <James.Bottomley@suse.de>
Wed, 28 Jul 2010 14:05:54 +0000 (09:05 -0500)
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>
drivers/scsi/libfc/fc_exch.c
include/scsi/fc_frame.h
include/scsi/libfc.h

index 104e0fba7c43bb71dff75eb8650c16f5668679c3..61eabd3ce4365ee326e52b166f20864e47954c23 100644 (file)
@@ -464,6 +464,7 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp,
 
        f_ctl = ntoh24(fh->fh_f_ctl);
        fc_exch_setup_hdr(ep, fp, f_ctl);
+       fr_encaps(fp) = ep->encaps;
 
        /*
         * 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,
                sp = fr_seq(fp);        /* sequence will be held */
                ep = fc_seq_exch(sp);
                fc_seq_send_ack(sp, fp);
+               ep->encaps = fr_encaps(fp);
 
                /*
                 * Call the receive function.
index 15427fab8a57e2cae49cf006a5199f760495ea7e..29dd97d5b53a916d00da624a6ad5498e2d7bc115 100644 (file)
@@ -51,6 +51,7 @@
 #define fr_sof(fp)     (fr_cb(fp)->fr_sof)
 #define fr_eof(fp)     (fr_cb(fp)->fr_eof)
 #define fr_flags(fp)   (fr_cb(fp)->fr_flags)
+#define fr_encaps(fp)  (fr_cb(fp)->fr_encaps)
 #define fr_max_payload(fp)     (fr_cb(fp)->fr_max_payload)
 #define fr_fsp(fp)     (fr_cb(fp)->fr_fsp)
 #define fr_crc(fp)     (fr_cb(fp)->fr_crc)
@@ -69,6 +70,7 @@ struct fcoe_rcv_info {
        u8              fr_sof;         /* start of frame delimiter */
        u8              fr_eof;         /* end of frame delimiter */
        u8              fr_flags;       /* flags - see below */
+       u8              fr_encaps;      /* LLD encapsulation info (e.g. FIP) */
        u8              granted_mac[ETH_ALEN]; /* FCoE MAC address */
 };
 
@@ -97,6 +99,7 @@ static inline void fc_frame_init(struct fc_frame *fp)
        fr_dev(fp) = NULL;
        fr_seq(fp) = NULL;
        fr_flags(fp) = 0;
+       fr_encaps(fp) = 0;
 }
 
 struct fc_frame *fc_frame_alloc_fill(struct fc_lport *, size_t payload_len);
index 24b91c9220551bcb18ea24c299786b19221ea01e..8d297f9a0a47fe87797c0556043b6532c4fb6fed 100644 (file)
@@ -412,6 +412,7 @@ struct fc_seq {
  * @esb_stat:     ESB exchange status
  * @r_a_tov:      Resouce allocation time out value (in msecs)
  * @seq_id:       The next sequence ID to use
+ * @encaps:       encapsulation information for lower-level driver
  * @f_ctl:        F_CTL flags for the sequence
  * @fh_type:      The frame type
  * @class:        The class of service
@@ -443,6 +444,7 @@ struct fc_exch {
        u32                 esb_stat;
        u32                 r_a_tov;
        u8                  seq_id;
+       u8                  encaps;
        u32                 f_ctl;
        u8                  fh_type;
        enum fc_class       class;