|
iPXE
|
CDC-NCM USB Ethernet driver. More...
#include <string.h>#include <errno.h>#include <ipxe/netdevice.h>#include <ipxe/ethernet.h>#include <ipxe/if_ether.h>#include <ipxe/profile.h>#include <ipxe/usb.h>#include <ipxe/usbnet.h>#include "ecm.h"#include "ncm.h"Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| static void | ncm_intr_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
| Complete interrupt transfer. | |
| static int | ncm_in_prefill (struct ncm_device *ncm) |
| Prefill bulk IN endpoint. | |
| static void | ncm_in_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
| Complete bulk IN transfer. | |
| static int | ncm_out_transmit (struct ncm_device *ncm, struct io_buffer *iobuf) |
| Transmit packet. | |
| static void | ncm_out_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
| Complete bulk OUT transfer. | |
| static int | ncm_open (struct net_device *netdev) |
| Open network device. | |
| static void | ncm_close (struct net_device *netdev) |
| Close network device. | |
| static int | ncm_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
| Transmit packet. | |
| static void | ncm_poll (struct net_device *netdev) |
| Poll for completed and received packets. | |
| static int | ncm_probe (struct usb_function *func, struct usb_configuration_descriptor *config) |
| Probe device. | |
| static void | ncm_remove (struct usb_function *func) |
| Remove device. | |
Variables | |
| static struct profiler ncm_intr_profiler | __profiler |
| Interrupt completion profiler. | |
| static struct usb_endpoint_driver_operations | ncm_intr_operations |
| Interrupt endpoint operations. | |
| static struct usb_endpoint_driver_operations | ncm_in_operations |
| Bulk IN endpoint operations. | |
| static struct usb_endpoint_driver_operations | ncm_out_operations |
| Bulk OUT endpoint operations. | |
| static struct net_device_operations | ncm_operations |
| CDC-NCM network device operations. | |
| static struct usb_device_id | ncm_ids [] |
| CDC-NCM device IDs. | |
| struct usb_driver ncm_driver | __usb_driver |
| CDC-NCM driver. | |
CDC-NCM USB Ethernet driver.
Definition in file ncm.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
static |
Complete interrupt transfer.
| ep | USB endpoint |
| iobuf | I/O buffer |
| rc | Completion status code |
Definition at line 74 of file ncm.c.
References CDC_CONNECTION_SPEED_CHANGE, CDC_NETWORK_CONNECTION, container_of, cpu_to_le16, io_buffer::data, DBGC, DBGC_HDA, EINVAL, error, free_iob(), usbnet_device::intr, iob_disown, iob_len(), len, message, ncm_device::netdev, netdev, netdev_link_down(), netdev_link_up(), netdev_rx_err(), usb_endpoint::open, profile_start(), profile_stop(), rc, strerror(), and ncm_device::usbnet.
|
static |
Prefill bulk IN endpoint.
| ncm | CDC-NCM device |
| rc | Return status code |
Definition at line 160 of file ncm.c.
References bus, ncm_device::bus, count, DBGC, ENOMEM, usbnet_device::in, mtu, ncm_device::mtu, NCM_IN_MAX_SIZE, NCM_IN_MIN_COUNT, NCM_IN_MIN_SIZE, NCM_MAX_NTB_INPUT_SIZE, NCM_MIN_NTB_INPUT_SIZE, rc, usb_prefill(), usb_refill_init(), and ncm_device::usbnet.
Referenced by ncm_open().
|
static |
Complete bulk IN transfer.
| ep | USB endpoint |
| iobuf | I/O buffer |
| rc | Completion status code |
Definition at line 213 of file ncm.c.
References alloc_iob(), container_of, cpu_to_le32, io_buffer::data, DBGC, DBGC_HDA, desc, ncm_datagram_pointer::desc, EINVAL, ENOMEM, error, ETH_HLEN, ncm_datagram_pointer::header_len, usbnet_device::in, iob_len(), iob_put, iob_reserve, iob_unput, le16_to_cpu, len, ncm_datagram_pointer::magic, memcpy(), NCM_DATAGRAM_POINTER_MAGIC_CRC, ncm_ntb_header::ndp, ncm_device::netdev, netdev, netdev_rx(), netdev_rx_err(), NULL, ncm_transfer_header::offset, offsetof, usb_endpoint::open, pkt_len, profile_start(), profile_stop(), rc, strerror(), typeof(), usb_recycle(), and ncm_device::usbnet.
|
static |
Transmit packet.
| ncm | CDC-NCM device |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 357 of file ncm.c.
References cpu_to_le16, cpu_to_le32, header, iob_ensure_headroom(), iob_len(), iob_push, len, memset(), NCM_DATAGRAM_POINTER_MAGIC, NCM_TRANSFER_HEADER_MAGIC, ncm_ntb_header::ndp, offsetof, usbnet_device::out, ncm_device::padding, profile_start(), profile_stop(), rc, ncm_device::sequence, typeof(), usb_stream(), and ncm_device::usbnet.
Referenced by ncm_transmit().
|
static |
Complete bulk OUT transfer.
| ep | USB endpoint |
| iobuf | I/O buffer |
| rc | Completion status code |
Definition at line 405 of file ncm.c.
References container_of, ncm_device::netdev, netdev, netdev_tx_complete_err(), usbnet_device::out, rc, and ncm_device::usbnet.
|
static |
Open network device.
| netdev | Network device |
| rc | Return status code |
Definition at line 433 of file ncm.c.
References usbnet_device::comms, cpu_to_le32, DBGC, usbnet_device::in, usb_endpoint::len, memset(), ncm_in_prefill(), NCM_SET_NET_ADDRESS, NCM_SET_NTB_INPUT_SIZE, netdev, rc, ncm_device::sequence, size, strerror(), ncm_device::usb, usb_control(), usb_flush(), ncm_device::usbnet, usbnet_close(), and usbnet_open().
|
static |
Close network device.
| netdev | Network device |
Definition at line 488 of file ncm.c.
References netdev, ncm_device::usbnet, and usbnet_close().
|
static |
Transmit packet.
| netdev | Network device |
| iobuf | I/O buffer |
| rc | Return status code |
Definition at line 502 of file ncm.c.
References ncm_out_transmit(), netdev, and rc.
|
static |
Poll for completed and received packets.
| netdev | Network device |
Definition at line 519 of file ncm.c.
References ncm_device::bus, netdev, netdev_rx_err(), NULL, rc, usb_poll(), ncm_device::usbnet, and usbnet_refill().
|
static |
Probe device.
| func | USB function |
| config | Configuration descriptor |
| rc | Return status code |
Definition at line 554 of file ncm.c.
References alloc_etherdev(), assert, ncm_device::bus, usb_hub::bus, usbnet_device::comms, DBGC, DBGC2, usb_function::dev, ncm_ntb_datagram_parameters::divisor, ecm_ethernet_descriptor(), ecm_fetch_mac(), EINVAL, ENOMEM, ETH_HLEN, usb_port::hub, ncm_ntb_parameters::in, usbnet_device::intr, le16_to_cpu, le32_to_cpu, memset(), ncm_device::mtu, ncm_ntb_datagram_parameters::mtu, usb_function::name, NCM_GET_NTB_PARAMETERS, ncm_in_operations, NCM_INTR_COUNT, ncm_intr_operations, ncm_operations, ncm_out_operations, ncm_device::netdev, netdev, netdev_init(), netdev_nullify(), netdev_put(), NULL, ncm_ntb_parameters::out, ncm_device::padding, usb_device::port, rc, register_netdev(), ncm_ntb_datagram_parameters::remainder, strerror(), unregister_netdev(), ncm_device::usb, usb_function::usb, usb_control(), usb_func_set_drvdata(), usb_interface_descriptor(), usb_refill_init(), ncm_device::usbnet, usbnet_describe(), and usbnet_init().
|
static |
Remove device.
| func | USB function |
Definition at line 656 of file ncm.c.
References ncm_device::netdev, netdev, netdev_nullify(), netdev_put(), unregister_netdev(), and usb_func_get_drvdata().
|
static |
|
static |
Interrupt endpoint operations.
Definition at line 143 of file ncm.c.
Referenced by ncm_probe().
|
static |
Bulk IN endpoint operations.
Definition at line 346 of file ncm.c.
Referenced by ncm_probe().
|
static |
Bulk OUT endpoint operations.
Definition at line 416 of file ncm.c.
Referenced by ncm_probe().
|
static |
CDC-NCM network device operations.
Definition at line 533 of file ncm.c.
Referenced by ncm_probe().
|
static |
CDC-NCM device IDs.
| struct usb_driver ncm_driver __usb_driver |
CDC-NCM driver.
Definition at line 671 of file ncm.c.