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 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 FILE_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 */
58 struct ecm_device {
59  /** USB device */
60  struct usb_device *usb;
61  /** USB bus */
62  struct usb_bus *bus;
63  /** Network device */
64  struct net_device *netdev;
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 
87 extern struct ecm_ethernet_descriptor *
90 extern int ecm_fetch_mac ( struct usb_function *func,
92  struct net_device *netdev );
93 
94 #endif /* _ECM_H */
Unicast packets.
Definition: ecm.h:32
unsigned short uint16_t
Definition: stdint.h:11
An Ethernet Functional Descriptor.
Definition: ecm.h:40
uint8_t wol
Number of wake-on-LAN filters.
Definition: ecm.h:54
struct usbnet_device usbnet
USB network device.
Definition: ecm.h:66
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
uint16_t mcast
Multicast filter configuration.
Definition: ecm.h:52
uint32_t statistics
Ethernet statistics bitmap.
Definition: ecm.h:48
FILE_SECBOOT(PERMITTED)
uint8_t subtype
Descriptor subtype.
Definition: ecm.h:44
struct ena_llq_option desc
Descriptor counts.
Definition: ena.h:20
Promiscuous mode.
Definition: ecm.h:28
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
Specified multicast packets.
Definition: ecm.h:36
A USB interface descriptor.
Definition: usb.h:245
An object interface.
Definition: interface.h:125
All multicast packets.
Definition: ecm.h:30
static struct net_device * netdev
Definition: gdbudp.c:52
struct usb_device * usb
USB device.
Definition: ecm.h:60
A USB device.
Definition: usb.h:723
struct usb_descriptor_header header
Descriptor header.
Definition: ecm.h:42
enum ecm_ethernet_packet_filter __attribute__
A USB network device.
Definition: usbnet.h:16
ecm_ethernet_packet_filter
Ethernet packet types.
Definition: ecm.h:26
A network device.
Definition: netdevice.h:353
struct usb_bus * bus
USB bus.
Definition: ecm.h:62
unsigned char uint8_t
Definition: stdint.h:10
uint8_t mac
MAC address string.
Definition: ecm.h:46
unsigned int uint32_t
Definition: stdint.h:12
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
A USB descriptor header.
Definition: usb.h:173
USB network devices.
A CDC-ECM network device.
Definition: ecm.h:58
A USB configuration descriptor.
Definition: usb.h:210
Universal Serial Bus (USB)
uint16_t mtu
Maximum segment size.
Definition: ecm.h:50
USB Communications Device Class (CDC)
A USB function.
Definition: usb.h:674
Broadcast packets.
Definition: ecm.h:34
A USB bus.
Definition: usb.h:966
struct net_device * netdev
Network device.
Definition: ecm.h:64