iPXE
Data Structures | Macros | Enumerations | Functions
rndis.h File Reference

Remote Network Driver Interface Specification. More...

#include <stdint.h>
#include <ipxe/netdevice.h>
#include <ipxe/iobuf.h>

Go to the source code of this file.

Data Structures

struct  rndis_header
 RNDIS message header. More...
 
struct  rndis_initialise_message
 RNDIS initialise message. More...
 
struct  rndis_initialise_completion
 RNDIS initialise completion. More...
 
struct  rndis_halt_message
 RNDIS halt message. More...
 
struct  rndis_oid_message
 RNDIS query or set OID message. More...
 
struct  rndis_query_completion
 RNDIS query OID completion. More...
 
struct  rndis_set_completion
 RNDIS set OID completion. More...
 
struct  rndis_reset_message
 RNDIS reset message. More...
 
struct  rndis_reset_completion
 RNDIS reset completion. More...
 
struct  rndis_diagnostic_info
 RNDIS diagnostic information. More...
 
struct  rndis_indicate_status_message
 RNDIS indicate status message. More...
 
struct  rndis_keepalive_message
 RNDIS keepalive message. More...
 
struct  rndis_keepalive_completion
 RNDIS keepalive completion. More...
 
struct  rndis_packet_field
 RNDIS packet field. More...
 
struct  rndis_packet_message
 RNDIS packet message. More...
 
struct  rndis_packet_record
 RNDIS packet record. More...
 
struct  rndis_operations
 RNDIS device operations. More...
 
struct  rndis_device
 An RNDIS device. More...
 

Macros

#define RNDIS_MAX_WAIT_MS   1000
 Maximum time to wait for a transaction to complete. More...
 
#define RNDIS_INITIALISE_MSG   0x00000002UL
 RNDIS initialise message. More...
 
#define RNDIS_INIT_ID   0xe110e110UL
 Request ID used for initialisation. More...
 
#define RNDIS_VERSION_MAJOR   1
 RNDIS major version. More...
 
#define RNDIS_VERSION_MINOR   0
 RNDIS minor version. More...
 
#define RNDIS_MTU   2048
 RNDIS maximum transfer size. More...
 
#define RNDIS_INITIALISE_CMPLT   0x80000002UL
 RNDIS initialise completion. More...
 
#define RNDIS_HALT_MSG   0x00000003UL
 RNDIS halt message. More...
 
#define RNDIS_QUERY_MSG   0x00000004UL
 RNDIS query OID message. More...
 
#define RNDIS_SET_MSG   0x00000005UL
 RNDIS set OID message. More...
 
#define RNDIS_QUERY_CMPLT   0x80000004UL
 RNDIS query OID completion. More...
 
#define RNDIS_SET_CMPLT   0x80000005UL
 RNDIS set OID completion. More...
 
#define RNDIS_RESET_MSG   0x00000006UL
 RNDIS reset message. More...
 
#define RNDIS_RESET_CMPLT   0x80000006UL
 RNDIS reset completion. More...
 
#define RNDIS_INDICATE_STATUS_MSG   0x00000007UL
 RNDIS indicate status message. More...
 
#define RNDIS_KEEPALIVE_MSG   0x00000008UL
 RNDIS keepalive message. More...
 
#define RNDIS_KEEPALIVE_CMPLT   0x80000008UL
 RNDIS keepalive completion. More...
 
#define RNDIS_PACKET_MSG   0x00000001UL
 RNDIS packet message. More...
 
#define RNDIS_OID_GEN_CURRENT_PACKET_FILTER   0x0001010eUL
 OID for packet filter. More...
 
#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS   0x00010114UL
 OID for media status. More...
 
#define RNDIS_OID_802_3_PERMANENT_ADDRESS   0x01010101UL
 OID for permanent MAC address. More...
 
#define RNDIS_OID_802_3_CURRENT_ADDRESS   0x01010102UL
 OID for current MAC address. More...
 

Enumerations

enum  rndis_status { RNDIS_STATUS_MEDIA_CONNECT = 0x4001000bUL, RNDIS_STATUS_MEDIA_DISCONNECT = 0x4001000cUL, RNDIS_STATUS_WTF_WORLD = 0x40020006UL }
 RNDIS status codes. More...
 
