Commit b2e118f6 authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller
Browse files

net: mscc: allow offloading timestamping operations to the PHY



This patch adds support for offloading timestamping operations not only
to the Ocelot switch (as already supported) but to compatible PHYs.
When both the PHY and the Ocelot switch support timestamping operations,
the PHY implementation is chosen as the timestamp will happen closer to
the medium.

Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7ff4f3f3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1204,7 +1204,10 @@ static int ocelot_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
	struct ocelot *ocelot = priv->port.ocelot;
	int port = priv->chip_port;

	if (ocelot->ptp) {
	/* If the attached PHY device isn't capable of timestamping operations,
	 * use our own (when possible).
	 */
	if (!phy_has_hwtstamp(dev->phydev) && ocelot->ptp) {
		switch (cmd) {
		case SIOCSHWTSTAMP:
			return ocelot_hwstamp_set(ocelot, port, ifr);
+2 −1
Original line number Diff line number Diff line
@@ -189,6 +189,7 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg)
			skb->offload_fwd_mark = 1;

		skb->protocol = eth_type_trans(skb, dev);
		if (!skb_defer_rx_timestamp(skb))
			netif_rx(skb);
		dev->stats.rx_bytes += len;
		dev->stats.rx_packets++;