xref: /freebsd/sys/dev/usb/net/if_urndisreg.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
1 /*	$OpenBSD: if_urndisreg.h,v 1.19 2013/11/21 14:08:05 mpi Exp $ */
2 
3 /*
4  * Copyright (c) 2010 Jonathan Armani <armani@openbsd.org>
5  * Copyright (c) 2010 Fabien Romano <fabien@openbsd.org>
6  * Copyright (c) 2010 Michael Knudsen <mk@openbsd.org>
7  * All rights reserved.
8  *
9  * Permission to use, copy, modify, and distribute this software for any
10  * purpose with or without fee is hereby granted, provided that the above
11  * copyright notice and this permission notice appear in all copies.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 #ifndef _IF_URNDISREG_H_
23 #define	_IF_URNDISREG_H_
24 
25 #define	RNDIS_RESPONSE_LEN	1024	/* bytes */
26 #define	RNDIS_RX_MAXLEN		(16 * 1024)
27 #define	RNDIS_TX_FRAMES_MAX	8
28 #define	RNDIS_TX_MAXLEN		MCLBYTES
29 
30 enum {
31 	URNDIS_BULK_RX,
32 	URNDIS_BULK_TX,
33 	URNDIS_INTR_RX,
34 	URNDIS_N_TRANSFER,
35 };
36 
37 struct urndis_softc {
38 	struct usb_ether sc_ue;
39 	struct mtx sc_mtx;
40 
41 	/* RNDIS device info */
42 	uint32_t sc_lim_pktsz;
43 	uint32_t sc_filter;
44 
45 	struct usb_device *sc_udev;
46 	struct usb_xfer *sc_xfer[URNDIS_N_TRANSFER];
47 
48 	uint8_t	sc_ifaceno_ctl;
49 	uint8_t	sc_response_buf[RNDIS_RESPONSE_LEN] __aligned(4);
50 };
51 
52 #define	URNDIS_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
53 #define	URNDIS_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
54 #define	URNDIS_LOCK_ASSERT(sc, what) mtx_assert(&(sc)->sc_mtx, (what))
55 
56 #endif					/* _IF_URNDISREG_H_ */
57