xref: /linux/drivers/net/dsa/sja1105/sja1105_vl.h (revision 7bb377107c72a40ab7505341f8626c8eb79a0cb7)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright 2020, NXP Semiconductors
3  */
4 #ifndef _SJA1105_VL_H
5 #define _SJA1105_VL_H
6 
7 #if IS_ENABLED(CONFIG_NET_DSA_SJA1105_VL)
8 
9 int sja1105_vl_redirect(struct sja1105_private *priv, int port,
10 			struct netlink_ext_ack *extack, unsigned long cookie,
11 			struct sja1105_key *key, unsigned long destports,
12 			bool append);
13 
14 int sja1105_vl_delete(struct sja1105_private *priv, int port,
15 		      struct sja1105_rule *rule,
16 		      struct netlink_ext_ack *extack);
17 
18 int sja1105_vl_gate(struct sja1105_private *priv, int port,
19 		    struct netlink_ext_ack *extack, unsigned long cookie,
20 		    struct sja1105_key *key, u32 index, s32 prio,
21 		    u64 base_time, u64 cycle_time, u64 cycle_time_ext,
22 		    u32 num_entries, struct action_gate_entry *entries);
23 
24 int sja1105_vl_stats(struct sja1105_private *priv, int port,
25 		     struct sja1105_rule *rule, struct flow_stats *stats,
26 		     struct netlink_ext_ack *extack);
27 
28 #else
29 
30 static inline int sja1105_vl_redirect(struct sja1105_private *priv, int port,
31 				      struct netlink_ext_ack *extack,
32 				      unsigned long cookie,
33 				      struct sja1105_key *key,
34 				      unsigned long destports,
35 				      bool append)
36 {
37 	NL_SET_ERR_MSG_MOD(extack, "Virtual Links not compiled in");
38 	return -EOPNOTSUPP;
39 }
40 
41 static inline int sja1105_vl_delete(struct sja1105_private *priv,
42 				    int port, struct sja1105_rule *rule,
43 				    struct netlink_ext_ack *extack)
44 {
45 	NL_SET_ERR_MSG_MOD(extack, "Virtual Links not compiled in");
46 	return -EOPNOTSUPP;
47 }
48 
49 static inline int sja1105_vl_gate(struct sja1105_private *priv, int port,
50 				  struct netlink_ext_ack *extack,
51 				  unsigned long cookie,
52 				  struct sja1105_key *key, u32 index, s32 prio,
53 				  u64 base_time, u64 cycle_time,
54 				  u64 cycle_time_ext, u32 num_entries,
55 				  struct action_gate_entry *entries)
56 {
57 	NL_SET_ERR_MSG_MOD(extack, "Virtual Links not compiled in");
58 	return -EOPNOTSUPP;
59 }
60 
61 static inline int sja1105_vl_stats(struct sja1105_private *priv, int port,
62 				   struct sja1105_rule *rule,
63 				   struct flow_stats *stats,
64 				   struct netlink_ext_ack *extack)
65 {
66 	NL_SET_ERR_MSG_MOD(extack, "Virtual Links not compiled in");
67 	return -EOPNOTSUPP;
68 }
69 
70 #endif /* IS_ENABLED(CONFIG_NET_DSA_SJA1105_VL) */
71 
72 #endif /* _SJA1105_VL_H */
73