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 
12 #include <ipxe/usb.h>
13 #include <ipxe/usbnet.h>
14 #include <ipxe/cdc.h>
15 
16 /** CDC-ECM subclass */
17 #define USB_SUBCLASS_CDC_ECM 0x06
18 
19 /** Set Ethernet packet filter */
20 #define ECM_SET_ETHERNET_PACKET_FILTER \
21  ( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
22  USB_REQUEST_TYPE ( 0x43 ) )
23 
24 /** Ethernet packet types */
26  /** Promiscuous mode */
28  /** All multicast packets */
30  /** Unicast packets */
32  /** Broadcast packets */
34  /** Specified multicast packets */
36 };
37 
38 /** An Ethernet Functional Descriptor */
40  /** Descriptor header */
42  /** Descriptor subtype */
44  /** MAC address string */
46  /** Ethernet statistics bitmap */
48  /** Maximum segment size */
50  /** Multicast filter configuration */
52  /** Number of wake-on-LAN filters */
54 } __attribute__ (( packed ));
55 
56 /** A CDC-ECM network device */
57 struct ecm_device {
58  /** USB device */
59  struct usb_device *usb;
60  /** USB bus */
61  struct usb_bus *bus;
62  /** Network device */
63  struct net_device *netdev;
64  /** USB network device */
66 };
67 
68 /** Interrupt maximum fill level
69  *
70  * This is a policy decision.
71  */
72 #define ECM_INTR_MAX_FILL 2
73 
74 /** Bulk IN maximum fill level
75  *
76  * This is a policy decision.
77  */
78 #define ECM_IN_MAX_FILL 8
79 
80 /** Bulk IN buffer size
81  *
82  * This is a policy decision.
83  */
84 #define ECM_IN_MTU ( ETH_FRAME_LEN + 4 /* possible VLAN header */ )
85 
86 extern struct ecm_ethernet_descriptor *
89 extern int ecm_fetch_mac ( struct usb_device *usb,
90  struct ecm_ethernet_descriptor *desc,
91  uint8_t *hw_addr );
92 
93 #endif /* _ECM_H */
#define __attribute__(x)
Definition: compiler.h:10
Unicast packets.
Definition: ecm.h:31
unsigned short uint16_t
Definition: stdint.h:11
int ecm_fetch_mac(struct usb_device *usb, struct ecm_ethernet_descriptor *desc, uint8_t *hw_addr)
Get hardware MAC address.
Definition: ecm.c:89
An Ethernet Functional Descriptor.
Definition: ecm.h:39
uint8_t wol
Number of wake-on-LAN filters.
Definition: ecm.h:53
struct usbnet_device usbnet
USB network device.
Definition: ecm.h:65
uint16_t mcast
Multicast filter configuration.
Definition: ecm.h:51
uint32_t statistics
Ethernet statistics bitmap.
Definition: ecm.h:47
uint8_t subtype
Descriptor subtype.
Definition: ecm.h:43
Promiscuous mode.
Definition: ecm.h:27
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
Specified multicast packets.
Definition: ecm.h:35
A USB interface descriptor.
Definition: usb.h:230
An object interface.
Definition: interface.h:109
All multicast packets.
Definition: ecm.h:29
struct usb_device * usb
USB device.
Definition: ecm.h:59
A USB device.
Definition: usb.h:706
struct usb_descriptor_header header
Descriptor header.
Definition: ecm.h:41
A USB network device.
Definition: usbnet.h:15
ecm_ethernet_packet_filter
Ethernet packet types.
Definition: ecm.h:25
A network device.
Definition: netdevice.h:348
struct usb_bus * bus
USB bus.
Definition: ecm.h:61
unsigned char uint8_t
Definition: stdint.h:10
uint8_t mac
MAC address string.
Definition: ecm.h:45
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:69
A USB descriptor header.
Definition: usb.h:158
USB network devices.
A CDC-ECM network device.
Definition: ecm.h:57
A USB configuration descriptor.
Definition: usb.h:195
Universal Serial Bus (USB)
uint16_t mtu
Maximum segment size.
Definition: ecm.h:49
USB Communications Device Class (CDC)
Broadcast packets.
Definition: ecm.h:33
A USB bus.
Definition: usb.h:949
struct net_device * netdev
Network device.
Definition: ecm.h:63