Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9007b9fa authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller
Browse files

sfc: Simplify XMAC link polling



From: Steve Hodgson <shodgson@solarflare.com>

Only the XMAC on Falcon needs help from the driver to poll and reset
the MAC-PHY link (XAUI); GMII is a simple parallel bus and on later
NICs firmware takes care of the XAUI link.  Also, an XMAC interrupt
currently schedules a work item which simply clears a flag
(efx_nic::mac_up) to be checked by the regular monitor (or the next
link reconfiguration, if that is sooner).

Rename the flag to xmac_poll_required, changing its sense.  Remove the
needless indirection and just set the flag immediately.  Call
falcon_xmac_poll() directly where required.

Add a new generic operation mac_op::check_fault to check the link
outside of regular monitoring, as required during self-tests.

(Note that this leaves us with an unused work item, but we will
immediately have another use for it.)

Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fe75820b
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -693,8 +693,6 @@ static void efx_mac_work(struct work_struct *data)
	struct efx_nic *efx = container_of(data, struct efx_nic, mac_work);

	mutex_lock(&efx->mac_lock);
	if (efx->port_enabled)
		efx->mac_op->irq(efx);
	mutex_unlock(&efx->mac_lock);
}

@@ -774,7 +772,6 @@ static void efx_start_port(struct efx_nic *efx)
	mutex_lock(&efx->mac_lock);
	efx->port_enabled = true;
	__efx_reconfigure_port(efx);
	efx->mac_op->irq(efx);
	mutex_unlock(&efx->mac_lock);
}

@@ -1903,8 +1900,6 @@ void efx_port_dummy_op_set_id_led(struct efx_nic *efx, enum efx_led_mode mode)

static struct efx_mac_operations efx_dummy_mac_operations = {
	.reconfigure	= efx_port_dummy_op_void,
	.poll		= efx_port_dummy_op_void,
	.irq		= efx_port_dummy_op_void,
};

static struct efx_phy_operations efx_dummy_phy_operations = {
+4 −3
Original line number Diff line number Diff line
@@ -900,7 +900,7 @@ static void falcon_handle_global_event(struct efx_channel *channel,

	if ((falcon_rev(efx) >= FALCON_REV_B0) &&
	    EFX_QWORD_FIELD(*event, FSF_BB_GLB_EV_XG_MGT_INTR)) {
		queue_work(efx->workqueue, &efx->mac_work);
		efx->xmac_poll_required = true;
		handled = true;
	}

@@ -2251,7 +2251,7 @@ int falcon_switch_mac(struct efx_nic *efx)

	EFX_LOG(efx, "selected %cMAC\n", EFX_IS10G(efx) ? 'X' : 'G');
	/* Not all macs support a mac-level link state */
	efx->mac_up = true;
	efx->xmac_poll_required = false;

	rc = falcon_reset_macs(efx);
out:
@@ -2624,7 +2624,8 @@ void falcon_monitor(struct efx_nic *efx)
		falcon_sim_phy_event(efx);
	}
	efx->phy_op->poll(efx);
	efx->mac_op->poll(efx);
	if (EFX_IS10G(efx))
		falcon_poll_xmac(efx);
}

/* Zeroes out the SRAM contents.  This routine must be called in
+2 −0
Original line number Diff line number Diff line
@@ -209,4 +209,6 @@ extern int falcon_test_registers(struct efx_nic *efx);
extern void falcon_generate_event(struct efx_channel *channel,
				  efx_qword_t *event);

extern void falcon_poll_xmac(struct efx_nic *efx);

#endif /* EFX_FALCON_H */
+2 −2
Original line number Diff line number Diff line
@@ -380,7 +380,7 @@ static int sfe4001_check_hw(struct efx_nic *efx)
	s32 status;

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

	/* Check the powered status of the PHY. Lack of power implies that
@@ -468,7 +468,7 @@ static int sfn4111t_check_hw(struct efx_nic *efx)
	s32 status;

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

	/* Test LHIGH, RHIGH, FAULT, EOT and IOT alarms */
+6 −2
Original line number Diff line number Diff line
@@ -216,9 +216,13 @@ static void falcon_update_stats_gmac(struct efx_nic *efx)
	mac_stats->rx_lt64 = mac_stats->rx_good_lt64 + mac_stats->rx_bad_lt64;
}

static bool falcon_gmac_check_fault(struct efx_nic *efx)
{
	return false;
}

struct efx_mac_operations falcon_gmac_operations = {
	.reconfigure	= falcon_reconfigure_gmac,
	.update_stats	= falcon_update_stats_gmac,
	.irq		= efx_port_dummy_op_void,
	.poll		= efx_port_dummy_op_void,
	.check_fault 	= falcon_gmac_check_fault,
};
Loading