drivers/usb/gadget/function/u_ether.h
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/function/u_ether.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/function/u_ether.h- Extension
.h- Size
- 10555 bytes
- Lines
- 322
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/if_ether.hlinux/usb/composite.hlinux/usb/cdc.hlinux/netdevice.h
Detected Declarations
struct eth_devstruct getherfunction can_support_ecmfunction gether_bitrate
Annotated Snippet
struct gether {
struct usb_function func;
/* updated by gether_{connect,disconnect} */
struct eth_dev *ioport;
/* endpoints handle full and/or high speeds */
struct usb_ep *in_ep;
struct usb_ep *out_ep;
bool is_zlp_ok;
u16 cdc_filter;
/* hooks for added framing, as needed for RNDIS and EEM. */
u32 header_len;
/* NCM requires fixed size bundles */
bool is_fixed;
u32 fixed_out_len;
u32 fixed_in_len;
bool supports_multi_frame;
struct sk_buff *(*wrap)(struct gether *port,
struct sk_buff *skb);
int (*unwrap)(struct gether *port,
struct sk_buff *skb,
struct sk_buff_head *list);
/* called on network open/close */
void (*open)(struct gether *);
void (*close)(struct gether *);
bool is_suspend;
};
#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
|USB_CDC_PACKET_TYPE_ALL_MULTICAST \
|USB_CDC_PACKET_TYPE_PROMISCUOUS \
|USB_CDC_PACKET_TYPE_DIRECTED)
/* variant of gether_setup that allows customizing network device name */
struct eth_dev *gether_setup_name(struct usb_gadget *g,
const char *dev_addr, const char *host_addr,
u8 ethaddr[ETH_ALEN], unsigned qmult, const char *netname);
/* netdev setup/teardown as directed by the gadget driver */
/* gether_setup - initialize one ethernet-over-usb link
* @g: gadget to associated with these links
* @ethaddr: NULL, or a buffer in which the ethernet address of the
* host side of the link is recorded
* Context: may sleep
*
* This sets up the single network link that may be exported by a
* gadget driver using this framework. The link layer addresses are
* set up using module parameters.
*
* Returns a eth_dev pointer on success, or an ERR_PTR on failure
*/
static inline struct eth_dev *gether_setup(struct usb_gadget *g,
const char *dev_addr, const char *host_addr,
u8 ethaddr[ETH_ALEN], unsigned qmult)
{
return gether_setup_name(g, dev_addr, host_addr, ethaddr, qmult, "usb");
}
/*
* variant of gether_setup_default that allows customizing
* network device name
*/
struct net_device *gether_setup_name_default(const char *netname);
/*
* gether_register_netdev - register the net device
* @net: net device to register
*
* Registers the net device associated with this ethernet-over-usb link
*
*/
int gether_register_netdev(struct net_device *net);
/* gether_setup_default - initialize one ethernet-over-usb link
* Context: may sleep
*
* This sets up the single network link that may be exported by a
* gadget driver using this framework. The link layer addresses
* are set to random values.
*
* Returns negative errno, or zero on success
*/
static inline struct net_device *gether_setup_default(void)
{
return gether_setup_name_default("usb");
Annotation
- Immediate include surface: `linux/err.h`, `linux/if_ether.h`, `linux/usb/composite.h`, `linux/usb/cdc.h`, `linux/netdevice.h`.
- Detected declarations: `struct eth_dev`, `struct gether`, `function can_support_ecm`, `function gether_bitrate`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.