1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
7 #include <net/pkt_sched.h>
9 #if IS_ENABLED(CONFIG_NET_DSA_SJA1105_TAS)
11 enum sja1105_tas_state
{
12 SJA1105_TAS_STATE_DISABLED
,
13 SJA1105_TAS_STATE_ENABLED_NOT_RUNNING
,
14 SJA1105_TAS_STATE_RUNNING
,
19 SJA1105_PTP_CLOCKSTEP
,
20 SJA1105_PTP_ADJUSTFREQ
,
23 struct sja1105_tas_data
{
24 struct tc_taprio_qopt_offload
*offload
[SJA1105_NUM_PORTS
];
25 enum sja1105_tas_state state
;
26 enum sja1105_ptp_op last_op
;
27 struct work_struct tas_work
;
28 s64 earliest_base_time
;
34 int sja1105_setup_tc_taprio(struct dsa_switch
*ds
, int port
,
35 struct tc_taprio_qopt_offload
*admin
);
37 void sja1105_tas_setup(struct dsa_switch
*ds
);
39 void sja1105_tas_teardown(struct dsa_switch
*ds
);
41 void sja1105_tas_clockstep(struct dsa_switch
*ds
);
43 void sja1105_tas_adjfreq(struct dsa_switch
*ds
);
47 /* C doesn't allow empty structures, bah! */
48 struct sja1105_tas_data
{
52 static inline int sja1105_setup_tc_taprio(struct dsa_switch
*ds
, int port
,
53 struct tc_taprio_qopt_offload
*admin
)
58 static inline void sja1105_tas_setup(struct dsa_switch
*ds
) { }
60 static inline void sja1105_tas_teardown(struct dsa_switch
*ds
) { }
62 static inline void sja1105_tas_clockstep(struct dsa_switch
*ds
) { }
64 static inline void sja1105_tas_adjfreq(struct dsa_switch
*ds
) { }
66 #endif /* IS_ENABLED(CONFIG_NET_DSA_SJA1105_TAS) */
68 #endif /* _SJA1105_TAS_H */