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 | |
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')
-rw-r--r-- | drivers/net/sfc/efx.c | 12 | ||||
-rw-r--r-- | drivers/net/sfc/ethtool.c | 4 | ||||
-rw-r--r-- | drivers/net/sfc/falcon.c | 21 | ||||
-rw-r--r-- | drivers/net/sfc/falcon_boards.c | 2 | ||||
-rw-r--r-- | drivers/net/sfc/falcon_gmac.c | 13 | ||||
-rw-r--r-- | drivers/net/sfc/falcon_xmac.c | 8 | ||||
-rw-r--r-- | drivers/net/sfc/net_driver.h | 26 | ||||
-rw-r--r-- | drivers/net/sfc/qt202x_phy.c | 11 | ||||
-rw-r--r-- | drivers/net/sfc/selftest.c | 2 | ||||
-rw-r--r-- | drivers/net/sfc/tenxpress.c | 22 |
10 files changed, 68 insertions, 53 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index b91321126fe1..ea31141b1737 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -543,6 +543,8 @@ void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue, int delay) | |||
543 | */ | 543 | */ |
544 | static void efx_link_status_changed(struct efx_nic *efx) | 544 | static void efx_link_status_changed(struct efx_nic *efx) |
545 | { | 545 | { |
546 | struct efx_link_state *link_state = &efx->link_state; | ||
547 | |||
546 | /* SFC Bug 5356: A net_dev notifier is registered, so we must ensure | 548 | /* SFC Bug 5356: A net_dev notifier is registered, so we must ensure |
547 | * that no events are triggered between unregister_netdev() and the | 549 | * that no events are triggered between unregister_netdev() and the |
548 | * driver unloading. A more general condition is that NETDEV_CHANGE | 550 | * driver unloading. A more general condition is that NETDEV_CHANGE |
@@ -555,19 +557,19 @@ static void efx_link_status_changed(struct efx_nic *efx) | |||
555 | return; | 557 | return; |
556 | } | 558 | } |
557 | 559 | ||
558 | if (efx->link_up != netif_carrier_ok(efx->net_dev)) { | 560 | if (link_state->up != netif_carrier_ok(efx->net_dev)) { |
559 | efx->n_link_state_changes++; | 561 | efx->n_link_state_changes++; |
560 | 562 | ||
561 | if (efx->link_up) | 563 | if (link_state->up) |
562 | netif_carrier_on(efx->net_dev); | 564 | netif_carrier_on(efx->net_dev); |
563 | else | 565 | else |
564 | netif_carrier_off(efx->net_dev); | 566 | netif_carrier_off(efx->net_dev); |
565 | } | 567 | } |
566 | 568 | ||
567 | /* Status message for kernel log */ | 569 | /* Status message for kernel log */ |
568 | if (efx->link_up) { | 570 | if (link_state->up) { |
569 | EFX_INFO(efx, "link up at %uMbps %s-duplex (MTU %d)%s\n", | 571 | EFX_INFO(efx, "link up at %uMbps %s-duplex (MTU %d)%s\n", |
570 | efx->link_speed, efx->link_fd ? "full" : "half", | 572 | link_state->speed, link_state->fd ? "full" : "half", |
571 | efx->net_dev->mtu, | 573 | efx->net_dev->mtu, |
572 | (efx->promiscuous ? " [PROMISC]" : "")); | 574 | (efx->promiscuous ? " [PROMISC]" : "")); |
573 | } else { | 575 | } else { |
@@ -758,7 +760,7 @@ static void efx_fini_port(struct efx_nic *efx) | |||
758 | efx->phy_op->fini(efx); | 760 | efx->phy_op->fini(efx); |
759 | efx->port_initialized = false; | 761 | efx->port_initialized = false; |
760 | 762 | ||
761 | efx->link_up = false; | 763 | efx->link_state.up = false; |
762 | efx_link_status_changed(efx); | 764 | efx_link_status_changed(efx); |
763 | } | 765 | } |
764 | 766 | ||
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index bb415326c739..eb12f201ab00 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c | |||
@@ -539,7 +539,7 @@ static u32 efx_ethtool_get_link(struct net_device *net_dev) | |||
539 | { | 539 | { |
540 | struct efx_nic *efx = netdev_priv(net_dev); | 540 | struct efx_nic *efx = netdev_priv(net_dev); |
541 | 541 | ||
542 | return efx->link_up; | 542 | return efx->link_state.up; |
543 | } | 543 | } |
544 | 544 | ||
545 | static int efx_ethtool_get_eeprom_len(struct net_device *net_dev) | 545 | static int efx_ethtool_get_eeprom_len(struct net_device *net_dev) |
@@ -699,7 +699,7 @@ static int efx_ethtool_set_pauseparam(struct net_device *net_dev, | |||
699 | if (EFX_WORKAROUND_11482(efx) && reset) { | 699 | if (EFX_WORKAROUND_11482(efx) && reset) { |
700 | if (falcon_rev(efx) >= FALCON_REV_B0) { | 700 | if (falcon_rev(efx) >= FALCON_REV_B0) { |
701 | /* Recover by resetting the EM block */ | 701 | /* Recover by resetting the EM block */ |
702 | if (efx->link_up) | 702 | if (efx->link_state.up) |
703 | falcon_drain_tx_fifo(efx); | 703 | falcon_drain_tx_fifo(efx); |
704 | } else { | 704 | } else { |
705 | /* Schedule a reset to recover */ | 705 | /* Schedule a reset to recover */ |
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 | } |
diff --git a/drivers/net/sfc/falcon_boards.c b/drivers/net/sfc/falcon_boards.c index cdf7a0d6e386..333ccc14e523 100644 --- a/drivers/net/sfc/falcon_boards.c +++ b/drivers/net/sfc/falcon_boards.c | |||
@@ -85,7 +85,7 @@ static int efx_check_lm87(struct efx_nic *efx, unsigned mask) | |||
85 | s32 alarms1, alarms2; | 85 | s32 alarms1, alarms2; |
86 | 86 | ||
87 | /* If link is up then do not monitor temperature */ | 87 | /* If link is up then do not monitor temperature */ |
88 | if (EFX_WORKAROUND_7884(efx) && efx->link_up) | 88 | if (EFX_WORKAROUND_7884(efx) && efx->link_state.up) |
89 | return 0; | 89 | return 0; |
90 | 90 | ||
91 | alarms1 = i2c_smbus_read_byte_data(client, LM87_REG_ALARMS1); | 91 | alarms1 = i2c_smbus_read_byte_data(client, LM87_REG_ALARMS1); |
diff --git a/drivers/net/sfc/falcon_gmac.c b/drivers/net/sfc/falcon_gmac.c index 8a1b80d1ff28..967f3fb397c9 100644 --- a/drivers/net/sfc/falcon_gmac.c +++ b/drivers/net/sfc/falcon_gmac.c | |||
@@ -24,16 +24,17 @@ | |||
24 | 24 | ||
25 | static void falcon_reconfigure_gmac(struct efx_nic *efx) | 25 | static void falcon_reconfigure_gmac(struct efx_nic *efx) |
26 | { | 26 | { |
27 | struct efx_link_state *link_state = &efx->link_state; | ||
27 | bool loopback, tx_fc, rx_fc, bytemode; | 28 | bool loopback, tx_fc, rx_fc, bytemode; |
28 | int if_mode; | 29 | int if_mode; |
29 | unsigned int max_frame_len; | 30 | unsigned int max_frame_len; |
30 | efx_oword_t reg; | 31 | efx_oword_t reg; |
31 | 32 | ||
32 | /* Configuration register 1 */ | 33 | /* Configuration register 1 */ |
33 | tx_fc = (efx->link_fc & EFX_FC_TX) || !efx->link_fd; | 34 | tx_fc = (link_state->fc & EFX_FC_TX) || !link_state->fd; |
34 | rx_fc = !!(efx->link_fc & EFX_FC_RX); | 35 | rx_fc = !!(link_state->fc & EFX_FC_RX); |
35 | loopback = (efx->loopback_mode == LOOPBACK_GMAC); | 36 | loopback = (efx->loopback_mode == LOOPBACK_GMAC); |
36 | bytemode = (efx->link_speed == 1000); | 37 | bytemode = (link_state->speed == 1000); |
37 | 38 | ||
38 | EFX_POPULATE_OWORD_5(reg, | 39 | EFX_POPULATE_OWORD_5(reg, |
39 | FRF_AB_GM_LOOP, loopback, | 40 | FRF_AB_GM_LOOP, loopback, |
@@ -50,7 +51,7 @@ static void falcon_reconfigure_gmac(struct efx_nic *efx) | |||
50 | FRF_AB_GM_IF_MODE, if_mode, | 51 | FRF_AB_GM_IF_MODE, if_mode, |
51 | FRF_AB_GM_PAD_CRC_EN, 1, | 52 | FRF_AB_GM_PAD_CRC_EN, 1, |
52 | FRF_AB_GM_LEN_CHK, 1, | 53 | FRF_AB_GM_LEN_CHK, 1, |
53 | FRF_AB_GM_FD, efx->link_fd, | 54 | FRF_AB_GM_FD, link_state->fd, |
54 | FRF_AB_GM_PAMBL_LEN, 0x7/*datasheet recommended */); | 55 | FRF_AB_GM_PAMBL_LEN, 0x7/*datasheet recommended */); |
55 | 56 | ||
56 | efx_writeo(efx, ®, FR_AB_GM_CFG2); | 57 | efx_writeo(efx, ®, FR_AB_GM_CFG2); |
@@ -101,8 +102,8 @@ static void falcon_reconfigure_gmac(struct efx_nic *efx) | |||
101 | /* FIFO configuration register 5 */ | 102 | /* FIFO configuration register 5 */ |
102 | efx_reado(efx, ®, FR_AB_GMF_CFG5); | 103 | efx_reado(efx, ®, FR_AB_GMF_CFG5); |
103 | EFX_SET_OWORD_FIELD(reg, FRF_AB_GMF_CFGBYTMODE, bytemode); | 104 | EFX_SET_OWORD_FIELD(reg, FRF_AB_GMF_CFGBYTMODE, bytemode); |
104 | EFX_SET_OWORD_FIELD(reg, FRF_AB_GMF_CFGHDPLX, !efx->link_fd); | 105 | EFX_SET_OWORD_FIELD(reg, FRF_AB_GMF_CFGHDPLX, !link_state->fd); |
105 | EFX_SET_OWORD_FIELD(reg, FRF_AB_GMF_HSTDRPLT64, !efx->link_fd); | 106 | EFX_SET_OWORD_FIELD(reg, FRF_AB_GMF_HSTDRPLT64, !link_state->fd); |
106 | EFX_SET_OWORD_FIELD(reg, FRF_AB_GMF_HSTFLTRFRMDC_PAUSE, 0); | 107 | EFX_SET_OWORD_FIELD(reg, FRF_AB_GMF_HSTFLTRFRMDC_PAUSE, 0); |
107 | efx_writeo(efx, ®, FR_AB_GMF_CFG5); | 108 | efx_writeo(efx, ®, FR_AB_GMF_CFG5); |
108 | udelay(10); | 109 | udelay(10); |
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c index 7e57b4a54b37..69cb55fc615a 100644 --- a/drivers/net/sfc/falcon_xmac.c +++ b/drivers/net/sfc/falcon_xmac.c | |||
@@ -89,7 +89,7 @@ static void falcon_mask_status_intr(struct efx_nic *efx, bool enable) | |||
89 | return; | 89 | return; |
90 | 90 | ||
91 | /* We expect xgmii faults if the wireside link is up */ | 91 | /* We expect xgmii faults if the wireside link is up */ |
92 | if (!EFX_WORKAROUND_5147(efx) || !efx->link_up) | 92 | if (!EFX_WORKAROUND_5147(efx) || !efx->link_state.up) |
93 | return; | 93 | return; |
94 | 94 | ||
95 | /* We can only use this interrupt to signal the negative edge of | 95 | /* We can only use this interrupt to signal the negative edge of |
@@ -132,7 +132,7 @@ bool falcon_xaui_link_ok(struct efx_nic *efx) | |||
132 | efx_writeo(efx, ®, FR_AB_XX_CORE_STAT); | 132 | efx_writeo(efx, ®, FR_AB_XX_CORE_STAT); |
133 | 133 | ||
134 | /* If the link is up, then check the phy side of the xaui link */ | 134 | /* If the link is up, then check the phy side of the xaui link */ |
135 | if (efx->link_up && link_ok) | 135 | if (efx->link_state.up && link_ok) |
136 | if (efx->phy_op->mmds & (1 << MDIO_MMD_PHYXS)) | 136 | if (efx->phy_op->mmds & (1 << MDIO_MMD_PHYXS)) |
137 | link_ok = efx_mdio_phyxgxs_lane_sync(efx); | 137 | link_ok = efx_mdio_phyxgxs_lane_sync(efx); |
138 | 138 | ||
@@ -143,7 +143,7 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx) | |||
143 | { | 143 | { |
144 | unsigned int max_frame_len; | 144 | unsigned int max_frame_len; |
145 | efx_oword_t reg; | 145 | efx_oword_t reg; |
146 | bool rx_fc = !!(efx->link_fc & EFX_FC_RX); | 146 | bool rx_fc = !!(efx->link_state.fc & EFX_FC_RX); |
147 | 147 | ||
148 | /* Configure MAC - cut-thru mode is hard wired on */ | 148 | /* Configure MAC - cut-thru mode is hard wired on */ |
149 | EFX_POPULATE_DWORD_3(reg, | 149 | EFX_POPULATE_DWORD_3(reg, |
@@ -356,7 +356,7 @@ static void falcon_xmac_irq(struct efx_nic *efx) | |||
356 | 356 | ||
357 | static void falcon_poll_xmac(struct efx_nic *efx) | 357 | static void falcon_poll_xmac(struct efx_nic *efx) |
358 | { | 358 | { |
359 | if (!EFX_WORKAROUND_5147(efx) || !efx->link_up || efx->mac_up) | 359 | if (!EFX_WORKAROUND_5147(efx) || !efx->link_state.up || efx->mac_up) |
360 | return; | 360 | return; |
361 | 361 | ||
362 | falcon_mask_status_intr(efx, false); | 362 | falcon_mask_status_intr(efx, false); |
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 55d45a77a107..f2df32423c98 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -419,7 +419,7 @@ enum phy_type { | |||
419 | PHY_TYPE_MAX /* Insert any new items before this */ | 419 | PHY_TYPE_MAX /* Insert any new items before this */ |
420 | }; | 420 | }; |
421 | 421 | ||
422 | #define EFX_IS10G(efx) ((efx)->link_speed == 10000) | 422 | #define EFX_IS10G(efx) ((efx)->link_state.speed == 10000) |
423 | 423 | ||
424 | enum nic_state { | 424 | enum nic_state { |
425 | STATE_INIT = 0, | 425 | STATE_INIT = 0, |
@@ -468,6 +468,20 @@ enum efx_mac_type { | |||
468 | }; | 468 | }; |
469 | 469 | ||
470 | /** | 470 | /** |
471 | * struct efx_link_state - Current state of the link | ||
472 | * @up: Link is up | ||
473 | * @fd: Link is full-duplex | ||
474 | * @fc: Actual flow control flags | ||
475 | * @speed: Link speed (Mbps) | ||
476 | */ | ||
477 | struct efx_link_state { | ||
478 | bool up; | ||
479 | bool fd; | ||
480 | enum efx_fc_type fc; | ||
481 | unsigned int speed; | ||
482 | }; | ||
483 | |||
484 | /** | ||
471 | * struct efx_mac_operations - Efx MAC operations table | 485 | * struct efx_mac_operations - Efx MAC operations table |
472 | * @reconfigure: Reconfigure MAC. Serialised by the mac_lock | 486 | * @reconfigure: Reconfigure MAC. Serialised by the mac_lock |
473 | * @update_stats: Update statistics | 487 | * @update_stats: Update statistics |
@@ -691,10 +705,7 @@ union efx_multicast_hash { | |||
691 | * @mdio: PHY MDIO interface | 705 | * @mdio: PHY MDIO interface |
692 | * @phy_mode: PHY operating mode. Serialised by @mac_lock. | 706 | * @phy_mode: PHY operating mode. Serialised by @mac_lock. |
693 | * @mac_up: MAC link state | 707 | * @mac_up: MAC link state |
694 | * @link_up: Link status | 708 | * @link_state: Current state of the link |
695 | * @link_fd: Link is full duplex | ||
696 | * @link_fc: Actualy flow control flags | ||
697 | * @link_speed: Link speed (Mbps) | ||
698 | * @n_link_state_changes: Number of times the link has changed state | 709 | * @n_link_state_changes: Number of times the link has changed state |
699 | * @promiscuous: Promiscuous flag. Protected by netif_tx_lock. | 710 | * @promiscuous: Promiscuous flag. Protected by netif_tx_lock. |
700 | * @multicast_hash: Multicast hash table | 711 | * @multicast_hash: Multicast hash table |
@@ -780,10 +791,7 @@ struct efx_nic { | |||
780 | enum efx_phy_mode phy_mode; | 791 | enum efx_phy_mode phy_mode; |
781 | 792 | ||
782 | bool mac_up; | 793 | bool mac_up; |
783 | bool link_up; | 794 | struct efx_link_state link_state; |
784 | bool link_fd; | ||
785 | enum efx_fc_type link_fc; | ||
786 | unsigned int link_speed; | ||
787 | unsigned int n_link_state_changes; | 795 | unsigned int n_link_state_changes; |
788 | 796 | ||
789 | bool promiscuous; | 797 | bool promiscuous; |
diff --git a/drivers/net/sfc/qt202x_phy.c b/drivers/net/sfc/qt202x_phy.c index 73bc5ad227f4..8208ac0ffad7 100644 --- a/drivers/net/sfc/qt202x_phy.c +++ b/drivers/net/sfc/qt202x_phy.c | |||
@@ -182,13 +182,14 @@ static void qt202x_phy_poll(struct efx_nic *efx) | |||
182 | { | 182 | { |
183 | int link_up = qt202x_link_ok(efx); | 183 | int link_up = qt202x_link_ok(efx); |
184 | /* Simulate a PHY event if link state has changed */ | 184 | /* Simulate a PHY event if link state has changed */ |
185 | if (link_up != efx->link_up) | 185 | if (link_up != efx->link_state.up) |
186 | falcon_sim_phy_event(efx); | 186 | falcon_sim_phy_event(efx); |
187 | } | 187 | } |
188 | 188 | ||
189 | static void qt202x_phy_reconfigure(struct efx_nic *efx) | 189 | static void qt202x_phy_reconfigure(struct efx_nic *efx) |
190 | { | 190 | { |
191 | struct qt202x_phy_data *phy_data = efx->phy_data; | 191 | struct qt202x_phy_data *phy_data = efx->phy_data; |
192 | struct efx_link_state *link_state = &efx->link_state; | ||
192 | 193 | ||
193 | if (efx->phy_type == PHY_TYPE_QT2025C) { | 194 | if (efx->phy_type == PHY_TYPE_QT2025C) { |
194 | /* There are several different register bits which can | 195 | /* There are several different register bits which can |
@@ -215,10 +216,10 @@ static void qt202x_phy_reconfigure(struct efx_nic *efx) | |||
215 | efx_mdio_phy_reconfigure(efx); | 216 | efx_mdio_phy_reconfigure(efx); |
216 | 217 | ||
217 | phy_data->phy_mode = efx->phy_mode; | 218 | phy_data->phy_mode = efx->phy_mode; |
218 | efx->link_up = qt202x_link_ok(efx); | 219 | link_state->up = qt202x_link_ok(efx); |
219 | efx->link_speed = 10000; | 220 | link_state->speed = 10000; |
220 | efx->link_fd = true; | 221 | link_state->fd = true; |
221 | efx->link_fc = efx->wanted_fc; | 222 | link_state->fc = efx->wanted_fc; |
222 | } | 223 | } |
223 | 224 | ||
224 | static void qt202x_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) | 225 | static void qt202x_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) |
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c index 7a9386f97c42..70eb5f135573 100644 --- a/drivers/net/sfc/selftest.c +++ b/drivers/net/sfc/selftest.c | |||
@@ -614,7 +614,7 @@ static int efx_test_loopbacks(struct efx_nic *efx, struct efx_self_tests *tests, | |||
614 | /* We need both the phy and xaui links to be ok. | 614 | /* We need both the phy and xaui links to be ok. |
615 | * rather than relying on the falcon_xmac irq/poll | 615 | * rather than relying on the falcon_xmac irq/poll |
616 | * regime, just poll xaui directly */ | 616 | * regime, just poll xaui directly */ |
617 | link_up = efx->link_up; | 617 | link_up = efx->link_state.up; |
618 | if (link_up && EFX_IS10G(efx) && | 618 | if (link_up && EFX_IS10G(efx) && |
619 | !falcon_xaui_link_ok(efx)) | 619 | !falcon_xaui_link_ok(efx)) |
620 | link_up = false; | 620 | link_up = false; |
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c index cb5e0573c7f3..b001f38524f7 100644 --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c | |||
@@ -503,6 +503,7 @@ static void tenxpress_low_power(struct efx_nic *efx) | |||
503 | static void tenxpress_phy_reconfigure(struct efx_nic *efx) | 503 | static void tenxpress_phy_reconfigure(struct efx_nic *efx) |
504 | { | 504 | { |
505 | struct tenxpress_phy_data *phy_data = efx->phy_data; | 505 | struct tenxpress_phy_data *phy_data = efx->phy_data; |
506 | struct efx_link_state *link_state = &efx->link_state; | ||
506 | struct ethtool_cmd ecmd; | 507 | struct ethtool_cmd ecmd; |
507 | bool phy_mode_change, loop_reset; | 508 | bool phy_mode_change, loop_reset; |
508 | 509 | ||
@@ -545,37 +546,38 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx) | |||
545 | phy_data->phy_mode = efx->phy_mode; | 546 | phy_data->phy_mode = efx->phy_mode; |
546 | 547 | ||
547 | if (efx->phy_type == PHY_TYPE_SFX7101) { | 548 | if (efx->phy_type == PHY_TYPE_SFX7101) { |
548 | efx->link_speed = 10000; | 549 | link_state->speed = 10000; |
549 | efx->link_fd = true; | 550 | link_state->fd = true; |
550 | efx->link_up = sfx7101_link_ok(efx); | 551 | link_state->up = sfx7101_link_ok(efx); |
551 | } else { | 552 | } else { |
552 | efx->phy_op->get_settings(efx, &ecmd); | 553 | efx->phy_op->get_settings(efx, &ecmd); |
553 | efx->link_speed = ecmd.speed; | 554 | link_state->speed = ecmd.speed; |
554 | efx->link_fd = ecmd.duplex == DUPLEX_FULL; | 555 | link_state->fd = ecmd.duplex == DUPLEX_FULL; |
555 | efx->link_up = sft9001_link_ok(efx, &ecmd); | 556 | link_state->up = sft9001_link_ok(efx, &ecmd); |
556 | } | 557 | } |
557 | efx->link_fc = efx_mdio_get_pause(efx); | 558 | link_state->fc = efx_mdio_get_pause(efx); |
558 | } | 559 | } |
559 | 560 | ||
560 | /* Poll PHY for interrupt */ | 561 | /* Poll PHY for interrupt */ |
561 | static void tenxpress_phy_poll(struct efx_nic *efx) | 562 | static void tenxpress_phy_poll(struct efx_nic *efx) |
562 | { | 563 | { |
563 | struct tenxpress_phy_data *phy_data = efx->phy_data; | 564 | struct tenxpress_phy_data *phy_data = efx->phy_data; |
565 | struct efx_link_state *link_state = &efx->link_state; | ||
564 | bool change = false; | 566 | bool change = false; |
565 | 567 | ||
566 | if (efx->phy_type == PHY_TYPE_SFX7101) { | 568 | if (efx->phy_type == PHY_TYPE_SFX7101) { |
567 | bool link_ok = sfx7101_link_ok(efx); | 569 | bool link_ok = sfx7101_link_ok(efx); |
568 | if (link_ok != efx->link_up) { | 570 | if (link_ok != link_state->up) { |
569 | change = true; | 571 | change = true; |
570 | } else { | 572 | } else { |
571 | unsigned int link_fc = efx_mdio_get_pause(efx); | 573 | unsigned int link_fc = efx_mdio_get_pause(efx); |
572 | if (link_fc != efx->link_fc) | 574 | if (link_fc != link_state->fc) |
573 | change = true; | 575 | change = true; |
574 | } | 576 | } |
575 | sfx7101_check_bad_lp(efx, link_ok); | 577 | sfx7101_check_bad_lp(efx, link_ok); |
576 | } else if (efx->loopback_mode) { | 578 | } else if (efx->loopback_mode) { |
577 | bool link_ok = sft9001_link_ok(efx, NULL); | 579 | bool link_ok = sft9001_link_ok(efx, NULL); |
578 | if (link_ok != efx->link_up) | 580 | if (link_ok != link_state->up) |
579 | change = true; | 581 | change = true; |
580 | } else { | 582 | } else { |
581 | int status = efx_mdio_read(efx, MDIO_MMD_PMAPMD, | 583 | int status = efx_mdio_read(efx, MDIO_MMD_PMAPMD, |