Revert "unicode: Don't special case ignorable code points"
[linux.git] / drivers / net / dsa / sja1105 / sja1105_tas.h
blobc05bd07e822157dd23685992d5189903713759fc
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
3 */
4 #ifndef _SJA1105_TAS_H
5 #define _SJA1105_TAS_H
7 #include <net/pkt_sched.h>
9 #define SJA1105_TAS_MAX_DELTA BIT(18)
11 struct sja1105_private;
13 #if IS_ENABLED(CONFIG_NET_DSA_SJA1105_TAS)
15 enum sja1105_tas_state {
16 SJA1105_TAS_STATE_DISABLED,
17 SJA1105_TAS_STATE_ENABLED_NOT_RUNNING,
18 SJA1105_TAS_STATE_RUNNING,
21 enum sja1105_ptp_op {
22 SJA1105_PTP_NONE,
23 SJA1105_PTP_CLOCKSTEP,
24 SJA1105_PTP_ADJUSTFREQ,
27 struct sja1105_gate_entry {
28 struct list_head list;
29 struct sja1105_rule *rule;
30 s64 interval;
31 u8 gate_state;
34 struct sja1105_gating_config {
35 u64 cycle_time;
36 s64 base_time;
37 int num_entries;
38 struct list_head entries;
41 struct sja1105_tas_data {
42 struct tc_taprio_qopt_offload *offload[SJA1105_MAX_NUM_PORTS];
43 struct sja1105_gating_config gating_cfg;
44 enum sja1105_tas_state state;
45 enum sja1105_ptp_op last_op;
46 struct work_struct tas_work;
47 s64 earliest_base_time;
48 s64 oper_base_time;
49 u64 max_cycle_time;
50 bool enabled;
53 int sja1105_setup_tc_taprio(struct dsa_switch *ds, int port,
54 struct tc_taprio_qopt_offload *admin);
56 void sja1105_tas_setup(struct dsa_switch *ds);
58 void sja1105_tas_teardown(struct dsa_switch *ds);
60 void sja1105_tas_clockstep(struct dsa_switch *ds);
62 void sja1105_tas_adjfreq(struct dsa_switch *ds);
64 bool sja1105_gating_check_conflicts(struct sja1105_private *priv, int port,
65 struct netlink_ext_ack *extack);
67 int sja1105_init_scheduling(struct sja1105_private *priv);
69 #else
71 /* C doesn't allow empty structures, bah! */
72 struct sja1105_tas_data {
73 u8 dummy;
76 static inline int sja1105_setup_tc_taprio(struct dsa_switch *ds, int port,
77 struct tc_taprio_qopt_offload *admin)
79 return -EOPNOTSUPP;
82 static inline void sja1105_tas_setup(struct dsa_switch *ds) { }
84 static inline void sja1105_tas_teardown(struct dsa_switch *ds) { }
86 static inline void sja1105_tas_clockstep(struct dsa_switch *ds) { }
88 static inline void sja1105_tas_adjfreq(struct dsa_switch *ds) { }
90 static inline bool
91 sja1105_gating_check_conflicts(struct dsa_switch *ds, int port,
92 struct netlink_ext_ack *extack)
94 return true;
97 static inline int sja1105_init_scheduling(struct sja1105_private *priv)
99 return 0;
102 #endif /* IS_ENABLED(CONFIG_NET_DSA_SJA1105_TAS) */
104 #endif /* _SJA1105_TAS_H */