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