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