0001
0002
0003
0004
0005
0006 #ifndef _LINUX_MII_TIMESTAMPER_H
0007 #define _LINUX_MII_TIMESTAMPER_H
0008
0009 #include <linux/device.h>
0010 #include <linux/ethtool.h>
0011 #include <linux/skbuff.h>
0012
0013 struct phy_device;
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 struct mii_timestamper {
0047 bool (*rxtstamp)(struct mii_timestamper *mii_ts,
0048 struct sk_buff *skb, int type);
0049
0050 void (*txtstamp)(struct mii_timestamper *mii_ts,
0051 struct sk_buff *skb, int type);
0052
0053 int (*hwtstamp)(struct mii_timestamper *mii_ts,
0054 struct ifreq *ifreq);
0055
0056 void (*link_state)(struct mii_timestamper *mii_ts,
0057 struct phy_device *phydev);
0058
0059 int (*ts_info)(struct mii_timestamper *mii_ts,
0060 struct ethtool_ts_info *ts_info);
0061
0062 struct device *device;
0063 };
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076 struct mii_timestamping_ctrl {
0077 struct mii_timestamper *(*probe_channel)(struct device *device,
0078 unsigned int port);
0079 void (*release_channel)(struct device *device,
0080 struct mii_timestamper *mii_ts);
0081 };
0082
0083 #ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
0084
0085 int register_mii_tstamp_controller(struct device *device,
0086 struct mii_timestamping_ctrl *ctrl);
0087
0088 void unregister_mii_tstamp_controller(struct device *device);
0089
0090 struct mii_timestamper *register_mii_timestamper(struct device_node *node,
0091 unsigned int port);
0092
0093 void unregister_mii_timestamper(struct mii_timestamper *mii_ts);
0094
0095 #else
0096
0097 static inline
0098 int register_mii_tstamp_controller(struct device *device,
0099 struct mii_timestamping_ctrl *ctrl)
0100 {
0101 return -EOPNOTSUPP;
0102 }
0103
0104 static inline void unregister_mii_tstamp_controller(struct device *device)
0105 {
0106 }
0107
0108 static inline
0109 struct mii_timestamper *register_mii_timestamper(struct device_node *node,
0110 unsigned int port)
0111 {
0112 return NULL;
0113 }
0114
0115 static inline void unregister_mii_timestamper(struct mii_timestamper *mii_ts)
0116 {
0117 }
0118
0119 #endif
0120
0121 #endif