/** * fc_adisc_fill() - Fill in adisc request frame * @lport: local port. * @fp: fc frame where payload will be placed.
*/ staticinlinevoid fc_adisc_fill(struct fc_lport *lport, struct fc_frame *fp)
{ struct fc_els_adisc *adisc;
copied = strscpy(entry->value, in, len); if (copied > 0 && copied + 1 < len)
memset(entry->value + copied + 1, 0, len - copied - 1);
}
/** * fc_ct_ms_fill() - Fill in a mgmt service request frame * @lport: local port. * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries. * @fp: frame to contain payload. * @op: CT opcode. * @r_ctl: pointer to FC header R_CTL. * @fh_type: pointer to FC-4 type.
*/ staticinlineint fc_ct_ms_fill(struct fc_lport *lport,
u32 fc_id, struct fc_frame *fp, unsignedint op, enum fc_rctl *r_ctl, enum fc_fh_type *fh_type)
{ struct fc_ct_req *ct;
size_t len; struct fc_fdmi_attr_entry *entry; struct fs_fdmi_attrs *hba_attrs; int numattrs = 0; struct fc_host_attrs *fc_host = shost_to_fc_host(lport->host);
switch (op) { case FC_FDMI_RHBA:
numattrs = 11;
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;
len += FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN;
if (fc_host->fdmi_version == FDMI_V2) {
numattrs += 7;
len += FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN;
len += FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN;
len += FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN;
len += FC_FDMI_HBA_ATTR_FABRICNAME_LEN;
len += FC_FDMI_HBA_ATTR_BIOSVERSION_LEN;
len += FC_FDMI_HBA_ATTR_BIOSSTATE_LEN;
len += FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN;
}
break; case 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;
if (fc_host->fdmi_version == FDMI_V2) {
numattrs += 10;
len += FC_FDMI_PORT_ATTR_NODENAME_LEN;
len += FC_FDMI_PORT_ATTR_PORTNAME_LEN;
len += FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN;
len += FC_FDMI_PORT_ATTR_PORTTYPE_LEN;
len += FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN;
len += FC_FDMI_PORT_ATTR_FABRICNAME_LEN;
len += FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN;
len += FC_FDMI_PORT_ATTR_PORTSTATE_LEN;
len += FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN;
len += FC_FDMI_PORT_ATTR_PORTID_LEN;
/* Current Port Speed */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_CURRENTPORTSPEED,
&entry->type);
put_unaligned_be16(len, &entry->len);
put_unaligned_be32(lport->link_speed,
&entry->value);
/* Max Frame Size */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_MAXFRAMESIZE,
&entry->type);
put_unaligned_be16(len, &entry->len);
put_unaligned_be32(fc_host_maxframe_size(lport->host),
&entry->value);
/* OS Device Name */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_OSDEVICENAME,
&entry->type);
put_unaligned_be16(len, &entry->len); /* Use the sysfs device name */
fc_ct_ms_fill_attr(entry,
dev_name(&lport->host->shost_gendev),
strnlen(dev_name(&lport->host->shost_gendev),
FC_FDMI_PORT_ATTR_HOSTNAME_LEN));
/* Host Name */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_HOSTNAME_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_HOSTNAME,
&entry->type);
put_unaligned_be16(len, &entry->len); if (strlen(fc_host_system_hostname(lport->host)))
fc_ct_ms_fill_attr(entry,
fc_host_system_hostname(lport->host),
strnlen(fc_host_system_hostname(lport->host),
FC_FDMI_PORT_ATTR_HOSTNAME_LEN)); else
fc_ct_ms_fill_attr(entry,
init_utsname()->nodename,
FC_FDMI_PORT_ATTR_HOSTNAME_LEN);
if (fc_host->fdmi_version == FDMI_V2) {
/* Node name */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_HOSTNAME_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_NODENAME_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_NODENAME,
&entry->type);
put_unaligned_be16(len, &entry->len);
put_unaligned_be64(fc_host_node_name(lport->host),
&entry->value);
/* Port name */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_NODENAME_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_PORTNAME_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_PORTNAME,
&entry->type);
put_unaligned_be16(len, &entry->len);
put_unaligned_be64(lport->wwpn,
&entry->value);
/* Port symbolic name */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_PORTNAME_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_SYMBOLICNAME,
&entry->type);
put_unaligned_be16(len, &entry->len);
fc_ct_ms_fill_attr(entry,
fc_host_symbolic_name(lport->host),
FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN);
/* Port type */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_PORTTYPE_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_PORTTYPE,
&entry->type);
put_unaligned_be16(len, &entry->len);
put_unaligned_be32(fc_host_port_type(lport->host),
&entry->value);
/* Supported class of service */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_PORTTYPE_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC,
&entry->type);
put_unaligned_be16(len, &entry->len);
put_unaligned_be32(fc_host_supported_classes(lport->host),
&entry->value);
/* Port Fabric name */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_FABRICNAME_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_FABRICNAME,
&entry->type);
put_unaligned_be16(len, &entry->len);
put_unaligned_be64(fc_host_fabric_name(lport->host),
&entry->value);
/* Port active FC-4 */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_FABRICNAME_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_CURRENTFC4TYPE,
&entry->type);
put_unaligned_be16(len, &entry->len);
memcpy(&entry->value, fc_host_active_fc4s(lport->host),
FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN);
/* Port state */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_PORTSTATE_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_PORTSTATE,
&entry->type);
put_unaligned_be16(len, &entry->len);
put_unaligned_be32(fc_host_port_state(lport->host),
&entry->value);
/* Port ID */
entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN);
len = FC_FDMI_ATTR_ENTRY_HEADER_LEN;
len += FC_FDMI_PORT_ATTR_PORTID_LEN;
put_unaligned_be16(FC_FDMI_PORT_ATTR_PORTID,
&entry->type);
put_unaligned_be16(len, &entry->len);
put_unaligned_be32(fc_host_port_id(lport->host),
&entry->value);
}
break; case FC_FDMI_DPRT:
len = sizeof(struct fc_fdmi_dprt);
ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT,
FC_FDMI_SUBTYPE); /* Port Name */
put_unaligned_be64(lport->wwpn,
&ct->payload.dprt.port.portname); break; case FC_FDMI_DHBA:
len = sizeof(struct fc_fdmi_dhba);
ct = fc_ct_hdr_fill(fp, op, len, FC_FST_MGMT,
FC_FDMI_SUBTYPE); /* HBA Identifier */
put_unaligned_be64(lport->wwpn, &ct->payload.dhba.hbaid.id); break; default: return -EINVAL;
}
*r_ctl = FC_RCTL_DD_UNSOL_CTL;
*fh_type = FC_TYPE_CT; return 0;
}
/** * fc_ct_fill() - Fill in a common transport service request frame * @lport: local port. * @fc_id: FC_ID of non-destination rport for GPN_ID and similar inquiries. * @fp: frame to contain payload. * @op: CT opcode. * @r_ctl: pointer to FC header R_CTL. * @fh_type: pointer to FC-4 type.
*/ staticinlineint fc_ct_fill(struct fc_lport *lport,
u32 fc_id, struct fc_frame *fp, unsignedint op, enum fc_rctl *r_ctl, enum fc_fh_type *fh_type, u32 *did)
{ int rc = -EINVAL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.