Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: mscc: ocelot: don't downgrade timestamping RX filters in SIOCSHWTSTAMP

The ocelot driver, when asked to timestamp all receiving packets, 1588
v1 or NTP, says "nah, here's 1588 v2 for you".

According to this discussion:
https://patchwork.kernel.org/project/netdevbpf/patch/20211104133204.19757-8-martin.kaistra@linutronix.de/#24577647
drivers that downgrade from a wider request to a narrower response (or
even a response where the intersection with the request is empty) are
buggy, and should return -ERANGE instead. This patch fixes that.

Fixes: 4e3b0468e6d7 ("net: mscc: PTP Hardware Clock (PHC) support")
Suggested-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Vladimir Oltean and committed by
Jakub Kicinski
8a075464 b32e521e

-6
-6
drivers/net/ethernet/mscc/ocelot.c
··· 1320 1320 switch (cfg.rx_filter) { 1321 1321 case HWTSTAMP_FILTER_NONE: 1322 1322 break; 1323 - case HWTSTAMP_FILTER_ALL: 1324 - case HWTSTAMP_FILTER_SOME: 1325 - case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: 1326 - case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: 1327 - case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: 1328 - case HWTSTAMP_FILTER_NTP_ALL: 1329 1323 case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: 1330 1324 case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: 1331 1325 case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: