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

Commit 7c236c43 authored by Stuart Hodgson's avatar Stuart Hodgson Committed by Ben Hutchings
Browse files

sfc: Add support for IEEE-1588 PTP



Add PTP IEEE-1588 support and make accesible via the PHC subsystem.

This work is based on prior code by Andrew Jackson

Signed-off-by: default avatarStuart Hodgson <smhodgson@solarflare.com>
[bwh:
 - Add byte order conversion in efx_ptp_send_times()
 - Simplify conversion of PPS event times
 - Add the built-in vs module check to CONFIG_SFC_PTP dependencies]
Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
parent 576eda8b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -34,3 +34,10 @@ config SFC_SRIOV
	  This enables support for the SFC9000 I/O Virtualization
	  features, allowing accelerated network performance in
	  virtualized environments.
config SFC_PTP
	bool "Solarflare SFC9000-family PTP support"
	depends on SFC && PTP_1588_CLOCK && !(SFC=y && PTP_1588_CLOCK=m)
	default y
	---help---
	  This enables support for the Precision Time Protocol (PTP)
	  on SFC9000-family NICs
+1 −0
Original line number Diff line number Diff line
@@ -5,5 +5,6 @@ sfc-y += efx.o nic.o falcon.o siena.o tx.o rx.o filter.o \
			   mcdi.o mcdi_phy.o mcdi_mon.o
sfc-$(CONFIG_SFC_MTD)	+= mtd.o
sfc-$(CONFIG_SFC_SRIOV)	+= siena_sriov.o
sfc-$(CONFIG_SFC_PTP)	+= ptp.o

obj-$(CONFIG_SFC)	+= sfc.o
+3 −0
Original line number Diff line number Diff line
@@ -1779,6 +1779,9 @@ static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
	struct efx_nic *efx = netdev_priv(net_dev);
	struct mii_ioctl_data *data = if_mii(ifr);

	if (cmd == SIOCSHWTSTAMP)
		return efx_ptp_ioctl(efx, ifr, cmd);

	/* Convert phy_id from older PRTAD/DEVAD format */
	if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) &&
	    (data->phy_id & 0xfc00) == 0x0400)
+1 −0
Original line number Diff line number Diff line
@@ -1174,6 +1174,7 @@ const struct ethtool_ops efx_ethtool_ops = {
	.get_rxfh_indir_size	= efx_ethtool_get_rxfh_indir_size,
	.get_rxfh_indir		= efx_ethtool_get_rxfh_indir,
	.set_rxfh_indir		= efx_ethtool_set_rxfh_indir,
	.get_ts_info		= efx_ptp_get_ts_info,
	.get_module_info	= efx_ethtool_get_module_info,
	.get_module_eeprom	= efx_ethtool_get_module_eeprom,
};
+5 −0
Original line number Diff line number Diff line
@@ -578,6 +578,11 @@ void efx_mcdi_process_event(struct efx_channel *channel,
	case MCDI_EVENT_CODE_FLR:
		efx_sriov_flr(efx, MCDI_EVENT_FIELD(*event, FLR_VF));
		break;
	case MCDI_EVENT_CODE_PTP_RX:
	case MCDI_EVENT_CODE_PTP_FAULT:
	case MCDI_EVENT_CODE_PTP_PPS:
		efx_ptp_event(efx, event);
		break;

	default:
		netif_err(efx, hw, efx->net_dev, "Unknown MCDI event 0x%x\n",
Loading