[SCSI] scsi_transport_fc: Add FDMI host attributes
authorNeerav Parikh <neerav.parikh@intel.com>
Mon, 23 Jan 2012 01:29:50 +0000 (17:29 -0800)
committerJames Bottomley <JBottomley@Parallels.com>
Sun, 19 Feb 2012 14:08:57 +0000 (08:08 -0600)
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>
drivers/scsi/scsi_transport_fc.c
include/scsi/scsi_transport_fc.h

index f59d4a0..80fbe2a 100644 (file)
@@ -313,7 +313,7 @@ static void fc_scsi_scan_rport(struct work_struct *work);
 #define FC_STARGET_NUM_ATTRS   3
 #define FC_RPORT_NUM_ATTRS     10
 #define FC_VPORT_NUM_ATTRS     9
-#define FC_HOST_NUM_ATTRS      22
+#define FC_HOST_NUM_ATTRS      29
 
 struct fc_internal {
        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;
        memset(fc_host->serial_number, 0,
                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_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(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(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 */
@@ -2208,6 +2229,13 @@ fc_attach_transport(struct fc_function_template *ft)
                SETUP_HOST_ATTRIBUTE_RD_NS(npiv_vports_inuse);
        }
        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_type);
index 2a65167..0135cbc 100644 (file)
@@ -486,6 +486,13 @@ struct fc_host_attrs {
        u32 maxframe_size;
        u16 max_npiv_vports;
        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 */
        u32 port_id;
@@ -541,6 +548,20 @@ struct fc_host_attrs {
        (((struct fc_host_attrs *)(x)->shost_data)->max_npiv_vports)
 #define fc_host_serial_number(x)       \
        (((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)     \
        (((struct fc_host_attrs *)(x)->shost_data)->port_id)
 #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_maxframe_size: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 */
        unsigned long   show_host_port_id:1;
        unsigned long   show_host_port_type:1;