2 * u_ether.h -- interface to USB gadget "ethernet link" utilities
4 * Copyright (C) 2003-2005,2008 David Brownell
5 * Copyright (C) 2003-2004 Robert Schwebel, Benedikt Spranger
6 * Copyright (C) 2008 Nokia Corporation
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/err.h>
27 #include <linux/if_ether.h>
28 #include <linux/usb/composite.h>
29 #include <linux/usb/cdc.h>
32 * This represents the USB side of an "ethernet" link, managed by a USB
33 * function which provides control and (maybe) framing. Two functions
34 * in different configurations could share the same ethernet link/netdev.
36 * There is currently a limitation that one instance of this function
37 * may be present in any given configuration.
40 struct usb_function func;
42 /* updated by gether_{connect,disconnect} */
43 struct eth_dev *ioport;
45 /* endpoints handle full and/or high speeds */
47 struct usb_ep *out_ep;
49 /* descriptors match device speed at gether_connect() time */
50 struct usb_endpoint_descriptor *in;
51 struct usb_endpoint_descriptor *out;
57 /* hooks for added framing, as needed for RNDIS and EEM.
58 * we currently don't support multiple frames per SKB.
61 struct sk_buff *(*wrap)(struct sk_buff *skb);
62 int (*unwrap)(struct sk_buff *skb);
64 /* called on network open/close */
65 void (*open)(struct gether *);
66 void (*close)(struct gether *);
69 #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
70 |USB_CDC_PACKET_TYPE_ALL_MULTICAST \
71 |USB_CDC_PACKET_TYPE_PROMISCUOUS \
72 |USB_CDC_PACKET_TYPE_DIRECTED)
75 /* netdev setup/teardown as directed by the gadget driver */
76 int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]);
77 void gether_cleanup(void);
79 /* connect/disconnect is handled by individual functions */
80 struct net_device *gether_connect(struct gether *);
81 void gether_disconnect(struct gether *);
83 #endif /* __U_ETHER_H */