aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c73
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c48
-rw-r--r--drivers/net/ixgbe/ixgbe_type.h5
3 files changed, 126 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_82599.c b/drivers/net/ixgbe/ixgbe_82599.c
index 23be4dbac7ed..6bc964fdacbe 100644
--- a/drivers/net/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ixgbe/ixgbe_82599.c
@@ -819,6 +819,9 @@ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw)
819 /* Store the permanent mac address */ 819 /* Store the permanent mac address */
820 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr); 820 hw->mac.ops.get_mac_addr(hw, hw->mac.perm_addr);
821 821
822 /* Store the permanent SAN mac address */
823 hw->mac.ops.get_san_mac_addr(hw, hw->mac.san_addr);
824
822reset_hw_out: 825reset_hw_out:
823 return status; 826 return status;
824} 827}
@@ -1294,6 +1297,75 @@ s32 ixgbe_get_device_caps_82599(struct ixgbe_hw *hw, u16 *device_caps)
1294 return 0; 1297 return 0;
1295} 1298}
1296 1299
1300/**
1301 * ixgbe_get_san_mac_addr_offset_82599 - SAN MAC address offset for 82599
1302 * @hw: pointer to hardware structure
1303 * @san_mac_offset: SAN MAC address offset
1304 *
1305 * This function will read the EEPROM location for the SAN MAC address
1306 * pointer, and returns the value at that location. This is used in both
1307 * get and set mac_addr routines.
1308 **/
1309s32 ixgbe_get_san_mac_addr_offset_82599(struct ixgbe_hw *hw,
1310 u16 *san_mac_offset)
1311{
1312 /*
1313 * First read the EEPROM pointer to see if the MAC addresses are
1314 * available.
1315 */
1316 hw->eeprom.ops.read(hw, IXGBE_SAN_MAC_ADDR_PTR, san_mac_offset);
1317
1318 return 0;
1319}
1320
1321/**
1322 * ixgbe_get_san_mac_addr_82599 - SAN MAC address retrieval for 82599
1323 * @hw: pointer to hardware structure
1324 * @san_mac_addr: SAN MAC address
1325 *
1326 * Reads the SAN MAC address from the EEPROM, if it's available. This is
1327 * per-port, so set_lan_id() must be called before reading the addresses.
1328 * set_lan_id() is called by identify_sfp(), but this cannot be relied
1329 * upon for non-SFP connections, so we must call it here.
1330 **/
1331s32 ixgbe_get_san_mac_addr_82599(struct ixgbe_hw *hw, u8 *san_mac_addr)
1332{
1333 u16 san_mac_data, san_mac_offset;
1334 u8 i;
1335
1336 /*
1337 * First read the EEPROM pointer to see if the MAC addresses are
1338 * available. If they're not, no point in calling set_lan_id() here.
1339 */
1340 ixgbe_get_san_mac_addr_offset_82599(hw, &san_mac_offset);
1341
1342 if ((san_mac_offset == 0) || (san_mac_offset == 0xFFFF)) {
1343 /*
1344 * No addresses available in this EEPROM. It's not an
1345 * error though, so just wipe the local address and return.
1346 */
1347 for (i = 0; i < 6; i++)
1348 san_mac_addr[i] = 0xFF;
1349
1350 goto san_mac_addr_out;
1351 }
1352
1353 /* make sure we know which port we need to program */
1354 hw->mac.ops.set_lan_id(hw);
1355 /* apply the port offset to the address offset */
1356 (hw->bus.func) ? (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT1_OFFSET) :
1357 (san_mac_offset += IXGBE_SAN_MAC_ADDR_PORT0_OFFSET);
1358 for (i = 0; i < 3; i++) {
1359 hw->eeprom.ops.read(hw, san_mac_offset, &san_mac_data);
1360 san_mac_addr[i * 2] = (u8)(san_mac_data);
1361 san_mac_addr[i * 2 + 1] = (u8)(san_mac_data >> 8);
1362 san_mac_offset++;
1363 }
1364
1365san_mac_addr_out:
1366 return 0;
1367}
1368
1297static struct ixgbe_mac_operations mac_ops_82599 = { 1369static struct ixgbe_mac_operations mac_ops_82599 = {
1298 .init_hw = &ixgbe_init_hw_generic, 1370 .init_hw = &ixgbe_init_hw_generic,
1299 .reset_hw = &ixgbe_reset_hw_82599, 1371 .reset_hw = &ixgbe_reset_hw_82599,
@@ -1303,6 +1375,7 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
1303 .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82599, 1375 .get_supported_physical_layer = &ixgbe_get_supported_physical_layer_82599,
1304 .enable_rx_dma = &ixgbe_enable_rx_dma_82599, 1376 .enable_rx_dma = &ixgbe_enable_rx_dma_82599,
1305 .get_mac_addr = &ixgbe_get_mac_addr_generic, 1377 .get_mac_addr = &ixgbe_get_mac_addr_generic,
1378 .get_san_mac_addr = &ixgbe_get_san_mac_addr_82599,
1306 .get_device_caps = &ixgbe_get_device_caps_82599, 1379 .get_device_caps = &ixgbe_get_device_caps_82599,
1307 .stop_adapter = &ixgbe_stop_adapter_generic, 1380 .stop_adapter = &ixgbe_stop_adapter_generic,
1308 .get_bus_info = &ixgbe_get_bus_info_generic, 1381 .get_bus_info = &ixgbe_get_bus_info_generic,
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index d69a0526f24d..fe0ac8bdb10b 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -4799,6 +4799,48 @@ static int ixgbe_ioctl(struct net_device *netdev, struct ifreq *req, int cmd)
4799 return mdio_mii_ioctl(&adapter->hw.phy.mdio, if_mii(req), cmd); 4799 return mdio_mii_ioctl(&adapter->hw.phy.mdio, if_mii(req), cmd);
4800} 4800}
4801 4801
4802/**
4803 * ixgbe_add_sanmac_netdev - Add the SAN MAC address to the corresponding
4804 * netdev->dev_addr_list
4805 * @netdev: network interface device structure
4806 *
4807 * Returns non-zero on failure
4808 **/
4809static int ixgbe_add_sanmac_netdev(struct net_device *dev)
4810{
4811 int err = 0;
4812 struct ixgbe_adapter *adapter = netdev_priv(dev);
4813 struct ixgbe_mac_info *mac = &adapter->hw.mac;
4814
4815 if (is_valid_ether_addr(mac->san_addr)) {
4816 rtnl_lock();
4817 err = dev_addr_add(dev, mac->san_addr, NETDEV_HW_ADDR_T_SAN);
4818 rtnl_unlock();
4819 }
4820 return err;
4821}
4822
4823/**
4824 * ixgbe_del_sanmac_netdev - Removes the SAN MAC address to the corresponding
4825 * netdev->dev_addr_list
4826 * @netdev: network interface device structure
4827 *
4828 * Returns non-zero on failure
4829 **/
4830static int ixgbe_del_sanmac_netdev(struct net_device *dev)
4831{
4832 int err = 0;
4833 struct ixgbe_adapter *adapter = netdev_priv(dev);
4834 struct ixgbe_mac_info *mac = &adapter->hw.mac;
4835
4836 if (is_valid_ether_addr(mac->san_addr)) {
4837 rtnl_lock();
4838 err = dev_addr_del(dev, mac->san_addr, NETDEV_HW_ADDR_T_SAN);
4839 rtnl_unlock();
4840 }
4841 return err;
4842}
4843
4802#ifdef CONFIG_NET_POLL_CONTROLLER 4844#ifdef CONFIG_NET_POLL_CONTROLLER
4803/* 4845/*
4804 * Polling 'interrupt' - used by things like netconsole to send skbs 4846 * Polling 'interrupt' - used by things like netconsole to send skbs
@@ -5159,6 +5201,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
5159 ixgbe_setup_dca(adapter); 5201 ixgbe_setup_dca(adapter);
5160 } 5202 }
5161#endif 5203#endif
5204 /* add san mac addr to netdev */
5205 ixgbe_add_sanmac_netdev(netdev);
5162 5206
5163 dev_info(&pdev->dev, "Intel(R) 10 Gigabit Network Connection\n"); 5207 dev_info(&pdev->dev, "Intel(R) 10 Gigabit Network Connection\n");
5164 cards_found++; 5208 cards_found++;
@@ -5229,6 +5273,10 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev)
5229 ixgbe_cleanup_fcoe(adapter); 5273 ixgbe_cleanup_fcoe(adapter);
5230 5274
5231#endif /* IXGBE_FCOE */ 5275#endif /* IXGBE_FCOE */
5276
5277 /* remove the added san mac */
5278 ixgbe_del_sanmac_netdev(netdev);
5279
5232 if (netdev->reg_state == NETREG_REGISTERED) 5280 if (netdev->reg_state == NETREG_REGISTERED)
5233 unregister_netdev(netdev); 5281 unregister_netdev(netdev);
5234 5282
diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
index 38f835da4b90..cb73b30f6c43 100644
--- a/drivers/net/ixgbe/ixgbe_type.h
+++ b/drivers/net/ixgbe/ixgbe_type.h
@@ -1439,6 +1439,7 @@
1439#define IXGBE_PBANUM0_PTR 0x15 1439#define IXGBE_PBANUM0_PTR 0x15
1440#define IXGBE_PBANUM1_PTR 0x16 1440#define IXGBE_PBANUM1_PTR 0x16
1441#define IXGBE_DEVICE_CAPS 0x2C 1441#define IXGBE_DEVICE_CAPS 0x2C
1442#define IXGBE_SAN_MAC_ADDR_PTR 0x28
1442#define IXGBE_PCIE_MSIX_82599_CAPS 0x72 1443#define IXGBE_PCIE_MSIX_82599_CAPS 0x72
1443#define IXGBE_PCIE_MSIX_82598_CAPS 0x62 1444#define IXGBE_PCIE_MSIX_82598_CAPS 0x62
1444 1445
@@ -1482,6 +1483,8 @@
1482#define IXGBE_EERD_ATTEMPTS 100000 1483#define IXGBE_EERD_ATTEMPTS 100000
1483#endif 1484#endif
1484 1485
1486#define IXGBE_SAN_MAC_ADDR_PORT0_OFFSET 0x0
1487#define IXGBE_SAN_MAC_ADDR_PORT1_OFFSET 0x3
1485#define IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP 0x1 1488#define IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP 0x1
1486#define IXGBE_DEVICE_CAPS_FCOE_OFFLOADS 0x2 1489#define IXGBE_DEVICE_CAPS_FCOE_OFFLOADS 0x2
1487 1490
@@ -2189,6 +2192,7 @@ struct ixgbe_mac_operations {
2189 enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *); 2192 enum ixgbe_media_type (*get_media_type)(struct ixgbe_hw *);
2190 u32 (*get_supported_physical_layer)(struct ixgbe_hw *); 2193 u32 (*get_supported_physical_layer)(struct ixgbe_hw *);
2191 s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *); 2194 s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *);
2195 s32 (*get_san_mac_addr)(struct ixgbe_hw *, u8 *);
2192 s32 (*get_device_caps)(struct ixgbe_hw *, u16 *); 2196 s32 (*get_device_caps)(struct ixgbe_hw *, u16 *);
2193 s32 (*stop_adapter)(struct ixgbe_hw *); 2197 s32 (*stop_adapter)(struct ixgbe_hw *);
2194 s32 (*get_bus_info)(struct ixgbe_hw *); 2198 s32 (*get_bus_info)(struct ixgbe_hw *);
@@ -2263,6 +2267,7 @@ struct ixgbe_mac_info {
2263 enum ixgbe_mac_type type; 2267 enum ixgbe_mac_type type;
2264 u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS]; 2268 u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
2265 u8 perm_addr[IXGBE_ETH_LENGTH_OF_ADDRESS]; 2269 u8 perm_addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
2270 u8 san_addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
2266 s32 mc_filter_type; 2271 s32 mc_filter_type;
2267 u32 mcft_size; 2272 u32 mcft_size;
2268 u32 vft_size; 2273 u32 vft_size;