45 { .
name =
"ecm.intr" };
53 { .
name =
"ecm.out" };
100 buf[
sizeof ( buf ) - 1 ] =
'\0';
102 ( sizeof ( buf ) - 1 ) );
109 if (
len != ( (
int ) (
sizeof ( buf ) - 1 ) ) ) {
110 DBGC ( usb,
"USB %s has invalid ECM MAC \"%s\"\n",
119 DBGC ( usb,
"USB %s could not decode ECM MAC \"%s\": %s\n",
129 DBGC ( usb,
"USB %s using system-specific MAC %s\n",
167 DBGC ( ecm,
"ECM %p interrupt failed: %s\n",
175 DBGC ( ecm,
"ECM %p underlength interrupt:\n", ecm );
187 DBGC ( ecm,
"ECM %p link up\n", ecm );
190 DBGC ( ecm,
"ECM %p link down\n", ecm );
200 DBGC ( ecm,
"ECM %p unrecognised interrupt:\n", ecm );
253 DBGC ( ecm,
"ECM %p bulk IN failed: %s\n",
340 DBGC ( ecm,
"ECM %p could not open: %s\n",
352 DBGC ( ecm,
"ECM %p could not set packet filter: %s\n",
453 memset ( ecm, 0,
sizeof ( *ecm ) );
461 DBGC ( ecm,
"ECM %p on %s\n", ecm, func->
name );
465 DBGC ( ecm,
"ECM %p could not describe: %s\n",
475 DBGC ( ecm,
"ECM %p has no Ethernet descriptor\n", ecm );
482 DBGC ( ecm,
"ECM %p could not fetch MAC address: %s\n",
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
void(* complete)(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete transfer.
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
An Ethernet Functional Descriptor.
unsigned int comms
Communications interface.
static void * usb_func_get_drvdata(struct usb_function *func)
Get USB function driver private data.
CDC-ECM USB Ethernet driver.
#define USB_SUBCLASS_CDC_ECM
CDC-ECM subclass.
int(* open)(struct net_device *netdev)
Open network device.
static void ecm_in_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete bulk IN transfer.
UINT8_t filter
Receive packet filter.
static struct net_device_operations ecm_operations
CDC-ECM network device operations.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
#define CDC_SUBTYPE_ETHERNET
Ethernet descriptor subtype.
struct arbelprm_completion_with_error error
struct usbnet_device usbnet
USB network device.
uint64_t desc
Microcode descriptor list physical address.
#define ECM_IN_MAX_FILL
Bulk IN maximum fill level.
#define ECM_SET_ETHERNET_PACKET_FILTER
Set Ethernet packet filter.
int usb_stream(struct usb_endpoint *ep, struct io_buffer *iobuf, int terminate)
Enqueue USB stream transfer.
#define for_each_interface_descriptor(desc, config, interface)
Iterate over all configuration descriptors within an interface descriptor.
static struct usb_endpoint_driver_operations ecm_intr_operations
Interrupt endpoint operations.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
static int ecm_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
A data structure for storing profiling information.
int open
Endpoint is open.
static void profile_stop(struct profiler *profiler)
Stop profiling.
struct usb_endpoint intr
Interrupt 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.
static int ecm_out_transmit(struct ecm_device *ecm, struct io_buffer *iobuf)
Transmit packet.
static void ecm_remove(struct usb_function *func)
Remove device.
#define ENOTSUP
Operation not supported.
static size_t base16_encoded_len(size_t raw_len)
Calculate length of base16-encoded data.
struct usb_endpoint out
Bulk OUT endpoint.
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
#define ENOMEM
Not enough space.
#define iob_disown(iobuf)
Disown an I/O buffer.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static struct usb_endpoint_driver_operations ecm_in_operations
Bulk IN endpoint operations.
A USB interface descriptor.
int acpi_mac(uint8_t *hw_addr)
Extract MAC address from DSDT/SSDT.
struct usb_port * port
USB port.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define container_of(ptr, type, field)
Get containing structure.
void * priv
Driver private data.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
struct ecm_ethernet_descriptor * ecm_ethernet_descriptor(struct usb_configuration_descriptor *config, struct usb_interface_descriptor *interface)
Locate Ethernet functional descriptor.
static void usb_refill_init(struct usb_endpoint *ep, size_t reserve, size_t len, unsigned int max)
Initialise USB endpoint refill.
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
static struct net_device * netdev
struct usb_device * usb
USB device.
static void usb_func_set_drvdata(struct usb_function *func, void *priv)
Set USB function driver private data.
static void profile_start(struct profiler *profiler)
Start profiling.
#define ECM_IN_MTU
Bulk IN buffer size.
#define USB_CS_INTERFACE_DESCRIPTOR
A class-specific interface descriptor.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
int usbnet_refill(struct usbnet_device *usbnet)
Refill USB network device bulk IN and interrupt endpoints.
struct usb_interface_descriptor * usb_interface_descriptor(struct usb_configuration_descriptor *config, unsigned int interface, unsigned int alternate)
Locate USB interface descriptor.
#define CDC_NETWORK_CONNECTION
Network connection notification.
static void usb_poll(struct usb_bus *bus)
Poll USB bus.
#define CDC_CONNECTION_SPEED_CHANGE
Connection speed change notification.
char * strerror(int errno)
Retrieve string representation of error number.
#define ECM_INTR_MAX_FILL
Interrupt maximum fill level.
int register_netdev(struct net_device *netdev)
Register network device.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
#define USB_CLASS_ID(base, subclass, protocol)
Construct USB class ID.
static void ecm_close(struct net_device *netdev)
Close network device.
struct usb_endpoint in
Bulk IN endpoint.
static void ecm_out_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete bulk OUT transfer.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
struct usb_bus * bus
USB bus.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static int ecm_open(struct net_device *netdev)
Open network device.
struct usb_device * usb
USB device.
static void ecm_intr_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete interrupt transfer.
#define USB_CLASS_CDC
Class code for communications devices.
Network device operations.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
static int ecm_probe(struct usb_function *func, struct usb_configuration_descriptor *config)
Probe device.
Network device management.
A CDC-ECM network device.
A USB configuration descriptor.
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
#define USB_ANY_ID
Match-anything ID.
Universal Serial Bus (USB)
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.
void * data
Start of data.
struct usb_hub * hub
USB hub.
static struct usb_device_id ecm_ids[]
CDC-ECM device IDs.
int ecm_fetch_mac(struct usb_function *func, struct ecm_ethernet_descriptor *desc, struct net_device *netdev)
Get hardware MAC address.
static struct usb_endpoint_driver_operations ecm_out_operations
Bulk OUT endpoint operations.
struct usb_endpoint * ep[32]
Endpoint list.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
#define cpu_to_le16(value)
struct usb_driver ecm_driver __usb_driver
CDC-ECM driver.
int usbnet_describe(struct usbnet_device *usbnet, struct usb_configuration_descriptor *config)
Describe USB network device interfaces.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
char message[VMCONSOLE_BUFSIZE]
void usbnet_close(struct usbnet_device *usbnet)
Close USB network device.
USB endpoint driver operations.
struct device dev
Generic device.
static void ecm_poll(struct net_device *netdev)
Poll for completed and received packets.
struct usb_bus * bus
USB bus.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
struct net_device * netdev
Network device.
struct usb_device_id * ids
USB ID table.
int usb_get_string_descriptor(struct usb_device *usb, unsigned int index, unsigned int language, char *buf, size_t len)
Get USB string descriptor.
void * memset(void *dest, int character, size_t len) __nonnull
static struct profiler ecm_intr_profiler __profiler
Interrupt completion profiler.
int usbnet_open(struct usbnet_device *usbnet)
Open USB network device.