enum  rndis_packet_filter {
  RNDIS_FILTER_UNICAST = 0x00000001UL, RNDIS_FILTER_MULTICAST = 0x00000002UL, RNDIS_FILTER_ALL_MULTICAST = 0x00000004UL, RNDIS_FILTER_BROADCAST = 0x00000008UL,
  RNDIS_FILTER_PROMISCUOUS = 0x00000020UL
}
 Packet filter bits. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static void rndis_init (struct rndis_device *rndis, struct rndis_operations *op)
 Initialise an RNDIS device. More...
 
void rndis_tx_complete_err (struct rndis_device *rndis, struct io_buffer *iobuf, int rc)
 Complete message transmission. More...
 
int rndis_tx_defer (struct rndis_device *rndis, struct io_buffer *iobuf)
 Defer transmitted packet. More...
 
void rndis_rx (struct rndis_device *rndis, struct io_buffer *iobuf)
 Receive packet from underlying transport layer. More...
 
void rndis_rx_err (struct rndis_device *rndis, struct io_buffer *iobuf, int rc)
 Discard packet from underlying transport layer. More...
 
struct rndis_devicealloc_rndis (size_t priv_len)
 Allocate RNDIS device. More...
 
int register_rndis (struct rndis_device *rndis)
 Register RNDIS device. More...
 
void unregister_rndis (struct rndis_device *rndis)
 Unregister RNDIS device. More...
 
void free_rndis (struct rndis_device *rndis)
 Free RNDIS device. More...
 
static void rndis_tx_complete (struct rndis_device *rndis, struct io_buffer *iobuf)
 Complete message transmission. More...
 

Detailed Description

Remote Network Driver Interface Specification.

Definition in file rndis.h.

Macro Definition Documentation

◆ RNDIS_MAX_WAIT_MS

#define RNDIS_MAX_WAIT_MS   1000

Maximum time to wait for a transaction to complete.

This is a policy decision.

Definition at line 20 of file rndis.h.

◆ RNDIS_INITIALISE_MSG

#define RNDIS_INITIALISE_MSG   0x00000002UL

RNDIS initialise message.

Definition at line 31 of file rndis.h.

◆ RNDIS_INIT_ID

#define RNDIS_INIT_ID   0xe110e110UL

Request ID used for initialisation.

This is a policy decision.

Definition at line 49 of file rndis.h.

◆ RNDIS_VERSION_MAJOR

#define RNDIS_VERSION_MAJOR   1

RNDIS major version.

Definition at line 52 of file rndis.h.

◆ RNDIS_VERSION_MINOR

#define RNDIS_VERSION_MINOR   0

RNDIS minor version.

Definition at line 55 of file rndis.h.

◆ RNDIS_MTU

#define RNDIS_MTU   2048

RNDIS maximum transfer size.

This is a policy decision.

Definition at line 61 of file rndis.h.

◆ RNDIS_INITIALISE_CMPLT

#define RNDIS_INITIALISE_CMPLT   0x80000002UL

RNDIS initialise completion.

Definition at line 64 of file rndis.h.

◆ RNDIS_HALT_MSG

#define RNDIS_HALT_MSG   0x00000003UL

RNDIS halt message.

Definition at line 91 of file rndis.h.

◆ RNDIS_QUERY_MSG

#define RNDIS_QUERY_MSG   0x00000004UL

RNDIS query OID message.

Definition at line 100 of file rndis.h.

◆ RNDIS_SET_MSG

#define RNDIS_SET_MSG   0x00000005UL

RNDIS set OID message.

Definition at line 103 of file rndis.h.

◆ RNDIS_QUERY_CMPLT

#define RNDIS_QUERY_CMPLT   0x80000004UL

RNDIS query OID completion.

Definition at line 120 of file rndis.h.

◆ RNDIS_SET_CMPLT

#define RNDIS_SET_CMPLT   0x80000005UL

RNDIS set OID completion.

Definition at line 135 of file rndis.h.

◆ RNDIS_RESET_MSG

#define RNDIS_RESET_MSG   0x00000006UL

RNDIS reset message.

Definition at line 146 of file rndis.h.

◆ RNDIS_RESET_CMPLT

#define RNDIS_RESET_CMPLT   0x80000006UL

RNDIS reset completion.

Definition at line 155 of file rndis.h.

◆ RNDIS_INDICATE_STATUS_MSG

#define RNDIS_INDICATE_STATUS_MSG   0x00000007UL

RNDIS indicate status message.

Definition at line 166 of file rndis.h.

◆ RNDIS_KEEPALIVE_MSG

