aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_82599.c
diff options
context:
space:
mode:
authorPJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>2009-05-17 08:32:25 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-18 00:04:07 -0400
commit0365e6e4373a5a447746fd7ac26074b92f180311 (patch)
treebe64a7a7cdc95dc3651655f3c09783a13fba629f /drivers/net/ixgbe/ixgbe_82599.c
parentebc06eeb7260ecad3bd69202ba6291138691d27b (diff)
ixgbe: Add FCoE Storage MAC Address support
This patch implements the Storage Address entrypoint from the net device. It will read the SAN MAC addresses from the EEPROM of the 82599 hardware, and make them available to the FCoE stack through the net device. Also, add/del the SAN MAC address to the netdev dev_addr_list via the kernel api dev_addr_add()/dev_addr_del() when there is a valid SAN MAC supported by the HW. Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Yi Zou <yi.zou@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/ixgbe/ixgbe_82599.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_82599.c73
1 files changed, 73 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,