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)
 
 FILE_SECBOOT (PERMITTED)
 
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 21 of file rndis.h.

◆ RNDIS_INITIALISE_MSG

#define RNDIS_INITIALISE_MSG   0x00000002UL

RNDIS initialise message.

Definition at line 32 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 50 of file rndis.h.

◆ RNDIS_VERSION_MAJOR

#define RNDIS_VERSION_MAJOR   1

RNDIS major version.

Definition at line 53 of file rndis.h.

◆ RNDIS_VERSION_MINOR

#define RNDIS_VERSION_MINOR   0

RNDIS minor version.

Definition at line 56 of file rndis.h.

◆ RNDIS_MTU

#define RNDIS_MTU   2048

RNDIS maximum transfer size.

This is a policy decision.

Definition at line 62 of file rndis.h.

◆ RNDIS_INITIALISE_CMPLT

#define RNDIS_INITIALISE_CMPLT   0x80000002UL

RNDIS initialise completion.

Definition at line 65 of file rndis.h.

◆ RNDIS_HALT_MSG

#define RNDIS_HALT_MSG   0x00000003UL

RNDIS halt message.

Definition at line 92 of file rndis.h.

◆ RNDIS_QUERY_MSG

#define RNDIS_QUERY_MSG   0x00000004UL

RNDIS query OID message.

Definition at line 101 of file rndis.h.

◆ RNDIS_SET_MSG

#define RNDIS_SET_MSG   0x00000005UL

RNDIS set OID message.

Definition at line 104 of file rndis.h.

◆ RNDIS_QUERY_CMPLT

#define RNDIS_QUERY_CMPLT   0x80000004UL

RNDIS query OID completion.

Definition at line 121 of file rndis.h.

◆ RNDIS_SET_CMPLT

#define RNDIS_SET_CMPLT   0x80000005UL

RNDIS set OID completion.

Definition at line 136 of file rndis.h.

◆ RNDIS_RESET_MSG

#define RNDIS_RESET_MSG   0x00000006UL

RNDIS reset message.

Definition at line 147 of file rndis.h.

◆ RNDIS_RESET_CMPLT

#define RNDIS_RESET_CMPLT   0x80000006UL

RNDIS reset completion.

Definition at line 156 of file rndis.h.

◆ RNDIS_INDICATE_STATUS_MSG

#define RNDIS_INDICATE_STATUS_MSG   0x00000007UL

RNDIS indicate status message.

Definition at line 167 of file rndis.h.

◆ RNDIS_KEEPALIVE_MSG

#define RNDIS_KEEPALIVE_MSG   0x00000008UL

RNDIS keepalive message.

Definition at line 200 of file rndis.h.

◆ RNDIS_KEEPALIVE_CMPLT

#define RNDIS_KEEPALIVE_CMPLT   0x80000008UL

RNDIS keepalive completion.

Definition at line 209 of file rndis.h.

◆ RNDIS_PACKET_MSG

#define RNDIS_PACKET_MSG   0x00000001UL

RNDIS packet message.

Definition at line 220 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 255 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 272 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 275 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 278 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 190 of file rndis.h.

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

◆ 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 258 of file rndis.h.

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

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED  )

◆ 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 340 of file rndis.h.

341  {
342 
343  rndis->op = op;
344 }
struct rndis_operations * op
RNDIS operations.
Definition: rndis.h:324
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 128 of file rndis.c.

129  {
130  struct net_device *netdev = rndis->netdev;
131  struct rndis_header *header;
132  size_t len = iob_len ( iobuf );
133 
134  /* Sanity check */
135  if ( len < sizeof ( *header ) ) {
136  DBGC ( rndis, "RNDIS %s completed underlength transmission:\n",
137  rndis->name );
138  DBGC_HDA ( rndis, 0, iobuf->data, len );
140  return;
141  }
142  header = iobuf->data;
143 
144  /* Complete buffer */
145  if ( header->type == cpu_to_le32 ( RNDIS_PACKET_MSG ) ) {
146  netdev_tx_complete_err ( netdev, iobuf, rc );
147  } else {
148  free_iob ( iobuf );
149  }
150 }
#define EINVAL
Invalid argument.
Definition: errno.h:429
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Device name.
Definition: rndis.h:322
void netdev_tx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard transmitted packet.
Definition: netdevice.c:441
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:153
#define DBGC(...)
Definition: compiler.h:505
struct net_device * netdev
Network device.
Definition: rndis.h:320
#define DBGC_HDA(...)
Definition: compiler.h:506
ring len
Length.
Definition: dwmac.h:231
static struct net_device * netdev
Definition: gdbudp.c:52
#define cpu_to_le32(value)
Definition: byteswap.h:108
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:160
A network device.
Definition: netdevice.h:353
RNDIS message header.
Definition: rndis.h:24
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
Definition: netdevice.c:471
void * data
Start of data.
Definition: iobuf.h:53
struct ena_llq_option header
Header locations.
Definition: ena.h:16
#define RNDIS_PACKET_MSG
RNDIS packet message.
Definition: rndis.h:220
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

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 191 of file rndis.c.

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

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 830 of file rndis.c.