#define RNDIS_KEEPALIVE_MSG   0x00000008UL

RNDIS keepalive message.

Definition at line 199 of file rndis.h.

◆ RNDIS_KEEPALIVE_CMPLT

#define RNDIS_KEEPALIVE_CMPLT   0x80000008UL

RNDIS keepalive completion.

Definition at line 208 of file rndis.h.

◆ RNDIS_PACKET_MSG

#define RNDIS_PACKET_MSG   0x00000001UL

RNDIS packet message.

Definition at line 219 of file rndis.h.

◆ RNDIS_OID_GEN_CURRENT_PACKET_FILTER

#define RNDIS_OID_GEN_CURRENT_PACKET_FILTER   0x0001010eUL

OID for packet filter.

Definition at line 254 of file rndis.h.

◆ RNDIS_OID_GEN_MEDIA_CONNECT_STATUS

#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS   0x00010114UL

OID for media status.

Definition at line 271 of file rndis.h.

◆ RNDIS_OID_802_3_PERMANENT_ADDRESS

#define RNDIS_OID_802_3_PERMANENT_ADDRESS   0x01010101UL

OID for permanent MAC address.

Definition at line 274 of file rndis.h.

◆ RNDIS_OID_802_3_CURRENT_ADDRESS

#define RNDIS_OID_802_3_CURRENT_ADDRESS   0x01010102UL

OID for current MAC address.

Definition at line 277 of file rndis.h.

Enumeration Type Documentation

◆ rndis_status

RNDIS status codes.

Enumerator
RNDIS_STATUS_MEDIA_CONNECT 

Device is connected to a network medium.

RNDIS_STATUS_MEDIA_DISCONNECT 

Device is disconnected from the medium.

RNDIS_STATUS_WTF_WORLD 

Unknown start-of-day status code.

Definition at line 189 of file rndis.h.

189  {
190  /** Device is connected to a network medium */
191  RNDIS_STATUS_MEDIA_CONNECT = 0x4001000bUL,
192  /** Device is disconnected from the medium */
193  RNDIS_STATUS_MEDIA_DISCONNECT = 0x4001000cUL,
194  /** Unknown start-of-day status code */
195  RNDIS_STATUS_WTF_WORLD = 0x40020006UL,
196 };
Unknown start-of-day status code.
Definition: rndis.h:195
Device is connected to a network medium.
Definition: rndis.h:191
Device is disconnected from the medium.
Definition: rndis.h:193

◆ rndis_packet_filter

Packet filter bits.

Enumerator
RNDIS_FILTER_UNICAST 

Unicast packets.

RNDIS_FILTER_MULTICAST 

Multicast packets.

RNDIS_FILTER_ALL_MULTICAST 

All multicast packets.

RNDIS_FILTER_BROADCAST 

Broadcast packets.

RNDIS_FILTER_PROMISCUOUS 

All packets.

Definition at line 257 of file rndis.h.

257  {
258  /** Unicast packets */
259  RNDIS_FILTER_UNICAST = 0x00000001UL,
260  /** Multicast packets */
261  RNDIS_FILTER_MULTICAST = 0x00000002UL,
262  /** All multicast packets */
263  RNDIS_FILTER_ALL_MULTICAST = 0x00000004UL,
264  /** Broadcast packets */
265  RNDIS_FILTER_BROADCAST = 0x00000008UL,
266  /** All packets */
267  RNDIS_FILTER_PROMISCUOUS = 0x00000020UL
268 };
Multicast packets.
Definition: rndis.h:261
Unicast packets.
Definition: rndis.h:259
All multicast packets.
Definition: rndis.h:263
All packets.
Definition: rndis.h:267
Broadcast packets.
Definition: rndis.h:265

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ rndis_init()

static void rndis_init ( struct rndis_device rndis,
struct rndis_operations op 
)
inlinestatic

Initialise an RNDIS device.

Parameters
rndisRNDIS device
opRNDIS device operations

Definition at line 339 of file rndis.h.

340  {
341 
342  rndis->op = op;
343 }
struct rndis_operations * op
RNDIS operations.
Definition: rndis.h:323
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327

References rndis_device::op, and op.

Referenced by acm_probe(), and netvsc_probe().

◆ rndis_tx_complete_err()

void rndis_tx_complete_err ( struct rndis_device rndis,
struct io_buffer iobuf,
int  rc 
)

Complete message transmission.

Parameters
rndisRNDIS device
iobufI/O buffer
rcPacket status code

Definition at line 127 of file rndis.c.

128  {
129  struct net_device *netdev = rndis->netdev;
130  struct rndis_header *header;
131  size_t len = iob_len ( iobuf );
132 
133  /* Sanity check */
134  if ( len < sizeof ( *header ) ) {
135  DBGC ( rndis, "RNDIS %s completed underlength transmission:\n",
136  rndis->name );
137  DBGC_HDA ( rndis, 0, iobuf->data, len );
139  return;
140  }
141  header = iobuf->data;
142 
143  /* Complete buffer */
144  if ( header->type == cpu_to_le32 ( RNDIS_PACKET_MSG ) ) {
145  netdev_tx_complete_err ( netdev, iobuf, rc );
146  } else {
147  free_iob ( iobuf );
148  }
149 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Device name.
Definition: rndis.h:321
void netdev_tx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard transmitted packet.
Definition: netdevice.c:369
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:145
#define DBGC(...)
Definition: compiler.h:505
struct net_device * netdev
Network device.
Definition: rndis.h:319
#define DBGC_HDA(...)
Definition: compiler.h:506
static struct net_device * netdev
Definition: gdbudp.c:52
#define cpu_to_le32(value)
Definition: byteswap.h:107
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
A network device.
Definition: netdevice.h:348
RNDIS message header.
Definition: rndis.h:23
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
Definition: netdevice.c:395
uint32_t len
Length.
Definition: ena.h:14
void * data
Start of data.
Definition: iobuf.h:44
struct ena_aq_header header
Header.
Definition: ena.h:12
#define RNDIS_PACKET_MSG
RNDIS packet message.
Definition: rndis.h:219
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References cpu_to_le32, io_buffer::data, DBGC, DBGC_HDA, EINVAL, free_iob(), header, iob_len(), len, rndis_device::name, netdev, rndis_device::netdev, netdev_tx_complete_err(), netdev_tx_err(), NULL, rc, and RNDIS_PACKET_MSG.

Referenced by acm_out_complete(), netvsc_cancel_transmit(), and rndis_tx_complete().

◆ rndis_tx_defer()

int rndis_tx_defer ( struct rndis_device rndis,
struct io_buffer iobuf 
)

Defer transmitted packet.

Parameters
rndisRNDIS device
iobufI/O buffer
Return values
rcReturn status code

As with netdev_tx_defer(), the caller must ensure that space in the transmit descriptor ring is freed up before calling rndis_tx_complete().

Unlike netdev_tx_defer(), this call may fail.

Definition at line 190 of file rndis.c.

190  {
191  struct net_device *netdev = rndis->netdev;
192  struct rndis_header *header;
193  struct rndis_packet_message *msg;
194 
195  /* Fail unless this was a packet message. Only packet
196  * messages correspond to I/O buffers in the network device's
197  * TX queue; other messages cannot be deferred in this way.
198  */
199  assert ( iob_len ( iobuf ) >= sizeof ( *header ) );
200  header = iobuf->data;
201  if ( header->type != cpu_to_le32 ( RNDIS_PACKET_MSG ) )
202  return -ENOTSUP;
203 
204  /* Strip RNDIS header and packet message header, to return
205  * this packet to the state in which we received it.
206  */
207  iob_pull ( iobuf, ( sizeof ( *header ) + sizeof ( *msg ) ) );
208 
209  /* Defer packet */
210  netdev_tx_defer ( netdev, iobuf );
211 
212  return 0;
213 }
#define iob_pull(iobuf, len)
Definition: iobuf.h:98
void netdev_tx_defer(struct net_device *netdev, struct io_buffer *iobuf)
Defer transmitted packet.
Definition: netdevice.c:344
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
struct net_device * netdev
Network device.
Definition: rndis.h:319
static struct net_device * netdev
Definition: gdbudp.c:52
#define cpu_to_le32(value)
Definition: byteswap.h:107
RNDIS packet message.
Definition: rndis.h:230
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
A network device.
Definition: netdevice.h:348
RNDIS message header.
Definition: rndis.h:23
void * data
Start of data.
Definition: iobuf.h:44
struct ena_aq_header header
Header.
Definition: ena.h:12
#define RNDIS_PACKET_MSG
RNDIS packet message.
Definition: rndis.h:219
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:285

References assert(), cpu_to_le32, io_buffer::data, ENOTSUP, header, iob_len(), iob_pull, msg(), netdev, rndis_device::netdev, netdev_tx_defer(), and RNDIS_PACKET_MSG.

Referenced by netvsc_transmit().

◆ rndis_rx()

void rndis_rx ( struct rndis_device rndis,
struct io_buffer iobuf 
)

Receive packet from underlying transport layer.

Parameters
rndisRNDIS device
iobufI/O buffer

Definition at line 829 of file rndis.c.

829  {
830  struct net_device *netdev = rndis->netdev;
831  struct rndis_header *header;
832  unsigned int type;
833  int rc;
834 
835  /* Sanity check */
836  if ( iob_len ( iobuf ) < sizeof ( *header ) ) {
837  DBGC ( rndis, "RNDIS %s received underlength packet:\n",
838  rndis->name );
839  DBGC_HDA ( rndis, 0, iobuf->data, iob_len ( iobuf ) );
840  rc = -EINVAL;
841  goto drop;
842  }
843  header = iobuf->data;
844 
845  /* Parse and strip header */
846  type = le32_to_cpu ( header->type );
847  iob_pull ( iobuf, sizeof ( *header ) );
848 
849  /* Handle message */
850  rndis_rx_message ( rndis, iob_disown ( iobuf ), type );
851 
852  return;
853 
854  drop:
855  /* Record error */
856  netdev_rx_err ( netdev, iob_disown ( iobuf ), rc );
857 }
#define iob_pull(iobuf, len)
Definition: iobuf.h:98
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition: netdevice.c:501
const char * name
Device name.
Definition: rndis.h:321
#define le32_to_cpu(value)
Definition: byteswap.h:113
uint8_t type
Type.
Definition: ena.h:16
#define DBGC(...)
Definition: compiler.h:505
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:208
struct net_device * netdev
Network device.
Definition: rndis.h:319
#define DBGC_HDA(...)
Definition: compiler.h:506
static struct net_device * netdev
Definition: gdbudp.c:52
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
A network device.
Definition: netdevice.h:348
static void rndis_rx_message(struct rndis_device *rndis, struct io_buffer *iobuf, unsigned int type)
Receive RNDIS message.
Definition: rndis.c:780
RNDIS message header.
Definition: rndis.h:23
void * data
Start of data.
Definition: iobuf.h:44
struct ena_aq_header header
Header.
Definition: ena.h:12

References io_buffer::data, DBGC, DBGC_HDA, EINVAL, header, iob_disown, iob_len(), iob_pull, le32_to_cpu, rndis_device::name, netdev, rndis_device::netdev, netdev_rx_err(), rc, rndis_rx_message(), and type.

Referenced by acm_control_receive(), acm_in_complete(), and netvsc_recv_data().

◆ rndis_rx_err()

void rndis_rx_err ( struct rndis_device rndis,
struct io_buffer iobuf,
int  rc 
)

Discard packet from underlying transport layer.

Parameters
rndisRNDIS device
iobufI/O buffer
rcPacket status code

Definition at line 866 of file rndis.c.

867  {
868  struct net_device *netdev = rndis->netdev;
869 
870  /* Record error */
871  netdev_rx_err ( netdev, iob_disown ( iobuf ), rc );
872 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
Definition: netdevice.c:501
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:208
struct net_device * netdev
Network device.
Definition: rndis.h:319
static struct net_device * netdev
Definition: gdbudp.c:52
A network device.
Definition: netdevice.h:348

References iob_disown, netdev, rndis_device::netdev, netdev_rx_err(), and rc.

Referenced by acm_in_complete(), acm_intr_complete(), and acm_poll().

◆ alloc_rndis()

struct rndis_device* alloc_rndis ( size_t  priv_len)

Allocate RNDIS device.

Parameters
priv_lenLength of private data
Return values
rndisRNDIS device, or NULL on allocation failure

Definition at line 1000 of file rndis.c.

1000  {
1001  struct net_device *netdev;
1002  struct rndis_device *rndis;
1003 
1004  /* Allocate and initialise structure */
1005  netdev = alloc_etherdev ( sizeof ( *rndis ) + priv_len );
1006  if ( ! netdev )
1007  return NULL;
1009  rndis = netdev->priv;
1010  rndis->netdev = netdev;
1011  rndis->priv = ( ( ( void * ) rndis ) + sizeof ( *rndis ) );
1012 
1013  return rndis;
1014 }
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition: netdevice.h:498
struct net_device * netdev
Network device.
Definition: rndis.h:319
void * priv
Driver private data.
Definition: netdevice.h:425
An RNDIS device.
Definition: rndis.h:317
static struct net_device * netdev
Definition: gdbudp.c:52
A network device.
Definition: netdevice.h:348
RNDIS device operations.
Definition: rndis.h:282
void * priv
Driver private data.
Definition: rndis.h:325
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition: ethernet.c:264
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References alloc_etherdev(), netdev, rndis_device::netdev, netdev_init(), NULL, rndis_device::priv, and net_device::priv.

Referenced by acm_probe(), and netvsc_probe().

◆ register_rndis()

int register_rndis ( struct rndis_device rndis)

Register RNDIS device.

Parameters
rndisRNDIS device
Return values
rcReturn status code

Note that this routine will open and use the RNDIS device in order to query the MAC address. The device must be immediately ready for use prior to registration.

Definition at line 1026 of file rndis.c.

1026  {
1027  struct net_device *netdev = rndis->netdev;
1028  int rc;
1029 
1030  /* Describe RNDIS device */
1031  if ( ( rc = rndis_describe ( rndis ) ) != 0 )
1032  goto err_describe;
1033 
1034  /* Register network device */
1035  if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
1036  DBGC ( rndis, "RNDIS %s could not register: %s\n",
1037  rndis->name, strerror ( rc ) );
1038  goto err_register;
1039  }
1040 
1041  return 0;
1042 
1044  err_register:
1045  err_describe:
1046  return rc;
1047 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Device name.
Definition: rndis.h:321
#define DBGC(...)
Definition: compiler.h:505
struct net_device * netdev
Network device.
Definition: rndis.h:319
static struct net_device * netdev
Definition: gdbudp.c:52
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition: netdevice.c:844
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
int register_netdev(struct net_device *netdev)
Register network device.
Definition: netdevice.c:667
A network device.
Definition: netdevice.h:348
static int rndis_describe(struct rndis_device *rndis)
Describe RNDIS device.
Definition: rndis.c:659

References DBGC, rndis_device::name, netdev, rndis_device::netdev, rc, register_netdev(), rndis_describe(), strerror(), and unregister_netdev().

Referenced by acm_probe(), and netvsc_probe().

◆ unregister_rndis()

void unregister_rndis ( struct rndis_device rndis)

Unregister RNDIS device.

Parameters
rndisRNDIS device

Definition at line 1054 of file rndis.c.

1054  {
1055  struct net_device *netdev = rndis->netdev;
1056 
1057  /* Unregister network device */
1059 }
struct net_device * netdev
Network device.
Definition: rndis.h:319
static struct net_device * netdev
Definition: gdbudp.c:52
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition: netdevice.c:844
A network device.
Definition: netdevice.h:348

References netdev, rndis_device::netdev, and unregister_netdev().

Referenced by acm_probe(), acm_remove(), netvsc_probe(), and netvsc_remove().

◆ free_rndis()

void free_rndis ( struct rndis_device rndis)

Free RNDIS device.

Parameters
rndisRNDIS device

Definition at line 1066 of file rndis.c.

1066  {
1067  struct net_device *netdev = rndis->netdev;
1068 
1069  /* Free network device */
1070  netdev_nullify ( netdev );
1071  netdev_put ( netdev );
1072 }
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
Definition: netdevice.h:555
struct net_device * netdev
Network device.
Definition: rndis.h:319
static struct net_device * netdev
Definition: gdbudp.c:52
A network device.
Definition: netdevice.h:348
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
Definition: netdevice.h:511

References netdev, rndis_device::netdev, netdev_nullify(), and netdev_put().

Referenced by acm_probe(), acm_remove(), netvsc_probe(), and netvsc_remove().

◆ rndis_tx_complete()

static void rndis_tx_complete ( struct rndis_device rndis,
struct io_buffer iobuf 
)
inlinestatic

Complete message transmission.

Parameters
rndisRNDIS device
iobufI/O buffer

Definition at line 364 of file rndis.h.

365  {
366 
367  rndis_tx_complete_err ( rndis, iobuf, 0 );
368 }
void rndis_tx_complete_err(struct rndis_device *rndis, struct io_buffer *iobuf, int rc)
Complete message transmission.
Definition: rndis.c:127

References rndis_tx_complete_err().

Referenced by acm_control_transmit(), and netvsc_recv_completion().