diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-12-13 00:50:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-13 00:58:17 -0500 |
commit | 177dfcd80f28f8fbc3e22c2d8b24d21cb86f1d97 (patch) | |
tree | a6e5e9949f388d48ac20c4efbb2811762ac5f9d4 /drivers/net/sfc/net_driver.h | |
parent | 356eebb2b3af24cc701823f1e025f04eef333239 (diff) |
sfc: Add support for sub-10G speeds
The SFC4000 has a separate MAC for use at sub-10G speeds. Introduce
an efx_mac_operations structure with implementations for the two MACs.
Switch between the MACs as necessary.
PHY settings are independent of the MAC, so add get_settings() and
set_settings() to efx_phy_operations. Also add macs field to indicate
which MACs the PHY is connected to.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/net_driver.h')
-rw-r--r-- | drivers/net/sfc/net_driver.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 6cac5ed427ba..883086e39455 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -463,6 +463,8 @@ enum phy_type { | |||
463 | 463 | ||
464 | #define PHY_ADDR_INVALID 0xff | 464 | #define PHY_ADDR_INVALID 0xff |
465 | 465 | ||
466 | #define EFX_IS10G(efx) ((efx)->link_speed == 10000) | ||
467 | |||
466 | enum nic_state { | 468 | enum nic_state { |
467 | STATE_INIT = 0, | 469 | STATE_INIT = 0, |
468 | STATE_RUNNING = 1, | 470 | STATE_RUNNING = 1, |
@@ -503,6 +505,24 @@ enum efx_fc_type { | |||
503 | EFX_FC_AUTO = 4, | 505 | EFX_FC_AUTO = 4, |
504 | }; | 506 | }; |
505 | 507 | ||
508 | /* Supported MAC bit-mask */ | ||
509 | enum efx_mac_type { | ||
510 | EFX_GMAC = 1, | ||
511 | EFX_XMAC = 2, | ||
512 | }; | ||
513 | |||
514 | /** | ||
515 | * struct efx_mac_operations - Efx MAC operations table | ||
516 | * @reconfigure: Reconfigure MAC. Serialised by the mac_lock | ||
517 | * @update_stats: Update statistics | ||
518 | * @check_hw: Check hardware. Serialised by the mac_lock | ||
519 | */ | ||
520 | struct efx_mac_operations { | ||
521 | void (*reconfigure) (struct efx_nic *efx); | ||
522 | void (*update_stats) (struct efx_nic *efx); | ||
523 | int (*check_hw) (struct efx_nic *efx); | ||
524 | }; | ||
525 | |||
506 | /** | 526 | /** |
507 | * struct efx_phy_operations - Efx PHY operations table | 527 | * struct efx_phy_operations - Efx PHY operations table |
508 | * @init: Initialise PHY | 528 | * @init: Initialise PHY |
@@ -511,16 +531,23 @@ enum efx_fc_type { | |||
511 | * @clear_interrupt: Clear down interrupt | 531 | * @clear_interrupt: Clear down interrupt |
512 | * @blink: Blink LEDs | 532 | * @blink: Blink LEDs |
513 | * @check_hw: Check hardware | 533 | * @check_hw: Check hardware |
534 | * @get_settings: Get ethtool settings. Serialised by the mac_lock. | ||
535 | * @set_settings: Set ethtool settings. Serialised by the mac_lock. | ||
514 | * @mmds: MMD presence mask | 536 | * @mmds: MMD presence mask |
515 | * @loopbacks: Supported loopback modes mask | 537 | * @loopbacks: Supported loopback modes mask |
516 | */ | 538 | */ |
517 | struct efx_phy_operations { | 539 | struct efx_phy_operations { |
540 | enum efx_mac_type macs; | ||
518 | int (*init) (struct efx_nic *efx); | 541 | int (*init) (struct efx_nic *efx); |
519 | void (*fini) (struct efx_nic *efx); | 542 | void (*fini) (struct efx_nic *efx); |
520 | void (*reconfigure) (struct efx_nic *efx); | 543 | void (*reconfigure) (struct efx_nic *efx); |
521 | void (*clear_interrupt) (struct efx_nic *efx); | 544 | void (*clear_interrupt) (struct efx_nic *efx); |
522 | int (*check_hw) (struct efx_nic *efx); | 545 | int (*check_hw) (struct efx_nic *efx); |
523 | int (*test) (struct efx_nic *efx); | 546 | int (*test) (struct efx_nic *efx); |
547 | void (*get_settings) (struct efx_nic *efx, | ||
548 | struct ethtool_cmd *ecmd); | ||
549 | int (*set_settings) (struct efx_nic *efx, | ||
550 | struct ethtool_cmd *ecmd); | ||
524 | int mmds; | 551 | int mmds; |
525 | unsigned loopbacks; | 552 | unsigned loopbacks; |
526 | }; | 553 | }; |
@@ -686,6 +713,7 @@ union efx_multicast_hash { | |||
686 | * @stats_lock: Statistics update lock. Serialises statistics fetches | 713 | * @stats_lock: Statistics update lock. Serialises statistics fetches |
687 | * @stats_enabled: Temporarily disable statistics fetches. | 714 | * @stats_enabled: Temporarily disable statistics fetches. |
688 | * Serialised by @stats_lock | 715 | * Serialised by @stats_lock |
716 | * @mac_op: MAC interface | ||
689 | * @mac_address: Permanent MAC address | 717 | * @mac_address: Permanent MAC address |
690 | * @phy_type: PHY type | 718 | * @phy_type: PHY type |
691 | * @phy_lock: PHY access lock | 719 | * @phy_lock: PHY access lock |
@@ -693,6 +721,7 @@ union efx_multicast_hash { | |||
693 | * @phy_data: PHY private data (including PHY-specific stats) | 721 | * @phy_data: PHY private data (including PHY-specific stats) |
694 | * @mii: PHY interface | 722 | * @mii: PHY interface |
695 | * @phy_mode: PHY operating mode. Serialised by @mac_lock. | 723 | * @phy_mode: PHY operating mode. Serialised by @mac_lock. |
724 | * @mac_up: MAC link state | ||
696 | * @link_up: Link status | 725 | * @link_up: Link status |
697 | * @link_fd: Link is full duplex | 726 | * @link_fd: Link is full duplex |
698 | * @link_speed: Link speed (Mbps) | 727 | * @link_speed: Link speed (Mbps) |
@@ -763,6 +792,7 @@ struct efx_nic { | |||
763 | spinlock_t stats_lock; | 792 | spinlock_t stats_lock; |
764 | bool stats_enabled; | 793 | bool stats_enabled; |
765 | 794 | ||
795 | struct efx_mac_operations *mac_op; | ||
766 | unsigned char mac_address[ETH_ALEN]; | 796 | unsigned char mac_address[ETH_ALEN]; |
767 | 797 | ||
768 | enum phy_type phy_type; | 798 | enum phy_type phy_type; |
@@ -772,6 +802,7 @@ struct efx_nic { | |||
772 | struct mii_if_info mii; | 802 | struct mii_if_info mii; |
773 | enum efx_phy_mode phy_mode; | 803 | enum efx_phy_mode phy_mode; |
774 | 804 | ||
805 | bool mac_up; | ||
775 | bool link_up; | 806 | bool link_up; |
776 | bool link_fd; | 807 | bool link_fd; |
777 | unsigned int link_speed; | 808 | unsigned int link_speed; |