Add three string sets related to timestamping information: ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags ETH_SS_TS_TX_TYPES: timestamping Tx types ETH_SS_TS_RX_FILTERS: timestamping Rx filters These will be used for TIMESTAMP_GET request. v2: avoid compiler warning ("enumeration value not handled in switch") in net_hwtstamp_validate() v3: omit dash in Tx type names ("one-step-*" -> "onestep-*"), suggested by Richard Cochran
Unified · Split
| @@ -596,6 +596,9 @@ struct ethtool_pauseparam { · 595 unmodified lines | |||
| 596 | * @ETH_SS_LINK_MODES: link mode names | 596 | * @ETH_SS_LINK_MODES: link mode names |
| 597 | * @ETH_SS_MSG_CLASSES: debug message class names | 597 | * @ETH_SS_MSG_CLASSES: debug message class names |
| 598 | * @ETH_SS_WOL_MODES: wake-on-lan modes | 598 | * @ETH_SS_WOL_MODES: wake-on-lan modes |
| 599 | * @ETH_SS_SOF_TIMESTAMPING: SOF_TIMESTAMPING_* flags | ||
| 600 | * @ETH_SS_TS_TX_TYPES: timestamping Tx types | ||
| 601 | * @ETH_SS_TS_RX_FILTERS: timestamping Rx filters | ||
| 599 | */ | 602 | */ |
| 600 | enum ethtool_stringset { | 603 | enum ethtool_stringset { |
| 601 | ETH_SS_TEST = 0, | 604 | ETH_SS_TEST = 0, |
| @@ -610,6 +613,9 @@ enum ethtool_stringset { · 8 unmodified lines | |||
| 610 | ETH_SS_LINK_MODES, | 613 | ETH_SS_LINK_MODES, |
| 611 | ETH_SS_MSG_CLASSES, | 614 | ETH_SS_MSG_CLASSES, |
| 612 | ETH_SS_WOL_MODES, | 615 | ETH_SS_WOL_MODES, |
| 616 | ETH_SS_SOF_TIMESTAMPING, | ||
| 617 | ETH_SS_TS_TX_TYPES, | ||
| 618 | ETH_SS_TS_RX_FILTERS, | ||
| 613 | 619 | ||
| 614 | /* add new constants above here */ | 620 | /* add new constants above here */ |
| 615 | ETH_SS_COUNT | 621 | ETH_SS_COUNT |
| @@ -98,6 +98,9 @@ enum hwtstamp_tx_types { · 97 unmodified lines | |||
| 98 | * receive a time stamp via the socket error queue. | 98 | * receive a time stamp via the socket error queue. |
| 99 | */ | 99 | */ |
| 100 | HWTSTAMP_TX_ONESTEP_P2P, | 100 | HWTSTAMP_TX_ONESTEP_P2P, |
| 101 | |||
| 102 | /* add new constants above here */ | ||
| 103 | __HWTSTAMP_TX_CNT | ||
| 101 | }; | 104 | }; |
| 102 | 105 | ||
| 103 | /* possible values for hwtstamp_config->rx_filter */ | 106 | /* possible values for hwtstamp_config->rx_filter */ |
| @@ -140,6 +143,9 @@ enum hwtstamp_rx_filters { · 36 unmodified lines | |||
| 140 | 143 | ||
| 141 | /* NTP, UDP, all versions and packet modes */ | 144 | /* NTP, UDP, all versions and packet modes */ |
| 142 | HWTSTAMP_FILTER_NTP_ALL, | 145 | HWTSTAMP_FILTER_NTP_ALL, |
| 146 | |||
| 147 | /* add new constants above here */ | ||
| 148 | __HWTSTAMP_FILTER_CNT | ||
| 143 | }; | 149 | }; |
| 144 | 150 | ||
| 145 | /* SCM_TIMESTAMPING_PKTINFO control message */ | 151 | /* SCM_TIMESTAMPING_PKTINFO control message */ |
| @@ -190,6 +190,9 @@ static int net_hwtstamp_validate(struct ifreq *ifr) · 189 unmodified lines | |||
| 190 | case HWTSTAMP_TX_ONESTEP_P2P: | 190 | case HWTSTAMP_TX_ONESTEP_P2P: |
| 191 | tx_type_valid = 1; | 191 | tx_type_valid = 1; |
| 192 | break; | 192 | break; |
| 193 | case __HWTSTAMP_TX_CNT: | ||
| 194 | /* not a real value */ | ||
| 195 | break; | ||
| 193 | } | 196 | } |
| 194 | 197 | ||
| 195 | switch (rx_filter) { | 198 | switch (rx_filter) { |
| @@ -211,6 +214,9 @@ static int net_hwtstamp_validate(struct ifreq *ifr) · 15 unmodified lines | |||
| 211 | case HWTSTAMP_FILTER_NTP_ALL: | 214 | case HWTSTAMP_FILTER_NTP_ALL: |
| 212 | rx_filter_valid = 1; | 215 | rx_filter_valid = 1; |
| 213 | break; | 216 | break; |
| 217 | case __HWTSTAMP_FILTER_CNT: | ||
| 218 | /* not a real value */ | ||
| 219 | break; | ||
| 214 | } | 220 | } |
| 215 | 221 | ||
| 216 | if (!tx_type_valid || !rx_filter_valid) | 222 | if (!tx_type_valid || !rx_filter_valid) |
| @@ -1,5 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | 2 | ||
| 3 | #include <linux/net_tstamp.h> | ||
| 4 | |||
| 3 | #include "common.h" | 5 | #include "common.h" |
| 4 | 6 | ||
| 5 | const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = { | 7 | const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN] = { |
| @@ -204,6 +206,53 @@ const char wol_mode_names[][ETH_GSTRING_LEN] = { · 198 unmodified lines | |||
| 204 | }; | 206 | }; |
| 205 | static_assert(ARRAY_SIZE(wol_mode_names) == WOL_MODE_COUNT); | 207 | static_assert(ARRAY_SIZE(wol_mode_names) == WOL_MODE_COUNT); |
| 206 | 208 | ||
| 209 | const char sof_timestamping_names[][ETH_GSTRING_LEN] = { | ||
| 210 | [const_ilog2(SOF_TIMESTAMPING_TX_HARDWARE)] = "hardware-transmit", | ||
| 211 | [const_ilog2(SOF_TIMESTAMPING_TX_SOFTWARE)] = "software-transmit", | ||
| 212 | [const_ilog2(SOF_TIMESTAMPING_RX_HARDWARE)] = "hardware-receive", | ||
| 213 | [const_ilog2(SOF_TIMESTAMPING_RX_SOFTWARE)] = "software-receive", | ||
| 214 | [const_ilog2(SOF_TIMESTAMPING_SOFTWARE)] = "software-system-clock", | ||
| 215 | [const_ilog2(SOF_TIMESTAMPING_SYS_HARDWARE)] = "hardware-legacy-clock", | ||
| 216 | [const_ilog2(SOF_TIMESTAMPING_RAW_HARDWARE)] = "hardware-raw-clock", | ||
| 217 | [const_ilog2(SOF_TIMESTAMPING_OPT_ID)] = "option-id", | ||
| 218 | [const_ilog2(SOF_TIMESTAMPING_TX_SCHED)] = "sched-transmit", | ||
| 219 | [const_ilog2(SOF_TIMESTAMPING_TX_ACK)] = "ack-transmit", | ||
| 220 | [const_ilog2(SOF_TIMESTAMPING_OPT_CMSG)] = "option-cmsg", | ||
| 221 | [const_ilog2(SOF_TIMESTAMPING_OPT_TSONLY)] = "option-tsonly", | ||
| 222 | [const_ilog2(SOF_TIMESTAMPING_OPT_STATS)] = "option-stats", | ||
| 223 | [const_ilog2(SOF_TIMESTAMPING_OPT_PKTINFO)] = "option-pktinfo", | ||
| 224 | [const_ilog2(SOF_TIMESTAMPING_OPT_TX_SWHW)] = "option-tx-swhw", | ||
| 225 | }; | ||
| 226 | static_assert(ARRAY_SIZE(sof_timestamping_names) == __SOF_TIMESTAMPING_CNT); | ||
| 227 | |||
| 228 | const char ts_tx_type_names[][ETH_GSTRING_LEN] = { | ||
| 229 | [HWTSTAMP_TX_OFF] = "off", | ||
| 230 | [HWTSTAMP_TX_ON] = "on", | ||
| 231 | [HWTSTAMP_TX_ONESTEP_SYNC] = "onestep-sync", | ||
| 232 | [HWTSTAMP_TX_ONESTEP_P2P] = "onestep-p2p", | ||
| 233 | }; | ||
| 234 | static_assert(ARRAY_SIZE(ts_tx_type_names) == __HWTSTAMP_TX_CNT); | ||
| 235 | |||
| 236 | const char ts_rx_filter_names[][ETH_GSTRING_LEN] = { | ||
| 237 | [HWTSTAMP_FILTER_NONE] = "none", | ||
| 238 | [HWTSTAMP_FILTER_ALL] = "all", | ||
| 239 | [HWTSTAMP_FILTER_SOME] = "some", | ||
| 240 | [HWTSTAMP_FILTER_PTP_V1_L4_EVENT] = "ptpv1-l4-event", | ||
| 241 | [HWTSTAMP_FILTER_PTP_V1_L4_SYNC] = "ptpv1-l4-sync", | ||
| 242 | [HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ] = "ptpv1-l4-delay-req", | ||
| 243 | [HWTSTAMP_FILTER_PTP_V2_L4_EVENT] = "ptpv2-l4-event", | ||
| 244 | [HWTSTAMP_FILTER_PTP_V2_L4_SYNC] = "ptpv2-l4-sync", | ||
| 245 | [HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ] = "ptpv2-l4-delay-req", | ||
| 246 | [HWTSTAMP_FILTER_PTP_V2_L2_EVENT] = "ptpv2-l2-event", | ||
| 247 | [HWTSTAMP_FILTER_PTP_V2_L2_SYNC] = "ptpv2-l2-sync", | ||
| 248 | [HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ] = "ptpv2-l2-delay-req", | ||
| 249 | [HWTSTAMP_FILTER_PTP_V2_EVENT] = "ptpv2-event", | ||
| 250 | [HWTSTAMP_FILTER_PTP_V2_SYNC] = "ptpv2-sync", | ||
| 251 | [HWTSTAMP_FILTER_PTP_V2_DELAY_REQ] = "ptpv2-delay-req", | ||
| 252 | [HWTSTAMP_FILTER_NTP_ALL] = "ntp-all", | ||
| 253 | }; | ||
| 254 | static_assert(ARRAY_SIZE(ts_rx_filter_names) == __HWTSTAMP_FILTER_CNT); | ||
| 255 | |||
| 207 | /* return false if legacy contained non-0 deprecated fields | 256 | /* return false if legacy contained non-0 deprecated fields |
| 208 | * maxtxpkt/maxrxpkt. rest of ksettings always updated | 257 | * maxtxpkt/maxrxpkt. rest of ksettings always updated |
| 209 | */ | 258 | */ |
| @@ -12,6 +12,8 @@ · 11 unmodified lines | |||
| 12 | #define ETHTOOL_LINK_MODE(speed, type, duplex) \ | 12 | #define ETHTOOL_LINK_MODE(speed, type, duplex) \ |
| 13 | ETHTOOL_LINK_MODE_ ## speed ## base ## type ## _ ## duplex ## _BIT | 13 | ETHTOOL_LINK_MODE_ ## speed ## base ## type ## _ ## duplex ## _BIT |
| 14 | 14 | ||
| 15 | #define __SOF_TIMESTAMPING_CNT (const_ilog2(SOF_TIMESTAMPING_LAST) + 1) | ||
| 16 | |||
| 15 | extern const char | 17 | extern const char |
| 16 | netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]; | 18 | netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]; |
| 17 | extern const char | 19 | extern const char |
| @@ -23,6 +25,9 @@ phy_tunable_strings[__ETHTOOL_PHY_TUNABLE_COUNT][ETH_GSTRING_LEN]; · 5 unmodified lines | |||
| 23 | extern const char link_mode_names[][ETH_GSTRING_LEN]; | 25 | extern const char link_mode_names[][ETH_GSTRING_LEN]; |
| 24 | extern const char netif_msg_class_names[][ETH_GSTRING_LEN]; | 26 | extern const char netif_msg_class_names[][ETH_GSTRING_LEN]; |
| 25 | extern const char wol_mode_names[][ETH_GSTRING_LEN]; | 27 | extern const char wol_mode_names[][ETH_GSTRING_LEN]; |
| 28 | extern const char sof_timestamping_names[][ETH_GSTRING_LEN]; | ||
| 29 | extern const char ts_tx_type_names[][ETH_GSTRING_LEN]; | ||
| 30 | extern const char ts_rx_filter_names[][ETH_GSTRING_LEN]; | ||
| 26 | 31 | ||
| 27 | int __ethtool_get_link(struct net_device *dev); | 32 | int __ethtool_get_link(struct net_device *dev); |
| 28 | 33 | ||
| @@ -60,6 +60,21 @@ static const struct strset_info info_template[] = { · 59 unmodified lines | |||
| 60 | .count = WOL_MODE_COUNT, | 60 | .count = WOL_MODE_COUNT, |
| 61 | .strings = wol_mode_names, | 61 | .strings = wol_mode_names, |
| 62 | }, | 62 | }, |
| 63 | [ETH_SS_SOF_TIMESTAMPING] = { | ||
| 64 | .per_dev = false, | ||
| 65 | .count = __SOF_TIMESTAMPING_CNT, | ||
| 66 | .strings = sof_timestamping_names, | ||
| 67 | }, | ||
| 68 | [ETH_SS_TS_TX_TYPES] = { | ||
| 69 | .per_dev = false, | ||
| 70 | .count = __HWTSTAMP_TX_CNT, | ||
| 71 | .strings = ts_tx_type_names, | ||
| 72 | }, | ||
| 73 | [ETH_SS_TS_RX_FILTERS] = { | ||
| 74 | .per_dev = false, | ||
| 75 | .count = __HWTSTAMP_FILTER_CNT, | ||
| 76 | .strings = ts_rx_filter_names, | ||
| 77 | }, | ||
| 63 | }; | 78 | }; |
| 64 | 79 | ||
| 65 | struct strset_req_info { | 80 | struct strset_req_info { |