diff mbox series

[net-next,2/3] net: axienet: Support software transmit time stamping.

Message ID 79b2d20c323484b8f86690ea56dae52b1be6a8e9.1576520432.git.richardcochran@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show
Series net: axienet: Fix random driver issues. | expand

Commit Message

Richard Cochran Dec. 16, 2019, 6:32 p.m. UTC
MAC drivers are expected to invoke the transmit time stamping hook in
order to support both software time stamping and PHY time stamping.
This patch adds the missing hook.  In addition, drivers calling
netif_rx() should first check for PHY time stamping by calling
skb_defer_rx_timestamp().

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 53644abe52da..05fa7371c39a 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -675,6 +675,9 @@  axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	cur_p->skb = skb;
 
 	tail_p = lp->tx_bd_p + sizeof(*lp->tx_bd_v) * lp->tx_bd_tail;
+
+	skb_tx_timestamp(skb);
+
 	/* Start the transfer */
 	axienet_dma_out32(lp, XAXIDMA_TX_TDESC_OFFSET, tail_p);
 	if (++lp->tx_bd_tail >= lp->tx_bd_num)
@@ -736,7 +739,8 @@  static void axienet_recv(struct net_device *ndev)
 			skb->ip_summed = CHECKSUM_COMPLETE;
 		}
 
-		netif_rx(skb);
+		if (!skb_defer_rx_timestamp(skb))
+			netif_rx(skb);
 
 		size += length;
 		packets++;
@@ -1367,6 +1371,7 @@  static const struct ethtool_ops axienet_ethtool_ops = {
 	.set_pauseparam = axienet_ethtools_set_pauseparam,
 	.get_coalesce   = axienet_ethtools_get_coalesce,
 	.set_coalesce   = axienet_ethtools_set_coalesce,
+	.get_ts_info	= ethtool_op_get_ts_info,
 	.get_link_ksettings = axienet_ethtools_get_link_ksettings,
 	.set_link_ksettings = axienet_ethtools_set_link_ksettings,
 };