xref: /linux/net/dsa/port.h (revision 8bc7c5e525584903ea83332e18a2118ed3b1985e)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #ifndef __DSA_PORT_H
4 #define __DSA_PORT_H
5 
6 #include <linux/types.h>
7 #include <net/dsa.h>
8 
9 struct ifreq;
10 struct netdev_lag_lower_state_info;
11 struct netdev_lag_upper_info;
12 struct netlink_ext_ack;
13 struct switchdev_mst_state;
14 struct switchdev_obj_port_mdb;
15 struct switchdev_vlan_msti;
16 struct phy_device;
17 
18 bool dsa_port_supports_hwtstamp(struct dsa_port *dp);
19 void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp,
20 			       const struct dsa_device_ops *tag_ops);
21 int dsa_port_set_state(struct dsa_port *dp, u8 state, bool do_fast_age);
22 int dsa_port_set_mst_state(struct dsa_port *dp,
23 			   const struct switchdev_mst_state *state,
24 			   struct netlink_ext_ack *extack);
25 int dsa_port_enable_rt(struct dsa_port *dp, struct phy_device *phy);
26 int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy);
27 void dsa_port_disable_rt(struct dsa_port *dp);
28 void dsa_port_disable(struct dsa_port *dp);
29 int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br,
30 			 struct netlink_ext_ack *extack);
31 void dsa_port_pre_bridge_leave(struct dsa_port *dp, struct net_device *br);
32 void dsa_port_bridge_leave(struct dsa_port *dp, struct net_device *br);
33 int dsa_port_lag_change(struct dsa_port *dp,
34 			struct netdev_lag_lower_state_info *linfo);
35 int dsa_port_lag_join(struct dsa_port *dp, struct net_device *lag_dev,
36 		      struct netdev_lag_upper_info *uinfo,
37 		      struct netlink_ext_ack *extack);
38 void dsa_port_pre_lag_leave(struct dsa_port *dp, struct net_device *lag_dev);
39 void dsa_port_lag_leave(struct dsa_port *dp, struct net_device *lag_dev);
40 int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
41 			    struct netlink_ext_ack *extack);
42 bool dsa_port_skip_vlan_configuration(struct dsa_port *dp);
43 int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock);
44 int dsa_port_mst_enable(struct dsa_port *dp, bool on,
45 			struct netlink_ext_ack *extack);
46 int dsa_port_vlan_msti(struct dsa_port *dp,
47 		       const struct switchdev_vlan_msti *msti);
48 int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu);
49 int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
50 		     u16 vid);
51 int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr,
52 		     u16 vid);
53 int dsa_port_standalone_host_fdb_add(struct dsa_port *dp,
54 				     const unsigned char *addr, u16 vid);
55 int dsa_port_standalone_host_fdb_del(struct dsa_port *dp,
56 				     const unsigned char *addr, u16 vid);
57 int dsa_port_bridge_host_fdb_add(struct dsa_port *dp, const unsigned char *addr,
58 				 u16 vid);
59 int dsa_port_bridge_host_fdb_del(struct dsa_port *dp, const unsigned char *addr,
60 				 u16 vid);
61 int dsa_port_lag_fdb_add(struct dsa_port *dp, const unsigned char *addr,
62 			 u16 vid);
63 int dsa_port_lag_fdb_del(struct dsa_port *dp, const unsigned char *addr,
64 			 u16 vid);
65 int dsa_port_fdb_dump(struct dsa_port *dp, dsa_fdb_dump_cb_t *cb, void *data);
66 int dsa_port_mdb_add(const struct dsa_port *dp,
67 		     const struct switchdev_obj_port_mdb *mdb);
68 int dsa_port_mdb_del(const struct dsa_port *dp,
69 		     const struct switchdev_obj_port_mdb *mdb);
70 int dsa_port_standalone_host_mdb_add(const struct dsa_port *dp,
71 				     const struct switchdev_obj_port_mdb *mdb);
72 int dsa_port_standalone_host_mdb_del(const struct dsa_port *dp,
73 				     const struct switchdev_obj_port_mdb *mdb);
74 int dsa_port_bridge_host_mdb_add(const struct dsa_port *dp,
75 				 const struct switchdev_obj_port_mdb *mdb);
76 int dsa_port_bridge_host_mdb_del(const struct dsa_port *dp,
77 				 const struct switchdev_obj_port_mdb *mdb);
78 int dsa_port_pre_bridge_flags(const struct dsa_port *dp,
79 			      struct switchdev_brport_flags flags,
80 			      struct netlink_ext_ack *extack);
81 int dsa_port_bridge_flags(struct dsa_port *dp,
82 			  struct switchdev_brport_flags flags,
83 			  struct netlink_ext_ack *extack);
84 int dsa_port_vlan_add(struct dsa_port *dp,
85 		      const struct switchdev_obj_port_vlan *vlan,
86 		      struct netlink_ext_ack *extack);
87 int dsa_port_vlan_del(struct dsa_port *dp,
88 		      const struct switchdev_obj_port_vlan *vlan);
89 int dsa_port_host_vlan_add(struct dsa_port *dp,
90 			   const struct switchdev_obj_port_vlan *vlan,
91 			   struct netlink_ext_ack *extack);
92 int dsa_port_host_vlan_del(struct dsa_port *dp,
93 			   const struct switchdev_obj_port_vlan *vlan);
94 int dsa_port_mrp_add(const struct dsa_port *dp,
95 		     const struct switchdev_obj_mrp *mrp);
96 int dsa_port_mrp_del(const struct dsa_port *dp,
97 		     const struct switchdev_obj_mrp *mrp);
98 int dsa_port_mrp_add_ring_role(const struct dsa_port *dp,
99 			       const struct switchdev_obj_ring_role_mrp *mrp);
100 int dsa_port_mrp_del_ring_role(const struct dsa_port *dp,
101 			       const struct switchdev_obj_ring_role_mrp *mrp);
102 int dsa_port_phylink_create(struct dsa_port *dp);
103 void dsa_port_phylink_destroy(struct dsa_port *dp);
104 int dsa_shared_port_link_register_of(struct dsa_port *dp);
105 void dsa_shared_port_link_unregister_of(struct dsa_port *dp);
106 int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr,
107 		      struct netlink_ext_ack *extack);
108 void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr);
109 int dsa_port_tag_8021q_vlan_add(struct dsa_port *dp, u16 vid, bool broadcast);
110 void dsa_port_tag_8021q_vlan_del(struct dsa_port *dp, u16 vid, bool broadcast);
111 void dsa_port_set_host_flood(struct dsa_port *dp, bool uc, bool mc);
112 int dsa_port_change_conduit(struct dsa_port *dp, struct net_device *conduit,
113 			    struct netlink_ext_ack *extack);
114 
115 #endif
116