diff options
author | Neerav Parikh <Neerav.Parikh@intel.com> | 2012-01-04 15:23:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-01-05 13:12:04 -0500 |
commit | ea81875ae07aeaca285afd2771425f771294c93c (patch) | |
tree | 9ce74372e323abd11b1a8a565bc5a5e6bb194692 /drivers/net | |
parent | 68bad94ed801d955535cb50dde3412944a24530c (diff) |
ixgbe: FCoE: Add support for ndo_get_fcoe_hbainfo() call
This patch implements support for ndo_get_fcoe_hbainfo()
call in the ixgbe driver.
This function will be called by the FCoE protocol stack to
obtain device specific information from the underlying
device configured to do FCoE.
Signed-off-by: Neerav Parikh <Neerav.Parikh@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 83 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 5 |
3 files changed, 90 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index a8368d5cf686..258164d6d45a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -560,6 +560,7 @@ extern int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg, | |||
560 | 560 | ||
561 | extern char ixgbe_driver_name[]; | 561 | extern char ixgbe_driver_name[]; |
562 | extern const char ixgbe_driver_version[]; | 562 | extern const char ixgbe_driver_version[]; |
563 | extern char ixgbe_default_device_descr[]; | ||
563 | 564 | ||
564 | extern void ixgbe_up(struct ixgbe_adapter *adapter); | 565 | extern void ixgbe_up(struct ixgbe_adapter *adapter); |
565 | extern void ixgbe_down(struct ixgbe_adapter *adapter); | 566 | extern void ixgbe_down(struct ixgbe_adapter *adapter); |
@@ -627,6 +628,8 @@ extern u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter); | |||
627 | extern u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up); | 628 | extern u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up); |
628 | #endif /* CONFIG_IXGBE_DCB */ | 629 | #endif /* CONFIG_IXGBE_DCB */ |
629 | extern int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type); | 630 | extern int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type); |
631 | extern int ixgbe_fcoe_get_hbainfo(struct net_device *netdev, | ||
632 | struct netdev_fcoe_hbainfo *info); | ||
630 | #endif /* IXGBE_FCOE */ | 633 | #endif /* IXGBE_FCOE */ |
631 | 634 | ||
632 | #endif /* _IXGBE_H_ */ | 635 | #endif /* _IXGBE_H_ */ |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c index df3b1be69d83..d18d6157dd2c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | |||
@@ -855,3 +855,86 @@ int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type) | |||
855 | } | 855 | } |
856 | return rc; | 856 | return rc; |
857 | } | 857 | } |
858 | |||
859 | /** | ||
860 | * ixgbe_fcoe_get_hbainfo - get FCoE HBA information | ||
861 | * @netdev : ixgbe adapter | ||
862 | * @info : HBA information | ||
863 | * | ||
864 | * Returns ixgbe HBA information | ||
865 | * | ||
866 | * Returns : 0 on success | ||
867 | */ | ||
868 | int ixgbe_fcoe_get_hbainfo(struct net_device *netdev, | ||
869 | struct netdev_fcoe_hbainfo *info) | ||
870 | { | ||
871 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | ||
872 | struct ixgbe_hw *hw = &adapter->hw; | ||
873 | int i, pos; | ||
874 | u8 buf[8]; | ||
875 | |||
876 | if (!info) | ||
877 | return -EINVAL; | ||
878 | |||
879 | /* Don't return information on unsupported devices */ | ||
880 | if (hw->mac.type != ixgbe_mac_82599EB && | ||
881 | hw->mac.type != ixgbe_mac_X540) | ||
882 | return -EINVAL; | ||
883 | |||
884 | /* Manufacturer */ | ||
885 | snprintf(info->manufacturer, sizeof(info->manufacturer), | ||
886 | "Intel Corporation"); | ||
887 | |||
888 | /* Serial Number */ | ||
889 | |||
890 | /* Get the PCI-e Device Serial Number Capability */ | ||
891 | pos = pci_find_ext_capability(adapter->pdev, PCI_EXT_CAP_ID_DSN); | ||
892 | if (pos) { | ||
893 | pos += 4; | ||
894 | for (i = 0; i < 8; i++) | ||
895 | pci_read_config_byte(adapter->pdev, pos + i, &buf[i]); | ||
896 | |||
897 | snprintf(info->serial_number, sizeof(info->serial_number), | ||
898 | "%02X%02X%02X%02X%02X%02X%02X%02X", | ||
899 | buf[7], buf[6], buf[5], buf[4], | ||
900 | buf[3], buf[2], buf[1], buf[0]); | ||
901 | } else | ||
902 | snprintf(info->serial_number, sizeof(info->serial_number), | ||
903 | "Unknown"); | ||
904 | |||
905 | /* Hardware Version */ | ||
906 | snprintf(info->hardware_version, | ||
907 | sizeof(info->hardware_version), | ||
908 | "Rev %d", hw->revision_id); | ||
909 | /* Driver Name/Version */ | ||
910 | snprintf(info->driver_version, | ||
911 | sizeof(info->driver_version), | ||
912 | "%s v%s", | ||
913 | ixgbe_driver_name, | ||
914 | ixgbe_driver_version); | ||
915 | /* Firmware Version */ | ||
916 | snprintf(info->firmware_version, | ||
917 | sizeof(info->firmware_version), | ||
918 | "0x%08x", | ||
919 | (adapter->eeprom_verh << 16) | | ||
920 | adapter->eeprom_verl); | ||
921 | |||
922 | /* Model */ | ||
923 | if (hw->mac.type == ixgbe_mac_82599EB) { | ||
924 | snprintf(info->model, | ||
925 | sizeof(info->model), | ||
926 | "Intel 82599"); | ||
927 | } else { | ||
928 | snprintf(info->model, | ||
929 | sizeof(info->model), | ||
930 | "Intel X540"); | ||
931 | } | ||
932 | |||
933 | /* Model Description */ | ||
934 | snprintf(info->model_description, | ||
935 | sizeof(info->model_description), | ||
936 | "%s", | ||
937 | ixgbe_default_device_descr); | ||
938 | |||
939 | return 0; | ||
940 | } | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 74669a8c060e..1ee5d0fbb905 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -55,6 +55,8 @@ | |||
55 | char ixgbe_driver_name[] = "ixgbe"; | 55 | char ixgbe_driver_name[] = "ixgbe"; |
56 | static const char ixgbe_driver_string[] = | 56 | static const char ixgbe_driver_string[] = |
57 | "Intel(R) 10 Gigabit PCI Express Network Driver"; | 57 | "Intel(R) 10 Gigabit PCI Express Network Driver"; |
58 | char ixgbe_default_device_descr[] = | ||
59 | "Intel(R) 10 Gigabit Network Connection"; | ||
58 | #define MAJ 3 | 60 | #define MAJ 3 |
59 | #define MIN 6 | 61 | #define MIN 6 |
60 | #define BUILD 7 | 62 | #define BUILD 7 |
@@ -7293,6 +7295,7 @@ static const struct net_device_ops ixgbe_netdev_ops = { | |||
7293 | .ndo_fcoe_enable = ixgbe_fcoe_enable, | 7295 | .ndo_fcoe_enable = ixgbe_fcoe_enable, |
7294 | .ndo_fcoe_disable = ixgbe_fcoe_disable, | 7296 | .ndo_fcoe_disable = ixgbe_fcoe_disable, |
7295 | .ndo_fcoe_get_wwn = ixgbe_fcoe_get_wwn, | 7297 | .ndo_fcoe_get_wwn = ixgbe_fcoe_get_wwn, |
7298 | .ndo_fcoe_get_hbainfo = ixgbe_fcoe_get_hbainfo, | ||
7296 | #endif /* IXGBE_FCOE */ | 7299 | #endif /* IXGBE_FCOE */ |
7297 | .ndo_set_features = ixgbe_set_features, | 7300 | .ndo_set_features = ixgbe_set_features, |
7298 | .ndo_fix_features = ixgbe_fix_features, | 7301 | .ndo_fix_features = ixgbe_fix_features, |
@@ -7722,7 +7725,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
7722 | /* add san mac addr to netdev */ | 7725 | /* add san mac addr to netdev */ |
7723 | ixgbe_add_sanmac_netdev(netdev); | 7726 | ixgbe_add_sanmac_netdev(netdev); |
7724 | 7727 | ||
7725 | e_dev_info("Intel(R) 10 Gigabit Network Connection\n"); | 7728 | e_dev_info("%s\n", ixgbe_default_device_descr); |
7726 | cards_found++; | 7729 | cards_found++; |
7727 | return 0; | 7730 | return 0; |
7728 | 7731 | ||