Skip to content

Commit 4a11c55

Browse files
committed
Merge branch 'net-mscc-allow-forwarding-ioctl-operations-to-attached-PHYs'
Antoine Tenart says: ==================== net: mscc: allow forwarding ioctl operations to attached PHYs These two patches allow forwarding ioctl to the PHY MII implementation, and support is added for offloading timestamping operations to compatible attached PHYs. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 626a832 + b2e118f commit 4a11c55

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,18 +1204,19 @@ static int ocelot_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
12041204
struct ocelot *ocelot = priv->port.ocelot;
12051205
int port = priv->chip_port;
12061206

1207-
/* The function is only used for PTP operations for now */
1208-
if (!ocelot->ptp)
1209-
return -EOPNOTSUPP;
1210-
1211-
switch (cmd) {
1212-
case SIOCSHWTSTAMP:
1213-
return ocelot_hwstamp_set(ocelot, port, ifr);
1214-
case SIOCGHWTSTAMP:
1215-
return ocelot_hwstamp_get(ocelot, port, ifr);
1216-
default:
1217-
return -EOPNOTSUPP;
1207+
/* If the attached PHY device isn't capable of timestamping operations,
1208+
* use our own (when possible).
1209+
*/
1210+
if (!phy_has_hwtstamp(dev->phydev) && ocelot->ptp) {
1211+
switch (cmd) {
1212+
case SIOCSHWTSTAMP:
1213+
return ocelot_hwstamp_set(ocelot, port, ifr);
1214+
case SIOCGHWTSTAMP:
1215+
return ocelot_hwstamp_get(ocelot, port, ifr);
1216+
}
12181217
}
1218+
1219+
return phy_mii_ioctl(dev->phydev, ifr, cmd);
12191220
}
12201221

12211222
static const struct net_device_ops ocelot_port_netdev_ops = {

drivers/net/ethernet/mscc/ocelot_board.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg)
189189
skb->offload_fwd_mark = 1;
190190

191191
skb->protocol = eth_type_trans(skb, dev);
192-
netif_rx(skb);
192+
if (!skb_defer_rx_timestamp(skb))
193+
netif_rx(skb);
193194
dev->stats.rx_bytes += len;
194195
dev->stats.rx_packets++;
195196
} while (ocelot_read(ocelot, QS_XTR_DATA_PRESENT) & BIT(grp));

0 commit comments

Comments
 (0)