1231200Smm/*	$FreeBSD: stable/11/sys/dev/usb/net/if_urndisreg.h 307481 2016-10-17 06:56:58Z sephe $ */
2231200Smm/*	$OpenBSD: if_urndisreg.h,v 1.19 2013/11/21 14:08:05 mpi Exp $ */
3231200Smm
4231200Smm/*
5231200Smm * Copyright (c) 2010 Jonathan Armani <armani@openbsd.org>
6231200Smm * Copyright (c) 2010 Fabien Romano <fabien@openbsd.org>
7231200Smm * Copyright (c) 2010 Michael Knudsen <mk@openbsd.org>
8231200Smm * All rights reserved.
9231200Smm *
10231200Smm * Permission to use, copy, modify, and distribute this software for any
11231200Smm * purpose with or without fee is hereby granted, provided that the above
12231200Smm * copyright notice and this permission notice appear in all copies.
13231200Smm *
14231200Smm * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15231200Smm * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16231200Smm * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17231200Smm * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18231200Smm * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19231200Smm * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20231200Smm * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21231200Smm */
22231200Smm
23231200Smm#ifndef _IF_URNDISREG_H_
24231200Smm#define	_IF_URNDISREG_H_
25238856Smm
26231200Smm#define	RNDIS_RESPONSE_LEN	1024	/* bytes */
27238856Smm#define	RNDIS_RX_MAXLEN		(16 * 1024)
28231200Smm#define	RNDIS_TX_FRAMES_MAX	8
29231200Smm#define	RNDIS_TX_MAXLEN		MCLBYTES
30231200Smm
31231200Smmenum {
32231200Smm	URNDIS_BULK_RX,
33231200Smm	URNDIS_BULK_TX,
34231200Smm	URNDIS_INTR_RX,
35238856Smm	URNDIS_N_TRANSFER,
36238856Smm};
37231200Smm
38231200Smmstruct urndis_softc {
39231200Smm
40231200Smm	struct usb_ether sc_ue;
41231200Smm	struct mtx sc_mtx;
42231200Smm
43231200Smm	/* RNDIS device info */
44231200Smm	uint32_t sc_lim_pktsz;
45231200Smm	uint32_t sc_filter;
46231200Smm
47231200Smm	struct usb_device *sc_udev;
48231200Smm	struct usb_xfer *sc_xfer[URNDIS_N_TRANSFER];
49231200Smm
50231200Smm	uint8_t	sc_ifaceno_ctl;
51231200Smm	uint8_t	sc_response_buf[RNDIS_RESPONSE_LEN] __aligned(4);
52231200Smm};
53231200Smm
54231200Smm#define	URNDIS_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
55231200Smm#define	URNDIS_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
56231200Smm#define	URNDIS_LOCK_ASSERT(sc, what) mtx_assert(&(sc)->sc_mtx, (what))
57231200Smm
58231200Smm#endif					/* _IF_URNDISREG_H_ */
59231200Smm