46 { .name =
"ecm.intr" };
54 { .name =
"ecm.out" };
101 buf[
sizeof ( buf ) - 1 ] =
'\0';
103 ( sizeof ( buf ) - 1 ) );
110 if (
len != ( (
int ) (
sizeof ( buf ) - 1 ) ) ) {
111 DBGC ( usb,
"USB %s has invalid ECM MAC \"%s\"\n",
120 DBGC ( usb,
"USB %s could not decode ECM MAC \"%s\": %s\n",
130 DBGC ( usb,
"USB %s using system-specific MAC %s\n",
168 DBGC ( ecm,
"ECM %p interrupt failed: %s\n",
176 DBGC ( ecm,
"ECM %p underlength interrupt:\n", ecm );
188 DBGC ( ecm,
"ECM %p link up\n", ecm );
191 DBGC ( ecm,
"ECM %p link down\n", ecm );
201 DBGC ( ecm,
"ECM %p unrecognised interrupt:\n", ecm );
254 DBGC ( ecm,
"ECM %p bulk IN failed: %s\n",
341 DBGC ( ecm,
"ECM %p could not open: %s\n",
353 DBGC ( ecm,
"ECM %p could not set packet filter: %s\n",
454 memset ( ecm, 0,
sizeof ( *ecm ) );
462 DBGC ( ecm,
"ECM %p on %s\n", ecm, func->
name );
466 DBGC ( ecm,
"ECM %p could not describe: %s\n",
476 DBGC ( ecm,
"ECM %p has no Ethernet descriptor\n", ecm );
483 DBGC ( ecm,
"ECM %p could not fetch MAC address: %s\n",
522 USB_ROM ( 0xffff, 0xffff,
"cdc-ecm",
"USB CDC-ECM NIC", 0 ),
#define NULL
NULL pointer (VOID *)
int acpi_mac(uint8_t *hw_addr)
Extract MAC address from DSDT/SSDT.
struct arbelprm_rc_send_wqe rc
struct arbelprm_completion_with_error error
#define assert(condition)
Assert a condition at run-time.
static size_t base16_encoded_len(size_t raw_len)
Calculate length of base16-encoded data.
#define CDC_NETWORK_CONNECTION
Network connection notification.
#define USB_CLASS_CDC
Class code for communications devices.
#define CDC_CONNECTION_SPEED_CHANGE
Connection speed change notification.
#define CDC_SUBTYPE_ETHERNET
Ethernet descriptor subtype.
static int ecm_probe(struct usb_function *func, struct usb_configuration_descriptor *config)
Probe device.
static void ecm_poll(struct net_device *netdev)
Poll for completed and received packets.
static void ecm_in_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete bulk IN transfer.
static int ecm_out_transmit(struct ecm_device *ecm, struct io_buffer *iobuf)
Transmit packet.
static void ecm_intr_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete interrupt transfer.
static int ecm_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
static struct usb_endpoint_driver_operations ecm_in_operations
Bulk IN endpoint operations.
static struct net_device_operations ecm_operations
CDC-ECM network device operations.
int ecm_fetch_mac(struct usb_function *func, struct ecm_ethernet_descriptor *desc, struct net_device *netdev)
Get hardware MAC address.
static void ecm_out_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete bulk OUT transfer.
static void ecm_remove(struct usb_function *func)
Remove device.
struct ecm_ethernet_descriptor * ecm_ethernet_descriptor(struct usb_configuration_descriptor *config, struct usb_interface_descriptor *interface)
Locate Ethernet functional descriptor.
static struct usb_endpoint_driver_operations ecm_out_operations
Bulk OUT endpoint operations.
static void ecm_close(struct net_device *netdev)
Close network device.
static int ecm_open(struct net_device *netdev)
Open network device.
static struct usb_endpoint_driver_operations ecm_intr_operations
Interrupt endpoint operations.
static struct usb_device_id ecm_ids[]
CDC-ECM device IDs.
CDC-ECM USB Ethernet driver.
#define ECM_IN_MAX_FILL
Bulk IN maximum fill level.
#define USB_SUBCLASS_CDC_ECM
CDC-ECM subclass.
@ ECM_PACKET_TYPE_ALL_MULTICAST
All multicast packets.
@ ECM_PACKET_TYPE_PROMISCUOUS
Promiscuous mode.
@ ECM_PACKET_TYPE_BROADCAST
Broadcast packets.
@ ECM_PACKET_TYPE_DIRECTED
Unicast packets.
#define ECM_INTR_MAX_FILL
Interrupt maximum fill level.
#define ECM_IN_MTU
Bulk IN buffer size.
#define ECM_SET_ETHERNET_PACKET_FILTER
Set Ethernet packet filter.
struct ena_llq_option desc
Descriptor counts.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
static struct net_device * netdev
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define EINVAL
Invalid argument.
#define ENOMEM
Not enough space.
#define ENOTSUP
Operation not supported.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
#define cpu_to_le16(value)
#define __profiler
Declare a profiler.
static void profile_stop(struct profiler *profiler)
Stop profiling.
static void profile_start(struct profiler *profiler)
Start profiling.
Universal Serial Bus (USB)
#define __usb_driver
Declare a USB driver.
static void usb_refill_init(struct usb_endpoint *ep, size_t reserve, size_t len, unsigned int max)
Initialise USB endpoint refill.
#define USB_CLASS_ID(base, subclass, protocol)
Construct USB class ID.
#define for_each_interface_descriptor(desc, config, interface)
Iterate over all configuration descriptors within an interface descriptor.
static void usb_poll(struct usb_bus *bus)
Poll USB bus.
#define USB_ROM(_vendor, _product, _name, _description, _data)
static void usb_func_set_drvdata(struct usb_function *func, void *priv)
Set USB function driver private data.
@ USB_SCORE_NORMAL
Normal driver.
#define USB_CS_INTERFACE_DESCRIPTOR
A class-specific interface descriptor.
static void * usb_func_get_drvdata(struct usb_function *func)
Get USB function driver private data.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
#define iob_disown(iobuf)
Disown an I/O buffer.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
int register_netdev(struct net_device *netdev)
Register network device.
Network device management.
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
UINT8_t filter
Receive packet filter.
#define container_of(ptr, type, field)
Get containing structure.
char * strerror(int errno)
Retrieve string representation of error number.
A CDC-ECM network device.
struct usb_bus * bus
USB bus.
struct usb_device * usb
USB device.
struct usbnet_device usbnet
USB network device.
struct net_device * netdev
Network device.
An Ethernet Functional Descriptor.
void * data
Start of data.
Network device operations.
A data structure for storing profiling information.
A USB configuration descriptor.
struct usb_port * port
USB port.
struct usb_endpoint * ep[32]
Endpoint list.
USB endpoint driver operations.
int open
Endpoint is open.
struct usb_device * usb
USB device.
struct device dev
Generic device.
struct usb_bus * bus
USB bus.
A USB interface descriptor.
struct usb_hub * hub
USB hub.
struct usb_endpoint out
Bulk OUT endpoint.
struct usb_endpoint intr
Interrupt endpoint.
unsigned int comms
Communications interface.
struct usb_endpoint in
Bulk IN endpoint.
int usb_control(struct usb_device *usb, unsigned int request, unsigned int value, unsigned int index, void *data, size_t len)
Issue USB control transaction.
int usb_get_string_descriptor(struct usb_device *usb, unsigned int index, unsigned int language, char *buf, size_t len)
Get USB string descriptor.
struct usb_interface_descriptor * usb_interface_descriptor(struct usb_configuration_descriptor *config, unsigned int interface, unsigned int alternate)
Locate USB interface descriptor.
int usb_stream(struct usb_endpoint *ep, struct io_buffer *iobuf, int terminate)
Enqueue USB stream transfer.
int usbnet_refill(struct usbnet_device *usbnet)
Refill USB network device bulk IN and interrupt endpoints.
int usbnet_open(struct usbnet_device *usbnet)
Open USB network device.
void usbnet_close(struct usbnet_device *usbnet)
Close USB network device.
int usbnet_describe(struct usbnet_device *usbnet, struct usb_configuration_descriptor *config)
Describe USB network device interfaces.
static void usbnet_init(struct usbnet_device *usbnet, struct usb_function *func, struct usb_endpoint_driver_operations *intr, struct usb_endpoint_driver_operations *in, struct usb_endpoint_driver_operations *out)
Initialise USB network device.
char message[VMCONSOLE_BUFSIZE]