1
2
3
4
5
6#ifndef _LINUX_MII_TIMESTAMPER_H
7#define _LINUX_MII_TIMESTAMPER_H
8
9#include <linux/device.h>
10#include <linux/ethtool.h>
11#include <linux/skbuff.h>
12
13struct phy_device;
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46struct mii_timestamper {
47 bool (*rxtstamp)(struct mii_timestamper *mii_ts,
48 struct sk_buff *skb, int type);
49
50 void (*txtstamp)(struct mii_timestamper *mii_ts,
51 struct sk_buff *skb, int type);
52
53 int (*hwtstamp)(struct mii_timestamper *mii_ts,
54 struct ifreq *ifreq);
55
56 void (*link_state)(struct mii_timestamper *mii_ts,
57 struct phy_device *phydev);
58
59 int (*ts_info)(struct mii_timestamper *mii_ts,
60 struct ethtool_ts_info *ts_info);
61
62 struct device *device;
63};
64
65
66
67
68
69
70
71
72
73
74
75
76struct mii_timestamping_ctrl {
77 struct mii_timestamper *(*probe_channel)(struct device *device,
78 unsigned int port);
79 void (*release_channel)(struct device *device,
80 struct mii_timestamper *mii_ts);
81};
82
83#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
84
85int register_mii_tstamp_controller(struct device *device,
86 struct mii_timestamping_ctrl *ctrl);
87
88void unregister_mii_tstamp_controller(struct device *device);
89
90struct mii_timestamper *register_mii_timestamper(struct device_node *node,
91 unsigned int port);
92
93void unregister_mii_timestamper(struct mii_timestamper *mii_ts);
94
95#else
96
97static inline
98int register_mii_tstamp_controller(struct device *device,
99 struct mii_timestamping_ctrl *ctrl)
100{
101 return -EOPNOTSUPP;
102}
103
104static inline void unregister_mii_tstamp_controller(struct device *device)
105{
106}
107
108static inline
109struct mii_timestamper *register_mii_timestamper(struct device_node *node,
110 unsigned int port)
111{
112 return NULL;
113}
114
115static inline void unregister_mii_timestamper(struct mii_timestamper *mii_ts)
116{
117}
118
119#endif
120
121#endif
122