From 24f089e2f2c800f88039e9d536d558ec6e349fad Mon Sep 17 00:00:00 2001 From: Joe Eykholt Date: Tue, 20 Jul 2010 15:21:01 -0700 Subject: [SCSI] libfc: add fc_fill_reply_hdr() and fc_fill_hdr() Add functions to fill in an FC header given a request header. These reduces code lines in fc_lport and fc_rport and works without an exchange/sequence assigned. fc_fill_reply_hdr() fills a header for a final reply frame. fc_fill_hdr() which is similar but allows specifying the f_ctl parameter. Add defines for F_CTL values FC_FCTL_REQ and FC_FCTL_RESP. These can be used for most request and response sequences. v2 of patch adds a line to copy the frame encapsulation info from the received frame. Signed-off-by: Joe Eykholt Signed-off-by: Robert Love Signed-off-by: James Bottomley --- include/scsi/fc_encode.h | 7 +++++++ include/scsi/libfc.h | 4 ++++ 2 files changed, 11 insertions(+) (limited to 'include/scsi') diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h index 9b4867c9c2d2..6d293c846a46 100644 --- a/include/scsi/fc_encode.h +++ b/include/scsi/fc_encode.h @@ -21,6 +21,13 @@ #define _FC_ENCODE_H_ #include +/* + * F_CTL values for simple requests and responses. + */ +#define FC_FCTL_REQ (FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT) +#define FC_FCTL_RESP (FC_FC_EX_CTX | FC_FC_LAST_SEQ | \ + FC_FC_END_SEQ | FC_FC_SEQ_INIT) + struct fc_ns_rft { struct fc_ns_fid fid; /* port ID object */ struct fc_ns_fts fts; /* FC4-types object */ diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index f1ce793f33b3..a6414ec63809 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h @@ -1027,6 +1027,10 @@ struct fc_seq *fc_elsct_send(struct fc_lport *, u32 did, void *arg, u32 timer_msec); void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *); void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *); +void fc_fill_reply_hdr(struct fc_frame *, const struct fc_frame *, + enum fc_rctl, u32 parm_offset); +void fc_fill_hdr(struct fc_frame *, const struct fc_frame *, + enum fc_rctl, u32 f_ctl, u16 seq_cnt, u32 parm_offset); /* -- cgit v1.2.3-59-g8ed1b