iPXE
ncm.h File Reference

CDC-NCM USB Ethernet driver. More...

#include <stdint.h>
#include <ipxe/usb.h>
#include <ipxe/cdc.h>
#include <byteswap.h>
#include "ecm.h"

Go to the source code of this file.

Data Structures

struct  ncm_ntb_datagram_parameters
 NTB datagram parameters. More...
struct  ncm_ntb_parameters
 NTB parameters. More...
struct  ncm_set_ntb_input_size
 Set NTB input size. More...
struct  ncm_transfer_header
 CDC-NCM transfer header (16-bit) More...
struct  ncm_datagram_descriptor
 CDC-NCM datagram descriptor (16-bit) More...
struct  ncm_datagram_pointer
 CDC-NCM datagram pointer (16-bit) More...
struct  ncm_ntb_header
 NTB constructed for transmitted packets (excluding padding) More...
struct  ncm_device
 A CDC-NCM network device. More...

Macros

#define USB_SUBCLASS_CDC_NCM   0x0d
 CDC-NCM subclass.
#define NCM_GET_NTB_PARAMETERS
 Get NTB parameters.
#define NCM_SET_NET_ADDRESS
 Set MAC address.
#define NCM_SET_NTB_INPUT_SIZE
 Set NTB input size.
#define NCM_MIN_NTB_INPUT_SIZE   2048
 Minimum allowed NTB input size.
#define NCM_MAX_NTB_INPUT_SIZE   65536
 Maximum allowed NTB input size (16-bit)
#define NCM_TRANSFER_HEADER_MAGIC   0x484d434eUL
 CDC-NCM transfer header magic.
#define NCM_DATAGRAM_POINTER_MAGIC   0x304d434eUL
 CDC-NCM datagram pointer magic.
#define NCM_DATAGRAM_POINTER_MAGIC_CRC   0x01000000UL
 CDC-NCM datagram pointer CRC present flag.
#define NCM_IN_MIN_COUNT   3
 Bulk IN ring minimum buffer count.
#define NCM_IN_MIN_SIZE   16384
 Bulk IN ring minimum total buffer size.
#define NCM_IN_MAX_SIZE   131072
 Bulk IN ring maximum total buffer size.
#define NCM_INTR_COUNT   2
 Interrupt ring buffer count.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)

Detailed Description

CDC-NCM USB Ethernet driver.

Definition in file ncm.h.

Macro Definition Documentation

◆ USB_SUBCLASS_CDC_NCM

#define USB_SUBCLASS_CDC_NCM   0x0d

CDC-NCM subclass.

Definition at line 20 of file ncm.h.

◆ NCM_GET_NTB_PARAMETERS

#define NCM_GET_NTB_PARAMETERS
Value:
USB_REQUEST_TYPE ( 0x80 ) )
#define USB_DIR_IN
Data transfer is from device to host.
Definition usb.h:98
#define USB_TYPE_CLASS
Class-specific request type.
Definition usb.h:104
#define USB_RECIP_INTERFACE
Request recipient is an interface.
Definition usb.h:116

Get NTB parameters.

Definition at line 23 of file ncm.h.

23#define NCM_GET_NTB_PARAMETERS \
24 ( USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
25 USB_REQUEST_TYPE ( 0x80 ) )

Referenced by ncm_probe().

◆ NCM_SET_NET_ADDRESS

#define NCM_SET_NET_ADDRESS
Value:
USB_REQUEST_TYPE ( 0x82 ) )
#define USB_DIR_OUT
Data transfer is from host to device.
Definition usb.h:95

Set MAC address.

Definition at line 56 of file ncm.h.

56#define NCM_SET_NET_ADDRESS \
57 ( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
58 USB_REQUEST_TYPE ( 0x82 ) )

Referenced by ncm_open().

◆ NCM_SET_NTB_INPUT_SIZE

#define NCM_SET_NTB_INPUT_SIZE
Value:
USB_REQUEST_TYPE ( 0x86 ) )

Set NTB input size.

Definition at line 61 of file ncm.h.

61#define NCM_SET_NTB_INPUT_SIZE \
62 ( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
63 USB_REQUEST_TYPE ( 0x86 ) )

Referenced by ncm_open().

◆ NCM_MIN_NTB_INPUT_SIZE

#define NCM_MIN_NTB_INPUT_SIZE   2048

Minimum allowed NTB input size.

Definition at line 72 of file ncm.h.

Referenced by ncm_in_prefill().

◆ NCM_MAX_NTB_INPUT_SIZE

#define NCM_MAX_NTB_INPUT_SIZE   65536

Maximum allowed NTB input size (16-bit)

Definition at line 75 of file ncm.h.

Referenced by ncm_in_prefill().

◆ NCM_TRANSFER_HEADER_MAGIC

#define NCM_TRANSFER_HEADER_MAGIC   0x484d434eUL

CDC-NCM transfer header magic.

Definition at line 92 of file ncm.h.

Referenced by ncm_out_transmit().

◆ NCM_DATAGRAM_POINTER_MAGIC

#define NCM_DATAGRAM_POINTER_MAGIC   0x304d434eUL

CDC-NCM datagram pointer magic.

Definition at line 118 of file ncm.h.

Referenced by ncm_out_transmit().

◆ NCM_DATAGRAM_POINTER_MAGIC_CRC

#define NCM_DATAGRAM_POINTER_MAGIC_CRC   0x01000000UL

CDC-NCM datagram pointer CRC present flag.

Definition at line 121 of file ncm.h.

Referenced by ncm_in_complete().

◆ NCM_IN_MIN_COUNT

#define NCM_IN_MIN_COUNT   3

Bulk IN ring minimum buffer count.

This is a policy decision.

Definition at line 159 of file ncm.h.

Referenced by ncm_in_prefill().

◆ NCM_IN_MIN_SIZE

#define NCM_IN_MIN_SIZE   16384

Bulk IN ring minimum total buffer size.

This is a policy decision.

Definition at line 165 of file ncm.h.

Referenced by ncm_in_prefill().

◆ NCM_IN_MAX_SIZE

#define NCM_IN_MAX_SIZE   131072

Bulk IN ring maximum total buffer size.

This is a policy decision.

Definition at line 171 of file ncm.h.

Referenced by ncm_in_prefill().

◆ NCM_INTR_COUNT

#define NCM_INTR_COUNT   2

Interrupt ring buffer count.

This is a policy decision.

Definition at line 177 of file ncm.h.

Referenced by ncm_probe().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )