summaryrefslogtreecommitdiffstats
path: root/sys/net/ifdi_if.m
blob: 301a6ee88f8ed914c55b49e3740b4b518238446e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
#
# Copyright (c) 2014, Matthew Macy (kmacy@freebsd.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#  1. Redistributions of source code must retain the above copyright notice,
#     this list of conditions and the following disclaimer.
#
#  2. Neither the name of Matthew Macy nor the names of its
#     contributors may be used to endorse or promote products derived from
#     this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD$
#

#include <sys/types.h>
#include <sys/systm.h>
#include <sys/socket.h>

#include <machine/bus.h>
#include <sys/bus.h>

#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_media.h>
#include <net/iflib.h>

INTERFACE ifdi;

CODE {

	static void
	null_void_op(if_ctx_t _ctx __unused)
	{
	}

	static void
	null_timer_op(if_ctx_t _ctx __unused, uint16_t _qsidx __unused)
	{
	}

	static int
	null_int_op(if_ctx_t _ctx __unused)
	{
		return (0);
	}

	static int
	null_queue_intr_enable(if_ctx_t _ctx __unused, uint16_t _qid __unused)
	{
		return (ENOTSUP);
	}

	static void
	null_led_func(if_ctx_t _ctx __unused, int _onoff __unused)
	{
	}

	static void
	null_vlan_register_op(if_ctx_t _ctx __unused, uint16_t vtag __unused)
	{
	}

	static int
	null_q_setup(if_ctx_t _ctx __unused, uint32_t _qid __unused)
	{
		return (0);
	}

	static int
	null_i2c_req(if_ctx_t _sctx __unused, struct ifi2creq *_i2c __unused)
	{
		return (ENOTSUP);
	}

	static int
	null_sysctl_int_delay(if_ctx_t _sctx __unused, if_int_delay_info_t _iidi __unused)
	{
		return (0);
	}

	static int
	null_iov_init(if_ctx_t _ctx __unused, uint16_t num_vfs __unused, const nvlist_t *params __unused)
	{
		return (ENOTSUP);
	}

	static int
	null_vf_add(if_ctx_t _ctx __unused, uint16_t num_vfs __unused, const nvlist_t *params __unused)
	{
		return (ENOTSUP);
	}

	static int
	null_priv_ioctl(if_ctx_t _ctx __unused, u_long command, caddr_t *data __unused)
	{
		return (ENOTSUP);
	}
};

#
# bus interfaces
#

METHOD int attach_pre {
	if_ctx_t _ctx;
};

METHOD int attach_post {
	if_ctx_t _ctx;
};

METHOD int detach {
	if_ctx_t _ctx;
};

METHOD int suspend {
	if_ctx_t _ctx;
} DEFAULT null_int_op;

METHOD int shutdown {
	if_ctx_t _ctx;
} DEFAULT null_int_op;

METHOD int resume {
	if_ctx_t _ctx;
} DEFAULT null_int_op;

#
# downcall to driver to allocate its
# own queue state and tie it to the parent
#

METHOD int tx_queues_alloc {
	if_ctx_t _ctx;
	caddr_t *_vaddrs;
	uint64_t *_paddrs;
	int ntxqs;
	int ntxqsets;
};

METHOD int rx_queues_alloc {
	if_ctx_t _ctx;
	caddr_t *_vaddrs;
	uint64_t *_paddrs;
	int nrxqs;
	int nrxqsets;
};

METHOD void queues_free {
	if_ctx_t _ctx;
};

#
# interface reset / stop
#

METHOD void init {
	if_ctx_t _ctx;
};

METHOD void stop {
	if_ctx_t _ctx;
};

#
# interrupt setup and manipulation
#

METHOD int msix_intr_assign {
	if_ctx_t _sctx;
	int msix;
};

METHOD void intr_enable {
	if_ctx_t _ctx;
};

METHOD void intr_disable {
	if_ctx_t _ctx;
};

METHOD int queue_intr_enable {
	if_ctx_t _ctx;
	uint16_t _qid;
} DEFAULT null_queue_intr_enable;

METHOD void link_intr_enable {
	if_ctx_t _ctx;
} DEFAULT null_void_op;

#
# interface configuration
#

METHOD void multi_set {
	if_ctx_t _ctx;
};

METHOD int mtu_set {
	if_ctx_t _ctx;
	uint32_t _mtu;
};

METHOD void media_set{
	if_ctx_t _ctx;
} DEFAULT null_void_op;

METHOD int promisc_set {
	if_ctx_t _ctx;
	int _flags;
};

METHOD void crcstrip_set {
	if_ctx_t _ctx;
	int _onoff;
};

#
# IOV handling
#

METHOD void vflr_handle {
	if_ctx_t _ctx;
} DEFAULT null_void_op;

METHOD int iov_init {
	if_ctx_t _ctx;
	uint16_t num_vfs;
	const nvlist_t * params;
} DEFAULT null_iov_init;

METHOD void iov_uninit {
	if_ctx_t _ctx;
} DEFAULT null_void_op;

METHOD int iov_vf_add {
	if_ctx_t _ctx;
	uint16_t num_vfs;
	const nvlist_t * params;
} DEFAULT null_vf_add;


#
# Device status
#

METHOD void update_admin_status {
	if_ctx_t _ctx;
};

METHOD void media_status {
	if_ctx_t _ctx;
	struct ifmediareq *_ifm;
};

METHOD int media_change {
	if_ctx_t _ctx;
};

METHOD uint64_t get_counter {
	if_ctx_t _ctx;
	ift_counter cnt;
};

METHOD int priv_ioctl {
	if_ctx_t _ctx;
	u_long   _cmd;
	caddr_t _data;
} DEFAULT null_priv_ioctl;

#
# optional methods
#

METHOD int i2c_req {
	if_ctx_t _ctx;
	struct ifi2creq *_req;
} DEFAULT null_i2c_req;

METHOD int txq_setup {
	if_ctx_t _ctx;
	uint32_t _txqid;
} DEFAULT null_q_setup;

METHOD int rxq_setup {
	if_ctx_t _ctx;
	uint32_t _txqid;
} DEFAULT null_q_setup;

METHOD void timer {
	if_ctx_t _ctx;
	uint16_t _txqid;
} DEFAULT null_timer_op;

METHOD void watchdog_reset {
	if_ctx_t _ctx;
} DEFAULT null_void_op;

METHOD void led_func {
	if_ctx_t _ctx;
	int _onoff;
} DEFAULT null_led_func;

METHOD void vlan_register {
	if_ctx_t _ctx;
	uint16_t _vtag;
} DEFAULT null_vlan_register_op;

METHOD void vlan_unregister {
	if_ctx_t _ctx;
	uint16_t _vtag;
} DEFAULT null_vlan_register_op;

METHOD int sysctl_int_delay {
	if_ctx_t _sctx;
	if_int_delay_info_t _iidi;
} DEFAULT null_sysctl_int_delay;


OpenPOWER on IntegriCloud