aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ethtool.h
diff options
context:
space:
mode:
authorRichard Cochran <richardcochran@gmail.com>2012-04-03 18:59:17 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-04 05:28:45 -0400
commitc8f3a8c31069137fe0100e6920558f1a7487ef3c (patch)
tree891303875fcca8c8110c949955b87e1447dbcdfc /include/linux/ethtool.h
parent995a9090b2b7dc734351f3ac0ba8d913ffb87001 (diff)
ethtool: Introduce a method for getting time stamping capabilities.
This commit adds a new ethtool ioctl that exposes the SO_TIMESTAMPING capabilities of a network interface. In addition, user space programs can use this ioctl to discover the PTP Hardware Clock (PHC) device associated with the interface. Since software receive time stamps are handled by the stack, the generic ethtool code can answer the query correctly in case the MAC or PHY drivers lack special time stamping features. Signed-off-by: Richard Cochran <richardcochran@gmail.com> Reviewed-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/ethtool.h')
-rw-r--r--include/linux/ethtool.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index e1d9e0ede309..1769714447b3 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -726,6 +726,29 @@ struct ethtool_sfeatures {
726 struct ethtool_set_features_block features[0]; 726 struct ethtool_set_features_block features[0];
727}; 727};
728 728
729/**
730 * struct ethtool_ts_info - holds a device's timestamping and PHC association
731 * @cmd: command number = %ETHTOOL_GET_TS_INFO
732 * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
733 * @phc_index: device index of the associated PHC, or -1 if there is none
734 * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
735 * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
736 *
737 * The bits in the 'tx_types' and 'rx_filters' fields correspond to
738 * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
739 * respectively. For example, if the device supports HWTSTAMP_TX_ON,
740 * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
741 */
742struct ethtool_ts_info {
743 __u32 cmd;
744 __u32 so_timestamping;
745 __s32 phc_index;
746 __u32 tx_types;
747 __u32 tx_reserved[3];
748 __u32 rx_filters;
749 __u32 rx_reserved[3];
750};
751
729/* 752/*
730 * %ETHTOOL_SFEATURES changes features present in features[].valid to the 753 * %ETHTOOL_SFEATURES changes features present in features[].valid to the
731 * values of corresponding bits in features[].requested. Bits in .requested 754 * values of corresponding bits in features[].requested. Bits in .requested
@@ -893,6 +916,9 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
893 * and flag of the device. 916 * and flag of the device.
894 * @get_dump_data: Get dump data. 917 * @get_dump_data: Get dump data.
895 * @set_dump: Set dump specific flags to the device. 918 * @set_dump: Set dump specific flags to the device.
919 * @get_ts_info: Get the time stamping and PTP hardware clock capabilities.
920 * Drivers supporting transmit time stamps in software should set this to
921 * ethtool_op_get_ts_info().
896 * 922 *
897 * All operations are optional (i.e. the function pointer may be set 923 * All operations are optional (i.e. the function pointer may be set
898 * to %NULL) and callers must take this into account. Callers must 924 * to %NULL) and callers must take this into account. Callers must
@@ -955,6 +981,7 @@ struct ethtool_ops {
955 int (*get_dump_data)(struct net_device *, 981 int (*get_dump_data)(struct net_device *,
956 struct ethtool_dump *, void *); 982 struct ethtool_dump *, void *);
957 int (*set_dump)(struct net_device *, struct ethtool_dump *); 983 int (*set_dump)(struct net_device *, struct ethtool_dump *);
984 int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
958 985
959}; 986};
960#endif /* __KERNEL__ */ 987#endif /* __KERNEL__ */
@@ -1029,6 +1056,7 @@ struct ethtool_ops {
1029#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */ 1056#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
1030#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */ 1057#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
1031#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */ 1058#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
1059#define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
1032 1060
1033/* compatibility with older code */ 1061/* compatibility with older code */
1034#define SPARC_ETH_GSET ETHTOOL_GSET 1062#define SPARC_ETH_GSET ETHTOOL_GSET