Skip to contentSkip to conversation

net: dp83640: fix SIOCSHWTSTAMP to update the struct with actual configuration

PATCH Applied Sergey Organov 3 participants 3 messages Jul 15, 2020 – Jul 16, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dp83640: fix SIOCSHWTSTAMP to update the struct with actual configuration

From Documentation/networking/timestamping.txt:

A driver which supports hardware time stamping shall update the struct with the actual, possibly more permissive configuration.

Do update the struct passed when we upscale the requested time stamping mode.

Fixes cb646e2b02b2 ("ptp: Added a clock driver for the National Semiconductor PHYTER.")
---
 drivers/net/phy/dp83640.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/phy/dp83640.c +4 -0
index ecbd5e0d685c..acb0aae60755 100644
@@ -1260,6 +1260,7 @@ static int dp83640_hwtstamp(struct mii_timestamper *mii_ts, struct ifreq *ifr)
 		dp83640->hwts_rx_en = 1;
 		dp83640->layer = PTP_CLASS_L4;
 		dp83640->version = PTP_CLASS_V1;
+		cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
 		break;
 	case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
 	case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
@@ -1267,6 +1268,7 @@ static int dp83640_hwtstamp(struct mii_timestamper *mii_ts, struct ifreq *ifr)
 		dp83640->hwts_rx_en = 1;
 		dp83640->layer = PTP_CLASS_L4;
 		dp83640->version = PTP_CLASS_V2;
+		cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
 		break;
 	case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
 	case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
@@ -1274,6 +1276,7 @@ static int dp83640_hwtstamp(struct mii_timestamper *mii_ts, struct ifreq *ifr)
 		dp83640->hwts_rx_en = 1;
 		dp83640->layer = PTP_CLASS_L2;
 		dp83640->version = PTP_CLASS_V2;
+		cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
 		break;
 	case HWTSTAMP_FILTER_PTP_V2_EVENT:
 	case HWTSTAMP_FILTER_PTP_V2_SYNC:
@@ -1281,6 +1284,7 @@ static int dp83640_hwtstamp(struct mii_timestamper *mii_ts, struct ifreq *ifr)
 		dp83640->hwts_rx_en = 1;
 		dp83640->layer = PTP_CLASS_L4 | PTP_CLASS_L2;
 		dp83640->version = PTP_CLASS_V2;
+		cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
 		break;
 	default:
 		return -ERANGE;
Signature · 1 line
2.10.0.1.g57b01a3
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Sergey Organov

From Documentation/networking/timestamping.txt:

A driver which supports hardware time stamping shall update the struct with the actual, possibly more permissive configuration.

Do update the struct passed when we upscale the requested time stamping mode.

Fixes cb646e2b02b2 ("ptp: Added a clock driver for the National Semiconductor PHYTER.")
maintainer Applied
#2 lore raw
Quoted 6 lines · On Thu, 16 Jul 2020 11:56:50 -0700 Richard Cochran wrote:
Quoted 5 lines · Sergey Organov

From Documentation/networking/timestamping.txt:

A driver which supports hardware time stamping shall update the struct with the actual, possibly more permissive configuration.

Quoted 7 lines
Quoted 5 lines

Do update the struct passed when we upscale the requested time stamping mode.

Fixes cb646e2b02b2 ("ptp: Added a clock driver for the National Semiconductor PHYTER.")

Applied, thank you!