scsi: FDMI enhancement
Javed Hasan
maintainercover scsi: FDMI enhancement
This series has FDMI enhancement code.
FDMI V2 attributes added for RHBA and RPA.
If registration get failed with FDMI V1 attributes, than fall back to the registration with FDMI V2 attributes.
Kindly apply this series to scsi-queue at your earliest convenience.
Javed Hasan (4):
include:scsi: FDMI enhancement include:scsi:fc: FDMI enhancement scsi:libfc: FDMI enhancement.
scsi:qedf: Added attributes for RHBA and RPA
drivers/scsi/libfc/fc_lport.c | 64 +++++++- drivers/scsi/qedf/qedf_main.c | 11 ++ include/scsi/fc/fc_ms.h | 59 ++++++-- include/scsi/fc_encode.h | 249 ++++++++++++++++++++++++++++++- include/scsi/scsi_transport_fc.h | 25 +++- 5 files changed, 389 insertions(+), 19 deletions(-)
Signature · 1 line
2.18.2
Javed Hasan
maintainerPATCH 1/4 include:scsi: FDMI enhancement
All the attributes added for RHBA and RPA registration. Fall back mechanism is added in between RBHA V2 and RHBA V1 attributes. In case RHBA get failed for RBHA V2 attributes, then we fall back to RHBA V1 attributes registration.
--- include/scsi/fc_encode.h | 249 ++++++++++++++++++++++++++++++- include/scsi/scsi_transport_fc.h | 25 +++- 2 files changed, 270 insertions(+), 4 deletions(-)
include/scsi/fc_encode.h +246 -3
@@ -210,10 +210,11 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,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 =10 ; + numattrs =11 ; len =sizeof (struct fc_fdmi_rhba ); len -=sizeof (struct fc_fdmi_attr_entry ); len += (numattrs *FC_FDMI_ATTR_ENTRY_HEADER_LEN );
@@ -227,8 +228,21 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, 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 ; + } + ct =fc_ct_hdr_fill (fp, op, len,FC_FST_MGMT , -FC_FDMI_SUBTYPE ); +FC_FDMI_SUBTYPE );/* HBA Identifier */ put_unaligned_be64 (lport->wwpn, &ct->payload.rhba.hbaid.id);
@@ -333,7 +347,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, &entry->type);put_unaligned_be16 (len, &entry->len);strncpy ((char *)&entry->value, -fc_host_optionrom_version (lport->host), +"unknown" ,FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN );/* Firmware Version */
@@ -361,6 +375,100 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,"%s v%s" ,init_utsname ()->sysname, init_utsname()->release); + +/* Max CT payload */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_MAXCTPAYLOAD , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be32 (fc_host_max_ct_payload (lport->host), + &entry->value); + +if (fc_host->fdmi_version ==FDMI_V2 ) { +/* Node symbolic name */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_NODESYMBLNAME , + &entry->type); +put_unaligned_be16 (len, &entry->len); +strncpy ((char *)&entry->value, +fc_host_symbolic_name (lport->host), +FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN ); + +/* Vendor specific info */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be32 (fc_host_num_ports (lport->host), + &entry->value); + +/* Number of ports */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_NUMBEROFPORTS , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be32 (fc_host_num_ports (lport->host), + &entry->value); + +/* Fabric name */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_FABRICNAME_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_FABRICNAME , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be64 (fc_host_fabric_name (lport->host), + &entry->value); + +/* BIOS version */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_FABRICNAME_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_BIOSVERSION_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_BIOSVERSION , + &entry->type); +put_unaligned_be16 (len, &entry->len); +strncpy ((char *)&entry->value, +fc_host_bootbios_version (lport->host), +FC_FDMI_HBA_ATTR_BIOSVERSION_LEN ); + +/* BIOS state */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_BIOSVERSION_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_BIOSSTATE_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_BIOSSTATE , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be32 (fc_host_bootbios_state (lport->host), + &entry->value); + +/* Vendor identifier */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_BIOSSTATE_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_VENDORIDENTIFIER , + &entry->type); +put_unaligned_be16 (len, &entry->len); +strncpy ((char *)&entry->value, +fc_host_vendor_identifier (lport->host), +FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN ); + } +break ;case FC_FDMI_RPA : numattrs =6 ;
@@ -373,6 +481,25 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, 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 ; +//Port name already added in RPA1 + 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 ; + + } + ct =fc_ct_hdr_fill (fp, op, len,FC_FST_MGMT ,FC_FDMI_SUBTYPE );
@@ -461,6 +588,122 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,strncpy ((char *)&entry->value,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); +strncpy ((char *)&entry->value, +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); + +/* Discovered ports */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_PORT_ATTR_PORTSTATE_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN ; +put_unaligned_be16 (FC_FDMI_PORT_ATTR_DISCOVEREDPORTS , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be32 (fc_host_num_discovered_ports (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 );
include/scsi/scsi_transport_fc.h +24 -1
@@ -482,10 +482,11 @@ enum fc_host_event_code {* managed by the transport w/o driver interaction. */ +#define FC_VENDOR_IDENTIFIER 8#define FC_FC4_LIST_SIZE 32#define FC_SYMBOLIC_NAME_SIZE 256#define FC_VERSION_STRING_SIZE 64 -#define FC_SERIAL_NUMBER_SIZE 80 +#define FC_SERIAL_NUMBER_SIZE 64struct fc_host_attrs {/* Fixed Attributes */
@@ -497,6 +498,10 @@ struct fc_host_attrs {u32 supported_speeds;u32 maxframe_size;u16 max_npiv_vports; +u32 max_ct_payload; +u32 num_ports; +u32 num_discovered_ports; +u32 bootbios_state;char serial_number[FC_SERIAL_NUMBER_SIZE ];char manufacturer[FC_SERIAL_NUMBER_SIZE ];char model[FC_SYMBOLIC_NAME_SIZE ];
@@ -505,6 +510,9 @@ struct fc_host_attrs {char driver_version[FC_VERSION_STRING_SIZE ];char firmware_version[FC_VERSION_STRING_SIZE ];char optionrom_version[FC_VERSION_STRING_SIZE ]; +char vendor_identifier[FC_VENDOR_IDENTIFIER ]; +char bootbios_version[FC_SYMBOLIC_NAME_SIZE ]; +/* Dynamic Attributes */ u32 port_id;
@@ -537,6 +545,9 @@ struct fc_host_attrs {/* bsg support */ struct request_queue *rqst_q; + +/* FDMI support version*/ +u8 fdmi_version; };#define shost_to_fc_host (x) \
@@ -616,6 +627,18 @@ struct fc_host_attrs { (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q)#define fc_host_dev_loss_tmo (x) \ (((struct fc_host_attrs *)(x)->shost_data)->dev_loss_tmo) +#define fc_host_max_ct_payload (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->max_ct_payload) +#define fc_host_vendor_identifier (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->vendor_identifier) +#define fc_host_num_discovered_ports (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->num_discovered_ports) +#define fc_host_num_ports (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->num_ports) +#define fc_host_bootbios_version (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->bootbios_version) +#define fc_host_bootbios_state (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->bootbios_state)/* The functions by which the transport class and the driver communicate */ struct fc_function_template {
Signature · 1 line
2.18.2
Re: [PATCH 1/4] include:scsi: FDMI enhancement
Quoted 167 lines · Javed Hasan
All the attributes added for RHBA and RPA registration. Fall back mechanism is added in between RBHA V2 and RHBA V1 attributes. In case RHBA get failed for RBHA V2 attributes, then we fall back to RHBA V1 attributes registration.
Signed-off-by Javed Hasan <[email protected]>---
include/scsi/fc_encode.h| 249 ++++++++++++++++++++++++++++++-include/scsi/scsi_transport_fc.h| 25 +++-2 files changed, 270 insertions(+), 4 deletions(-)include/scsi/fc_encode.h +111
-3@@ -210,10 +210,11 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,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 =10 ; + numattrs =11 ; len =sizeof (struct fc_fdmi_rhba ); len -=sizeof (struct fc_fdmi_attr_entry ); len += (numattrs *FC_FDMI_ATTR_ENTRY_HEADER_LEN );@@ -227,8 +228,21 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, 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 ; + } + ct =fc_ct_hdr_fill (fp, op, len,FC_FST_MGMT , -FC_FDMI_SUBTYPE ); +FC_FDMI_SUBTYPE );/* HBA Identifier */ put_unaligned_be64 (lport->wwpn, &ct->payload.rhba.hbaid.id);@@ -333,7 +347,7 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, &entry->type);put_unaligned_be16 (len, &entry->len);strncpy ((char *)&entry->value, -fc_host_optionrom_version (lport->host), +"unknown" ,FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN );/* Firmware Version */ @@ -361,6 +375,100 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,"%s v%s" ,init_utsname ()->sysname, init_utsname()->release); + +/* Max CT payload */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_MAXCTPAYLOAD , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be32 (fc_host_max_ct_payload (lport->host), + &entry->value); + +if (fc_host->fdmi_version ==FDMI_V2 ) { +/* Node symbolic name */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_NODESYMBLNAME , + &entry->type); +put_unaligned_be16 (len, &entry->len); +strncpy ((char *)&entry->value, +fc_host_symbolic_name (lport->host), +FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN ); + +/* Vendor specific info */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be32 (fc_host_num_ports (lport->host), + &entry->value); + +/* Number of ports */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_NUMBEROFPORTS , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be32 (fc_host_num_ports (lport->host), + &entry->value); + +/* Fabric name */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_FABRICNAME_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_FABRICNAME , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be64 (fc_host_fabric_name (lport->host), + &entry->value); + +/* BIOS version */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_FABRICNAME_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_BIOSVERSION_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_BIOSVERSION , + &entry->type); +put_unaligned_be16 (len, &entry->len); +strncpy ((char *)&entry->value, +fc_host_bootbios_version (lport->host), +FC_FDMI_HBA_ATTR_BIOSVERSION_LEN ); + +/* BIOS state */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_BIOSVERSION_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_BIOSSTATE_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_BIOSSTATE , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be32 (fc_host_bootbios_state (lport->host), + &entry->value); + +/* Vendor identifier */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_HBA_ATTR_BIOSSTATE_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN ; +put_unaligned_be16 (FC_FDMI_HBA_ATTR_VENDORIDENTIFIER , + &entry->type); +put_unaligned_be16 (len, &entry->len); +strncpy ((char *)&entry->value, +fc_host_vendor_identifier (lport->host), +FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN ); + } +break ;case FC_FDMI_RPA : numattrs =6 ;
include/scsi/fc_encode.h static inline int fc_ct_ms_fill(struct fc_lport *lport, · line 490
Quoted 10 lines
include/scsi/fc_encode.h +7
-0@@ -373,6 +481,25 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport, 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 ; +//Port name already added in RPA1
Fix incorrect comment style.
Quoted 208 lines
include/scsi/fc_encode.h +128
-0+ 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 ; + + } + ct =fc_ct_hdr_fill (fp, op, len,FC_FST_MGMT ,FC_FDMI_SUBTYPE );@@ -461,6 +588,122 @@ static inline int fc_ct_ms_fill(struct fc_lport *lport,strncpy ((char *)&entry->value,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); +strncpy ((char *)&entry->value, +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); + +/* Discovered ports */ + entry = (struct fc_fdmi_attr_entry *)((char *)entry->value + +FC_FDMI_PORT_ATTR_PORTSTATE_LEN ); + len =FC_FDMI_ATTR_ENTRY_HEADER_LEN ; + len +=FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN ; +put_unaligned_be16 (FC_FDMI_PORT_ATTR_DISCOVEREDPORTS , + &entry->type); +put_unaligned_be16 (len, &entry->len); +put_unaligned_be32 (fc_host_num_discovered_ports (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 );include/scsi/scsi_transport_fc.h +24
-1@@ -482,10 +482,11 @@ enum fc_host_event_code {* managed by the transport w/o driver interaction. */ +#define FC_VENDOR_IDENTIFIER 8#define FC_FC4_LIST_SIZE 32#define FC_SYMBOLIC_NAME_SIZE 256#define FC_VERSION_STRING_SIZE 64 -#define FC_SERIAL_NUMBER_SIZE 80 +#define FC_SERIAL_NUMBER_SIZE 64struct fc_host_attrs {/* Fixed Attributes */ @@ -497,6 +498,10 @@ struct fc_host_attrs {u32 supported_speeds;u32 maxframe_size;u16 max_npiv_vports; +u32 max_ct_payload; +u32 num_ports; +u32 num_discovered_ports; +u32 bootbios_state;char serial_number[FC_SERIAL_NUMBER_SIZE ];char manufacturer[FC_SERIAL_NUMBER_SIZE ];char model[FC_SYMBOLIC_NAME_SIZE ];@@ -505,6 +510,9 @@ struct fc_host_attrs {char driver_version[FC_VERSION_STRING_SIZE ];char firmware_version[FC_VERSION_STRING_SIZE ];char optionrom_version[FC_VERSION_STRING_SIZE ]; +char vendor_identifier[FC_VENDOR_IDENTIFIER ]; +char bootbios_version[FC_SYMBOLIC_NAME_SIZE ]; +/* Dynamic Attributes */ u32 port_id;@@ -537,6 +545,9 @@ struct fc_host_attrs {/* bsg support */ struct request_queue *rqst_q; + +/* FDMI support version*/ +u8 fdmi_version; };#define shost_to_fc_host (x) \@@ -616,6 +627,18 @@ struct fc_host_attrs { (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q)#define fc_host_dev_loss_tmo (x) \ (((struct fc_host_attrs *)(x)->shost_data)->dev_loss_tmo) +#define fc_host_max_ct_payload (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->max_ct_payload) +#define fc_host_vendor_identifier (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->vendor_identifier) +#define fc_host_num_discovered_ports (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->num_discovered_ports) +#define fc_host_num_ports (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->num_ports) +#define fc_host_bootbios_version (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->bootbios_version) +#define fc_host_bootbios_state (x) \ + (((struct fc_host_attrs *)(x)->shost_data)->bootbios_state)/* The functions by which the transport class and the driver communicate */ struct fc_function_template {Signature · 1 line
2.18.2
Other than the incorrect comment style this patch looks good.
You can add my R-B once you have addressed the comment.
--
Himanshu Madhani Oracle Linux Engineering
Javed Hasan
maintainerPATCH 2/4 include:scsi:fc: FDMI enhancement
In reply to Javed HasanAll the attributes added for RHBA and RPA registration. Fall back mechanism is added in between RBHA V2 and RHBA V1 attributes. In case RHBA get failed for RBHA V2 attributes, then we fall back to RHBA V1 attributes registration.
--- include/scsi/fc/fc_ms.h | 59 ++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 9 deletions(-)
include/scsi/fc/fc_ms.h +50 -9
@@ -24,6 +24,12 @@*/ #define FC_FDMI_SUBTYPE 0x10/* fs_ct_hdr.ct_fs_subtype */ +/* +* Management server FDMI specifications. +*/ +#define FDMI_V1 1/* FDMI version 1 specifications */ +#define FDMI_V2 2/* FDMI version 2 specifications */ +/* * Management server FDMI Requests. */
@@ -57,22 +63,36 @@ enum fc_fdmi_hba_attr_type {FC_FDMI_HBA_ATTR_FIRMWAREVERSION =0x0009 ,FC_FDMI_HBA_ATTR_OSNAMEVERSION =0x000A ,FC_FDMI_HBA_ATTR_MAXCTPAYLOAD =0x000B , +FC_FDMI_HBA_ATTR_NODESYMBLNAME =0x000C , +FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO =0x000D , +FC_FDMI_HBA_ATTR_NUMBEROFPORTS =0x000E , +FC_FDMI_HBA_ATTR_FABRICNAME =0x000F , +FC_FDMI_HBA_ATTR_BIOSVERSION =0x0010 , +FC_FDMI_HBA_ATTR_BIOSSTATE =0x0011 , + FC_FDMI_HBA_ATTR_VENDORIDENTIFIER = 0x00E0, };/* * HBA Attribute Length */ #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 -#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 80 -#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 80 -#define FC_FDMI_HBA_ATTR_MODEL_LEN 256 -#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256 -#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 256 +#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 +#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64 +#define FC_FDMI_HBA_ATTR_MODEL_LEN 100 +#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 100 +#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 100#define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN 4 +#define FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN 100 +#define FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN 4 +#define FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN 4 +#define FC_FDMI_HBA_ATTR_FABRICNAME_LEN 8 +#define FC_FDMI_HBA_ATTR_BIOSVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_BIOSSTATE_LEN 4 +#define FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN 8/* * Port Attribute Type
@@ -84,6 +104,16 @@ enum fc_fdmi_port_attr_type {FC_FDMI_PORT_ATTR_MAXFRAMESIZE =0x0004 ,FC_FDMI_PORT_ATTR_OSDEVICENAME =0x0005 ,FC_FDMI_PORT_ATTR_HOSTNAME =0x0006 , +FC_FDMI_PORT_ATTR_NODENAME =0x0007 , +FC_FDMI_PORT_ATTR_PORTNAME =0x0008 , +FC_FDMI_PORT_ATTR_SYMBOLICNAME =0x0009 , +FC_FDMI_PORT_ATTR_PORTTYPE =0x000A , +FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC =0x000B , +FC_FDMI_PORT_ATTR_FABRICNAME =0x000C , +FC_FDMI_PORT_ATTR_CURRENTFC4TYPE =0x000D , +FC_FDMI_PORT_ATTR_PORTSTATE =0x101 , +FC_FDMI_PORT_ATTR_DISCOVEREDPORTS =0x102 , + FC_FDMI_PORT_ATTR_PORTID = 0x103, };/*
@@ -95,6 +125,17 @@ enum fc_fdmi_port_attr_type {#define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN 4#define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN 256#define FC_FDMI_PORT_ATTR_HOSTNAME_LEN 256 +#define FC_FDMI_PORT_ATTR_NODENAME_LEN 8 +#define FC_FDMI_PORT_ATTR_PORTNAME_LEN 8 +#define FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN 256 +#define FC_FDMI_PORT_ATTR_PORTTYPE_LEN 4 +#define FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN 4 +#define FC_FDMI_PORT_ATTR_FABRICNAME_LEN 8 +#define FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN 32 +#define FC_FDMI_PORT_ATTR_PORTSTATE_LEN 4 +#define FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN 4 +#define FC_FDMI_PORT_ATTR_PORTID_LEN 4 +/* * HBA Attribute ID
Signature · 1 line
2.18.2
Re: [PATCH 2/4] include:scsi:fc: FDMI enhancement
Quoted 50 lines · Javed Hasan
All the attributes added for RHBA and RPA registration. Fall back mechanism is added in between RBHA V2 and RHBA V1 attributes. In case RHBA get failed for RBHA V2 attributes, then we fall back to RHBA V1 attributes registration.
Signed-off-by Javed Hasan <[email protected]>---
include/scsi/fc/fc_ms.h| 59 ++++++++++++++++++++++++++++++++++-------1 file changed, 50 insertions(+), 9 deletions(-)include/scsi/fc/fc_ms.h +13
-1@@ -24,6 +24,12 @@*/ #define FC_FDMI_SUBTYPE 0x10/* fs_ct_hdr.ct_fs_subtype */ +/* +* Management server FDMI specifications. +*/ +#define FDMI_V1 1/* FDMI version 1 specifications */ +#define FDMI_V2 2/* FDMI version 2 specifications */ +/* * Management server FDMI Requests. */ @@ -57,22 +63,36 @@ enum fc_fdmi_hba_attr_type {FC_FDMI_HBA_ATTR_FIRMWAREVERSION =0x0009 ,FC_FDMI_HBA_ATTR_OSNAMEVERSION =0x000A ,FC_FDMI_HBA_ATTR_MAXCTPAYLOAD =0x000B , +FC_FDMI_HBA_ATTR_NODESYMBLNAME =0x000C , +FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO =0x000D , +FC_FDMI_HBA_ATTR_NUMBEROFPORTS =0x000E , +FC_FDMI_HBA_ATTR_FABRICNAME =0x000F , +FC_FDMI_HBA_ATTR_BIOSVERSION =0x0010 , +FC_FDMI_HBA_ATTR_BIOSSTATE =0x0011 , + FC_FDMI_HBA_ATTR_VENDORIDENTIFIER = 0x00E0, };/* * HBA Attribute Length */ #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 -#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 80
include/scsi/fc/fc_ms.h enum fc_fdmi_hba_attr_type { · line 80
Quoted 10 lines
include/scsi/fc/fc_ms.h +2
-8-#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 80 -#define FC_FDMI_HBA_ATTR_MODEL_LEN 256 -#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256 -#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 256 +#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 +#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64
These below value of 100 seems odd. How did you decided on this value?
Quoted 56 lines
include/scsi/fc/fc_ms.h +35
-0+#define FC_FDMI_HBA_ATTR_MODEL_LEN 100 +#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 100 +#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 100#define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN 4 +#define FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN 100 +#define FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN 4 +#define FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN 4 +#define FC_FDMI_HBA_ATTR_FABRICNAME_LEN 8 +#define FC_FDMI_HBA_ATTR_BIOSVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_BIOSSTATE_LEN 4 +#define FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN 8/* * Port Attribute Type @@ -84,6 +104,16 @@ enum fc_fdmi_port_attr_type {FC_FDMI_PORT_ATTR_MAXFRAMESIZE =0x0004 ,FC_FDMI_PORT_ATTR_OSDEVICENAME =0x0005 ,FC_FDMI_PORT_ATTR_HOSTNAME =0x0006 , +FC_FDMI_PORT_ATTR_NODENAME =0x0007 , +FC_FDMI_PORT_ATTR_PORTNAME =0x0008 , +FC_FDMI_PORT_ATTR_SYMBOLICNAME =0x0009 , +FC_FDMI_PORT_ATTR_PORTTYPE =0x000A , +FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC =0x000B , +FC_FDMI_PORT_ATTR_FABRICNAME =0x000C , +FC_FDMI_PORT_ATTR_CURRENTFC4TYPE =0x000D , +FC_FDMI_PORT_ATTR_PORTSTATE =0x101 , +FC_FDMI_PORT_ATTR_DISCOVEREDPORTS =0x102 , + FC_FDMI_PORT_ATTR_PORTID = 0x103, };/* @@ -95,6 +125,17 @@ enum fc_fdmi_port_attr_type {#define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN 4#define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN 256#define FC_FDMI_PORT_ATTR_HOSTNAME_LEN 256 +#define FC_FDMI_PORT_ATTR_NODENAME_LEN 8 +#define FC_FDMI_PORT_ATTR_PORTNAME_LEN 8 +#define FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN 256 +#define FC_FDMI_PORT_ATTR_PORTTYPE_LEN 4 +#define FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN 4 +#define FC_FDMI_PORT_ATTR_FABRICNAME_LEN 8 +#define FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN 32 +#define FC_FDMI_PORT_ATTR_PORTSTATE_LEN 4 +#define FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN 4 +#define FC_FDMI_PORT_ATTR_PORTID_LEN 4 +/* * HBA Attribute ID Signature · 1 line
2.18.2
--
Himanshu Madhani Oracle Linux Engineering
Javed Hasan
maintainerRE: [EXT] Re: [PATCH 2/4] include:scsi:fc: FDMI enhancement
Hello Himanshu,
Please find my response inline.
-----Original Message-----
From: Himanshu Madhani <[email protected]>
Sent: Monday, October 19, 2020 8:57 PM
To: Javed Hasan <[email protected]>
Cc: Martin K . Petersen <[email protected]>; [email protected]; GR-QLogic-Storage-Upstream <[email protected]>
Subject: [EXT] Re: [PATCH 2/4] include:scsi:fc: FDMI enhancement
External Email
----------------------------------------------------------------------
Quoted 47 lines · Javed Hasan
All the attributes added for RHBA and RPA registration. Fall back mechanism is added in between RBHA V2 and RHBA V1 attributes. In case RHBA get failed for RBHA V2 attributes, then we fall back to RHBA V1 attributes registration.
Signed-off-by Javed Hasan <[email protected]>---
include/scsi/fc/fc_ms.h| 59 ++++++++++++++++++++++++++++++++++-------1 file changed, 50 insertions(+), 9 deletions(-)include/scsi/fc/fc_ms.h index renamed from include/scsi/fc/fc_ms.h +0
-0
9e273fed0a85..abbd6bacc888100644include/scsi/fc/fc_ms.h +13
-1@@ -24,6 +24,12 @@*/ #define FC_FDMI_SUBTYPE 0x10/* fs_ct_hdr.ct_fs_subtype */ +/* +* Management server FDMI specifications. +*/ +#define FDMI_V1 1/* FDMI version 1 specifications */ +#define FDMI_V2 2/* FDMI version 2 specifications */ +/* * Management server FDMI Requests. */ @@ -57,22 +63,36 @@ enum fc_fdmi_hba_attr_type {FC_FDMI_HBA_ATTR_FIRMWAREVERSION =0x0009 ,FC_FDMI_HBA_ATTR_OSNAMEVERSION =0x000A ,FC_FDMI_HBA_ATTR_MAXCTPAYLOAD =0x000B , +FC_FDMI_HBA_ATTR_NODESYMBLNAME =0x000C , +FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO =0x000D , +FC_FDMI_HBA_ATTR_NUMBEROFPORTS =0x000E , +FC_FDMI_HBA_ATTR_FABRICNAME =0x000F , +FC_FDMI_HBA_ATTR_BIOSVERSION =0x0010 , +FC_FDMI_HBA_ATTR_BIOSSTATE =0x0011 , + FC_FDMI_HBA_ATTR_VENDORIDENTIFIER = 0x00E0, };/* * HBA Attribute Length */ #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 -#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 80
include/scsi/fc/fc_ms.h enum fc_fdmi_hba_attr_type { · line 80
Quoted 10 lines
include/scsi/fc/fc_ms.h +2
-8-#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 80 -#define FC_FDMI_HBA_ATTR_MODEL_LEN 256 -#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256 -#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 256 -#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 256 +#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 +#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64
These below value of 100 seems odd. How did you decided on this value?
<JH> In libfc we do have logic to split FCP commands but not for CT commands.
If I am adding all attributes of RHBA then total length is going upto 2750(approx), Which is far more than 2048 and that is causing problem.
Practically all version/names get covered with in 100 bytes.
Quoted 54 lines
include/scsi/fc/fc_ms.h +35
-1+#define FC_FDMI_HBA_ATTR_MODEL_LEN 100 +#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 100 +#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 100#define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN 4 +#define FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN 100 +#define FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN 4 +#define FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN 4 +#define FC_FDMI_HBA_ATTR_FABRICNAME_LEN 8 +#define FC_FDMI_HBA_ATTR_BIOSVERSION_LEN 100 +#define FC_FDMI_HBA_ATTR_BIOSSTATE_LEN 4 +#define FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN 8/* * Port Attribute Type @@ -84,6 +104,16 @@ enum fc_fdmi_port_attr_type {FC_FDMI_PORT_ATTR_MAXFRAMESIZE =0x0004 ,FC_FDMI_PORT_ATTR_OSDEVICENAME =0x0005 ,FC_FDMI_PORT_ATTR_HOSTNAME =0x0006 , +FC_FDMI_PORT_ATTR_NODENAME =0x0007 , +FC_FDMI_PORT_ATTR_PORTNAME =0x0008 , +FC_FDMI_PORT_ATTR_SYMBOLICNAME =0x0009 , +FC_FDMI_PORT_ATTR_PORTTYPE =0x000A , +FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC =0x000B , +FC_FDMI_PORT_ATTR_FABRICNAME =0x000C , +FC_FDMI_PORT_ATTR_CURRENTFC4TYPE =0x000D , +FC_FDMI_PORT_ATTR_PORTSTATE =0x101 , +FC_FDMI_PORT_ATTR_DISCOVEREDPORTS =0x102 , + FC_FDMI_PORT_ATTR_PORTID = 0x103, };/* @@ -95,6 +125,17 @@ enum fc_fdmi_port_attr_type {#define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN 4#define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN 256#define FC_FDMI_PORT_ATTR_HOSTNAME_LEN 256 +#define FC_FDMI_PORT_ATTR_NODENAME_LEN 8 +#define FC_FDMI_PORT_ATTR_PORTNAME_LEN 8 +#define FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN 256 +#define FC_FDMI_PORT_ATTR_PORTTYPE_LEN 4 +#define FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN 4 +#define FC_FDMI_PORT_ATTR_FABRICNAME_LEN 8 +#define FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN 32 +#define FC_FDMI_PORT_ATTR_PORTSTATE_LEN 4 +#define FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN 4 +#define FC_FDMI_PORT_ATTR_PORTID_LEN 4 +/* * HBA Attribute ID --
Quoted 2 lines
2.18.2
--
Himanshu Madhani Oracle Linux Engineering
Re: [EXT] [PATCH 2/4] include:scsi:fc: FDMI enhancement
Quoted 8 lines · Javed Hasan
<JH> In libfc we do have logic to split FCP commands but not for CT commands.
If I am adding all attributes of RHBA then total length is going upto 2750(approx), Which is far more than 2048 and that is causing problem.
Practically all version/names get covered with in 100 bytes.
following length fields that are being added by this patch will never exceed 64 bytes IIRC.
+#define FC_FDMI_HBA_ATTR_MODEL_LEN 100
+#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 100
+#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 100
+#define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN 100
+#define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN 100
+#define FC_FDMI_HBA_ATTR_FIRMWAREVERSIO_LEN 100
OSNAME will need 128 bytes
+#define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN 100
I would like to see more realistic numbers for these length than just arbitrary 100 bytes.
--
Himanshu Madhani Oracle Linux Engineering
Javed Hasan
maintainerPATCH 3/4 scsi:libfc: FDMI enhancement.
In reply to Javed HasanAdded all the attributes for RHBA and RPA registration. Fall back mechanism is added in between RBHA V2 and RHBA V1 attributes. In case RHBA get failed for RBHA V2 attributes, then we fall back to RHBA V1 attributes registration.
--- drivers/scsi/libfc/fc_lport.c | 64 +++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 6 deletions(-)
drivers/scsi/libfc/fc_lport.c +58 -6
@@ -1185,7 +1185,7 @@ static void fc_lport_ms_resp(struct fc_seq *sp, struct fc_frame *fp,struct fc_lport *lport = lp_arg;struct fc_frame_header *fh;struct fc_ct_hdr *ct; - +struct fc_host_attrs *fc_host =shost_to_fc_host (lport->host);FC_LPORT_DBG (lport,"Received a ms %s\n" ,fc_els_resp_type (fp));if (fp ==ERR_PTR (-FC_EX_CLOSED ))
@@ -1219,7 +1219,13 @@ static void fc_lport_ms_resp(struct fc_seq *sp, struct fc_frame *fp,switch (lport->state) {case LPORT_ST_RHBA : -if (ntohs (ct->ct_cmd) ==FC_FS_ACC ) +if ((ntohs (ct->ct_cmd) ==FC_FS_RJT ) && fc_host->fdmi_version ==FDMI_V2 ) { +FC_LPORT_DBG (lport,"Error for FDMI-V2, fall back to FDMI-V1\n" ); + fc_host->fdmi_version =FDMI_V1 ; + +fc_lport_enter_ms (lport,LPORT_ST_RHBA ); + + }else if (ntohs (ct->ct_cmd) ==FC_FS_ACC )fc_lport_enter_ms (lport,LPORT_ST_RPA );else /* Error Skip RPA */ fc_lport_enter_scr (lport);
@@ -1433,7 +1439,7 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state)int size =sizeof (struct fc_ct_hdr );size_t len;int numattrs; - +struct fc_host_attrs *fc_host =shost_to_fc_host (lport->host);lockdep_assert_held (&lport->lp_mutex); FC_LPORT_DBG(lport, "Entered %s state from %s state\n",
@@ -1446,10 +1452,10 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state)case LPORT_ST_RHBA : cmd =FC_FDMI_RHBA ;/* Number of HBA Attributes */ - numattrs =10 ; + 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 ;
@@ -1460,6 +1466,21 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) 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 ; + } + + len += (numattrs *FC_FDMI_ATTR_ENTRY_HEADER_LEN ); size += len;break ;
@@ -1469,7 +1490,6 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) 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 ;
@@ -1477,6 +1497,22 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) 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 ; + } + + len += (numattrs *FC_FDMI_ATTR_ENTRY_HEADER_LEN ); + size += len;break ;case LPORT_ST_DPRT :
@@ -1546,6 +1582,7 @@ static void fc_lport_timeout(struct work_struct *work)struct fc_lport *lport = container_of(work, struct fc_lport, retry_work.work); +struct fc_host_attrs *fc_host =shost_to_fc_host (lport->host);mutex_lock (&lport->lp_mutex);
@@ -1573,6 +1610,13 @@ static void fc_lport_timeout(struct work_struct *work)fc_lport_enter_fdmi (lport);break ;case LPORT_ST_RHBA : +if (fc_host->fdmi_version ==FDMI_V2 ) { +FC_LPORT_DBG (lport,"timeout for FDMI-V2 RHBA,fall back to FDMI-V1\n" ); + fc_host->fdmi_version =FDMI_V1 ; +fc_lport_enter_ms (lport,LPORT_ST_RHBA ); +break ; + } + fallthrough;case LPORT_ST_RPA :case LPORT_ST_DHBA :case LPORT_ST_DPRT :
@@ -1839,6 +1883,13 @@ EXPORT_SYMBOL(fc_lport_config);*/ int fc_lport_init (struct fc_lport *lport) { +struct fc_host_attrs *fc_host; + + fc_host =shost_to_fc_host (lport->host); + +/* Set FDMI version to FDMI-2 specification*/ + fc_host->fdmi_version =FDMI_V2 ; +fc_host_port_type (lport->host) =FC_PORTTYPE_NPORT ;fc_host_node_name (lport->host) = lport->wwnn;fc_host_port_name (lport->host) = lport->wwpn;
@@ -1847,6 +1898,7 @@ int fc_lport_init(struct fc_lport *lport) sizeof(fc_host_supported_fc4s(lport->host)));fc_host_supported_fc4s (lport->host)[2 ] =1 ;fc_host_supported_fc4s (lport->host)[7 ] =1 ; +fc_host_num_discovered_ports (lport->host) =4 ;/* This value is also unchanging */ memset(fc_host_active_fc4s(lport->host), 0,
Signature · 1 line
2.18.2
Re: [PATCH 3/4] scsi:libfc: FDMI enhancement.
Quoted 165 lines · Javed Hasan
Added all the attributes for RHBA and RPA registration. Fall back mechanism is added in between RBHA V2 and RHBA V1 attributes. In case RHBA get failed for RBHA V2 attributes, then we fall back to RHBA V1 attributes registration.
Signed-off-by Javed Hasan <[email protected]>---
drivers/scsi/libfc/fc_lport.c| 64 +++++++++++++++++++++++++++++++----1 file changed, 58 insertions(+), 6 deletions(-)drivers/scsi/libfc/fc_lport.c +58
-6@@ -1185,7 +1185,7 @@ static void fc_lport_ms_resp(struct fc_seq *sp, struct fc_frame *fp,struct fc_lport *lport = lp_arg;struct fc_frame_header *fh;struct fc_ct_hdr *ct; - +struct fc_host_attrs *fc_host =shost_to_fc_host (lport->host);FC_LPORT_DBG (lport,"Received a ms %s\n" ,fc_els_resp_type (fp));if (fp ==ERR_PTR (-FC_EX_CLOSED ))@@ -1219,7 +1219,13 @@ static void fc_lport_ms_resp(struct fc_seq *sp, struct fc_frame *fp,switch (lport->state) {case LPORT_ST_RHBA : -if (ntohs (ct->ct_cmd) ==FC_FS_ACC ) +if ((ntohs (ct->ct_cmd) ==FC_FS_RJT ) && fc_host->fdmi_version ==FDMI_V2 ) { +FC_LPORT_DBG (lport,"Error for FDMI-V2, fall back to FDMI-V1\n" ); + fc_host->fdmi_version =FDMI_V1 ; + +fc_lport_enter_ms (lport,LPORT_ST_RHBA ); + + }else if (ntohs (ct->ct_cmd) ==FC_FS_ACC )fc_lport_enter_ms (lport,LPORT_ST_RPA );else /* Error Skip RPA */ fc_lport_enter_scr (lport);@@ -1433,7 +1439,7 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state)int size =sizeof (struct fc_ct_hdr );size_t len;int numattrs; - +struct fc_host_attrs *fc_host =shost_to_fc_host (lport->host);lockdep_assert_held (&lport->lp_mutex); FC_LPORT_DBG(lport, "Entered %s state from %s state\n",@@ -1446,10 +1452,10 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state)case LPORT_ST_RHBA : cmd =FC_FDMI_RHBA ;/* Number of HBA Attributes */ - numattrs =10 ; + 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 ;@@ -1460,6 +1466,21 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) 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 ; + } + + len += (numattrs *FC_FDMI_ATTR_ENTRY_HEADER_LEN ); size += len;break ;@@ -1469,7 +1490,6 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) 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 ;@@ -1477,6 +1497,22 @@ static void fc_lport_enter_ms(struct fc_lport *lport, enum fc_lport_state state) 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 ; + } + + len += (numattrs *FC_FDMI_ATTR_ENTRY_HEADER_LEN ); + size += len;break ;case LPORT_ST_DPRT :@@ -1546,6 +1582,7 @@ static void fc_lport_timeout(struct work_struct *work)struct fc_lport *lport = container_of(work, struct fc_lport, retry_work.work); +struct fc_host_attrs *fc_host =shost_to_fc_host (lport->host);mutex_lock (&lport->lp_mutex);@@ -1573,6 +1610,13 @@ static void fc_lport_timeout(struct work_struct *work)fc_lport_enter_fdmi (lport);break ;case LPORT_ST_RHBA : +if (fc_host->fdmi_version ==FDMI_V2 ) { +FC_LPORT_DBG (lport,"timeout for FDMI-V2 RHBA,fall back to FDMI-V1\n" ); + fc_host->fdmi_version =FDMI_V1 ; +fc_lport_enter_ms (lport,LPORT_ST_RHBA ); +break ; + } + fallthrough;case LPORT_ST_RPA :case LPORT_ST_DHBA :case LPORT_ST_DPRT :@@ -1839,6 +1883,13 @@ EXPORT_SYMBOL(fc_lport_config);*/ int fc_lport_init (struct fc_lport *lport) { +struct fc_host_attrs *fc_host; + + fc_host =shost_to_fc_host (lport->host); + +/* Set FDMI version to FDMI-2 specification*/ + fc_host->fdmi_version =FDMI_V2 ; +fc_host_port_type (lport->host) =FC_PORTTYPE_NPORT ;fc_host_node_name (lport->host) = lport->wwnn;fc_host_port_name (lport->host) = lport->wwpn;@@ -1847,6 +1898,7 @@ int fc_lport_init(struct fc_lport *lport) sizeof(fc_host_supported_fc4s(lport->host)));fc_host_supported_fc4s (lport->host)[2 ] =1 ;fc_host_supported_fc4s (lport->host)[7 ] =1 ; +fc_host_num_discovered_ports (lport->host) =4 ;/* This value is also unchanging */ memset(fc_host_active_fc4s(lport->host), 0,Signature · 1 line
2.18.2
Looks Good.
--
Himanshu Madhani Oracle Linux Engineering
Javed Hasan
maintainerPATCH 4/4 scsi:qedf: Added attributes for RHBA and RPA
In reply to Javed HasanAdd attributes for RHBA and RPA.
--- drivers/scsi/qedf/qedf_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/scsi/qedf/qedf_main.c +11 -0
@@ -1715,6 +1715,17 @@ static void qedf_setup_fdmi(struct qedf_ctx *qedf)FW_MAJOR_VERSION ,FW_MINOR_VERSION ,FW_REVISION_VERSION , FW_ENGINEERING_VERSION); +snprintf (fc_host_vendor_identifier (lport->host), +FC_VENDOR_IDENTIFIER ,"%s" ,"Marvell" ); + +fc_host_num_discovered_ports (lport->host) =DISCOVERED_PORTS ; +fc_host_port_state (lport->host) =FC_PORTSTATE_ONLINE ; +fc_host_max_ct_payload (lport->host) =MAX_CT_PAYLOAD ; +fc_host_num_ports (lport->host) =NUMBER_OF_PORTS ; +fc_host_bootbios_state (lport->host) =0X00000000 ; +snprintf (fc_host_bootbios_version (lport->host), +FC_SYMBOLIC_NAME_SIZE ,"%s" ,"Unknown" ); + }static int qedf_lport_setup (struct qedf_ctx *qedf)
Signature · 1 line
2.18.2
Re: [PATCH 4/4] scsi:qedf: Added attributes for RHBA and RPA
Quoted 21 lines · Javed Hasan
Add attributes for RHBA and RPA.
Signed-off-by Javed Hasan <[email protected]>---
drivers/scsi/qedf/qedf_main.c| 11 +++++++++++1 file changed, 11 insertions(+)drivers/scsi/qedf/qedf_main.c +2
-0@@ -1715,6 +1715,17 @@ static void qedf_setup_fdmi(struct qedf_ctx *qedf)FW_MAJOR_VERSION ,FW_MINOR_VERSION ,FW_REVISION_VERSION , FW_ENGINEERING_VERSION); +snprintf (fc_host_vendor_identifier (lport->host), +FC_VENDOR_IDENTIFIER ,"%s" ,"Marvell" );
drivers/scsi/qedf/qedf_main.c static void qedf_setup_fdmi(struct qedf_ctx *qedf) · line 1729
Quoted 10 lines
drivers/scsi/qedf/qedf_main.c +9
-0+ +fc_host_num_discovered_ports (lport->host) =DISCOVERED_PORTS ; +fc_host_port_state (lport->host) =FC_PORTSTATE_ONLINE ; +fc_host_max_ct_payload (lport->host) =MAX_CT_PAYLOAD ; +fc_host_num_ports (lport->host) =NUMBER_OF_PORTS ; +fc_host_bootbios_state (lport->host) =0X00000000 ; +snprintf (fc_host_bootbios_version (lport->host), +FC_SYMBOLIC_NAME_SIZE ,"%s" ,"Unknown" ); + }
Above changes seems like adding port attribute to transport. Did not quite get the RHBA/RPA addition here? Am I missing something?
Quoted 5 lines
drivers/scsi/qedf/qedf_main.c +0
-0static int qedf_lport_setup (struct qedf_ctx *qedf)Signature · 1 line
2.18.2
--
Himanshu Madhani Oracle Linux Engineering
Javed Hasan
maintainerRE: [EXT] Re: [PATCH 4/4] scsi:qedf: Added attributes for RHBA and RPA
Hello Himanshu,
Please find my response inline.
-----Original Message-----
From: Himanshu Madhani <[email protected]>
Sent: Monday, October 19, 2020 9:35 PM
To: Javed Hasan <[email protected]>
Cc: Martin K . Petersen <[email protected]>; [email protected]; GR-QLogic-Storage-Upstream <[email protected]>
Subject: [EXT] Re: [PATCH 4/4] scsi:qedf: Added attributes for RHBA and RPA
External Email
----------------------------------------------------------------------
Quoted 20 lines · Javed Hasan
Add attributes for RHBA and RPA.
Signed-off-by Javed Hasan <[email protected]>---
drivers/scsi/qedf/qedf_main.c| 11 +++++++++++1 file changed, 11 insertions(+)(quoted diff) +0
-0
b/drivers/scsi/qedf/qedf_main.cindex46d185cb9ea8..e4d800cf9db7100644drivers/scsi/qedf/qedf_main.c +2
-0@@ -1715,6 +1715,17 @@ static void qedf_setup_fdmi(struct qedf_ctx *qedf)FW_MAJOR_VERSION ,FW_MINOR_VERSION ,FW_REVISION_VERSION , FW_ENGINEERING_VERSION); +snprintf (fc_host_vendor_identifier (lport->host), +FC_VENDOR_IDENTIFIER ,"%s" ,"Marvell" );
drivers/scsi/qedf/qedf_main.c static void qedf_setup_fdmi(struct qedf_ctx *qedf) · line 1729
Quoted 10 lines
drivers/scsi/qedf/qedf_main.c +9
-0+ +fc_host_num_discovered_ports (lport->host) =DISCOVERED_PORTS ; +fc_host_port_state (lport->host) =FC_PORTSTATE_ONLINE ; +fc_host_max_ct_payload (lport->host) =MAX_CT_PAYLOAD ; +fc_host_num_ports (lport->host) =NUMBER_OF_PORTS ; +fc_host_bootbios_state (lport->host) =0X00000000 ; +snprintf (fc_host_bootbios_version (lport->host), +FC_SYMBOLIC_NAME_SIZE ,"%s" ,"Unknown" ); + }
Above changes seems like adding port attribute to transport.
Did not quite get the RHBA/RPA addition here? Am I missing something?
<JH> Yes, you are right. Will move the attributes (not specific to manufacturer) to libfc.
Quoted 5 lines
drivers/scsi/qedf/qedf_main.c +0
-1static int qedf_lport_setup (struct qedf_ctx *qedf) --2.18.2
--
Himanshu Madhani Oracle Linux Engineering