Skip to content

Commit

Permalink
sfc: Move xmac_poll_required into struct falcon_nic_data
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Dec 3, 2010
1 parent 40641ed commit cef68bd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion drivers/net/sfc/falcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ static bool
falcon_handle_global_event(struct efx_channel *channel, efx_qword_t *event)
{
struct efx_nic *efx = channel->efx;
struct falcon_nic_data *nic_data = efx->nic_data;

if (EFX_QWORD_FIELD(*event, FSF_AB_GLB_EV_G_PHY0_INTR) ||
EFX_QWORD_FIELD(*event, FSF_AB_GLB_EV_XG_PHY0_INTR) ||
Expand All @@ -895,7 +896,7 @@ falcon_handle_global_event(struct efx_channel *channel, efx_qword_t *event)

if ((efx_nic_rev(efx) == EFX_REV_FALCON_B0) &&
EFX_QWORD_FIELD(*event, FSF_BB_GLB_EV_XG_MGT_INTR)) {
efx->xmac_poll_required = true;
nic_data->xmac_poll_required = true;
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/net/sfc/falcon_boards.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,11 @@ static void sfe4001_fini(struct efx_nic *efx)

static int sfe4001_check_hw(struct efx_nic *efx)
{
struct falcon_nic_data *nic_data = efx->nic_data;
s32 status;

/* If XAUI link is up then do not monitor */
if (EFX_WORKAROUND_7884(efx) && !efx->xmac_poll_required)
if (EFX_WORKAROUND_7884(efx) && !nic_data->xmac_poll_required)
return 0;

/* Check the powered status of the PHY. Lack of power implies that
Expand Down
13 changes: 9 additions & 4 deletions drivers/net/sfc/falcon_xmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ int falcon_reset_xaui(struct efx_nic *efx)

static void falcon_ack_status_intr(struct efx_nic *efx)
{
struct falcon_nic_data *nic_data = efx->nic_data;
efx_oword_t reg;

if ((efx_nic_rev(efx) != EFX_REV_FALCON_B0) || LOOPBACK_INTERNAL(efx))
Expand All @@ -98,7 +99,7 @@ static void falcon_ack_status_intr(struct efx_nic *efx)

/* We can only use this interrupt to signal the negative edge of
* xaui_align [we have to poll the positive edge]. */
if (efx->xmac_poll_required)
if (nic_data->xmac_poll_required)
return;

efx_reado(efx, &reg, FR_AB_XM_MGT_INT_MSK);
Expand Down Expand Up @@ -276,12 +277,14 @@ static bool falcon_xmac_check_fault(struct efx_nic *efx)

static int falcon_reconfigure_xmac(struct efx_nic *efx)
{
struct falcon_nic_data *nic_data = efx->nic_data;

falcon_reconfigure_xgxs_core(efx);
falcon_reconfigure_xmac_core(efx);

falcon_reconfigure_mac_wrapper(efx);

efx->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 5);
nic_data->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 5);
falcon_ack_status_intr(efx);

return 0;
Expand Down Expand Up @@ -349,11 +352,13 @@ static void falcon_update_stats_xmac(struct efx_nic *efx)

void falcon_poll_xmac(struct efx_nic *efx)
{
struct falcon_nic_data *nic_data = efx->nic_data;

if (!EFX_WORKAROUND_5147(efx) || !efx->link_state.up ||
!efx->xmac_poll_required)
!nic_data->xmac_poll_required)
return;

efx->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 1);
nic_data->xmac_poll_required = !falcon_xmac_link_ok_retry(efx, 1);
falcon_ack_status_intr(efx);
}

Expand Down
2 changes: 0 additions & 2 deletions drivers/net/sfc/net_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ struct efx_filter_state;
* @mdio: PHY MDIO interface
* @mdio_bus: PHY MDIO bus ID (only used by Siena)
* @phy_mode: PHY operating mode. Serialised by @mac_lock.
* @xmac_poll_required: XMAC link state needs polling
* @link_advertising: Autonegotiation advertising flags
* @link_state: Current state of the link
* @n_link_state_changes: Number of times the link has changed state
Expand Down Expand Up @@ -771,7 +770,6 @@ struct efx_nic {
unsigned int mdio_bus;
enum efx_phy_mode phy_mode;

bool xmac_poll_required;
u32 link_advertising;
struct efx_link_state link_state;
unsigned int n_link_state_changes;
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/sfc/nic.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ struct falcon_board {
* @spi_eeprom: SPI EEPROM device
* @spi_lock: SPI bus lock
* @mdio_lock: MDIO bus lock
* @xmac_poll_required: XMAC link state needs polling
*/
struct falcon_nic_data {
struct pci_dev *pci_dev2;
Expand All @@ -130,6 +131,7 @@ struct falcon_nic_data {
struct efx_spi_device spi_eeprom;
struct mutex spi_lock;
struct mutex mdio_lock;
bool xmac_poll_required;
};

static inline struct falcon_board *falcon_board(struct efx_nic *efx)
Expand Down

0 comments on commit cef68bd

Please sign in to comment.