summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/cadence/macb_ptp.c
diff options
context:
space:
mode:
authorHarini Katakam <harini.katakam@xilinx.com>2022-05-18 20:07:56 +0300
committerJakub Kicinski <kuba@kernel.org>2022-05-20 02:58:16 +0300
commit5cebb40bc9554aafcc492431181f43c6231b0459 (patch)
treecd8f827ed7daeed8360d517c1b52efd4de7fd0c5 /drivers/net/ethernet/cadence/macb_ptp.c
parentd904c8cc0302393640bc29ee62193f88ddc53126 (diff)
downloadlinux-5cebb40bc9554aafcc492431181f43c6231b0459.tar.xz
net: macb: Fix PTP one step sync support
PTP one step sync packets cannot have CSUM padding and insertion in SW since time stamp is inserted on the fly by HW. In addition, ptp4l version 3.0 and above report an error when skb timestamps are reported for packets that not processed for TX TS after transmission. Add a helper to identify PTP one step sync and fix the above two errors. Add a common mask for PTP header flag field "twoStepflag". Also reset ptp OSS bit when one step is not selected. Fixes: ab91f0a9b5f4 ("net: macb: Add hardware PTP support") Fixes: 653e92a9175e ("net: macb: add support for padding and fcs computation") Signed-off-by: Harini Katakam <harini.katakam@xilinx.com> Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com> Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/20220518170756.7752-1-harini.katakam@xilinx.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/cadence/macb_ptp.c')
-rw-r--r--drivers/net/ethernet/cadence/macb_ptp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c
index fb6b27f46b15..9559c16078f9 100644
--- a/drivers/net/ethernet/cadence/macb_ptp.c
+++ b/drivers/net/ethernet/cadence/macb_ptp.c
@@ -470,8 +470,10 @@ int gem_set_hwtst(struct net_device *dev, struct ifreq *ifr, int cmd)
case HWTSTAMP_TX_ONESTEP_SYNC:
if (gem_ptp_set_one_step_sync(bp, 1) != 0)
return -ERANGE;
- fallthrough;
+ tx_bd_control = TSTAMP_ALL_FRAMES;
+ break;
case HWTSTAMP_TX_ON:
+ gem_ptp_set_one_step_sync(bp, 0);
tx_bd_control = TSTAMP_ALL_FRAMES;
break;
default: