87 DBGC ( rndis,
"RNDIS %s timed out waiting for ID %#08x\n",
88 rndis->
name, wait_id );
111 if ( (
rc = rndis->
op->
transmit ( rndis, iobuf ) ) != 0 ) {
112 DBGC ( rndis,
"RNDIS %s could not transmit: %s\n",
135 DBGC ( rndis,
"RNDIS %s completed underlength transmission:\n",
231 if (
len <
sizeof ( *
msg ) ) {
232 DBGC ( rndis,
"RNDIS %s received underlength data packet:\n",
243 if ( ( data_offset >
len ) || (
data_len > (
len - data_offset ) ) ) {
244 DBGC ( rndis,
"RNDIS %s data packet data exceeds packet:\n",
320 if (
len <
sizeof ( *cmplt ) ) {
321 DBGC ( rndis,
"RNDIS %s received underlength initialisation " 322 "completion:\n", rndis->
name );
334 DBGC ( rndis,
"RNDIS %s received initialisation completion " 335 "failure %#08x\n", rndis->
name,
434 const void *
data,
size_t len ) {
488 if (
len <
sizeof ( *cmplt ) ) {
489 DBGC ( rndis,
"RNDIS %s received underlength query " 490 "completion:\n", rndis->
name );
502 DBGC ( rndis,
"RNDIS %s received query completion failure " 512 if ( ( info_offset >
len ) || (
info_len > (
len - info_offset ) ) ) {
513 DBGC ( rndis,
"RNDIS %s query completion information exceeds " 514 "packet:\n", rndis->
name );
519 info = ( ( (
void * ) cmplt ) + info_offset );
537 if (
info_len !=
sizeof ( *link_status ) ) {
538 DBGC ( rndis,
"RNDIS %s invalid link status:\n",
542 goto err_link_status;
545 if ( *link_status == 0 ) {
546 DBGC ( rndis,
"RNDIS %s link is up\n", rndis->
name );
549 DBGC ( rndis,
"RNDIS %s link is down: %#08x\n",
556 DBGC ( rndis,
"RNDIS %s unexpected query completion ID %#08x\n",
594 if (
len <
sizeof ( *cmplt ) ) {
595 DBGC ( rndis,
"RNDIS %s received underlength set completion:\n",
608 DBGC ( rndis,
"RNDIS %s received set completion failure " 639 const void *
data,
size_t len ) {
667 if ( (
rc = rndis->
op->
open ( rndis ) ) != 0 ) {
668 DBGC ( rndis,
"RNDIS %s could not open: %s\n",
680 goto err_query_permanent;
685 goto err_query_current;
725 if (
len <
sizeof ( *
msg ) ) {
726 DBGC ( rndis,
"RNDIS %s received underlength status message:\n",
738 switch (
msg->status ) {
741 DBGC ( rndis,
"RNDIS %s link is up\n", rndis->
name );
746 DBGC ( rndis,
"RNDIS %s link is down\n", rndis->
name );
755 DBGC ( rndis,
"RNDIS %s unexpected status %#08x:\n",
809 DBGC ( rndis,
"RNDIS %s received unexpected type %#08x\n",
837 DBGC ( rndis,
"RNDIS %s received underlength packet:\n",
888 DBGC ( rndis,
"RNDIS %s could not set receive filter to %#08x: " 907 if ( (
rc = rndis->
op->
open ( rndis ) ) != 0 ) {
908 DBGC ( rndis,
"RNDIS %s could not open: %s\n",
983 rndis->
op->
poll ( rndis );
1011 rndis->
priv = ( ( (
void * ) rndis ) +
sizeof ( *rndis ) );
1036 DBGC ( rndis,
"RNDIS %s could not register: %s\n",
struct rndis_device * alloc_rndis(size_t priv_len)
Allocate RNDIS device.
#define iob_pull(iobuf, len)
#define EINVAL
Invalid argument.
Unknown start-of-day status code.
struct arbelprm_rc_send_wqe rc
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
void netdev_tx_defer(struct net_device *netdev, struct io_buffer *iobuf)
Defer transmitted packet.
int(* open)(struct rndis_device *rndis)
Open RNDIS device.
#define RNDIS_INDICATE_STATUS_MSG
RNDIS indicate status message.
void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
const char * name
Device name.
static void rndis_rx_data(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive data packet.
#define le32_to_cpu(value)
void netdev_tx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard transmitted packet.
UINT8_t filter
Receive packet filter.
#define iob_push(iobuf, len)
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
RNDIS query OID completion.
uint32_t type
Operating system type.
void unregister_rndis(struct rndis_device *rndis)
Unregister RNDIS device.
RNDIS query or set OID message.
static void rndis_rx_query_oid(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive query OID completion.
RNDIS initialise message.
void(* close)(struct rndis_device *rndis)
Close RNDIS device.
RNDIS initialise completion.
static int rndis_wait(struct rndis_device *rndis, unsigned int wait_id)
Wait for completion.
static int rndis_tx_halt(struct rndis_device *rndis)
Transmit halt message.
#define RNDIS_QUERY_CMPLT
RNDIS query OID completion.
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
uint32_t data_len
Microcode data size (or 0 to indicate 2000 bytes)
#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS
OID for media status.
#define RNDIS_MAX_WAIT_MS
Maximum time to wait for a transaction to complete.
static void rndis_rx_status(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive indicate status message.
Device is connected to a network medium.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
#define RNDIS_INIT_ID
Request ID used for initialisation.
#define ENOTSUP
Operation not supported.
static int rndis_filter(struct rndis_device *rndis, unsigned int filter)
Set receive filter.
static int rndis_tx_message(struct rndis_device *rndis, struct io_buffer *iobuf, unsigned int type)
Transmit message.
int(* transmit)(struct rndis_device *rndis, struct io_buffer *iobuf)
Transmit packet.
#define RNDIS_VERSION_MAJOR
RNDIS major version.
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
#define RNDIS_MTU
RNDIS maximum transfer size.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
uint8_t info_len
Reject information length.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
static int rndis_open(struct net_device *netdev)
Open network device.
struct net_device * netdev
Network device.
unsigned int wait_id
Request ID for current blocking request.
void * priv
Driver private data.
struct rndis_operations * op
RNDIS operations.
pseudo_bit_t value[0x00020]
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
static struct net_device * netdev
#define RNDIS_SET_CMPLT
RNDIS set OID completion.
void unregister_netdev(struct net_device *netdev)
Unregister network device.
void rndis_rx_err(struct rndis_device *rndis, struct io_buffer *iobuf, int rc)
Discard packet from underlying transport layer.
#define cpu_to_le32(value)
uint8_t id
Request identifier.
#define EPROTO
Protocol error.
#define iob_unput(iobuf, len)
static int rndis_tx_initialise(struct rndis_device *rndis, unsigned int id)
Transmit initialisation message.
static int rndis_tx_data(struct rndis_device *rndis, struct io_buffer *iobuf)
Transmit data packet.
#define RNDIS_QUERY_MSG
RNDIS query OID message.
static int rndis_initialise(struct rndis_device *rndis)
Initialise RNDIS.
char * strerror(int errno)
Retrieve string representation of error number.
#define RNDIS_OID_802_3_PERMANENT_ADDRESS
OID for permanent MAC address.
int register_rndis(struct rndis_device *rndis)
Register RNDIS device.
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.
static struct io_buffer * rndis_alloc_iob(size_t len)
Allocate I/O buffer.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
#define RNDIS_INITIALISE_MSG
RNDIS initialise message.
static void rndis_rx_message(struct rndis_device *rndis, struct io_buffer *iobuf, unsigned int type)
Receive RNDIS message.
void(* poll)(struct rndis_device *rndis)
Poll for completed and received packets.
uint32_t len
Information buffer length.
Remote Network Driver Interface Specification.
static void rndis_close(struct net_device *netdev)
Close network device.
void rndis_rx(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive packet from underlying transport layer.
static int rndis_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
#define RNDIS_OID_GEN_CURRENT_PACKET_FILTER
OID for packet filter.
int rndis_tx_defer(struct rndis_device *rndis, struct io_buffer *iobuf)
Defer transmitted packet.
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.
uint32_t offset
Information buffer offset.
Network device management.
#define RNDIS_SET_MSG
RNDIS set OID message.
static int rndis_halt(struct rndis_device *rndis)
Halt RNDIS.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
#define iob_reserve(iobuf, len)
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
#define RNDIS_OID_802_3_CURRENT_ADDRESS
OID for current MAC address.
static int rndis_describe(struct rndis_device *rndis)
Describe RNDIS device.
#define RNDIS_VERSION_MINOR
RNDIS minor version.
static int rndis_oid(struct rndis_device *rndis, unsigned int oid, const void *data, size_t len)
Query or set OID.
void * data
Start of data.
void * priv
Driver private data.
static void rndis_rx_set_oid(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive set OID completion.
#define EIO
Input/output error.
static void rndis_poll(struct net_device *netdev)
Poll for completed and received packets.
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
struct ena_aq_header header
Header.
#define RNDIS_PACKET_MSG
RNDIS packet message.
int wait_rc
Return status code for current blocking request.
uint8_t data[48]
Additional event data.
static int rndis_tx_oid(struct rndis_device *rndis, unsigned int oid, const void *data, size_t len)
Transmit OID message.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
void free_rndis(struct rndis_device *rndis)
Free RNDIS device.
void rndis_tx_complete_err(struct rndis_device *rndis, struct io_buffer *iobuf, int rc)
Complete message transmission.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
static void rndis_rx_initialise(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive initialisation completion.
#define ETIMEDOUT
Connection timed out.
RNDIS set OID completion.
#define RNDIS_INITIALISE_CMPLT
RNDIS initialise completion.
Device is disconnected from the medium.
RNDIS indicate status message.
void * memset(void *dest, int character, size_t len) __nonnull
#define RNDIS_HALT_MSG
RNDIS halt message.