iPXE
ecm.h
Go to the documentation of this file.
1#ifndef _ECM_H
2#define _ECM_H
3
4/** @file
5 *
6 * CDC-ECM USB Ethernet driver
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <ipxe/usb.h>
14#include <ipxe/usbnet.h>
15#include <ipxe/cdc.h>
16
17/** CDC-ECM subclass */
18#define USB_SUBCLASS_CDC_ECM 0x06
19
20/** Set Ethernet packet filter */
21#define ECM_SET_ETHERNET_PACKET_FILTER \
22 ( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
23 USB_REQUEST_TYPE ( 0x43 ) )
24
25/** Ethernet packet types */
27 /** Promiscuous mode */
29 /** All multicast packets */
31 /** Unicast packets */
33 /** Broadcast packets */
35 /** Specified multicast packets */
37};
38
39/** An Ethernet Functional Descriptor */
41 /** Descriptor header */
43 /** Descriptor subtype */
45 /** MAC address string */
47 /** Ethernet statistics bitmap */
49 /** Maximum segment size */
51 /** Multicast filter configuration */
53 /** Number of wake-on-LAN filters */
55} __attribute__ (( packed ));
56
57/** A CDC-ECM network device */
58struct ecm_device {
59 /** USB device */
60 struct usb_device *usb;
61 /** USB bus */
62 struct usb_bus *bus;
63 /** Network device */
65 /** USB network device */
67};
68
69/** Interrupt maximum fill level
70 *
71 * This is a policy decision.
72 */
73#define ECM_INTR_MAX_FILL 2
74
75/** Bulk IN maximum fill level
76 *
77 * This is a policy decision.
78 */
79#define ECM_IN_MAX_FILL 8
80
81/** Bulk IN buffer size
82 *
83 * This is a policy decision.
84 */
85#define ECM_IN_MTU ( ETH_FRAME_LEN + 4 /* possible VLAN header */ )
86
87extern struct ecm_ethernet_descriptor *
90extern int ecm_fetch_mac ( struct usb_function *func,
92 struct net_device *netdev );
93
94#endif /* _ECM_H */
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned char uint8_t
Definition stdint.h:10
USB Communications Device Class (CDC)
ecm_ethernet_packet_filter
Ethernet packet types.
Definition ecm.h:26
@ ECM_PACKET_TYPE_ALL_MULTICAST
All multicast packets.
Definition ecm.h:30
@ ECM_PACKET_TYPE_PROMISCUOUS
Promiscuous mode.
Definition ecm.h:28
@ ECM_PACKET_TYPE_MULTICAST
Specified multicast packets.
Definition ecm.h:36
@ ECM_PACKET_TYPE_BROADCAST
Broadcast packets.
Definition ecm.h:34
@ ECM_PACKET_TYPE_DIRECTED
Unicast packets.
Definition ecm.h:32
int ecm_fetch_mac(struct usb_function *func, struct ecm_ethernet_descriptor *desc, struct net_device *netdev)
Get hardware MAC address.
Definition ecm.c:91
struct ecm_ethernet_descriptor * ecm_ethernet_descriptor(struct usb_configuration_descriptor *config, struct usb_interface_descriptor *interface)
Locate Ethernet functional descriptor.
Definition ecm.c:71
struct ena_llq_option desc
Descriptor counts.
Definition ena.h:9
static struct net_device * netdev
Definition gdbudp.c:53
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define __attribute__(x)
Definition compiler.h:10
Universal Serial Bus (USB)
A CDC-ECM network device.
Definition ecm.h:58
struct usb_bus * bus
USB bus.
Definition ecm.h:62
struct usb_device * usb
USB device.
Definition ecm.h:60
struct usbnet_device usbnet
USB network device.
Definition ecm.h:66
struct net_device * netdev
Network device.
Definition ecm.h:64
An Ethernet Functional Descriptor.
Definition ecm.h:40
uint8_t wol
Number of wake-on-LAN filters.
Definition ecm.h:54
uint16_t mtu
Maximum segment size.
Definition ecm.h:50
uint8_t mac
MAC address string.
Definition ecm.h:46
struct usb_descriptor_header header
Descriptor header.
Definition ecm.h:42
uint32_t statistics
Ethernet statistics bitmap.
Definition ecm.h:48
uint8_t subtype
Descriptor subtype.
Definition ecm.h:44
uint16_t mcast
Multicast filter configuration.
Definition ecm.h:52
An object interface.
Definition interface.h:125
A network device.
Definition netdevice.h:353
A USB bus.
Definition usb.h:966
A USB configuration descriptor.
Definition usb.h:210
A USB descriptor header.
Definition usb.h:173
A USB device.
Definition usb.h:723
A USB function.
Definition usb.h:674
A USB interface descriptor.
Definition usb.h:245
A USB network device.
Definition usbnet.h:16
USB network devices.