aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/net_driver.h
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-12-13 00:50:46 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-13 00:58:17 -0500
commit04cc8cacb01c09fba2297faf1477cd570ba43f0b (patch)
treef17dbd584b072d14f1500c6f6d659be993ae35c7 /drivers/net/sfc/net_driver.h
parent177dfcd80f28f8fbc3e22c2d8b24d21cb86f1d97 (diff)
sfc: Implement auto-negotiation
Add infrastructure for auto-negotiation of speed, duplex and flow control. When using 10Xpress, auto-negotiate flow control. While we're at it, clean up the code to warn when partner is not 10GBASE-T capable. 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.h38
1 files changed, 36 insertions, 2 deletions
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 883086e39455..fb8d72527a34 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -511,6 +511,35 @@ enum efx_mac_type {
511 EFX_XMAC = 2, 511 EFX_XMAC = 2,
512}; 512};
513 513
514static inline unsigned int efx_fc_advertise(enum efx_fc_type wanted_fc)
515{
516 unsigned int adv = 0;
517 if (wanted_fc & EFX_FC_RX)
518 adv = ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
519 if (wanted_fc & EFX_FC_TX)
520 adv ^= ADVERTISE_PAUSE_ASYM;
521 return adv;
522}
523
524static inline enum efx_fc_type efx_fc_resolve(enum efx_fc_type wanted_fc,
525 unsigned int lpa)
526{
527 unsigned int adv = efx_fc_advertise(wanted_fc);
528
529 if (!(wanted_fc & EFX_FC_AUTO))
530 return wanted_fc;
531
532 if (adv & lpa & ADVERTISE_PAUSE_CAP)
533 return EFX_FC_RX | EFX_FC_TX;
534 if (adv & lpa & ADVERTISE_PAUSE_ASYM) {
535 if (adv & ADVERTISE_PAUSE_CAP)
536 return EFX_FC_RX;
537 if (lpa & ADVERTISE_PAUSE_CAP)
538 return EFX_FC_TX;
539 }
540 return 0;
541}
542
514/** 543/**
515 * struct efx_mac_operations - Efx MAC operations table 544 * struct efx_mac_operations - Efx MAC operations table
516 * @reconfigure: Reconfigure MAC. Serialised by the mac_lock 545 * @reconfigure: Reconfigure MAC. Serialised by the mac_lock
@@ -533,6 +562,8 @@ struct efx_mac_operations {
533 * @check_hw: Check hardware 562 * @check_hw: Check hardware
534 * @get_settings: Get ethtool settings. Serialised by the mac_lock. 563 * @get_settings: Get ethtool settings. Serialised by the mac_lock.
535 * @set_settings: Set ethtool settings. Serialised by the mac_lock. 564 * @set_settings: Set ethtool settings. Serialised by the mac_lock.
565 * @set_xnp_advertise: Set abilities advertised in Extended Next Page
566 * (only needed where AN bit is set in mmds)
536 * @mmds: MMD presence mask 567 * @mmds: MMD presence mask
537 * @loopbacks: Supported loopback modes mask 568 * @loopbacks: Supported loopback modes mask
538 */ 569 */
@@ -548,6 +579,7 @@ struct efx_phy_operations {
548 struct ethtool_cmd *ecmd); 579 struct ethtool_cmd *ecmd);
549 int (*set_settings) (struct efx_nic *efx, 580 int (*set_settings) (struct efx_nic *efx,
550 struct ethtool_cmd *ecmd); 581 struct ethtool_cmd *ecmd);
582 bool (*set_xnp_advertise) (struct efx_nic *efx, u32);
551 int mmds; 583 int mmds;
552 unsigned loopbacks; 584 unsigned loopbacks;
553}; 585};
@@ -724,11 +756,12 @@ union efx_multicast_hash {
724 * @mac_up: MAC link state 756 * @mac_up: MAC link state
725 * @link_up: Link status 757 * @link_up: Link status
726 * @link_fd: Link is full duplex 758 * @link_fd: Link is full duplex
759 * @link_fc: Actualy flow control flags
727 * @link_speed: Link speed (Mbps) 760 * @link_speed: Link speed (Mbps)
728 * @n_link_state_changes: Number of times the link has changed state 761 * @n_link_state_changes: Number of times the link has changed state
729 * @promiscuous: Promiscuous flag. Protected by netif_tx_lock. 762 * @promiscuous: Promiscuous flag. Protected by netif_tx_lock.
730 * @multicast_hash: Multicast hash table 763 * @multicast_hash: Multicast hash table
731 * @flow_control: Flow control flags - separate RX/TX so can't use link_options 764 * @wanted_fc: Wanted flow control flags
732 * @reconfigure_work: work item for dealing with PHY events 765 * @reconfigure_work: work item for dealing with PHY events
733 * @loopback_mode: Loopback status 766 * @loopback_mode: Loopback status
734 * @loopback_modes: Supported loopback mode bitmask 767 * @loopback_modes: Supported loopback mode bitmask
@@ -805,12 +838,13 @@ struct efx_nic {
805 bool mac_up; 838 bool mac_up;
806 bool link_up; 839 bool link_up;
807 bool link_fd; 840 bool link_fd;
841 enum efx_fc_type link_fc;
808 unsigned int link_speed; 842 unsigned int link_speed;
809 unsigned int n_link_state_changes; 843 unsigned int n_link_state_changes;
810 844
811 bool promiscuous; 845 bool promiscuous;
812 union efx_multicast_hash multicast_hash; 846 union efx_multicast_hash multicast_hash;
813 enum efx_fc_type flow_control; 847 enum efx_fc_type wanted_fc;
814 struct work_struct reconfigure_work; 848 struct work_struct reconfigure_work;
815 849
816 atomic_t rx_reset; 850 atomic_t rx_reset;