xref: /freebsd/sys/dev/etherswitch/etherswitch_if.m (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
1
2#include <sys/bus.h>
3
4# Needed for ifreq/ifmediareq
5#include <sys/socket.h>
6#include <net/if.h>
7
8#include <dev/etherswitch/etherswitch.h>
9
10INTERFACE etherswitch;
11
12#
13# Default implementation
14#
15CODE {
16	static void
17	null_etherswitch_lock(device_t dev)
18	{
19	}
20
21	static void
22	null_etherswitch_unlock(device_t dev)
23	{
24	}
25
26	static int
27	null_etherswitch_getconf(device_t dev, etherswitch_conf_t *conf)
28	{
29		return (0);
30	}
31
32	static int
33	null_etherswitch_setconf(device_t dev, etherswitch_conf_t *conf)
34	{
35		return (0);
36	}
37
38	static int
39	null_etherswitch_flush_all(device_t dev)
40	{
41
42		return (ENXIO);
43	}
44
45	static int
46	null_etherswitch_flush_port(device_t dev, int port)
47	{
48
49		return (ENXIO);
50	}
51
52	static int
53	null_etherswitch_flush_mac(device_t dev,
54	    etherswitch_atu_flush_macentry_t *e)
55	{
56
57		return (ENXIO);
58	}
59
60	static int
61	null_etherswitch_fetch_table(device_t dev,
62	    etherswitch_atu_table_t *table)
63	{
64
65		table->es_nitems = 0;
66		return (ENXIO);
67	}
68
69	static int
70	null_etherswitch_fetch_entry(device_t dev,
71	    etherswitch_atu_entry_t *e)
72	{
73
74		return (ENXIO);
75	}
76};
77
78#
79# Return device info
80#
81METHOD etherswitch_info_t* getinfo {
82	device_t	dev;
83}
84
85#
86# Lock access to switch registers
87#
88METHOD void lock {
89	device_t	dev;
90} DEFAULT null_etherswitch_lock;
91
92#
93# Unlock access to switch registers
94#
95METHOD void unlock {
96	device_t	dev;
97} DEFAULT null_etherswitch_unlock;
98
99#
100# Read switch register
101#
102METHOD int readreg {
103	device_t	dev;
104	int		reg;
105};
106
107#
108# Write switch register
109#
110METHOD int writereg {
111	device_t	dev;
112	int		reg;
113	int		value;
114};
115
116#
117# Read PHY register
118#
119METHOD int readphyreg {
120	device_t	dev;
121	int		phy;
122	int		reg;
123};
124
125#
126# Write PHY register
127#
128METHOD int writephyreg {
129	device_t	dev;
130	int		phy;
131	int		reg;
132	int		value;
133};
134
135#
136# Get port configuration
137#
138METHOD int getport {
139	device_t	dev;
140	etherswitch_port_t *vg;
141}
142
143#
144# Set port configuration
145#
146METHOD int setport {
147	device_t	dev;
148	etherswitch_port_t *vg;
149}
150
151#
152# Get VLAN group configuration
153#
154METHOD int getvgroup {
155	device_t	dev;
156	etherswitch_vlangroup_t *vg;
157}
158
159#
160# Set VLAN group configuration
161#
162METHOD int setvgroup {
163	device_t	dev;
164	etherswitch_vlangroup_t *vg;
165}
166
167#
168# Get the Switch configuration
169#
170METHOD int getconf {
171	device_t	dev;
172	etherswitch_conf_t	*conf;
173} DEFAULT null_etherswitch_getconf;
174
175#
176# Set the Switch configuration
177#
178METHOD int setconf {
179	device_t	dev;
180	etherswitch_conf_t	*conf;
181} DEFAULT null_etherswitch_setconf;
182
183#
184# Flush all of the programmed/learnt MAC addresses
185#
186METHOD int flush_all {
187	device_t dev;
188} DEFAULT null_etherswitch_flush_all;
189
190#
191# Flush a single MAC address entry
192#
193METHOD int flush_mac {
194	device_t dev;
195	etherswitch_atu_flush_macentry_t *entry;
196} DEFAULT null_etherswitch_flush_mac;
197
198#
199# Flush all of the dynamic MAC addresses on a given port
200#
201METHOD int flush_port {
202	device_t dev;
203	int port;
204} DEFAULT null_etherswitch_flush_port;
205
206#
207# Fetch the address table from the ethernet switch.
208#
209METHOD int fetch_table {
210	device_t dev;
211	etherswitch_atu_table_t *table;
212} DEFAULT null_etherswitch_fetch_table;
213
214#
215# Fetch a single entry from the ethernet switch table.
216#
217METHOD int fetch_table_entry {
218	device_t dev;
219	etherswitch_atu_entry_t *entry;
220} DEFAULT null_etherswitch_fetch_entry;
221