diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-11-23 11:06:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-24 13:58:53 -0500 |
commit | eb50c0d67fe3c5513c717c2dee6d9771c51be703 (patch) | |
tree | 449f56f6c8fac242be9ac57663ad98128524b404 /drivers/net/sfc/falcon.c | |
parent | e775fb93a880d218ce0b3fd405278dd78f86c405 (diff) |
sfc: Gather link state fields in struct efx_nic into new struct efx_link_state
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/falcon.c')
-rw-r--r-- | drivers/net/sfc/falcon.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index ff15b9dd3618..6eee4b796c43 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c | |||
@@ -1905,7 +1905,7 @@ static int falcon_reset_macs(struct efx_nic *efx) | |||
1905 | 1905 | ||
1906 | /* If we've reset the EM block and the link is up, then | 1906 | /* If we've reset the EM block and the link is up, then |
1907 | * we'll have to kick the XAUI link so the PHY can recover */ | 1907 | * we'll have to kick the XAUI link so the PHY can recover */ |
1908 | if (efx->link_up && EFX_IS10G(efx) && EFX_WORKAROUND_5147(efx)) | 1908 | if (efx->link_state.up && EFX_IS10G(efx) && EFX_WORKAROUND_5147(efx)) |
1909 | falcon_reset_xaui(efx); | 1909 | falcon_reset_xaui(efx); |
1910 | 1910 | ||
1911 | return 0; | 1911 | return 0; |
@@ -1939,17 +1939,18 @@ void falcon_deconfigure_mac_wrapper(struct efx_nic *efx) | |||
1939 | EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_INGR_EN, 0); | 1939 | EFX_SET_OWORD_FIELD(reg, FRF_BZ_RX_INGR_EN, 0); |
1940 | efx_writeo(efx, ®, FR_AZ_RX_CFG); | 1940 | efx_writeo(efx, ®, FR_AZ_RX_CFG); |
1941 | 1941 | ||
1942 | if (!efx->link_up) | 1942 | if (!efx->link_state.up) |
1943 | falcon_drain_tx_fifo(efx); | 1943 | falcon_drain_tx_fifo(efx); |
1944 | } | 1944 | } |
1945 | 1945 | ||
1946 | void falcon_reconfigure_mac_wrapper(struct efx_nic *efx) | 1946 | void falcon_reconfigure_mac_wrapper(struct efx_nic *efx) |
1947 | { | 1947 | { |
1948 | struct efx_link_state *link_state = &efx->link_state; | ||
1948 | efx_oword_t reg; | 1949 | efx_oword_t reg; |
1949 | int link_speed; | 1950 | int link_speed; |
1950 | bool tx_fc; | 1951 | bool tx_fc; |
1951 | 1952 | ||
1952 | switch (efx->link_speed) { | 1953 | switch (link_state->speed) { |
1953 | case 10000: link_speed = 3; break; | 1954 | case 10000: link_speed = 3; break; |
1954 | case 1000: link_speed = 2; break; | 1955 | case 1000: link_speed = 2; break; |
1955 | case 100: link_speed = 1; break; | 1956 | case 100: link_speed = 1; break; |
@@ -1969,7 +1970,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx) | |||
1969 | * discarded. */ | 1970 | * discarded. */ |
1970 | if (falcon_rev(efx) >= FALCON_REV_B0) { | 1971 | if (falcon_rev(efx) >= FALCON_REV_B0) { |
1971 | EFX_SET_OWORD_FIELD(reg, FRF_BB_TXFIFO_DRAIN_EN, | 1972 | EFX_SET_OWORD_FIELD(reg, FRF_BB_TXFIFO_DRAIN_EN, |
1972 | !efx->link_up); | 1973 | !link_state->up); |
1973 | } | 1974 | } |
1974 | 1975 | ||
1975 | efx_writeo(efx, ®, FR_AB_MAC_CTRL); | 1976 | efx_writeo(efx, ®, FR_AB_MAC_CTRL); |
@@ -1980,7 +1981,7 @@ void falcon_reconfigure_mac_wrapper(struct efx_nic *efx) | |||
1980 | /* Transmission of pause frames when RX crosses the threshold is | 1981 | /* Transmission of pause frames when RX crosses the threshold is |
1981 | * covered by RX_XOFF_MAC_EN and XM_TX_CFG_REG:XM_FCNTL. | 1982 | * covered by RX_XOFF_MAC_EN and XM_TX_CFG_REG:XM_FCNTL. |
1982 | * Action on receipt of pause frames is controller by XM_DIS_FCNTL */ | 1983 | * Action on receipt of pause frames is controller by XM_DIS_FCNTL */ |
1983 | tx_fc = !!(efx->link_fc & EFX_FC_TX); | 1984 | tx_fc = !!(efx->link_state.fc & EFX_FC_TX); |
1984 | efx_reado(efx, ®, FR_AZ_RX_CFG); | 1985 | efx_reado(efx, ®, FR_AZ_RX_CFG); |
1985 | EFX_SET_OWORD_FIELD(reg, FRF_AZ_RX_XOFF_MAC_EN, tx_fc); | 1986 | EFX_SET_OWORD_FIELD(reg, FRF_AZ_RX_XOFF_MAC_EN, tx_fc); |
1986 | 1987 | ||
@@ -2175,11 +2176,11 @@ int falcon_switch_mac(struct efx_nic *efx) | |||
2175 | 2176 | ||
2176 | /* Internal loopbacks override the phy speed setting */ | 2177 | /* Internal loopbacks override the phy speed setting */ |
2177 | if (efx->loopback_mode == LOOPBACK_GMAC) { | 2178 | if (efx->loopback_mode == LOOPBACK_GMAC) { |
2178 | efx->link_speed = 1000; | 2179 | efx->link_state.speed = 1000; |
2179 | efx->link_fd = true; | 2180 | efx->link_state.fd = true; |
2180 | } else if (LOOPBACK_INTERNAL(efx)) { | 2181 | } else if (LOOPBACK_INTERNAL(efx)) { |
2181 | efx->link_speed = 10000; | 2182 | efx->link_state.speed = 10000; |
2182 | efx->link_fd = true; | 2183 | efx->link_state.fd = true; |
2183 | } | 2184 | } |
2184 | 2185 | ||
2185 | WARN_ON(!mutex_is_locked(&efx->mac_lock)); | 2186 | WARN_ON(!mutex_is_locked(&efx->mac_lock)); |
@@ -2752,7 +2753,7 @@ static int falcon_probe_nic_variant(struct efx_nic *efx) | |||
2752 | } | 2753 | } |
2753 | 2754 | ||
2754 | /* Initial assumed speed */ | 2755 | /* Initial assumed speed */ |
2755 | efx->link_speed = EFX_OWORD_FIELD(nic_stat, FRF_AB_STRAP_10G) ? 10000 : 1000; | 2756 | efx->link_state.speed = EFX_OWORD_FIELD(nic_stat, FRF_AB_STRAP_10G) ? 10000 : 1000; |
2756 | 2757 | ||
2757 | return 0; | 2758 | return 0; |
2758 | } | 2759 | } |