22 #include <asm/unaligned.h>
23 #include <linux/utsname.h>
28 #define FC_FCTL_REQ (FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT)
29 #define FC_FCTL_RESP (FC_FC_EX_CTX | FC_FC_LAST_SEQ | \
30 FC_FC_END_SEQ | FC_FC_SEQ_INIT)
57 u32 f_ctl,
u32 parm_offset)
75 u32 f_ctl,
u32 parm_offset)
79 fh = fc_frame_header_get(fp);
80 __fc_fill_fc_hdr(fh, r_ctl, did, sid, type, f_ctl, parm_offset);
92 adisc = fc_frame_payload_get(fp,
sizeof(*adisc));
93 memset(adisc, 0,
sizeof(*adisc));
105 unsigned int op,
size_t req_size,
112 ct_plen =
sizeof(
struct fc_ct_hdr) + req_size;
113 ct = fc_frame_payload_get(fp, ct_plen);
116 ct->hdr.ct_fs_type = fs_type;
117 ct->hdr.ct_fs_subtype =
subtype;
131 static inline int fc_ct_ns_fill(
struct fc_lport *lport,
133 unsigned int op,
enum fc_rctl *r_ctl,
141 ct = fc_ct_hdr_fill(fp, op,
sizeof(
struct fc_ns_gid_ft),
147 ct = fc_ct_hdr_fill(fp, op,
sizeof(
struct fc_ns_fid),
154 ct = fc_ct_hdr_fill(fp, op,
sizeof(
struct fc_ns_rft),
161 ct = fc_ct_hdr_fill(fp, op,
sizeof(
struct fc_ns_rff_id),
172 ct = fc_ct_hdr_fill(fp, op,
sizeof(
struct fc_ns_rn_id),
180 ct = fc_ct_hdr_fill(fp, op,
sizeof(
struct fc_ns_rspn) + len,
190 ct = fc_ct_hdr_fill(fp, op,
sizeof(
struct fc_ns_rsnn) + len,
215 static inline int fc_ct_ms_fill(
struct fc_lport *lport,
217 unsigned int op,
enum fc_rctl *r_ctl,
263 put_unaligned_be16(len, &entry->
len);
274 put_unaligned_be16(len, &entry->
len);
286 put_unaligned_be16(len, &entry->
len);
298 put_unaligned_be16(len, &entry->
len);
310 put_unaligned_be16(len, &entry->
len);
322 put_unaligned_be16(len, &entry->
len);
334 put_unaligned_be16(len, &entry->
len);
346 put_unaligned_be16(len, &entry->
len);
358 put_unaligned_be16(len, &entry->
len);
370 put_unaligned_be16(len, &entry->
len);
374 init_utsname()->sysname,
407 put_unaligned_be16(len, &entry->
len);
418 put_unaligned_be16(len, &entry->
len);
430 put_unaligned_be16(len, &entry->
len);
441 put_unaligned_be16(len, &entry->
len);
452 put_unaligned_be16(len, &entry->
len);
455 dev_name(&lport->
host->shost_gendev),
466 put_unaligned_be16(len, &entry->
len);
474 init_utsname()->nodename,
509 static inline int fc_ct_fill(
struct fc_lport *lport,
511 unsigned int op,
enum fc_rctl *r_ctl,
518 rc = fc_ct_ms_fill(lport, fc_id, fp, op, r_ctl, fh_type);
523 rc = fc_ct_ns_fill(lport, fc_id, fp, op, r_ctl, fh_type);
533 static inline void fc_plogi_fill(
struct fc_lport *lport,
struct fc_frame *fp,
540 plogi = fc_frame_payload_get(fp,
sizeof(*plogi));
541 memset(plogi, 0,
sizeof(*plogi));
554 csp->sp_tot_seq =
htons(255);
555 csp->sp_rel_off =
htons(0x1f);
566 static inline void fc_flogi_fill(
struct fc_lport *lport,
struct fc_frame *fp)
572 flogi = fc_frame_payload_get(fp,
sizeof(*flogi));
573 memset(flogi, 0,
sizeof(*flogi));
591 static inline void fc_fdisc_fill(
struct fc_lport *lport,
struct fc_frame *fp)
597 fdisc = fc_frame_payload_get(fp,
sizeof(*fdisc));
598 memset(fdisc, 0,
sizeof(*fdisc));
614 static inline void fc_logo_fill(
struct fc_lport *lport,
struct fc_frame *fp)
618 logo = fc_frame_payload_get(fp,
sizeof(*logo));
619 memset(logo, 0,
sizeof(*logo));
632 rtv = fc_frame_payload_get(fp,
sizeof(*rtv));
633 memset(rtv, 0,
sizeof(*rtv));
645 rec = fc_frame_payload_get(fp,
sizeof(*rec));
646 memset(rec, 0,
sizeof(*rec));
656 static inline void fc_prli_fill(
struct fc_lport *lport,
struct fc_frame *fp)
663 pp = fc_frame_payload_get(fp,
sizeof(*
pp));
680 scr = fc_frame_payload_get(fp,
sizeof(*scr));
681 memset(scr, 0,
sizeof(*scr));
689 static inline int fc_els_fill(
struct fc_lport *lport,
691 struct fc_frame *fp,
unsigned int op,
696 fc_adisc_fill(lport, fp);
704 fc_flogi_fill(lport, fp);
708 fc_fdisc_fill(lport, fp);
712 fc_logo_fill(lport, fp);
716 fc_rtv_fill(lport, fp);
720 fc_rec_fill(lport, fp);
724 fc_prli_fill(lport, fp);
728 fc_scr_fill(lport, fp);