diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2013-11-28 01:39:27 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2014-01-05 01:13:45 -0500 |
commit | f62b5060d6701dcc8c072f7fc2160f71a2cbc183 (patch) | |
tree | ce3572cf5ca1f29d4762bd4970d654dbcedac489 /drivers/net/ethernet/intel | |
parent | a45e88c9db90c869365d8e258989639a09cf19dc (diff) |
i40e: fix mac address checking
Remove custom i40e functions around ethernet addresses that are
duplicating already existing kernel functionality.
Also ends up fixing a bug with multicast addresses.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel')
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_common.c | 27 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_main.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_prototype.h | 1 |
3 files changed, 1 insertions, 29 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c index d84fca1b3f28..e5694b9f4e95 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_common.c +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c | |||
@@ -240,33 +240,6 @@ i40e_status i40e_get_mac_addr(struct i40e_hw *hw, u8 *mac_addr) | |||
240 | } | 240 | } |
241 | 241 | ||
242 | /** | 242 | /** |
243 | * i40e_validate_mac_addr - Validate MAC address | ||
244 | * @mac_addr: pointer to MAC address | ||
245 | * | ||
246 | * Tests a MAC address to ensure it is a valid Individual Address | ||
247 | **/ | ||
248 | i40e_status i40e_validate_mac_addr(u8 *mac_addr) | ||
249 | { | ||
250 | i40e_status status = 0; | ||
251 | |||
252 | /* Make sure it is not a multicast address */ | ||
253 | if (I40E_IS_MULTICAST(mac_addr)) { | ||
254 | hw_dbg(hw, "MAC address is multicast\n"); | ||
255 | status = I40E_ERR_INVALID_MAC_ADDR; | ||
256 | /* Not a broadcast address */ | ||
257 | } else if (I40E_IS_BROADCAST(mac_addr)) { | ||
258 | hw_dbg(hw, "MAC address is broadcast\n"); | ||
259 | status = I40E_ERR_INVALID_MAC_ADDR; | ||
260 | /* Reject the zero address */ | ||
261 | } else if (mac_addr[0] == 0 && mac_addr[1] == 0 && mac_addr[2] == 0 && | ||
262 | mac_addr[3] == 0 && mac_addr[4] == 0 && mac_addr[5] == 0) { | ||
263 | hw_dbg(hw, "MAC address is all zeros\n"); | ||
264 | status = I40E_ERR_INVALID_MAC_ADDR; | ||
265 | } | ||
266 | return status; | ||
267 | } | ||
268 | |||
269 | /** | ||
270 | * i40e_get_media_type - Gets media type | 243 | * i40e_get_media_type - Gets media type |
271 | * @hw: pointer to the hardware structure | 244 | * @hw: pointer to the hardware structure |
272 | **/ | 245 | **/ |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index d5719bd9d5ee..e48e1c8da4c0 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -7644,7 +7644,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7644 | } | 7644 | } |
7645 | 7645 | ||
7646 | i40e_get_mac_addr(hw, hw->mac.addr); | 7646 | i40e_get_mac_addr(hw, hw->mac.addr); |
7647 | if (i40e_validate_mac_addr(hw->mac.addr)) { | 7647 | if (!is_valid_ether_addr(hw->mac.addr)) { |
7648 | dev_info(&pdev->dev, "invalid MAC address %pM\n", hw->mac.addr); | 7648 | dev_info(&pdev->dev, "invalid MAC address %pM\n", hw->mac.addr); |
7649 | err = -EIO; | 7649 | err = -EIO; |
7650 | goto err_mac_addr; | 7650 | goto err_mac_addr; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h index 0b6e9fc9fb1f..800f3c816284 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h +++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h | |||
@@ -205,7 +205,6 @@ void i40e_clear_pxe_mode(struct i40e_hw *hw); | |||
205 | bool i40e_get_link_status(struct i40e_hw *hw); | 205 | bool i40e_get_link_status(struct i40e_hw *hw); |
206 | i40e_status i40e_get_mac_addr(struct i40e_hw *hw, | 206 | i40e_status i40e_get_mac_addr(struct i40e_hw *hw, |
207 | u8 *mac_addr); | 207 | u8 *mac_addr); |
208 | i40e_status i40e_validate_mac_addr(u8 *mac_addr); | ||
209 | i40e_status i40e_read_lldp_cfg(struct i40e_hw *hw, | 208 | i40e_status i40e_read_lldp_cfg(struct i40e_hw *hw, |
210 | struct i40e_lldp_variables *lldp_cfg); | 209 | struct i40e_lldp_variables *lldp_cfg); |
211 | /* prototype for functions used for NVM access */ | 210 | /* prototype for functions used for NVM access */ |