830  {
831  struct net_device *netdev = rndis->netdev;
832  struct rndis_header *header;
833  unsigned int type;
834  int rc;
835 
836  /* Sanity check */
837  if ( iob_len ( iobuf ) < sizeof ( *header ) ) {
838  DBGC ( rndis, "RNDIS %s received underlength packet:\n",
839  rndis->name );
840  DBGC_HDA ( rndis, 0, iobuf->data, iob_len ( iobuf ) );
841  rc = -EINVAL;
842  goto drop;
843  }
844  header = iobuf->data;
845 
846  /* Parse and strip header */
847  type = le32_to_cpu ( header->type );
848  iob_pull ( iobuf, sizeof ( *header ) );
849 
850  /* Handle message */
851  rndis_rx_message ( rndis, iob_disown ( iobuf ), type );
852 
853  return;
854 
855  drop:
856  /* Record error */
857  netdev_rx_err ( netdev, iob_disown ( iobuf ), rc );
858 }
#define iob_pull(iobuf, len)
Definition: iobuf.h:107
#define EINVAL
Invalid argument.
Definition: errno.h:429
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:587
const char * name
Device name.
Definition: rndis.h:322
#define le32_to_cpu(value)
Definition: byteswap.h:114
uint32_t type
Operating system type.
Definition: ena.h:12
#define DBGC(...)
Definition: compiler.h:505
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:217
struct net_device * netdev
Network device.
Definition: rndis.h:320
#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:160
A network device.
Definition: netdevice.h:353
static void rndis_rx_message(struct rndis_device *rndis, struct io_buffer *iobuf, unsigned int type)
Receive RNDIS message.
Definition: rndis.c:781
RNDIS message header.
Definition: rndis.h:24
void * data
Start of data.
Definition: iobuf.h:53
struct ena_llq_option header
Header locations.
Definition: ena.h:16

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 867 of file rndis.c.

868  {
869  struct net_device *netdev = rndis->netdev;
870 
871  /* Record error */
872  netdev_rx_err ( netdev, iob_disown ( iobuf ), rc );
873 }
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:587
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition: iobuf.h:217
struct net_device * netdev
Network device.
Definition: rndis.h:320
static struct net_device * netdev
Definition: gdbudp.c:52
A network device.
Definition: netdevice.h:353

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 1001 of file rndis.c.

1001  {
1002  struct net_device *netdev;
1003  struct rndis_device *rndis;
1004 
1005  /* Allocate and initialise structure */
1006  netdev = alloc_etherdev ( sizeof ( *rndis ) + priv_len );
1007  if ( ! netdev )
1008  return NULL;
1010  rndis = netdev->priv;
1011  rndis->netdev = netdev;
1012  rndis->priv = ( ( ( void * ) rndis ) + sizeof ( *rndis ) );
1013 
1014  return rndis;
1015 }
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
Definition: netdevice.h:519
struct net_device * netdev
Network device.
Definition: rndis.h:320
void * priv
Driver private data.
Definition: netdevice.h:432
An RNDIS device.
Definition: rndis.h:318
static struct net_device * netdev
Definition: gdbudp.c:52
A network device.
Definition: netdevice.h:353
RNDIS device operations.
Definition: rndis.h:283
void * priv
Driver private data.
Definition: rndis.h:326
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
Definition: ethernet.c:265
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

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 1027 of file rndis.c.

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

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 1055 of file rndis.c.

1055  {
1056  struct net_device *netdev = rndis->netdev;
1057 
1058  /* Unregister network device */
1060 }
struct net_device * netdev
Network device.
Definition: rndis.h:320
static struct net_device * netdev
Definition: gdbudp.c:52
void unregister_netdev(struct net_device *netdev)
Unregister network device.
Definition: netdevice.c:942
A network device.
Definition: netdevice.h:353

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 1067 of file rndis.c.

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

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 365 of file rndis.h.

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

References rndis_tx_complete_err().

Referenced by acm_control_transmit(), and netvsc_recv_completion().