Commit 383ff34bebc2eccae71686fbd72e1cd948859675

Authored by Yi Zou
Committed by David S. Miller
1 parent eb89bd4f80

ixgbe: Add support for 82599 alternative WWNN/WWPN prefix

The 82599 EEPROM supports alternative prefix for World Wide Node Name
(WWNN) and World Wide Port Name (WWPN). The prefixes can be used together
with the SAN MAC address to form the WWNN and WWPN, which can be used by
upper layer drivers such as Fiber Channel over Ethernet (FCoE).

Signed-off-by: Yi Zou <yi.zou@intel.com>
Acked-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 65 additions and 0 deletions Side-by-side Diff

drivers/net/ixgbe/ixgbe_82599.c
... ... @@ -1000,6 +1000,10 @@
1000 1000 hw->mac.num_rar_entries--;
1001 1001 }
1002 1002  
  1003 + /* Store the alternative WWNN/WWPN prefix */
  1004 + hw->mac.ops.get_wwn_prefix(hw, &hw->mac.wwnn_prefix,
  1005 + &hw->mac.wwpn_prefix);
  1006 +
1003 1007 reset_hw_out:
1004 1008 return status;
1005 1009 }
... ... @@ -2536,6 +2540,51 @@
2536 2540 return status;
2537 2541 }
2538 2542  
  2543 +/**
  2544 + * ixgbe_get_wwn_prefix_82599 - Get alternative WWNN/WWPN prefix from
  2545 + * the EEPROM
  2546 + * @hw: pointer to hardware structure
  2547 + * @wwnn_prefix: the alternative WWNN prefix
  2548 + * @wwpn_prefix: the alternative WWPN prefix
  2549 + *
  2550 + * This function will read the EEPROM from the alternative SAN MAC address
  2551 + * block to check the support for the alternative WWNN/WWPN prefix support.
  2552 + **/
  2553 +static s32 ixgbe_get_wwn_prefix_82599(struct ixgbe_hw *hw, u16 *wwnn_prefix,
  2554 + u16 *wwpn_prefix)
  2555 +{
  2556 + u16 offset, caps;
  2557 + u16 alt_san_mac_blk_offset;
  2558 +
  2559 + /* clear output first */
  2560 + *wwnn_prefix = 0xFFFF;
  2561 + *wwpn_prefix = 0xFFFF;
  2562 +
  2563 + /* check if alternative SAN MAC is supported */
  2564 + hw->eeprom.ops.read(hw, IXGBE_ALT_SAN_MAC_ADDR_BLK_PTR,
  2565 + &alt_san_mac_blk_offset);
  2566 +
  2567 + if ((alt_san_mac_blk_offset == 0) ||
  2568 + (alt_san_mac_blk_offset == 0xFFFF))
  2569 + goto wwn_prefix_out;
  2570 +
  2571 + /* check capability in alternative san mac address block */
  2572 + offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_CAPS_OFFSET;
  2573 + hw->eeprom.ops.read(hw, offset, &caps);
  2574 + if (!(caps & IXGBE_ALT_SAN_MAC_ADDR_CAPS_ALTWWN))
  2575 + goto wwn_prefix_out;
  2576 +
  2577 + /* get the corresponding prefix for WWNN/WWPN */
  2578 + offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_WWNN_OFFSET;
  2579 + hw->eeprom.ops.read(hw, offset, wwnn_prefix);
  2580 +
  2581 + offset = alt_san_mac_blk_offset + IXGBE_ALT_SAN_MAC_ADDR_WWPN_OFFSET;
  2582 + hw->eeprom.ops.read(hw, offset, wwpn_prefix);
  2583 +
  2584 +wwn_prefix_out:
  2585 + return 0;
  2586 +}
  2587 +
2539 2588 static struct ixgbe_mac_operations mac_ops_82599 = {
2540 2589 .init_hw = &ixgbe_init_hw_generic,
2541 2590 .reset_hw = &ixgbe_reset_hw_82599,
... ... @@ -2547,6 +2596,7 @@
2547 2596 .get_mac_addr = &ixgbe_get_mac_addr_generic,
2548 2597 .get_san_mac_addr = &ixgbe_get_san_mac_addr_82599,
2549 2598 .get_device_caps = &ixgbe_get_device_caps_82599,
  2599 + .get_wwn_prefix = &ixgbe_get_wwn_prefix_82599,
2550 2600 .stop_adapter = &ixgbe_stop_adapter_generic,
2551 2601 .get_bus_info = &ixgbe_get_bus_info_generic,
2552 2602 .set_lan_id = &ixgbe_set_lan_id_multi_port_pcie,
drivers/net/ixgbe/ixgbe_type.h
... ... @@ -1539,6 +1539,16 @@
1539 1539 #define IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR 0x4
1540 1540 #define IXGBE_FW_PATCH_VERSION_4 0x7
1541 1541  
  1542 +/* Alternative SAN MAC Address Block */
  1543 +#define IXGBE_ALT_SAN_MAC_ADDR_BLK_PTR 0x27 /* Alt. SAN MAC block */
  1544 +#define IXGBE_ALT_SAN_MAC_ADDR_CAPS_OFFSET 0x0 /* Alt. SAN MAC capability */
  1545 +#define IXGBE_ALT_SAN_MAC_ADDR_PORT0_OFFSET 0x1 /* Alt. SAN MAC 0 offset */
  1546 +#define IXGBE_ALT_SAN_MAC_ADDR_PORT1_OFFSET 0x4 /* Alt. SAN MAC 1 offset */
  1547 +#define IXGBE_ALT_SAN_MAC_ADDR_WWNN_OFFSET 0x7 /* Alt. WWNN prefix offset */
  1548 +#define IXGBE_ALT_SAN_MAC_ADDR_WWPN_OFFSET 0x8 /* Alt. WWPN prefix offset */
  1549 +#define IXGBE_ALT_SAN_MAC_ADDR_CAPS_SANMAC 0x0 /* Alt. SAN MAC exists */
  1550 +#define IXGBE_ALT_SAN_MAC_ADDR_CAPS_ALTWWN 0x1 /* Alt. WWN base exists */
  1551 +
1542 1552 /* PCI Bus Info */
1543 1553 #define IXGBE_PCI_LINK_STATUS 0xB2
1544 1554 #define IXGBE_PCI_DEVICE_CONTROL2 0xC8
... ... @@ -2345,6 +2355,7 @@
2345 2355 s32 (*get_mac_addr)(struct ixgbe_hw *, u8 *);
2346 2356 s32 (*get_san_mac_addr)(struct ixgbe_hw *, u8 *);
2347 2357 s32 (*get_device_caps)(struct ixgbe_hw *, u16 *);
  2358 + s32 (*get_wwn_prefix)(struct ixgbe_hw *, u16 *, u16 *);
2348 2359 s32 (*stop_adapter)(struct ixgbe_hw *);
2349 2360 s32 (*get_bus_info)(struct ixgbe_hw *);
2350 2361 void (*set_lan_id)(struct ixgbe_hw *);
... ... @@ -2416,6 +2427,10 @@
2416 2427 u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
2417 2428 u8 perm_addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
2418 2429 u8 san_addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
  2430 + /* prefix for World Wide Node Name (WWNN) */
  2431 + u16 wwnn_prefix;
  2432 + /* prefix for World Wide Port Name (WWPN) */
  2433 + u16 wwpn_prefix;
2419 2434 s32 mc_filter_type;
2420 2435 u32 mcft_size;
2421 2436 u32 vft_size;