aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fcoe
diff options
context:
space:
mode:
authorNeerav Parikh <neerav.parikh@intel.com>2012-01-22 20:30:10 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-02-19 09:08:58 -0500
commit6fef3902889ade6270a942cc2554252dbff1146c (patch)
tree2e75370280348fc4a826965038dc10811de43a5a /drivers/scsi/fcoe
parentd78c317f6cd701bda9f6dbfbfbcba72f39dd6ad7 (diff)
[SCSI] fcoe: Add support for FDMI in fcoe
This adds support for updating the FC-GS FDMI attributes in the fcoe driver. 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>
Diffstat (limited to 'drivers/scsi/fcoe')
-rw-r--r--drivers/scsi/fcoe/fcoe.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index e9599600aa23..b222e2dd5def 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -734,6 +734,85 @@ static int fcoe_shost_config(struct fc_lport *lport, struct device *dev)
734 return 0; 734 return 0;
735} 735}
736 736
737
738/**
739 * fcoe_fdmi_info() - Get FDMI related info from net devive for SW FCoE
740 * @lport: The local port that is associated with the net device
741 * @netdev: The associated net device
742 *
743 * Must be called after fcoe_shost_config() as it will use local port mutex
744 *
745 */
746static void fcoe_fdmi_info(struct fc_lport *lport, struct net_device *netdev)
747{
748 struct fcoe_interface *fcoe;
749 struct fcoe_port *port;
750 struct net_device *realdev;
751 int rc;
752 struct netdev_fcoe_hbainfo fdmi;
753
754 port = lport_priv(lport);
755 fcoe = port->priv;
756 realdev = fcoe->realdev;
757
758 if (!realdev)
759 return;
760
761 /* No FDMI state m/c for NPIV ports */
762 if (lport->vport)
763 return;
764
765 if (realdev->netdev_ops->ndo_fcoe_get_hbainfo) {
766 memset(&fdmi, 0, sizeof(fdmi));
767 rc = realdev->netdev_ops->ndo_fcoe_get_hbainfo(realdev,
768 &fdmi);
769 if (rc) {
770 printk(KERN_INFO "fcoe: Failed to retrieve FDMI "
771 "information from netdev.\n");
772 return;
773 }
774
775 snprintf(fc_host_serial_number(lport->host),
776 FC_SERIAL_NUMBER_SIZE,
777 "%s",
778 fdmi.serial_number);
779 snprintf(fc_host_manufacturer(lport->host),
780 FC_SERIAL_NUMBER_SIZE,
781 "%s",
782 fdmi.manufacturer);
783 snprintf(fc_host_model(lport->host),
784 FC_SYMBOLIC_NAME_SIZE,
785 "%s",
786 fdmi.model);
787 snprintf(fc_host_model_description(lport->host),
788 FC_SYMBOLIC_NAME_SIZE,
789 "%s",
790 fdmi.model_description);
791 snprintf(fc_host_hardware_version(lport->host),
792 FC_VERSION_STRING_SIZE,
793 "%s",
794 fdmi.hardware_version);
795 snprintf(fc_host_driver_version(lport->host),
796 FC_VERSION_STRING_SIZE,
797 "%s",
798 fdmi.driver_version);
799 snprintf(fc_host_optionrom_version(lport->host),
800 FC_VERSION_STRING_SIZE,
801 "%s",
802 fdmi.optionrom_version);
803 snprintf(fc_host_firmware_version(lport->host),
804 FC_VERSION_STRING_SIZE,
805 "%s",
806 fdmi.firmware_version);
807
808 /* Enable FDMI lport states */
809 lport->fdmi_enabled = 1;
810 } else {
811 lport->fdmi_enabled = 0;
812 printk(KERN_INFO "fcoe: No FDMI support.\n");
813 }
814}
815
737/** 816/**
738 * fcoe_oem_match() - The match routine for the offloaded exchange manager 817 * fcoe_oem_match() - The match routine for the offloaded exchange manager
739 * @fp: The I/O frame 818 * @fp: The I/O frame
@@ -1047,6 +1126,9 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe,
1047 goto out_lp_destroy; 1126 goto out_lp_destroy;
1048 } 1127 }
1049 1128
1129 /* Initialized FDMI information */
1130 fcoe_fdmi_info(lport, netdev);
1131
1050 /* 1132 /*
1051 * fcoe_em_alloc() and fcoe_hostlist_add() both 1133 * fcoe_em_alloc() and fcoe_hostlist_add() both
1052 * need to be atomic with respect to other changes to the 1134 * need to be atomic with respect to other changes to the