xref: /openbsd/sys/dev/usb/if_urndisreg.h (revision 7591b6e0)
1 /*	$OpenBSD: if_urndisreg.h,v 1.20 2016/09/16 11:13:37 mikeb 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 #define RNDIS_RX_LIST_CNT	1
23 #define RNDIS_TX_LIST_CNT	1
24 #define RNDIS_BUFSZ		1562
25 
26 struct urndis_chain {
27 	struct urndis_softc	*sc_softc;
28 	struct usbd_xfer	*sc_xfer;
29 	char			*sc_buf;
30 	struct mbuf		*sc_mbuf;
31 	int			 sc_idx;
32 };
33 
34 struct urndis_cdata {
35 	struct urndis_chain	sc_rx_chain[RNDIS_RX_LIST_CNT];
36 	struct urndis_chain	sc_tx_chain[RNDIS_TX_LIST_CNT];
37 	int			sc_tx_cnt;
38 };
39 
40 #define GET_IFP(sc) (&(sc)->sc_arpcom.ac_if)
41 struct urndis_softc {
42 	struct device			sc_dev;
43 
44 	char				sc_attached;
45 	struct arpcom			sc_arpcom;
46 
47 	/* RNDIS device info */
48 	u_int32_t			sc_lim_pktsz;
49 	u_int32_t			sc_filter;
50 
51 	/* USB goo */
52 	struct usbd_device		*sc_udev;
53 	int				sc_ifaceno_ctl;
54 	struct usbd_interface		*sc_iface_data;
55 
56 	struct timeval			sc_rx_notice;
57 	int				sc_bulkin_no;
58 	struct usbd_pipe		*sc_bulkin_pipe;
59 	int				sc_bulkout_no;
60 	struct usbd_pipe		*sc_bulkout_pipe;
61 
62 	struct urndis_cdata		sc_data;
63 };
64