[SCSI] scsi_transport_fc: Add FDMI host attributes

This adds FC-GS Fabric Device Management Interface
(FDMI) related attributes to fc_host_attr structure.

This is in preparation for allowing FDMI attributes
to be registered via libfc.

Signed-off-by: Neerav Parikh <neerav.parikh@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Acked-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
Neerav Parikh 2012-01-22 17:29:50 -08:00 committed by James Bottomley
parent 263d9401a3
commit bb8ef587a7
2 changed files with 57 additions and 1 deletions

View File

@ -313,7 +313,7 @@ static void fc_scsi_scan_rport(struct work_struct *work);
#define FC_STARGET_NUM_ATTRS 3 #define FC_STARGET_NUM_ATTRS 3
#define FC_RPORT_NUM_ATTRS 10 #define FC_RPORT_NUM_ATTRS 10
#define FC_VPORT_NUM_ATTRS 9 #define FC_VPORT_NUM_ATTRS 9
#define FC_HOST_NUM_ATTRS 22 #define FC_HOST_NUM_ATTRS 29
struct fc_internal { struct fc_internal {
struct scsi_transport_template t; struct scsi_transport_template t;
@ -399,6 +399,20 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
fc_host->max_npiv_vports = 0; fc_host->max_npiv_vports = 0;
memset(fc_host->serial_number, 0, memset(fc_host->serial_number, 0,
sizeof(fc_host->serial_number)); sizeof(fc_host->serial_number));
memset(fc_host->manufacturer, 0,
sizeof(fc_host->manufacturer));
memset(fc_host->model, 0,
sizeof(fc_host->model));
memset(fc_host->model_description, 0,
sizeof(fc_host->model_description));
memset(fc_host->hardware_version, 0,
sizeof(fc_host->hardware_version));
memset(fc_host->driver_version, 0,
sizeof(fc_host->driver_version));
memset(fc_host->firmware_version, 0,
sizeof(fc_host->firmware_version));
memset(fc_host->optionrom_version, 0,
sizeof(fc_host->optionrom_version));
fc_host->port_id = -1; fc_host->port_id = -1;
fc_host->port_type = FC_PORTTYPE_UNKNOWN; fc_host->port_type = FC_PORTTYPE_UNKNOWN;
@ -1513,6 +1527,13 @@ fc_private_host_rd_attr_cast(permanent_port_name, "0x%llx\n", 20,
fc_private_host_rd_attr(maxframe_size, "%u bytes\n", 20); fc_private_host_rd_attr(maxframe_size, "%u bytes\n", 20);
fc_private_host_rd_attr(max_npiv_vports, "%u\n", 20); fc_private_host_rd_attr(max_npiv_vports, "%u\n", 20);
fc_private_host_rd_attr(serial_number, "%s\n", (FC_SERIAL_NUMBER_SIZE +1)); fc_private_host_rd_attr(serial_number, "%s\n", (FC_SERIAL_NUMBER_SIZE +1));
fc_private_host_rd_attr(manufacturer, "%s\n", FC_SERIAL_NUMBER_SIZE + 1);
fc_private_host_rd_attr(model, "%s\n", FC_SYMBOLIC_NAME_SIZE + 1);
fc_private_host_rd_attr(model_description, "%s\n", FC_SYMBOLIC_NAME_SIZE + 1);
fc_private_host_rd_attr(hardware_version, "%s\n", FC_VERSION_STRING_SIZE + 1);
fc_private_host_rd_attr(driver_version, "%s\n", FC_VERSION_STRING_SIZE + 1);
fc_private_host_rd_attr(firmware_version, "%s\n", FC_VERSION_STRING_SIZE + 1);
fc_private_host_rd_attr(optionrom_version, "%s\n", FC_VERSION_STRING_SIZE + 1);
/* Dynamic Host Attributes */ /* Dynamic Host Attributes */
@ -2208,6 +2229,13 @@ fc_attach_transport(struct fc_function_template *ft)
SETUP_HOST_ATTRIBUTE_RD_NS(npiv_vports_inuse); SETUP_HOST_ATTRIBUTE_RD_NS(npiv_vports_inuse);
} }
SETUP_HOST_ATTRIBUTE_RD(serial_number); SETUP_HOST_ATTRIBUTE_RD(serial_number);
SETUP_HOST_ATTRIBUTE_RD(manufacturer);
SETUP_HOST_ATTRIBUTE_RD(model);
SETUP_HOST_ATTRIBUTE_RD(model_description);
SETUP_HOST_ATTRIBUTE_RD(hardware_version);
SETUP_HOST_ATTRIBUTE_RD(driver_version);
SETUP_HOST_ATTRIBUTE_RD(firmware_version);
SETUP_HOST_ATTRIBUTE_RD(optionrom_version);
SETUP_HOST_ATTRIBUTE_RD(port_id); SETUP_HOST_ATTRIBUTE_RD(port_id);
SETUP_HOST_ATTRIBUTE_RD(port_type); SETUP_HOST_ATTRIBUTE_RD(port_type);

View File

@ -486,6 +486,13 @@ struct fc_host_attrs {
u32 maxframe_size; u32 maxframe_size;
u16 max_npiv_vports; u16 max_npiv_vports;
char serial_number[FC_SERIAL_NUMBER_SIZE]; char serial_number[FC_SERIAL_NUMBER_SIZE];
char manufacturer[FC_SERIAL_NUMBER_SIZE];
char model[FC_SYMBOLIC_NAME_SIZE];
char model_description[FC_SYMBOLIC_NAME_SIZE];
char hardware_version[FC_VERSION_STRING_SIZE];
char driver_version[FC_VERSION_STRING_SIZE];
char firmware_version[FC_VERSION_STRING_SIZE];
char optionrom_version[FC_VERSION_STRING_SIZE];
/* Dynamic Attributes */ /* Dynamic Attributes */
u32 port_id; u32 port_id;
@ -541,6 +548,20 @@ struct fc_host_attrs {
(((struct fc_host_attrs *)(x)->shost_data)->max_npiv_vports) (((struct fc_host_attrs *)(x)->shost_data)->max_npiv_vports)
#define fc_host_serial_number(x) \ #define fc_host_serial_number(x) \
(((struct fc_host_attrs *)(x)->shost_data)->serial_number) (((struct fc_host_attrs *)(x)->shost_data)->serial_number)
#define fc_host_manufacturer(x) \
(((struct fc_host_attrs *)(x)->shost_data)->manufacturer)
#define fc_host_model(x) \
(((struct fc_host_attrs *)(x)->shost_data)->model)
#define fc_host_model_description(x) \
(((struct fc_host_attrs *)(x)->shost_data)->model_description)
#define fc_host_hardware_version(x) \
(((struct fc_host_attrs *)(x)->shost_data)->hardware_version)
#define fc_host_driver_version(x) \
(((struct fc_host_attrs *)(x)->shost_data)->driver_version)
#define fc_host_firmware_version(x) \
(((struct fc_host_attrs *)(x)->shost_data)->firmware_version)
#define fc_host_optionrom_version(x) \
(((struct fc_host_attrs *)(x)->shost_data)->optionrom_version)
#define fc_host_port_id(x) \ #define fc_host_port_id(x) \
(((struct fc_host_attrs *)(x)->shost_data)->port_id) (((struct fc_host_attrs *)(x)->shost_data)->port_id)
#define fc_host_port_type(x) \ #define fc_host_port_type(x) \
@ -700,6 +721,13 @@ struct fc_function_template {
unsigned long show_host_supported_speeds:1; unsigned long show_host_supported_speeds:1;
unsigned long show_host_maxframe_size:1; unsigned long show_host_maxframe_size:1;
unsigned long show_host_serial_number:1; unsigned long show_host_serial_number:1;
unsigned long show_host_manufacturer:1;
unsigned long show_host_model:1;
unsigned long show_host_model_description:1;
unsigned long show_host_hardware_version:1;
unsigned long show_host_driver_version:1;
unsigned long show_host_firmware_version:1;
unsigned long show_host_optionrom_version:1;
/* host dynamic attributes */ /* host dynamic attributes */
unsigned long show_host_port_id:1; unsigned long show_host_port_id:1;
unsigned long show_host_port_type:1; unsigned long show_host_port_type:1;