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