static void fc_lport_enter_rft_id(struct fc_lport *lport) { struct fc_frame *fp; struct fc_ns_fts *lps; int i; FC_LPORT_DBG(lport, "Entered RFT_ID state from %s state\n", fc_lport_state(lport)); fc_lport_state_enter(lport, LPORT_ST_RFT_ID); lps = &lport->fcts; i = sizeof(lps->ff_type_map) / sizeof(lps->ff_type_map[0]); while (--i >= 0) if (ntohl(lps->ff_type_map[i]) != 0) break; if (i < 0) { fc_lport_enter_scr(lport); return; } fp = fc_frame_alloc(lport, sizeof(struct fc_ct_hdr) + sizeof(struct fc_ns_rft)); if (!fp) { fc_lport_error(lport, fp); return; } if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RFT_ID, fc_lport_rft_id_resp, lport, lport->e_d_tov)) fc_lport_error(lport, fp); }
/** * fc_rport_enter_flogi() - Send a FLOGI request to the fabric manager * @lport: Fibre Channel local port to be logged in to the fabric * * Locking Note: The lport lock is expected to be held before calling * this routine. */ void fc_lport_enter_flogi(struct fc_lport *lport) { struct fc_frame *fp; FC_LPORT_DBG(lport, "Entered FLOGI state from %s state\n", fc_lport_state(lport)); fc_lport_state_enter(lport, LPORT_ST_FLOGI); if (lport->point_to_multipoint) { if (lport->port_id) fc_lport_enter_ready(lport); return; } fp = fc_frame_alloc(lport, sizeof(struct fc_els_flogi)); if (!fp) return fc_lport_error(lport, fp); if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, lport->vport ? ELS_FDISC : ELS_FLOGI, fc_lport_flogi_resp, lport, lport->vport ? 2 * lport->r_a_tov : lport->e_d_tov)) fc_lport_error(lport, NULL); }
/** * fc_lport_enter_ns() - register some object with the name server * @lport: Fibre Channel local port to register * * Locking Note: The lport lock is expected to be held before calling * this routine. */ static void fc_lport_enter_ns(struct fc_lport *lport, enum fc_lport_state state) { struct fc_frame *fp; enum fc_ns_req cmd; int size = sizeof(struct fc_ct_hdr); size_t len; FC_LPORT_DBG(lport, "Entered %s state from %s state\n", fc_lport_state_names[state], fc_lport_state(lport)); fc_lport_state_enter(lport, state); switch (state) { case LPORT_ST_RNN_ID: cmd = FC_NS_RNN_ID; size += sizeof(struct fc_ns_rn_id); break; case LPORT_ST_RSNN_NN: len = strnlen(fc_host_symbolic_name(lport->host), 255); /* if there is no symbolic name, skip to RFT_ID */ if (!len) return fc_lport_enter_ns(lport, LPORT_ST_RFT_ID); cmd = FC_NS_RSNN_NN; size += sizeof(struct fc_ns_rsnn) + len; break; case LPORT_ST_RSPN_ID: len = strnlen(fc_host_symbolic_name(lport->host), 255); /* if there is no symbolic name, skip to RFT_ID */ if (!len) return fc_lport_enter_ns(lport, LPORT_ST_RFT_ID); cmd = FC_NS_RSPN_ID; size += sizeof(struct fc_ns_rspn) + len; break; case LPORT_ST_RFT_ID: cmd = FC_NS_RFT_ID; size += sizeof(struct fc_ns_rft); break; case LPORT_ST_RFF_ID: cmd = FC_NS_RFF_ID; size += sizeof(struct fc_ns_rff_id); break; default: fc_lport_error(lport, NULL); return; } fp = fc_frame_alloc(lport, size); if (!fp) { fc_lport_error(lport, fp); return; } if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, cmd, fc_lport_ns_resp, lport, 3 * lport->r_a_tov)) fc_lport_error(lport, fp); }
void fc_lport_enter_flogi(struct fc_lport *lport) { struct fc_frame *fp; FC_LPORT_DBG(lport, "Entered FLOGI state from %s state\n", fc_lport_state(lport)); fc_lport_state_enter(lport, LPORT_ST_FLOGI); fp = fc_frame_alloc(lport, sizeof(struct fc_els_flogi)); if (!fp) return fc_lport_error(lport, fp); if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, ELS_FLOGI, fc_lport_flogi_resp, lport, lport->e_d_tov)) fc_lport_error(lport, NULL); }
static void fc_lport_recv_flogi_req(struct fc_lport *lport, struct fc_frame *rx_fp) { struct fc_frame *fp; struct fc_frame_header *fh; struct fc_els_flogi *flp; struct fc_els_flogi *new_flp; u64 remote_wwpn; u32 remote_fid; u32 local_fid; FC_LPORT_DBG(lport, "Received FLOGI request while in state %s\n", fc_lport_state(lport)); remote_fid = fc_frame_sid(rx_fp); flp = fc_frame_payload_get(rx_fp, sizeof(*flp)); if (!flp) goto out; remote_wwpn = get_unaligned_be64(&flp->fl_wwpn); if (remote_wwpn == lport->wwpn) { printk(KERN_WARNING "host%d: libfc: Received FLOGI from port " "with same WWPN %16.16llx\n", lport->host->host_no, remote_wwpn); goto out; } FC_LPORT_DBG(lport, "FLOGI from port WWPN %16.16llx\n", remote_wwpn); local_fid = FC_LOCAL_PTP_FID_LO; if (remote_wwpn < lport->wwpn) { local_fid = FC_LOCAL_PTP_FID_HI; if (!remote_fid || remote_fid == local_fid) remote_fid = FC_LOCAL_PTP_FID_LO; } else if (!remote_fid) { remote_fid = FC_LOCAL_PTP_FID_HI; } fc_lport_set_port_id(lport, local_fid, rx_fp); fp = fc_frame_alloc(lport, sizeof(*flp)); if (fp) { new_flp = fc_frame_payload_get(fp, sizeof(*flp)); fc_lport_flogi_fill(lport, new_flp, ELS_FLOGI); new_flp->fl_cmd = (u8) ELS_LS_ACC; fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0); fh = fc_frame_header_get(fp); hton24(fh->fh_s_id, local_fid); hton24(fh->fh_d_id, remote_fid); lport->tt.frame_send(lport, fp); } else { fc_lport_error(lport, fp); } fc_lport_ptp_setup(lport, remote_fid, remote_wwpn, get_unaligned_be64(&flp->fl_wwnn)); out: fc_frame_free(rx_fp); }
static void fc_lport_enter_scr(struct fc_lport *lport) { struct fc_frame *fp; FC_LPORT_DBG(lport, "Entered SCR state from %s state\n", fc_lport_state(lport)); fc_lport_state_enter(lport, LPORT_ST_SCR); fp = fc_frame_alloc(lport, sizeof(struct fc_els_scr)); if (!fp) { fc_lport_error(lport, fp); return; } if (!lport->tt.elsct_send(lport, FC_FID_FCTRL, fp, ELS_SCR, fc_lport_scr_resp, lport, lport->e_d_tov)) fc_lport_error(lport, NULL); }
static void fc_lport_rpn_id_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg) { struct fc_lport *lport = lp_arg; struct fc_frame_header *fh; struct fc_ct_hdr *ct; FC_LPORT_DBG(lport, "Received a RPN_ID %s\n", fc_els_resp_type(fp)); if (fp == ERR_PTR(-FC_EX_CLOSED)) return; mutex_lock(&lport->lp_mutex); if (lport->state != LPORT_ST_RPN_ID) { FC_LPORT_DBG(lport, "Received a RPN_ID response, but in state " "%s\n", fc_lport_state(lport)); if (IS_ERR(fp)) goto err; goto out; } if (IS_ERR(fp)) { fc_lport_error(lport, fp); goto err; } fh = fc_frame_header_get(fp); ct = fc_frame_payload_get(fp, sizeof(*ct)); if (fh && ct && fh->fh_type == FC_TYPE_CT && ct->ct_fs_type == FC_FST_DIR && ct->ct_fs_subtype == FC_NS_SUBTYPE && ntohs(ct->ct_cmd) == FC_FS_ACC) fc_lport_enter_rft_id(lport); else fc_lport_error(lport, fp); out: fc_frame_free(fp); err: mutex_unlock(&lport->lp_mutex); }
static void fc_lport_enter_logo(struct fc_lport *lport) { struct fc_frame *fp; struct fc_els_logo *logo; FC_LPORT_DBG(lport, "Entered LOGO state from %s state\n", fc_lport_state(lport)); fc_lport_state_enter(lport, LPORT_ST_LOGO); fp = fc_frame_alloc(lport, sizeof(*logo)); if (!fp) { fc_lport_error(lport, fp); return; } if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, ELS_LOGO, fc_lport_logo_resp, lport, lport->e_d_tov)) fc_lport_error(lport, NULL); }
static void fc_lport_enter_rpn_id(struct fc_lport *lport) { struct fc_frame *fp; FC_LPORT_DBG(lport, "Entered RPN_ID state from %s state\n", fc_lport_state(lport)); fc_lport_state_enter(lport, LPORT_ST_RPN_ID); fp = fc_frame_alloc(lport, sizeof(struct fc_ct_hdr) + sizeof(struct fc_ns_rn_id)); if (!fp) { fc_lport_error(lport, fp); return; } if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RPN_ID, fc_lport_rpn_id_resp, lport, lport->e_d_tov)) fc_lport_error(lport, NULL); }
/** * fc_lport_logo_resp() - Handle response to LOGO request * @sp: The sequence that the LOGO was on * @fp: The LOGO frame * @lp_arg: The lport port that received the LOGO request * * Locking Note: This function will be called without the lport lock * held, but it will lock, call an _enter_* function or fc_lport_error() * and then unlock the lport. */ void fc_lport_logo_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg) { struct fc_lport *lport = lp_arg; u8 op; FC_LPORT_DBG(lport, "Received a LOGO %s\n", fc_els_resp_type(fp)); if (fp == ERR_PTR(-FC_EX_CLOSED)) return; mutex_lock(&lport->lp_mutex); if (lport->state != LPORT_ST_LOGO) { FC_LPORT_DBG(lport, "Received a LOGO response, but in state " "%s\n", fc_lport_state(lport)); if (IS_ERR(fp)) goto err; goto out; } if (IS_ERR(fp)) { fc_lport_error(lport, fp); goto err; } op = fc_frame_payload_op(fp); if (op == ELS_LS_ACC) fc_lport_enter_disabled(lport); else fc_lport_error(lport, fp); out: fc_frame_free(fp); err: mutex_unlock(&lport->lp_mutex); }
/** * fc_rport_enter_dns() - Create a fc_rport for the name server * @lport: The local port requesting a remote port for the name server * * Locking Note: The lport lock is expected to be held before calling * this routine. */ static void fc_lport_enter_dns(struct fc_lport *lport) { struct fc_rport_priv *rdata; FC_LPORT_DBG(lport, "Entered DNS state from %s state\n", fc_lport_state(lport)); fc_lport_state_enter(lport, LPORT_ST_DNS); mutex_lock(&lport->disc.disc_mutex); rdata = lport->tt.rport_create(lport, FC_FID_DIR_SERV); mutex_unlock(&lport->disc.disc_mutex); if (!rdata) goto err; rdata->ops = &fc_lport_rport_ops; lport->tt.rport_login(rdata); return; err: fc_lport_error(lport, NULL); }
/** * fc_lport_recv_flogi_req() - Receive a FLOGI request * @lport: The local port that recieved the request * @rx_fp: The FLOGI frame * * A received FLOGI request indicates a point-to-point connection. * Accept it with the common service parameters indicating our N port. * Set up to do a PLOGI if we have the higher-number WWPN. * * Locking Note: The lport lock is expected to be held before calling * this function. */ static void fc_lport_recv_flogi_req(struct fc_lport *lport, struct fc_frame *rx_fp) { struct fc_frame *fp; struct fc_frame_header *fh; struct fc_els_flogi *flp; struct fc_els_flogi *new_flp; u64 remote_wwpn; u32 remote_fid; u32 local_fid; FC_LPORT_DBG(lport, "Received FLOGI request while in state %s\n", fc_lport_state(lport)); remote_fid = fc_frame_sid(rx_fp); flp = fc_frame_payload_get(rx_fp, sizeof(*flp)); if (!flp) goto out; remote_wwpn = get_unaligned_be64(&flp->fl_wwpn); if (remote_wwpn == lport->wwpn) { printk(KERN_WARNING "host%d: libfc: Received FLOGI from port " "with same WWPN %16.16llx\n", lport->host->host_no, remote_wwpn); goto out; } FC_LPORT_DBG(lport, "FLOGI from port WWPN %16.16llx\n", remote_wwpn); /* * XXX what is the right thing to do for FIDs? * The originator might expect our S_ID to be 0xfffffe. * But if so, both of us could end up with the same FID. */ local_fid = FC_LOCAL_PTP_FID_LO; if (remote_wwpn < lport->wwpn) { local_fid = FC_LOCAL_PTP_FID_HI; if (!remote_fid || remote_fid == local_fid) remote_fid = FC_LOCAL_PTP_FID_LO; } else if (!remote_fid) { remote_fid = FC_LOCAL_PTP_FID_HI; } fc_lport_set_port_id(lport, local_fid, rx_fp); fp = fc_frame_alloc(lport, sizeof(*flp)); if (fp) { new_flp = fc_frame_payload_get(fp, sizeof(*flp)); fc_lport_flogi_fill(lport, new_flp, ELS_FLOGI); new_flp->fl_cmd = (u8) ELS_LS_ACC; /* * Send the response. If this fails, the originator should * repeat the sequence. */ fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0); fh = fc_frame_header_get(fp); hton24(fh->fh_s_id, local_fid); hton24(fh->fh_d_id, remote_fid); lport->tt.frame_send(lport, fp); } else { fc_lport_error(lport, fp); } fc_lport_ptp_setup(lport, remote_fid, remote_wwpn, get_unaligned_be64(&flp->fl_wwnn)); out: fc_frame_free(rx_fp); }
/** * fc_lport_flogi_resp() - Handle response to FLOGI request * @sp: The sequence that the FLOGI was on * @fp: The FLOGI response frame * @lp_arg: The lport port that received the FLOGI response * * Locking Note: This function will be called without the lport lock * held, but it will lock, call an _enter_* function or fc_lport_error() * and then unlock the lport. */ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg) { struct fc_lport *lport = lp_arg; struct fc_els_flogi *flp; u32 did; u16 csp_flags; unsigned int r_a_tov; unsigned int e_d_tov; u16 mfs; FC_LPORT_DBG(lport, "Received a FLOGI %s\n", fc_els_resp_type(fp)); if (fp == ERR_PTR(-FC_EX_CLOSED)) return; mutex_lock(&lport->lp_mutex); if (lport->state != LPORT_ST_FLOGI) { FC_LPORT_DBG(lport, "Received a FLOGI response, but in state " "%s\n", fc_lport_state(lport)); if (IS_ERR(fp)) goto err; goto out; } if (IS_ERR(fp)) { fc_lport_error(lport, fp); goto err; } did = fc_frame_did(fp); if (fc_frame_payload_op(fp) == ELS_LS_ACC && did) { flp = fc_frame_payload_get(fp, sizeof(*flp)); if (flp) { mfs = ntohs(flp->fl_csp.sp_bb_data) & FC_SP_BB_DATA_MASK; if (mfs >= FC_SP_MIN_MAX_PAYLOAD && mfs < lport->mfs) lport->mfs = mfs; csp_flags = ntohs(flp->fl_csp.sp_features); r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov); e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov); if (csp_flags & FC_SP_FT_EDTR) e_d_tov /= 1000000; lport->npiv_enabled = !!(csp_flags & FC_SP_FT_NPIV_ACC); if ((csp_flags & FC_SP_FT_FPORT) == 0) { if (e_d_tov > lport->e_d_tov) lport->e_d_tov = e_d_tov; lport->r_a_tov = 2 * e_d_tov; fc_lport_set_port_id(lport, did, fp); printk(KERN_INFO "host%d: libfc: " "Port (%6.6x) entered " "point-to-point mode\n", lport->host->host_no, did); fc_lport_ptp_setup(lport, fc_frame_sid(fp), get_unaligned_be64( &flp->fl_wwpn), get_unaligned_be64( &flp->fl_wwnn)); } else { lport->e_d_tov = e_d_tov; lport->r_a_tov = r_a_tov; fc_host_fabric_name(lport->host) = get_unaligned_be64(&flp->fl_wwnn); fc_lport_set_port_id(lport, did, fp); fc_lport_enter_dns(lport); } } } else { FC_LPORT_DBG(lport, "FLOGI RJT or bad response\n"); fc_lport_error(lport, fp); } out: fc_frame_free(fp); err: mutex_unlock(&lport->lp_mutex); }
/** * fc_lport_ns_resp() - Handle response to a name server * registration exchange * @sp: current sequence in exchange * @fp: response frame * @lp_arg: Fibre Channel host port instance * * Locking Note: This function will be called without the lport lock * held, but it will lock, call an _enter_* function or fc_lport_error() * and then unlock the lport. */ static void fc_lport_ns_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg) { struct fc_lport *lport = lp_arg; struct fc_frame_header *fh; struct fc_ct_hdr *ct; FC_LPORT_DBG(lport, "Received a ns %s\n", fc_els_resp_type(fp)); if (fp == ERR_PTR(-FC_EX_CLOSED)) return; mutex_lock(&lport->lp_mutex); if (lport->state < LPORT_ST_RNN_ID || lport->state > LPORT_ST_RFF_ID) { FC_LPORT_DBG(lport, "Received a name server response, " "but in state %s\n", fc_lport_state(lport)); if (IS_ERR(fp)) goto err; goto out; } if (IS_ERR(fp)) { fc_lport_error(lport, fp); goto err; } fh = fc_frame_header_get(fp); ct = fc_frame_payload_get(fp, sizeof(*ct)); if (fh && ct && fh->fh_type == FC_TYPE_CT && ct->ct_fs_type == FC_FST_DIR && ct->ct_fs_subtype == FC_NS_SUBTYPE && ntohs(ct->ct_cmd) == FC_FS_ACC) switch (lport->state) { case LPORT_ST_RNN_ID: fc_lport_enter_ns(lport, LPORT_ST_RSNN_NN); break; case LPORT_ST_RSNN_NN: fc_lport_enter_ns(lport, LPORT_ST_RSPN_ID); break; case LPORT_ST_RSPN_ID: fc_lport_enter_ns(lport, LPORT_ST_RFT_ID); break; case LPORT_ST_RFT_ID: fc_lport_enter_ns(lport, LPORT_ST_RFF_ID); break; case LPORT_ST_RFF_ID: fc_lport_enter_scr(lport); break; default: /* should have already been caught by state checks */ break; } else fc_lport_error(lport, fp); out: fc_frame_free(fp); err: mutex_unlock(&lport->lp_mutex); }
static void fc_lport_ms_resp(struct fc_seq *sp, struct fc_frame *fp, void *lp_arg) { struct fc_lport *lport = lp_arg; struct fc_frame_header *fh; struct fc_ct_hdr *ct; FC_LPORT_DBG(lport, "Received a ms %s\n", fc_els_resp_type(fp)); if (fp == ERR_PTR(-FC_EX_CLOSED)) return; mutex_lock(&lport->lp_mutex); if (lport->state < LPORT_ST_RHBA || lport->state > LPORT_ST_DPRT) { FC_LPORT_DBG(lport, "Received a management server response, " "but in state %s\n", fc_lport_state(lport)); if (IS_ERR(fp)) goto err; goto out; } if (IS_ERR(fp)) { fc_lport_error(lport, fp); goto err; } fh = fc_frame_header_get(fp); ct = fc_frame_payload_get(fp, sizeof(*ct)); if (fh && ct && fh->fh_type == FC_TYPE_CT && ct->ct_fs_type == FC_FST_MGMT && ct->ct_fs_subtype == FC_FDMI_SUBTYPE) { FC_LPORT_DBG(lport, "Received a management server response, " "reason=%d explain=%d\n", ct->ct_reason, ct->ct_explan); switch (lport->state) { case LPORT_ST_RHBA: if (ntohs(ct->ct_cmd) == FC_FS_ACC) fc_lport_enter_ms(lport, LPORT_ST_RPA); else fc_lport_enter_scr(lport); break; case LPORT_ST_RPA: fc_lport_enter_scr(lport); break; case LPORT_ST_DPRT: fc_lport_enter_ms(lport, LPORT_ST_RHBA); break; case LPORT_ST_DHBA: fc_lport_enter_ms(lport, LPORT_ST_DPRT); break; default: break; } } else { fc_lport_error(lport, fp); } out: fc_frame_free(fp); err: mutex_unlock(&lport->lp_mutex); }
static void fc_lport_recv_flogi_req(struct fc_seq *sp_in, struct fc_frame *rx_fp, struct fc_lport *lport) { struct fc_frame *fp; struct fc_frame_header *fh; struct fc_seq *sp; struct fc_exch *ep; struct fc_els_flogi *flp; struct fc_els_flogi *new_flp; u64 remote_wwpn; u32 remote_fid; u32 local_fid; u32 f_ctl; FC_LPORT_DBG(lport, "Received FLOGI request while in state %s\n", fc_lport_state(lport)); fh = fc_frame_header_get(rx_fp); remote_fid = ntoh24(fh->fh_s_id); flp = fc_frame_payload_get(rx_fp, sizeof(*flp)); if (!flp) goto out; remote_wwpn = get_unaligned_be64(&flp->fl_wwpn); if (remote_wwpn == lport->wwpn) { printk(KERN_WARNING "libfc: Received FLOGI from port " "with same WWPN %llx\n", remote_wwpn); goto out; } FC_LPORT_DBG(lport, "FLOGI from port WWPN %llx\n", remote_wwpn); local_fid = FC_LOCAL_PTP_FID_LO; if (remote_wwpn < lport->wwpn) { local_fid = FC_LOCAL_PTP_FID_HI; if (!remote_fid || remote_fid == local_fid) remote_fid = FC_LOCAL_PTP_FID_LO; } else if (!remote_fid) { remote_fid = FC_LOCAL_PTP_FID_HI; } fc_host_port_id(lport->host) = local_fid; fp = fc_frame_alloc(lport, sizeof(*flp)); if (fp) { sp = lport->tt.seq_start_next(fr_seq(rx_fp)); new_flp = fc_frame_payload_get(fp, sizeof(*flp)); fc_lport_flogi_fill(lport, new_flp, ELS_FLOGI); new_flp->fl_cmd = (u8) ELS_LS_ACC; f_ctl = FC_FC_EX_CTX | FC_FC_LAST_SEQ | FC_FC_END_SEQ; ep = fc_seq_exch(sp); fc_fill_fc_hdr(fp, FC_RCTL_ELS_REP, ep->did, ep->sid, FC_TYPE_ELS, f_ctl, 0); lport->tt.seq_send(lport, sp, fp); } else { fc_lport_error(lport, fp); } fc_lport_ptp_setup(lport, remote_fid, remote_wwpn, get_unaligned_be64(&flp->fl_wwnn)); out: sp = fr_seq(rx_fp); fc_frame_free(rx_fp); }
static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) { struct fc_frame *fp; enum fc_fdmi_req cmd; int size = sizeof(struct fc_ct_hdr); size_t len; int numattrs; FC_LPORT_DBG(lport, "Entered %s state from %s state\n", fc_lport_state_names[state], fc_lport_state(lport)); fc_lport_state_enter(lport, state); switch (state) { case LPORT_ST_RHBA: cmd = FC_FDMI_RHBA; numattrs = 10; len = sizeof(struct fc_fdmi_rhba); len -= sizeof(struct fc_fdmi_attr_entry); len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN); len += FC_FDMI_HBA_ATTR_NODENAME_LEN; len += FC_FDMI_HBA_ATTR_MANUFACTURER_LEN; len += FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN; len += FC_FDMI_HBA_ATTR_MODEL_LEN; len += FC_FDMI_HBA_ATTR_MODELDESCR_LEN; len += FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN; len += FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN; len += FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN; len += FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN; len += FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN; size += len; break; case LPORT_ST_RPA: cmd = FC_FDMI_RPA; numattrs = 6; len = sizeof(struct fc_fdmi_rpa); len -= sizeof(struct fc_fdmi_attr_entry); len += (numattrs * FC_FDMI_ATTR_ENTRY_HEADER_LEN); len += FC_FDMI_PORT_ATTR_FC4TYPES_LEN; len += FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN; len += FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN; len += FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN; len += FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN; len += FC_FDMI_PORT_ATTR_HOSTNAME_LEN; size += len; break; case LPORT_ST_DPRT: cmd = FC_FDMI_DPRT; len = sizeof(struct fc_fdmi_dprt); size += len; break; case LPORT_ST_DHBA: cmd = FC_FDMI_DHBA; len = sizeof(struct fc_fdmi_dhba); size += len; break; default: fc_lport_error(lport, NULL); return; } FC_LPORT_DBG(lport, "Cmd=0x%x Len %d size %d\n", cmd, (int)len, size); fp = fc_frame_alloc(lport, size); if (!fp) { fc_lport_error(lport, fp); return; } if (!lport->tt.elsct_send(lport, FC_FID_MGMT_SERV, fp, cmd, fc_lport_ms_resp, lport, 3 * lport->r_a_tov)) fc_lport_error(lport, fp); }