diff options
author | Joe Perches <joe@perches.com> | 2012-10-24 13:19:02 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-12-07 00:31:06 -0500 |
commit | f8ebc68373a891310fe64726940e245cf307d172 (patch) | |
tree | 970b274c2bf7df824a08d76ae1e4bee613a88898 | |
parent | b93196dc5af7729ff7cc50d3d322ab1a364aa14f (diff) |
ixgbe: Use is_valid_ether_addr
Use the normal kernel test instead of a module specific one.
Signed-off-by: Joe Perches <joe@perches.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 26 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_common.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 9 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | 2 |
6 files changed, 4 insertions, 38 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c index e75f5a4a2a6d..1073aea5da40 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c | |||
@@ -1078,7 +1078,7 @@ mac_reset_top: | |||
1078 | hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr); | 1078 | hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr); |
1079 | 1079 | ||
1080 | /* Add the SAN MAC address to the RAR only if it's a valid address */ | 1080 | /* Add the SAN MAC address to the RAR only if it's a valid address */ |
1081 | if (ixgbe_validate_mac_addr(hw->mac.san_addr) == 0) { | 1081 | if (is_valid_ether_addr(hw->mac.san_addr)) { |
1082 | hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1, | 1082 | hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1, |
1083 | hw->mac.san_addr, 0, IXGBE_RAH_AV); | 1083 | hw->mac.san_addr, 0, IXGBE_RAH_AV); |
1084 | 1084 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c index 5af1eebc32f1..5e68afdd502a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | |||
@@ -1783,29 +1783,6 @@ s32 ixgbe_update_eeprom_checksum_generic(struct ixgbe_hw *hw) | |||
1783 | } | 1783 | } |
1784 | 1784 | ||
1785 | /** | 1785 | /** |
1786 | * ixgbe_validate_mac_addr - Validate MAC address | ||
1787 | * @mac_addr: pointer to MAC address. | ||
1788 | * | ||
1789 | * Tests a MAC address to ensure it is a valid Individual Address | ||
1790 | **/ | ||
1791 | s32 ixgbe_validate_mac_addr(u8 *mac_addr) | ||
1792 | { | ||
1793 | s32 status = 0; | ||
1794 | |||
1795 | /* Make sure it is not a multicast address */ | ||
1796 | if (IXGBE_IS_MULTICAST(mac_addr)) | ||
1797 | status = IXGBE_ERR_INVALID_MAC_ADDR; | ||
1798 | /* Not a broadcast address */ | ||
1799 | else if (IXGBE_IS_BROADCAST(mac_addr)) | ||
1800 | status = IXGBE_ERR_INVALID_MAC_ADDR; | ||
1801 | /* Reject the zero address */ | ||
1802 | else if (is_zero_ether_addr(mac_addr)) | ||
1803 | status = IXGBE_ERR_INVALID_MAC_ADDR; | ||
1804 | |||
1805 | return status; | ||
1806 | } | ||
1807 | |||
1808 | /** | ||
1809 | * ixgbe_set_rar_generic - Set Rx address register | 1786 | * ixgbe_set_rar_generic - Set Rx address register |
1810 | * @hw: pointer to hardware structure | 1787 | * @hw: pointer to hardware structure |
1811 | * @index: Receive address register to write | 1788 | * @index: Receive address register to write |
@@ -1909,8 +1886,7 @@ s32 ixgbe_init_rx_addrs_generic(struct ixgbe_hw *hw) | |||
1909 | * to the permanent address. | 1886 | * to the permanent address. |
1910 | * Otherwise, use the permanent address from the eeprom. | 1887 | * Otherwise, use the permanent address from the eeprom. |
1911 | */ | 1888 | */ |
1912 | if (ixgbe_validate_mac_addr(hw->mac.addr) == | 1889 | if (!is_valid_ether_addr(hw->mac.addr)) { |
1913 | IXGBE_ERR_INVALID_MAC_ADDR) { | ||
1914 | /* Get the MAC address from the RAR0 for later reference */ | 1890 | /* Get the MAC address from the RAR0 for later reference */ |
1915 | hw->mac.ops.get_mac_addr(hw, hw->mac.addr); | 1891 | hw->mac.ops.get_mac_addr(hw, hw->mac.addr); |
1916 | 1892 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h index 1b65b6cc07bf..f7a0970a251c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h | |||
@@ -81,7 +81,6 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw); | |||
81 | s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw); | 81 | s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw); |
82 | void ixgbe_fc_autoneg(struct ixgbe_hw *hw); | 82 | void ixgbe_fc_autoneg(struct ixgbe_hw *hw); |
83 | 83 | ||
84 | s32 ixgbe_validate_mac_addr(u8 *mac_addr); | ||
85 | s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask); | 84 | s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask); |
86 | void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask); | 85 | void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask); |
87 | s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr); | 86 | s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 2fa16de46786..b7bc22ba158f 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -7444,7 +7444,7 @@ static int ixgbe_probe(struct pci_dev *pdev, | |||
7444 | memcpy(netdev->dev_addr, hw->mac.perm_addr, netdev->addr_len); | 7444 | memcpy(netdev->dev_addr, hw->mac.perm_addr, netdev->addr_len); |
7445 | memcpy(netdev->perm_addr, hw->mac.perm_addr, netdev->addr_len); | 7445 | memcpy(netdev->perm_addr, hw->mac.perm_addr, netdev->addr_len); |
7446 | 7446 | ||
7447 | if (ixgbe_validate_mac_addr(netdev->perm_addr)) { | 7447 | if (!is_valid_ether_addr(netdev->perm_addr)) { |
7448 | e_dev_err("invalid MAC address\n"); | 7448 | e_dev_err("invalid MAC address\n"); |
7449 | err = -EIO; | 7449 | err = -EIO; |
7450 | goto err_sw_init; | 7450 | goto err_sw_init; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h index 21915e20399a..cab302ab296d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | |||
@@ -1834,15 +1834,6 @@ enum { | |||
1834 | /* Number of 100 microseconds we wait for PCI Express master disable */ | 1834 | /* Number of 100 microseconds we wait for PCI Express master disable */ |
1835 | #define IXGBE_PCI_MASTER_DISABLE_TIMEOUT 800 | 1835 | #define IXGBE_PCI_MASTER_DISABLE_TIMEOUT 800 |
1836 | 1836 | ||
1837 | /* Check whether address is multicast. This is little-endian specific check.*/ | ||
1838 | #define IXGBE_IS_MULTICAST(Address) \ | ||
1839 | (bool)(((u8 *)(Address))[0] & ((u8)0x01)) | ||
1840 | |||
1841 | /* Check whether an address is broadcast. */ | ||
1842 | #define IXGBE_IS_BROADCAST(Address) \ | ||
1843 | ((((u8 *)(Address))[0] == ((u8)0xff)) && \ | ||
1844 | (((u8 *)(Address))[1] == ((u8)0xff))) | ||
1845 | |||
1846 | /* RAH */ | 1837 | /* RAH */ |
1847 | #define IXGBE_RAH_VIND_MASK 0x003C0000 | 1838 | #define IXGBE_RAH_VIND_MASK 0x003C0000 |
1848 | #define IXGBE_RAH_VIND_SHIFT 18 | 1839 | #define IXGBE_RAH_VIND_SHIFT 18 |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c index de4da5219b71..c73b92993391 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c | |||
@@ -152,7 +152,7 @@ mac_reset_top: | |||
152 | hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr); | 152 | hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr); |
153 | 153 | ||
154 | /* Add the SAN MAC address to the RAR only if it's a valid address */ | 154 | /* Add the SAN MAC address to the RAR only if it's a valid address */ |
155 | if (ixgbe_validate_mac_addr(hw->mac.san_addr) == 0) { | 155 | if (is_valid_ether_addr(hw->mac.san_addr)) { |
156 | hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1, | 156 | hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1, |
157 | hw->mac.san_addr, 0, IXGBE_RAH_AV); | 157 | hw->mac.san_addr, 0, IXGBE_RAH_AV); |
158 | 158 | ||