| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright(c) 2008 Intel Corporation. All rights reserved. | 
|  | 3 | * | 
|  | 4 | * This program is free software; you can redistribute it and/or modify it | 
|  | 5 | * under the terms and conditions of the GNU General Public License, | 
|  | 6 | * version 2, as published by the Free Software Foundation. | 
|  | 7 | * | 
|  | 8 | * This program is distributed in the hope it will be useful, but WITHOUT | 
|  | 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 
|  | 10 | * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | 
|  | 11 | * more details. | 
|  | 12 | * | 
|  | 13 | * You should have received a copy of the GNU General Public License along with | 
|  | 14 | * this program; if not, write to the Free Software Foundation, Inc., | 
|  | 15 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | 
|  | 16 | * | 
|  | 17 | * Maintained at www.Open-FCoE.org | 
|  | 18 | */ | 
|  | 19 |  | 
|  | 20 | #ifndef _FC_ENCODE_H_ | 
|  | 21 | #define _FC_ENCODE_H_ | 
|  | 22 | #include <asm/unaligned.h> | 
|  | 23 |  | 
|  | 24 | struct fc_ns_rft { | 
|  | 25 | struct fc_ns_fid fid;	/* port ID object */ | 
|  | 26 | struct fc_ns_fts fts;	/* FC4-types object */ | 
|  | 27 | }; | 
|  | 28 |  | 
|  | 29 | struct fc_ct_req { | 
|  | 30 | struct fc_ct_hdr hdr; | 
|  | 31 | union { | 
|  | 32 | struct fc_ns_gid_ft gid; | 
|  | 33 | struct fc_ns_rn_id  rn; | 
|  | 34 | struct fc_ns_rft rft; | 
| Joe Eykholt | 2ab7e1e | 2009-08-25 14:03:58 -0700 | [diff] [blame] | 35 | struct fc_ns_fid fid; | 
| Chris Leech | 5baa17c | 2009-11-03 11:46:56 -0800 | [diff] [blame] | 36 | struct fc_ns_rsnn snn; | 
| Chris Leech | c9866a5 | 2009-11-03 11:47:01 -0800 | [diff] [blame] | 37 | struct fc_ns_rspn spn; | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 38 | } payload; | 
|  | 39 | }; | 
|  | 40 |  | 
|  | 41 | /** | 
|  | 42 | * fill FC header fields in specified fc_frame | 
|  | 43 | */ | 
|  | 44 | static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl, | 
|  | 45 | u32 did, u32 sid, enum fc_fh_type type, | 
|  | 46 | u32 f_ctl, u32 parm_offset) | 
|  | 47 | { | 
|  | 48 | struct fc_frame_header *fh; | 
|  | 49 |  | 
|  | 50 | fh = fc_frame_header_get(fp); | 
|  | 51 | WARN_ON(r_ctl == 0); | 
|  | 52 | fh->fh_r_ctl = r_ctl; | 
|  | 53 | hton24(fh->fh_d_id, did); | 
|  | 54 | hton24(fh->fh_s_id, sid); | 
|  | 55 | fh->fh_type = type; | 
|  | 56 | hton24(fh->fh_f_ctl, f_ctl); | 
|  | 57 | fh->fh_cs_ctl = 0; | 
|  | 58 | fh->fh_df_ctl = 0; | 
|  | 59 | fh->fh_parm_offset = htonl(parm_offset); | 
|  | 60 | } | 
|  | 61 |  | 
|  | 62 | /** | 
| Joe Eykholt | 370c3bd | 2009-08-25 14:03:47 -0700 | [diff] [blame] | 63 | * fc_adisc_fill() - Fill in adisc request frame | 
|  | 64 | * @lport: local port. | 
|  | 65 | * @fp: fc frame where payload will be placed. | 
|  | 66 | */ | 
|  | 67 | static inline void fc_adisc_fill(struct fc_lport *lport, struct fc_frame *fp) | 
|  | 68 | { | 
|  | 69 | struct fc_els_adisc *adisc; | 
|  | 70 |  | 
|  | 71 | adisc = fc_frame_payload_get(fp, sizeof(*adisc)); | 
|  | 72 | memset(adisc, 0, sizeof(*adisc)); | 
|  | 73 | adisc->adisc_cmd = ELS_ADISC; | 
|  | 74 | put_unaligned_be64(lport->wwpn, &adisc->adisc_wwpn); | 
|  | 75 | put_unaligned_be64(lport->wwnn, &adisc->adisc_wwnn); | 
|  | 76 | hton24(adisc->adisc_port_id, fc_host_port_id(lport->host)); | 
|  | 77 | } | 
|  | 78 |  | 
|  | 79 | /** | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 80 | * fc_ct_hdr_fill- fills ct header and reset ct payload | 
|  | 81 | * returns pointer to ct request. | 
|  | 82 | */ | 
|  | 83 | static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp, | 
|  | 84 | unsigned int op, size_t req_size) | 
|  | 85 | { | 
|  | 86 | struct fc_ct_req *ct; | 
|  | 87 | size_t ct_plen; | 
|  | 88 |  | 
|  | 89 | ct_plen  = sizeof(struct fc_ct_hdr) + req_size; | 
|  | 90 | ct = fc_frame_payload_get(fp, ct_plen); | 
|  | 91 | memset(ct, 0, ct_plen); | 
|  | 92 | ct->hdr.ct_rev = FC_CT_REV; | 
|  | 93 | ct->hdr.ct_fs_type = FC_FST_DIR; | 
|  | 94 | ct->hdr.ct_fs_subtype = FC_NS_SUBTYPE; | 
|  | 95 | ct->hdr.ct_cmd = htons((u16) op); | 
|  | 96 | return ct; | 
|  | 97 | } | 
|  | 98 |  | 
|  | 99 | /** | 
| Joe Eykholt | 2ab7e1e | 2009-08-25 14:03:58 -0700 | [diff] [blame] | 100 | * fc_ct_fill() - Fill in a name service request frame | 
|  | 101 | * @lport: local port. | 
|  | 102 | * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries. | 
|  | 103 | * @fp: frame to contain payload. | 
|  | 104 | * @op: CT opcode. | 
|  | 105 | * @r_ctl: pointer to FC header R_CTL. | 
|  | 106 | * @fh_type: pointer to FC-4 type. | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 107 | */ | 
| Joe Eykholt | a46f327 | 2009-08-25 14:00:55 -0700 | [diff] [blame] | 108 | static inline int fc_ct_fill(struct fc_lport *lport, | 
| Joe Eykholt | 2ab7e1e | 2009-08-25 14:03:58 -0700 | [diff] [blame] | 109 | u32 fc_id, struct fc_frame *fp, | 
| Joe Eykholt | a46f327 | 2009-08-25 14:00:55 -0700 | [diff] [blame] | 110 | unsigned int op, enum fc_rctl *r_ctl, | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 111 | enum fc_fh_type *fh_type) | 
|  | 112 | { | 
|  | 113 | struct fc_ct_req *ct; | 
|  | 114 |  | 
|  | 115 | switch (op) { | 
|  | 116 | case FC_NS_GPN_FT: | 
|  | 117 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_gid_ft)); | 
|  | 118 | ct->payload.gid.fn_fc4_type = FC_TYPE_FCP; | 
|  | 119 | break; | 
|  | 120 |  | 
| Joe Eykholt | 2ab7e1e | 2009-08-25 14:03:58 -0700 | [diff] [blame] | 121 | case FC_NS_GPN_ID: | 
|  | 122 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_fid)); | 
|  | 123 | hton24(ct->payload.fid.fp_fid, fc_id); | 
|  | 124 | break; | 
|  | 125 |  | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 126 | case FC_NS_RFT_ID: | 
|  | 127 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft)); | 
|  | 128 | hton24(ct->payload.rft.fid.fp_fid, | 
|  | 129 | fc_host_port_id(lport->host)); | 
|  | 130 | ct->payload.rft.fts = lport->fcts; | 
|  | 131 | break; | 
|  | 132 |  | 
| Chris Leech | c9c7bd7 | 2009-11-03 11:46:51 -0800 | [diff] [blame] | 133 | case FC_NS_RNN_ID: | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 134 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); | 
|  | 135 | hton24(ct->payload.rn.fr_fid.fp_fid, | 
|  | 136 | fc_host_port_id(lport->host)); | 
|  | 137 | ct->payload.rft.fts = lport->fcts; | 
| Chris Leech | c9c7bd7 | 2009-11-03 11:46:51 -0800 | [diff] [blame] | 138 | put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 139 | break; | 
|  | 140 |  | 
| Chris Leech | c9866a5 | 2009-11-03 11:47:01 -0800 | [diff] [blame] | 141 | case FC_NS_RSPN_ID: | 
|  | 142 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn)); | 
|  | 143 | hton24(ct->payload.spn.fr_fid.fp_fid, | 
|  | 144 | fc_host_port_id(lport->host)); | 
|  | 145 | strncpy(ct->payload.spn.fr_name, | 
|  | 146 | fc_host_symbolic_name(lport->host), 255); | 
|  | 147 | ct->payload.spn.fr_name_len = | 
|  | 148 | strnlen(ct->payload.spn.fr_name, 255); | 
|  | 149 | break; | 
|  | 150 |  | 
| Chris Leech | 5baa17c | 2009-11-03 11:46:56 -0800 | [diff] [blame] | 151 | case FC_NS_RSNN_NN: | 
|  | 152 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rsnn)); | 
|  | 153 | put_unaligned_be64(lport->wwnn, &ct->payload.snn.fr_wwn); | 
|  | 154 | strncpy(ct->payload.snn.fr_name, | 
|  | 155 | fc_host_symbolic_name(lport->host), 255); | 
|  | 156 | ct->payload.snn.fr_name_len = | 
|  | 157 | strnlen(ct->payload.snn.fr_name, 255); | 
|  | 158 | break; | 
|  | 159 |  | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 160 | default: | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 161 | return -EINVAL; | 
|  | 162 | } | 
|  | 163 | *r_ctl = FC_RCTL_DD_UNSOL_CTL; | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 164 | *fh_type = FC_TYPE_CT; | 
|  | 165 | return 0; | 
|  | 166 | } | 
|  | 167 |  | 
|  | 168 | /** | 
|  | 169 | * fc_plogi_fill - Fill in plogi request frame | 
|  | 170 | */ | 
|  | 171 | static inline void fc_plogi_fill(struct fc_lport *lport, struct fc_frame *fp, | 
|  | 172 | unsigned int op) | 
|  | 173 | { | 
|  | 174 | struct fc_els_flogi *plogi; | 
|  | 175 | struct fc_els_csp *csp; | 
|  | 176 | struct fc_els_cssp *cp; | 
|  | 177 |  | 
|  | 178 | plogi = fc_frame_payload_get(fp, sizeof(*plogi)); | 
|  | 179 | memset(plogi, 0, sizeof(*plogi)); | 
|  | 180 | plogi->fl_cmd = (u8) op; | 
|  | 181 | put_unaligned_be64(lport->wwpn, &plogi->fl_wwpn); | 
|  | 182 | put_unaligned_be64(lport->wwnn, &plogi->fl_wwnn); | 
|  | 183 |  | 
|  | 184 | csp = &plogi->fl_csp; | 
|  | 185 | csp->sp_hi_ver = 0x20; | 
|  | 186 | csp->sp_lo_ver = 0x20; | 
|  | 187 | csp->sp_bb_cred = htons(10);	/* this gets set by gateway */ | 
|  | 188 | csp->sp_bb_data = htons((u16) lport->mfs); | 
|  | 189 | cp = &plogi->fl_cssp[3 - 1];	/* class 3 parameters */ | 
|  | 190 | cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ); | 
|  | 191 | csp->sp_features = htons(FC_SP_FT_CIRO); | 
|  | 192 | csp->sp_tot_seq = htons(255);	/* seq. we accept */ | 
|  | 193 | csp->sp_rel_off = htons(0x1f); | 
|  | 194 | csp->sp_e_d_tov = htonl(lport->e_d_tov); | 
|  | 195 |  | 
|  | 196 | cp->cp_rdfs = htons((u16) lport->mfs); | 
|  | 197 | cp->cp_con_seq = htons(255); | 
|  | 198 | cp->cp_open_seq = 1; | 
|  | 199 | } | 
|  | 200 |  | 
|  | 201 | /** | 
|  | 202 | * fc_flogi_fill - Fill in a flogi request frame. | 
|  | 203 | */ | 
|  | 204 | static inline void fc_flogi_fill(struct fc_lport *lport, struct fc_frame *fp) | 
|  | 205 | { | 
|  | 206 | struct fc_els_csp *sp; | 
|  | 207 | struct fc_els_cssp *cp; | 
|  | 208 | struct fc_els_flogi *flogi; | 
|  | 209 |  | 
|  | 210 | flogi = fc_frame_payload_get(fp, sizeof(*flogi)); | 
|  | 211 | memset(flogi, 0, sizeof(*flogi)); | 
|  | 212 | flogi->fl_cmd = (u8) ELS_FLOGI; | 
|  | 213 | put_unaligned_be64(lport->wwpn, &flogi->fl_wwpn); | 
|  | 214 | put_unaligned_be64(lport->wwnn, &flogi->fl_wwnn); | 
|  | 215 | sp = &flogi->fl_csp; | 
|  | 216 | sp->sp_hi_ver = 0x20; | 
|  | 217 | sp->sp_lo_ver = 0x20; | 
|  | 218 | sp->sp_bb_cred = htons(10);	/* this gets set by gateway */ | 
|  | 219 | sp->sp_bb_data = htons((u16) lport->mfs); | 
|  | 220 | cp = &flogi->fl_cssp[3 - 1];	/* class 3 parameters */ | 
|  | 221 | cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ); | 
| Chris Leech | db36c06 | 2009-11-03 11:46:24 -0800 | [diff] [blame] | 222 | if (lport->does_npiv) | 
|  | 223 | sp->sp_features = htons(FC_SP_FT_NPIV); | 
|  | 224 | } | 
|  | 225 |  | 
|  | 226 | /** | 
|  | 227 | * fc_fdisc_fill - Fill in a fdisc request frame. | 
|  | 228 | */ | 
|  | 229 | static inline void fc_fdisc_fill(struct fc_lport *lport, struct fc_frame *fp) | 
|  | 230 | { | 
|  | 231 | struct fc_els_csp *sp; | 
|  | 232 | struct fc_els_cssp *cp; | 
|  | 233 | struct fc_els_flogi *fdisc; | 
|  | 234 |  | 
|  | 235 | fdisc = fc_frame_payload_get(fp, sizeof(*fdisc)); | 
|  | 236 | memset(fdisc, 0, sizeof(*fdisc)); | 
|  | 237 | fdisc->fl_cmd = (u8) ELS_FDISC; | 
|  | 238 | put_unaligned_be64(lport->wwpn, &fdisc->fl_wwpn); | 
|  | 239 | put_unaligned_be64(lport->wwnn, &fdisc->fl_wwnn); | 
|  | 240 | sp = &fdisc->fl_csp; | 
|  | 241 | sp->sp_hi_ver = 0x20; | 
|  | 242 | sp->sp_lo_ver = 0x20; | 
|  | 243 | sp->sp_bb_cred = htons(10);	/* this gets set by gateway */ | 
|  | 244 | sp->sp_bb_data = htons((u16) lport->mfs); | 
|  | 245 | cp = &fdisc->fl_cssp[3 - 1];	/* class 3 parameters */ | 
|  | 246 | cp->cp_class = htons(FC_CPC_VALID | FC_CPC_SEQ); | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 247 | } | 
|  | 248 |  | 
|  | 249 | /** | 
|  | 250 | * fc_logo_fill - Fill in a logo request frame. | 
|  | 251 | */ | 
|  | 252 | static inline void fc_logo_fill(struct fc_lport *lport, struct fc_frame *fp) | 
|  | 253 | { | 
|  | 254 | struct fc_els_logo *logo; | 
|  | 255 |  | 
|  | 256 | logo = fc_frame_payload_get(fp, sizeof(*logo)); | 
|  | 257 | memset(logo, 0, sizeof(*logo)); | 
|  | 258 | logo->fl_cmd = ELS_LOGO; | 
|  | 259 | hton24(logo->fl_n_port_id, fc_host_port_id(lport->host)); | 
|  | 260 | logo->fl_n_port_wwn = htonll(lport->wwpn); | 
|  | 261 | } | 
|  | 262 |  | 
|  | 263 | /** | 
|  | 264 | * fc_rtv_fill - Fill in RTV (read timeout value) request frame. | 
|  | 265 | */ | 
|  | 266 | static inline void fc_rtv_fill(struct fc_lport *lport, struct fc_frame *fp) | 
|  | 267 | { | 
|  | 268 | struct fc_els_rtv *rtv; | 
|  | 269 |  | 
|  | 270 | rtv = fc_frame_payload_get(fp, sizeof(*rtv)); | 
|  | 271 | memset(rtv, 0, sizeof(*rtv)); | 
|  | 272 | rtv->rtv_cmd = ELS_RTV; | 
|  | 273 | } | 
|  | 274 |  | 
|  | 275 | /** | 
|  | 276 | * fc_rec_fill - Fill in rec request frame | 
|  | 277 | */ | 
|  | 278 | static inline void fc_rec_fill(struct fc_lport *lport, struct fc_frame *fp) | 
|  | 279 | { | 
|  | 280 | struct fc_els_rec *rec; | 
|  | 281 | struct fc_exch *ep = fc_seq_exch(fr_seq(fp)); | 
|  | 282 |  | 
|  | 283 | rec = fc_frame_payload_get(fp, sizeof(*rec)); | 
|  | 284 | memset(rec, 0, sizeof(*rec)); | 
|  | 285 | rec->rec_cmd = ELS_REC; | 
|  | 286 | hton24(rec->rec_s_id, fc_host_port_id(lport->host)); | 
|  | 287 | rec->rec_ox_id = htons(ep->oxid); | 
|  | 288 | rec->rec_rx_id = htons(ep->rxid); | 
|  | 289 | } | 
|  | 290 |  | 
|  | 291 | /** | 
|  | 292 | * fc_prli_fill - Fill in prli request frame | 
|  | 293 | */ | 
|  | 294 | static inline void fc_prli_fill(struct fc_lport *lport, struct fc_frame *fp) | 
|  | 295 | { | 
|  | 296 | struct { | 
|  | 297 | struct fc_els_prli prli; | 
|  | 298 | struct fc_els_spp spp; | 
|  | 299 | } *pp; | 
|  | 300 |  | 
|  | 301 | pp = fc_frame_payload_get(fp, sizeof(*pp)); | 
|  | 302 | memset(pp, 0, sizeof(*pp)); | 
|  | 303 | pp->prli.prli_cmd = ELS_PRLI; | 
|  | 304 | pp->prli.prli_spp_len = sizeof(struct fc_els_spp); | 
|  | 305 | pp->prli.prli_len = htons(sizeof(*pp)); | 
|  | 306 | pp->spp.spp_type = FC_TYPE_FCP; | 
|  | 307 | pp->spp.spp_flags = FC_SPP_EST_IMG_PAIR; | 
|  | 308 | pp->spp.spp_params = htonl(lport->service_params); | 
|  | 309 | } | 
|  | 310 |  | 
|  | 311 | /** | 
|  | 312 | * fc_scr_fill - Fill in a scr request frame. | 
|  | 313 | */ | 
|  | 314 | static inline void fc_scr_fill(struct fc_lport *lport, struct fc_frame *fp) | 
|  | 315 | { | 
|  | 316 | struct fc_els_scr *scr; | 
|  | 317 |  | 
|  | 318 | scr = fc_frame_payload_get(fp, sizeof(*scr)); | 
|  | 319 | memset(scr, 0, sizeof(*scr)); | 
|  | 320 | scr->scr_cmd = ELS_SCR; | 
|  | 321 | scr->scr_reg_func = ELS_SCRF_FULL; | 
|  | 322 | } | 
|  | 323 |  | 
|  | 324 | /** | 
|  | 325 | * fc_els_fill - Fill in an ELS  request frame | 
|  | 326 | */ | 
| Joe Eykholt | 9fb9d32 | 2009-08-25 14:00:50 -0700 | [diff] [blame] | 327 | static inline int fc_els_fill(struct fc_lport *lport, | 
| Joe Eykholt | a46f327 | 2009-08-25 14:00:55 -0700 | [diff] [blame] | 328 | u32 did, | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 329 | struct fc_frame *fp, unsigned int op, | 
| Joe Eykholt | a46f327 | 2009-08-25 14:00:55 -0700 | [diff] [blame] | 330 | enum fc_rctl *r_ctl, enum fc_fh_type *fh_type) | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 331 | { | 
|  | 332 | switch (op) { | 
| Joe Eykholt | 370c3bd | 2009-08-25 14:03:47 -0700 | [diff] [blame] | 333 | case ELS_ADISC: | 
|  | 334 | fc_adisc_fill(lport, fp); | 
|  | 335 | break; | 
|  | 336 |  | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 337 | case ELS_PLOGI: | 
|  | 338 | fc_plogi_fill(lport, fp, ELS_PLOGI); | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 339 | break; | 
|  | 340 |  | 
|  | 341 | case ELS_FLOGI: | 
|  | 342 | fc_flogi_fill(lport, fp); | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 343 | break; | 
|  | 344 |  | 
| Chris Leech | db36c06 | 2009-11-03 11:46:24 -0800 | [diff] [blame] | 345 | case ELS_FDISC: | 
|  | 346 | fc_fdisc_fill(lport, fp); | 
|  | 347 | break; | 
|  | 348 |  | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 349 | case ELS_LOGO: | 
|  | 350 | fc_logo_fill(lport, fp); | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 351 | break; | 
|  | 352 |  | 
|  | 353 | case ELS_RTV: | 
|  | 354 | fc_rtv_fill(lport, fp); | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 355 | break; | 
|  | 356 |  | 
|  | 357 | case ELS_REC: | 
|  | 358 | fc_rec_fill(lport, fp); | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 359 | break; | 
|  | 360 |  | 
|  | 361 | case ELS_PRLI: | 
|  | 362 | fc_prli_fill(lport, fp); | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 363 | break; | 
|  | 364 |  | 
|  | 365 | case ELS_SCR: | 
|  | 366 | fc_scr_fill(lport, fp); | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 367 | break; | 
|  | 368 |  | 
|  | 369 | default: | 
| Robert Love | 42e9a92 | 2008-12-09 15:10:17 -0800 | [diff] [blame] | 370 | return -EINVAL; | 
|  | 371 | } | 
|  | 372 |  | 
|  | 373 | *r_ctl = FC_RCTL_ELS_REQ; | 
|  | 374 | *fh_type = FC_TYPE_ELS; | 
|  | 375 | return 0; | 
|  | 376 | } | 
|  | 377 | #endif /* _FC_ENCODE_H_ */ |