iPXE
Functions | Variables
rndis.c File Reference

Remote Network Driver Interface Specification. More...

#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/iobuf.h>
#include <ipxe/netdevice.h>
#include <ipxe/ethernet.h>
#include <ipxe/device.h>
#include <ipxe/rndis.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static struct io_bufferrndis_alloc_iob (size_t len)
 Allocate I/O buffer. More...
 
static int rndis_wait (struct rndis_device *rndis, unsigned int wait_id)
 Wait for completion. More...
 
static int rndis_tx_message (struct rndis_device *rndis, struct io_buffer *iobuf, unsigned int type)
 Transmit message. More...
 
void rndis_tx_complete_err (struct rndis_device *rndis, struct io_buffer *iobuf, int rc)
 Complete message transmission. More...
 
static int rndis_tx_data (struct rndis_device *rndis, struct io_buffer *iobuf)
 Transmit data packet. More...
 
int rndis_tx_defer (struct rndis_device *rndis, struct io_buffer *iobuf)
 Defer transmitted packet. More...
 
static void rndis_rx_data (struct rndis_device *rndis, struct io_buffer *iobuf)
 Receive data packet. More...
 
static int rndis_tx_initialise (struct rndis_device *rndis, unsigned int id)
 Transmit initialisation message. More...
 
static void rndis_rx_initialise (struct rndis_device *rndis, struct io_buffer *iobuf)
 Receive initialisation completion. More...
 
static int rndis_initialise (struct rndis_device *rndis)
 Initialise RNDIS. More...
 
static int rndis_tx_halt (struct rndis_device *rndis)
 Transmit halt message. More...
 
static int rndis_halt (struct rndis_device *rndis)
 Halt RNDIS. More...
 
static int rndis_tx_oid (struct rndis_device *rndis, unsigned int oid, const void *data, size_t len)
 Transmit OID message. More...
 
static void rndis_rx_query_oid (struct rndis_device *rndis, struct io_buffer *iobuf)
 Receive query OID completion. More...
 
static void rndis_rx_set_oid (struct rndis_device *rndis, struct io_buffer *iobuf)
 Receive set OID completion. More...
 
static int rndis_oid (struct rndis_device *rndis, unsigned int oid, const void *data, size_t len)
 Query or set OID. More...
 
static int rndis_describe (struct rndis_device *rndis)
 Describe RNDIS device. More...
 
static void rndis_rx_status (struct rndis_device *rndis, struct io_buffer *iobuf)
 Receive indicate status message. More...
 
static void rndis_rx_message (struct rndis_device *rndis, struct io_buffer *iobuf, unsigned int type)
 Receive RNDIS message. 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...
 
static int rndis_filter (struct rndis_device *rndis, unsigned int filter)
 Set receive filter. More...
 
static int rndis_open (struct net_device *netdev)
 Open network device. More...
 
static void rndis_close (struct net_device *netdev)
 Close network device. More...
 
static int rndis_transmit (struct net_device *netdev, struct io_buffer *iobuf)
 Transmit packet. More...
 
static void rndis_poll (struct net_device *netdev)
 Poll for completed and received packets. 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...
 

Variables

static struct net_device_operations rndis_operations
 Network device operations. More...
 

Detailed Description

Remote Network Driver Interface Specification.

Definition in file rndis.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ rndis_alloc_iob()

static struct io_buffer* rndis_alloc_iob ( size_t  len)
static

Allocate I/O buffer.

Parameters
lenLength
Return values
iobufI/O buffer, or NULL

Definition at line 48 of file rndis.c.

48  {
49  struct rndis_header *header;
50  struct io_buffer *iobuf;
51 
52  /* Allocate I/O buffer and reserve space */
53  iobuf = alloc_iob ( sizeof ( *header ) + len );
54  if ( iobuf )
55  iob_reserve ( iobuf, sizeof ( *header ) );
56 
57  return iobuf;
58 }
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition: iobuf.c:128
RNDIS message header.
Definition: rndis.h:23
#define iob_reserve(iobuf, len)
Definition: iobuf.h:63
uint32_t len
Length.
Definition: ena.h:14
struct ena_aq_header header
Header.
Definition: ena.h:12
A persistent I/O buffer.
Definition: iobuf.h:32

References alloc_iob(), header, iob_reserve, and len.

Referenced by rndis_tx_halt(), rndis_tx_initialise(), and rndis_tx_oid().

◆ rndis_wait()

static int rndis_wait ( struct rndis_device rndis,
unsigned int  wait_id 
)
static

Wait for completion.

Parameters
rndisRNDIS device
wait_idRequest ID
Return values
rcReturn status code

Definition at line 67 of file rndis.c.

67  {
68  unsigned int i;
69 
70  /* Record query ID */
71  rndis->wait_id = wait_id;
72 
73  /* Wait for operation to complete */
74  for ( i = 0 ; i < RNDIS_MAX_WAIT_MS ; i++ ) {
75 
76  /* Check for completion */
77  if ( ! rndis->wait_id )
78  return rndis->wait_rc;
79 
80  /* Poll RNDIS device */
81  rndis->op->poll ( rndis );
82 
83  /* Delay for 1ms */
84  mdelay ( 1 );
85  }
86 
87  DBGC ( rndis, "RNDIS %s timed out waiting for ID %#08x\n",
88  rndis->name, wait_id );
89  return -ETIMEDOUT;
90 }
const char * name
Device name.
Definition: rndis.h:321
#define DBGC(...)
Definition: compiler.h:505
#define RNDIS_MAX_WAIT_MS
Maximum time to wait for a transaction to complete.
Definition: rndis.h:20
unsigned int wait_id
Request ID for current blocking request.
Definition: rndis.h:328
struct rndis_operations * op
RNDIS operations.
Definition: rndis.h:323
void(* poll)(struct rndis_device *rndis)
Poll for completed and received packets.
Definition: rndis.h:313
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition: timer.c:78
int wait_rc
Return status code for current blocking request.
Definition: rndis.h:330
#define ETIMEDOUT
Connection timed out.
Definition: errno.h:669

References DBGC, ETIMEDOUT, mdelay(), rndis_device::name, rndis_device::op, rndis_operations::poll, RNDIS_MAX_WAIT_MS, rndis_device::wait_id, and rndis_device::wait_rc.

Referenced by rndis_initialise(), and rndis_oid().

◆ rndis_tx_message()

static int rndis_tx_message ( struct rndis_device rndis,
struct io_buffer iobuf,
unsigned int  type 
)
static

Transmit message.

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

Definition at line 100 of file rndis.c.

101  {
102  struct rndis_header *header;
103  int rc;
104 
105  /* Prepend RNDIS header */
106  header = iob_push ( iobuf, sizeof ( *header ) );
107  header->type = cpu_to_le32 ( type );
108  header->len = cpu_to_le32 ( iob_len ( iobuf ) );
109 
110  /* Transmit message */
111  if ( ( rc = rndis->op->transmit ( rndis, iobuf ) ) != 0 ) {
112  DBGC ( rndis, "RNDIS %s could not transmit: %s\n",
113  rndis->name, strerror ( rc ) );
114  return rc;
115  }
116 
117  return 0;
118 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Device name.
Definition: rndis.h:321
#define iob_push(iobuf, len)
Definition: iobuf.h:80
uint8_t type
Type.
Definition: ena.h:16
#define DBGC(...)
Definition: compiler.h:505
int(* transmit)(struct rndis_device *rndis, struct io_buffer *iobuf)
Transmit packet.
Definition: rndis.h:306
struct rndis_operations * op
RNDIS operations.
Definition: rndis.h:323
#define cpu_to_le32(value)
Definition: byteswap.h:107
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
RNDIS message header.
Definition: rndis.h:23
struct ena_aq_header header
Header.
Definition: ena.h:12

References cpu_to_le32, DBGC, header, iob_len(), iob_push, rndis_device::name, rndis_device::op, rc, strerror(), rndis_operations::transmit, and type.

Referenced by rndis_tx_data(), rndis_tx_halt(), rndis_tx_initialise(), and rndis_tx_oid().

◆ 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_data()

static int rndis_tx_data ( struct rndis_device rndis,
struct io_buffer iobuf 
)
static

Transmit data packet.

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

Definition at line 158 of file rndis.c.

159  {
160  struct rndis_packet_message *msg;
161  size_t len = iob_len ( iobuf );
162  int rc;
163 
164  /* Prepend packet message header */
165  msg = iob_push ( iobuf, sizeof ( *msg ) );
166  memset ( msg, 0, sizeof ( *msg ) );
167  msg->data.offset = cpu_to_le32 ( sizeof ( *msg ) );
168  msg->data.len = cpu_to_le32 ( len );
169 
170  /* Transmit message */
171  if ( ( rc = rndis_tx_message ( rndis, iobuf, RNDIS_PACKET_MSG ) ) != 0 )
172  return rc;
173 
174  return 0;
175 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_push(iobuf, len)
Definition: iobuf.h:80
static int rndis_tx_message(struct rndis_device *rndis, struct io_buffer *iobuf, unsigned int type)
Transmit message.
Definition: rndis.c:100
#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
uint32_t len
Length.
Definition: ena.h:14
#define RNDIS_PACKET_MSG
RNDIS packet message.
Definition: rndis.h:219
void * memset(void *dest, int character, size_t len) __nonnull
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:285

References cpu_to_le32, iob_len(), iob_push, len, memset(), msg(), rc, RNDIS_PACKET_MSG, and rndis_tx_message().

Referenced by rndis_transmit().

◆ 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_data()

static void rndis_rx_data ( struct rndis_device rndis,
struct io_buffer iobuf 
)
static

Receive data packet.

Parameters
rndisRNDIS device
iobufI/O buffer

Definition at line 221 of file rndis.c.

222  {
223  struct net_device *netdev = rndis->netdev;
224  struct rndis_packet_message *msg;
225  size_t len = iob_len ( iobuf );
226  size_t data_offset;
227  size_t data_len;
228  int rc;
229 
230  /* Sanity check */
231  if ( len < sizeof ( *msg ) ) {
232  DBGC ( rndis, "RNDIS %s received underlength data packet:\n",
233  rndis->name );
234  DBGC_HDA ( rndis, 0, iobuf->data, len );
235  rc = -EINVAL;
236  goto err_len;
237  }
238  msg = iobuf->data;
239 
240  /* Locate and sanity check data buffer */
241  data_offset = le32_to_cpu ( msg->data.offset );
242  data_len = le32_to_cpu ( msg->data.len );
243  if ( ( data_offset > len ) || ( data_len > ( len - data_offset ) ) ) {
244  DBGC ( rndis, "RNDIS %s data packet data exceeds packet:\n",
245  rndis->name );
246  DBGC_HDA ( rndis, 0, iobuf->data, len );
247  rc = -EINVAL;
248  goto err_data;
249  }
250 
251  /* Strip non-data portions */
252  iob_pull ( iobuf, data_offset );
253  iob_unput ( iobuf, ( iob_len ( iobuf ) - data_len ) );
254 
255  /* Hand off to network stack */
256  netdev_rx ( netdev, iob_disown ( iobuf ) );
257 
258  return;
259 
260  err_data:
261  err_len:
262  /* Report error to network stack */
263  netdev_rx_err ( netdev, iob_disown ( iobuf ), rc );
264 }
#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
#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
#define iob_unput(iobuf, len)
Definition: iobuf.h:131
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
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
Definition: netdevice.c:470
uint32_t len
Length.
Definition: ena.h:14
void * data
Start of data.
Definition: iobuf.h:44
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:285

References io_buffer::data, DBGC, DBGC_HDA, EINVAL, iob_disown, iob_len(), iob_pull, iob_unput, le32_to_cpu, len, msg(), rndis_device::name, netdev, rndis_device::netdev, netdev_rx(), netdev_rx_err(), and rc.

Referenced by rndis_rx_message().

◆ rndis_tx_initialise()

static int rndis_tx_initialise ( struct rndis_device rndis,
unsigned int  id 
)
static

Transmit initialisation message.

Parameters
rndisRNDIS device
idRequest ID
Return values
rcReturn status code

Definition at line 273 of file rndis.c.

273  {
274  struct io_buffer *iobuf;
276  int rc;
277 
278  /* Allocate I/O buffer */
279  iobuf = rndis_alloc_iob ( sizeof ( *msg ) );
280  if ( ! iobuf ) {
281  rc = -ENOMEM;
282  goto err_alloc;
283  }
284 
285  /* Construct message */
286  msg = iob_put ( iobuf, sizeof ( *msg ) );
287  memset ( msg, 0, sizeof ( *msg ) );
288  msg->id = id; /* Non-endian */
289  msg->major = cpu_to_le32 ( RNDIS_VERSION_MAJOR );
290  msg->minor = cpu_to_le32 ( RNDIS_VERSION_MINOR );
291  msg->mtu = cpu_to_le32 ( RNDIS_MTU );
292 
293  /* Transmit message */
294  if ( ( rc = rndis_tx_message ( rndis, iobuf,
295  RNDIS_INITIALISE_MSG ) ) != 0 )
296  goto err_tx;
297 
298  return 0;
299 
300  err_tx:
301  free_iob ( iobuf );
302  err_alloc:
303  return rc;
304 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:116
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:145
RNDIS initialise message.
Definition: rndis.h:34
static int rndis_tx_message(struct rndis_device *rndis, struct io_buffer *iobuf, unsigned int type)
Transmit message.
Definition: rndis.c:100
#define RNDIS_VERSION_MAJOR
RNDIS major version.
Definition: rndis.h:52
#define ENOMEM
Not enough space.
Definition: errno.h:534
#define RNDIS_MTU
RNDIS maximum transfer size.
Definition: rndis.h:61
#define cpu_to_le32(value)
Definition: byteswap.h:107
uint8_t id
Request identifier.
Definition: ena.h:12
static struct io_buffer * rndis_alloc_iob(size_t len)
Allocate I/O buffer.
Definition: rndis.c:48
#define RNDIS_INITIALISE_MSG
RNDIS initialise message.
Definition: rndis.h:31
#define RNDIS_VERSION_MINOR
RNDIS minor version.
Definition: rndis.h:55
void * memset(void *dest, int character, size_t len) __nonnull
A persistent I/O buffer.
Definition: iobuf.h:32
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:285

References cpu_to_le32, ENOMEM, free_iob(), id, iob_put, memset(), msg(), rc, rndis_alloc_iob(), RNDIS_INITIALISE_MSG, RNDIS_MTU, rndis_tx_message(), RNDIS_VERSION_MAJOR, and RNDIS_VERSION_MINOR.

Referenced by rndis_initialise().

◆ rndis_rx_initialise()

static void rndis_rx_initialise ( struct rndis_device rndis,
struct io_buffer iobuf 
)
static

Receive initialisation completion.

Parameters
rndisRNDIS device
iobufI/O buffer

Definition at line 312 of file rndis.c.

313  {
314  struct rndis_initialise_completion *cmplt;
315  size_t len = iob_len ( iobuf );
316  unsigned int id;
317  int rc;
318 
319  /* Sanity check */
320  if ( len < sizeof ( *cmplt ) ) {
321  DBGC ( rndis, "RNDIS %s received underlength initialisation "
322  "completion:\n", rndis->name );
323  DBGC_HDA ( rndis, 0, iobuf->data, len );
324  rc = -EINVAL;
325  goto err_len;
326  }
327  cmplt = iobuf->data;
328 
329  /* Extract request ID */
330  id = cmplt->id; /* Non-endian */
331 
332  /* Check status */
333  if ( cmplt->status ) {
334  DBGC ( rndis, "RNDIS %s received initialisation completion "
335  "failure %#08x\n", rndis->name,
336  le32_to_cpu ( cmplt->status ) );
337  rc = -EIO;
338  goto err_status;
339  }
340 
341  /* Success */
342  rc = 0;
343 
344  err_status:
345  /* Record completion result if applicable */
346  if ( id == rndis->wait_id ) {
347  rndis->wait_id = 0;
348  rndis->wait_rc = rc;
349  }
350  err_len:
351  free_iob ( iobuf );
352 }
#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
#define le32_to_cpu(value)
Definition: byteswap.h:113
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:145
#define DBGC(...)
Definition: compiler.h:505
RNDIS initialise completion.
Definition: rndis.h:67
uint32_t id
Request ID.
Definition: rndis.h:69
unsigned int wait_id
Request ID for current blocking request.
Definition: rndis.h:328
#define DBGC_HDA(...)
Definition: compiler.h:506
uint8_t id
Request identifier.
Definition: ena.h:12
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
uint32_t len
Length.
Definition: ena.h:14
void * data
Start of data.
Definition: iobuf.h:44
#define EIO
Input/output error.
Definition: errno.h:433
uint32_t status
Status.
Definition: rndis.h:71
int wait_rc
Return status code for current blocking request.
Definition: rndis.h:330

References io_buffer::data, DBGC, DBGC_HDA, EINVAL, EIO, free_iob(), id, rndis_initialise_completion::id, iob_len(), le32_to_cpu, len, rndis_device::name, rc, rndis_initialise_completion::status, rndis_device::wait_id, and rndis_device::wait_rc.

Referenced by rndis_rx_message().

◆ rndis_initialise()

static int rndis_initialise ( struct rndis_device rndis)
static

Initialise RNDIS.

Parameters
rndisRNDIS device
Return values
rcReturn status code

Definition at line 360 of file rndis.c.

360  {
361  int rc;
362 
363  /* Transmit initialisation message */
364  if ( ( rc = rndis_tx_initialise ( rndis, RNDIS_INIT_ID ) ) != 0 )
365  return rc;
366 
367  /* Wait for response */
368  if ( ( rc = rndis_wait ( rndis, RNDIS_INIT_ID ) ) != 0 )
369  return rc;
370 
371  return 0;
372 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int rndis_wait(struct rndis_device *rndis, unsigned int wait_id)
Wait for completion.
Definition: rndis.c:67
#define RNDIS_INIT_ID
Request ID used for initialisation.
Definition: rndis.h:49
static int rndis_tx_initialise(struct rndis_device *rndis, unsigned int id)
Transmit initialisation message.
Definition: rndis.c:273

References rc, RNDIS_INIT_ID, rndis_tx_initialise(), and rndis_wait().

Referenced by rndis_describe(), and rndis_open().

◆ rndis_tx_halt()

static int rndis_tx_halt ( struct rndis_device rndis)
static

Transmit halt message.

Parameters
rndisRNDIS device
Return values
rcReturn status code

Definition at line 380 of file rndis.c.

380  {
381  struct io_buffer *iobuf;
382  struct rndis_halt_message *msg;
383  int rc;
384 
385  /* Allocate I/O buffer */
386  iobuf = rndis_alloc_iob ( sizeof ( *msg ) );
387  if ( ! iobuf ) {
388  rc = -ENOMEM;
389  goto err_alloc;
390  }
391 
392  /* Construct message */
393  msg = iob_put ( iobuf, sizeof ( *msg ) );
394  memset ( msg, 0, sizeof ( *msg ) );
395 
396  /* Transmit message */
397  if ( ( rc = rndis_tx_message ( rndis, iobuf, RNDIS_HALT_MSG ) ) != 0 )
398  goto err_tx;
399 
400  return 0;
401 
402  err_tx:
403  free_iob ( iobuf );
404  err_alloc:
405  return rc;
406 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:116
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:145
static int rndis_tx_message(struct rndis_device *rndis, struct io_buffer *iobuf, unsigned int type)
Transmit message.
Definition: rndis.c:100
#define ENOMEM
Not enough space.
Definition: errno.h:534
static struct io_buffer * rndis_alloc_iob(size_t len)
Allocate I/O buffer.
Definition: rndis.c:48
RNDIS halt message.
Definition: rndis.h:94
void * memset(void *dest, int character, size_t len) __nonnull
A persistent I/O buffer.
Definition: iobuf.h:32
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:285
#define RNDIS_HALT_MSG
RNDIS halt message.
Definition: rndis.h:91

References ENOMEM, free_iob(), iob_put, memset(), msg(), rc, rndis_alloc_iob(), RNDIS_HALT_MSG, and rndis_tx_message().

Referenced by rndis_halt().

◆ rndis_halt()

static int rndis_halt ( struct rndis_device rndis)
static

Halt RNDIS.

Parameters
rndisRNDIS device
Return values
rcReturn status code

Definition at line 414 of file rndis.c.

414  {
415  int rc;
416 
417  /* Transmit halt message */
418  if ( ( rc = rndis_tx_halt ( rndis ) ) != 0 )
419  return rc;
420 
421  return 0;
422 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int rndis_tx_halt(struct rndis_device *rndis)
Transmit halt message.
Definition: rndis.c:380

References rc, and rndis_tx_halt().

Referenced by rndis_close(), rndis_describe(), and rndis_open().

◆ rndis_tx_oid()

static int rndis_tx_oid ( struct rndis_device rndis,
unsigned int  oid,
const void *  data,
size_t  len 
)
static

Transmit OID message.

Parameters
rndisRNDIS device
oidObject ID
dataNew OID value (or NULL to query current value)
lenLength of new OID value
Return values
rcReturn status code

Definition at line 433 of file rndis.c.

434  {
435  struct io_buffer *iobuf;
436  struct rndis_oid_message *msg;
437  unsigned int type;
438  int rc;
439 
440  /* Allocate I/O buffer */
441  iobuf = rndis_alloc_iob ( sizeof ( *msg ) + len );
442  if ( ! iobuf ) {
443  rc = -ENOMEM;
444  goto err_alloc;
445  }
446 
447  /* Construct message. We use the OID as the request ID. */
448  msg = iob_put ( iobuf, sizeof ( *msg ) );
449  memset ( msg, 0, sizeof ( *msg ) );
450  msg->id = oid; /* Non-endian */
451  msg->oid = cpu_to_le32 ( oid );
452  msg->offset = cpu_to_le32 ( sizeof ( *msg ) );
453  msg->len = cpu_to_le32 ( len );
454  memcpy ( iob_put ( iobuf, len ), data, len );
455 
456  /* Transmit message */
458  if ( ( rc = rndis_tx_message ( rndis, iobuf, type ) ) != 0 )
459  goto err_tx;
460 
461  return 0;
462 
463  err_tx:
464  free_iob ( iobuf );
465  err_alloc:
466  return rc;
467 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define iob_put(iobuf, len)
Definition: iobuf.h:116
uint32_t oid
Object ID.
Definition: rndis.h:110
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:145
uint8_t type
Type.
Definition: ena.h:16
RNDIS query or set OID message.
Definition: rndis.h:106
static int rndis_tx_message(struct rndis_device *rndis, struct io_buffer *iobuf, unsigned int type)
Transmit message.
Definition: rndis.c:100
#define ENOMEM
Not enough space.
Definition: errno.h:534
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define cpu_to_le32(value)
Definition: byteswap.h:107
#define RNDIS_QUERY_MSG
RNDIS query OID message.
Definition: rndis.h:100
static struct io_buffer * rndis_alloc_iob(size_t len)
Allocate I/O buffer.
Definition: rndis.c:48
#define RNDIS_SET_MSG
RNDIS set OID message.
Definition: rndis.h:103
uint32_t len
Length.
Definition: ena.h:14
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
void * memset(void *dest, int character, size_t len) __nonnull
A persistent I/O buffer.
Definition: iobuf.h:32
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:285

References cpu_to_le32, data, ENOMEM, free_iob(), iob_put, len, memcpy(), memset(), msg(), rndis_oid_message::oid, rc, rndis_alloc_iob(), RNDIS_QUERY_MSG, RNDIS_SET_MSG, rndis_tx_message(), and type.

Referenced by rndis_oid().

◆ rndis_rx_query_oid()

static void rndis_rx_query_oid ( struct rndis_device rndis,
struct io_buffer iobuf 
)
static

Receive query OID completion.

Parameters
rndisRNDIS device
iobufI/O buffer

Definition at line 475 of file rndis.c.

476  {
477  struct net_device *netdev = rndis->netdev;
478  struct rndis_query_completion *cmplt;
479  size_t len = iob_len ( iobuf );
480  size_t info_offset;
481  size_t info_len;
482  unsigned int id;
483  void *info;
484  uint32_t *link_status;
485  int rc;
486 
487  /* Sanity check */
488  if ( len < sizeof ( *cmplt ) ) {
489  DBGC ( rndis, "RNDIS %s received underlength query "
490  "completion:\n", rndis->name );
491  DBGC_HDA ( rndis, 0, iobuf->data, len );
492  rc = -EINVAL;
493  goto err_len;
494  }
495  cmplt = iobuf->data;
496 
497  /* Extract request ID */
498  id = cmplt->id; /* Non-endian */
499 
500  /* Check status */
501  if ( cmplt->status ) {
502  DBGC ( rndis, "RNDIS %s received query completion failure "
503  "%#08x\n", rndis->name, le32_to_cpu ( cmplt->status ) );
504  DBGC_HDA ( rndis, 0, iobuf->data, len );
505  rc = -EIO;
506  goto err_status;
507  }
508 
509  /* Locate and sanity check information buffer */
510  info_offset = le32_to_cpu ( cmplt->offset );
511  info_len = le32_to_cpu ( cmplt->len );
512  if ( ( info_offset > len ) || ( info_len > ( len - info_offset ) ) ) {
513  DBGC ( rndis, "RNDIS %s query completion information exceeds "
514  "packet:\n", rndis->name );
515  DBGC_HDA ( rndis, 0, iobuf->data, len );
516  rc = -EINVAL;
517  goto err_info;
518  }
519  info = ( ( ( void * ) cmplt ) + info_offset );
520 
521  /* Handle OID */
522  switch ( id ) {
523 
525  if ( info_len > sizeof ( netdev->hw_addr ) )
526  info_len = sizeof ( netdev->hw_addr );
528  break;
529 
531  if ( info_len > sizeof ( netdev->ll_addr ) )
532  info_len = sizeof ( netdev->ll_addr );
534  break;
535 
537  if ( info_len != sizeof ( *link_status ) ) {
538  DBGC ( rndis, "RNDIS %s invalid link status:\n",
539  rndis->name );
540  DBGC_HDA ( rndis, 0, iobuf->data, len );
541  rc = -EPROTO;
542  goto err_link_status;
543  }
544  link_status = info;
545  if ( *link_status == 0 ) {
546  DBGC ( rndis, "RNDIS %s link is up\n", rndis->name );
548  } else {
549  DBGC ( rndis, "RNDIS %s link is down: %#08x\n",
550  rndis->name, le32_to_cpu ( *link_status ) );
552  }
553  break;
554 
555  default:
556  DBGC ( rndis, "RNDIS %s unexpected query completion ID %#08x\n",
557  rndis->name, id );
558  DBGC_HDA ( rndis, 0, iobuf->data, len );
559  rc = -EPROTO;
560  goto err_id;
561  }
562 
563  /* Success */
564  rc = 0;
565 
566  err_id:
567  err_link_status:
568  err_info:
569  err_status:
570  /* Record completion result if applicable */
571  if ( id == rndis->wait_id ) {
572  rndis->wait_id = 0;
573  rndis->wait_rc = rc;
574  }
575  err_len:
576  /* Free I/O buffer */
577  free_iob ( iobuf );
578 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
u32 info
Definition: ar9003_mac.h:67
const char * name
Device name.
Definition: rndis.h:321
#define le32_to_cpu(value)
Definition: byteswap.h:113
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:145
RNDIS query OID completion.
Definition: rndis.h:123
#define DBGC(...)
Definition: compiler.h:505
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
Definition: netdevice.c:186
#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS
OID for media status.
Definition: rndis.h:271
void * memcpy(void *dest, const void *src, size_t len) __nonnull
uint32_t id
Request ID.
Definition: rndis.h:125
uint32_t status
Status.
Definition: rndis.h:127
uint8_t info_len
Reject information length.
Definition: ib_mad.h:18
struct net_device * netdev
Network device.
Definition: rndis.h:319
unsigned int wait_id
Request ID for current blocking request.
Definition: rndis.h:328
#define DBGC_HDA(...)
Definition: compiler.h:506
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
Definition: netdevice.h:768
static struct net_device * netdev
Definition: gdbudp.c:52
uint8_t id
Request identifier.
Definition: ena.h:12
#define EPROTO
Protocol error.
Definition: errno.h:624
#define RNDIS_OID_802_3_PERMANENT_ADDRESS
OID for permanent MAC address.
Definition: rndis.h:274
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
uint32_t len
Information buffer length.
Definition: rndis.h:129
unsigned int uint32_t
Definition: stdint.h:12
uint32_t offset
Information buffer offset.
Definition: rndis.h:131
uint32_t len
Length.
Definition: ena.h:14
#define RNDIS_OID_802_3_CURRENT_ADDRESS
OID for current MAC address.
Definition: rndis.h:277
void * data
Start of data.
Definition: iobuf.h:44
#define EIO
Input/output error.
Definition: errno.h:433
int wait_rc
Return status code for current blocking request.
Definition: rndis.h:330
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
Definition: netdevice.h:381
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
Definition: netdevice.h:375

References io_buffer::data, DBGC, DBGC_HDA, EINVAL, EIO, EPROTO, free_iob(), net_device::hw_addr, id, rndis_query_completion::id, info, info_len, iob_len(), le32_to_cpu, len, rndis_query_completion::len, net_device::ll_addr, memcpy(), rndis_device::name, netdev, rndis_device::netdev, netdev_link_down(), netdev_link_up(), rndis_query_completion::offset, rc, RNDIS_OID_802_3_CURRENT_ADDRESS, RNDIS_OID_802_3_PERMANENT_ADDRESS, RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, rndis_query_completion::status, rndis_device::wait_id, and rndis_device::wait_rc.

Referenced by rndis_rx_message().

◆ rndis_rx_set_oid()

static void rndis_rx_set_oid ( struct rndis_device rndis,
struct io_buffer iobuf 
)
static

Receive set OID completion.

Parameters
rndisRNDIS device
iobufI/O buffer

Definition at line 586 of file rndis.c.

587  {
588  struct rndis_set_completion *cmplt;
589  size_t len = iob_len ( iobuf );
590  unsigned int id;
591  int rc;
592 
593  /* Sanity check */
594  if ( len < sizeof ( *cmplt ) ) {
595  DBGC ( rndis, "RNDIS %s received underlength set completion:\n",
596  rndis->name );
597  DBGC_HDA ( rndis, 0, iobuf->data, len );
598  rc = -EINVAL;
599  goto err_len;
600  }
601  cmplt = iobuf->data;
602 
603  /* Extract request ID */
604  id = cmplt->id; /* Non-endian */
605 
606  /* Check status */
607  if ( cmplt->status ) {
608  DBGC ( rndis, "RNDIS %s received set completion failure "
609  "%#08x\n", rndis->name, le32_to_cpu ( cmplt->status ) );
610  DBGC_HDA ( rndis, 0, iobuf->data, len );
611  rc = -EIO;
612  goto err_status;
613  }
614 
615  /* Success */
616  rc = 0;
617 
618  err_status:
619  /* Record completion result if applicable */
620  if ( id == rndis->wait_id ) {
621  rndis->wait_id = 0;
622  rndis->wait_rc = rc;
623  }
624  err_len:
625  /* Free I/O buffer */
626  free_iob ( iobuf );
627 }
#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
#define le32_to_cpu(value)
Definition: byteswap.h:113
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:145
#define DBGC(...)
Definition: compiler.h:505
unsigned int wait_id
Request ID for current blocking request.
Definition: rndis.h:328
#define DBGC_HDA(...)
Definition: compiler.h:506
uint8_t id
Request identifier.
Definition: ena.h:12
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:151
uint32_t id
Request ID.
Definition: rndis.h:140
uint32_t len
Length.
Definition: ena.h:14
void * data
Start of data.
Definition: iobuf.h:44
#define EIO
Input/output error.
Definition: errno.h:433
int wait_rc
Return status code for current blocking request.
Definition: rndis.h:330
RNDIS set OID completion.
Definition: rndis.h:138
uint32_t status
Status.
Definition: rndis.h:142

References io_buffer::data, DBGC, DBGC_HDA, EINVAL, EIO, free_iob(), id, rndis_set_completion::id, iob_len(), le32_to_cpu, len, rndis_device::name, rc, rndis_set_completion::status, rndis_device::wait_id, and rndis_device::wait_rc.

Referenced by rndis_rx_message().

◆ rndis_oid()

static int rndis_oid ( struct rndis_device rndis,
unsigned int  oid,
const void *  data,
size_t  len 
)
static

Query or set OID.

Parameters
rndisRNDIS device
oidObject ID
dataNew OID value (or NULL to query current value)
lenLength of new OID value
Return values
rcReturn status code

Definition at line 638 of file rndis.c.

639  {
640  int rc;
641 
642  /* Transmit query */
643  if ( ( rc = rndis_tx_oid ( rndis, oid, data, len ) ) != 0 )
644  return rc;
645 
646  /* Wait for response */
647  if ( ( rc = rndis_wait ( rndis, oid ) ) != 0 )
648  return rc;
649 
650  return 0;
651 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int rndis_wait(struct rndis_device *rndis, unsigned int wait_id)
Wait for completion.
Definition: rndis.c:67
uint32_t len
Length.
Definition: ena.h:14
static int rndis_tx_oid(struct rndis_device *rndis, unsigned int oid, const void *data, size_t len)
Transmit OID message.
Definition: rndis.c:433
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12

References data, len, rc, rndis_tx_oid(), and rndis_wait().

Referenced by rndis_describe(), rndis_filter(), and rndis_open().

◆ rndis_describe()

static int rndis_describe ( struct rndis_device rndis)
static

Describe RNDIS device.

Parameters
rndisRNDIS device
Return values
rcReturn status code

Definition at line 659 of file rndis.c.

659  {
660  struct net_device *netdev = rndis->netdev;
661  int rc;
662 
663  /* Assign device name (for debugging) */
664  rndis->name = netdev->dev->name;
665 
666  /* Open RNDIS device to read MAC addresses */
667  if ( ( rc = rndis->op->open ( rndis ) ) != 0 ) {
668  DBGC ( rndis, "RNDIS %s could not open: %s\n",
669  rndis->name, strerror ( rc ) );
670  goto err_open;
671  }
672 
673  /* Initialise RNDIS */
674  if ( ( rc = rndis_initialise ( rndis ) ) != 0 )
675  goto err_initialise;
676 
677  /* Query permanent MAC address */
679  NULL, 0 ) ) != 0 )
680  goto err_query_permanent;
681 
682  /* Query current MAC address */
683  if ( ( rc = rndis_oid ( rndis, RNDIS_OID_802_3_CURRENT_ADDRESS,
684  NULL, 0 ) ) != 0 )
685  goto err_query_current;
686 
687  /* Get link status */
689  NULL, 0 ) ) != 0 )
690  goto err_query_link;
691 
692  /* Halt RNDIS device */
693  rndis_halt ( rndis );
694 
695  /* Close RNDIS device */
696  rndis->op->close ( rndis );
697 
698  return 0;
699 
700  err_query_link:
701  err_query_current:
702  err_query_permanent:
703  rndis_halt ( rndis );
704  err_initialise:
705  rndis->op->close ( rndis );
706  err_open:
707  return rc;
708 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
int(* open)(struct rndis_device *rndis)
Open RNDIS device.
Definition: rndis.h:289
const char * name
Device name.
Definition: rndis.h:321
#define DBGC(...)
Definition: compiler.h:505
char name[40]
Name.
Definition: device.h:75
void(* close)(struct rndis_device *rndis)
Close RNDIS device.
Definition: rndis.h:295
#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS
OID for media status.
Definition: rndis.h:271
struct net_device * netdev
Network device.
Definition: rndis.h:319
struct rndis_operations * op
RNDIS operations.
Definition: rndis.h:323
static struct net_device * netdev
Definition: gdbudp.c:52
static int rndis_initialise(struct rndis_device *rndis)
Initialise RNDIS.
Definition: rndis.c:360
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define RNDIS_OID_802_3_PERMANENT_ADDRESS
OID for permanent MAC address.
Definition: rndis.h:274
A network device.
Definition: netdevice.h:348
struct device * dev
Underlying hardware device.
Definition: netdevice.h:360
static int rndis_halt(struct rndis_device *rndis)
Halt RNDIS.
Definition: rndis.c:414
#define RNDIS_OID_802_3_CURRENT_ADDRESS
OID for current MAC address.
Definition: rndis.h:277
static int rndis_oid(struct rndis_device *rndis, unsigned int oid, const void *data, size_t len)
Query or set OID.
Definition: rndis.c:638
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References rndis_operations::close, DBGC, net_device::dev, device::name, rndis_device::name, netdev, rndis_device::netdev, NULL, rndis_device::op, rndis_operations::open, rc, rndis_halt(), rndis_initialise(), rndis_oid(), RNDIS_OID_802_3_CURRENT_ADDRESS, RNDIS_OID_802_3_PERMANENT_ADDRESS, RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, and strerror().

Referenced by register_rndis().

◆ rndis_rx_status()

static void rndis_rx_status ( struct rndis_device rndis,
struct io_buffer iobuf 
)
static

Receive indicate status message.

Parameters
rndisRNDIS device
iobufI/O buffer

Definition at line 716 of file rndis.c.

717  {
718  struct net_device *netdev = rndis->netdev;
720  size_t len = iob_len ( iobuf );
721  unsigned int status;
722  int rc;
723 
724  /* Sanity check */
725  if ( len < sizeof ( *msg ) ) {
726  DBGC ( rndis, "RNDIS %s received underlength status message:\n",
727  rndis->name );
728  DBGC_HDA ( rndis, 0, iobuf->data, len );
729  rc = -EINVAL;
730  goto err_len;
731  }
732  msg = iobuf->data;
733 
734  /* Extract status */
735  status = le32_to_cpu ( msg->status );
736 
737  /* Handle status */
738  switch ( msg->status ) {
739 
741  DBGC ( rndis, "RNDIS %s link is up\n", rndis->name );
743  break;
744 
746  DBGC ( rndis, "RNDIS %s link is down\n", rndis->name );
748  break;
749 
751  /* Ignore */
752  break;
753 
754  default:
755  DBGC ( rndis, "RNDIS %s unexpected status %#08x:\n",
756  rndis->name, status );
757  DBGC_HDA ( rndis, 0, iobuf->data, len );
758  rc = -ENOTSUP;
759  goto err_status;
760  }
761 
762  /* Free I/O buffer */
763  free_iob ( iobuf );
764 
765  return;
766 
767  err_status:
768  err_len:
769  /* Report error via network device statistics */
770  netdev_rx_err ( netdev, iobuf, rc );
771 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
Unknown start-of-day status code.
Definition: rndis.h:195
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
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:145
#define DBGC(...)
Definition: compiler.h:505
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
Definition: netdevice.c:186
Device is connected to a network medium.
Definition: rndis.h:191
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
uint8_t status
Status.
Definition: ena.h:16
struct net_device * netdev
Network device.
Definition: rndis.h:319
#define DBGC_HDA(...)
Definition: compiler.h:506
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
Definition: netdevice.h:768
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
uint32_t len
Length.
Definition: ena.h:14
void * data
Start of data.
Definition: iobuf.h:44
Device is disconnected from the medium.
Definition: rndis.h:193
RNDIS indicate status message.
Definition: rndis.h:177
static void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: settings_ui.c:285

References io_buffer::data, DBGC, DBGC_HDA, EINVAL, ENOTSUP, free_iob(), iob_len(), le32_to_cpu, len, msg(), rndis_device::name, netdev, rndis_device::netdev, netdev_link_down(), netdev_link_up(), netdev_rx_err(), rc, RNDIS_STATUS_MEDIA_CONNECT, RNDIS_STATUS_MEDIA_DISCONNECT, RNDIS_STATUS_WTF_WORLD, and status.

Referenced by rndis_rx_message().

◆ rndis_rx_message()

static void rndis_rx_message ( struct rndis_device rndis,
struct io_buffer iobuf,
unsigned int  type 
)
static

Receive RNDIS message.

Parameters
rndisRNDIS device
iobufI/O buffer
typeMessage type

Definition at line 780 of file rndis.c.

781  {
782  struct net_device *netdev = rndis->netdev;
783  int rc;
784 
785  /* Handle packet */
786  switch ( type ) {
787 
788  case RNDIS_PACKET_MSG:
789  rndis_rx_data ( rndis, iob_disown ( iobuf ) );
790  break;
791 
793  rndis_rx_initialise ( rndis, iob_disown ( iobuf ) );
794  break;
795 
796  case RNDIS_QUERY_CMPLT:
797  rndis_rx_query_oid ( rndis, iob_disown ( iobuf ) );
798  break;
799 
800  case RNDIS_SET_CMPLT:
801  rndis_rx_set_oid ( rndis, iob_disown ( iobuf ) );
802  break;
803 
805  rndis_rx_status ( rndis, iob_disown ( iobuf ) );
806  break;
807 
808  default:
809  DBGC ( rndis, "RNDIS %s received unexpected type %#08x\n",
810  rndis->name, type );
811  DBGC_HDA ( rndis, 0, iobuf->data, iob_len ( iobuf ) );
812  rc = -EPROTO;
813  goto err_type;
814  }
815 
816  return;
817 
818  err_type:
819  /* Report error via network device statistics */
820  netdev_rx_err ( netdev, iobuf, rc );
821 }
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 RNDIS_INDICATE_STATUS_MSG
RNDIS indicate status message.
Definition: rndis.h:166
const char * name
Device name.
Definition: rndis.h:321
static void rndis_rx_data(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive data packet.
Definition: rndis.c:221
uint8_t type
Type.
Definition: ena.h:16
#define DBGC(...)
Definition: compiler.h:505
static void rndis_rx_query_oid(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive query OID completion.
Definition: rndis.c:475
#define RNDIS_QUERY_CMPLT
RNDIS query OID completion.
Definition: rndis.h:120
static void rndis_rx_status(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive indicate status message.
Definition: rndis.c:716
#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
#define RNDIS_SET_CMPLT
RNDIS set OID completion.
Definition: rndis.h:135
#define EPROTO
Protocol error.
Definition: errno.h:624
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
void * data
Start of data.
Definition: iobuf.h:44
static void rndis_rx_set_oid(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive set OID completion.
Definition: rndis.c:586
#define RNDIS_PACKET_MSG
RNDIS packet message.
Definition: rndis.h:219
static void rndis_rx_initialise(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive initialisation completion.
Definition: rndis.c:312
#define RNDIS_INITIALISE_CMPLT
RNDIS initialise completion.
Definition: rndis.h:64

References io_buffer::data, DBGC, DBGC_HDA, EPROTO, iob_disown, iob_len(), rndis_device::name, netdev, rndis_device::netdev, netdev_rx_err(), rc, RNDIS_INDICATE_STATUS_MSG, RNDIS_INITIALISE_CMPLT, RNDIS_PACKET_MSG, RNDIS_QUERY_CMPLT, rndis_rx_data(), rndis_rx_initialise(), rndis_rx_query_oid(), rndis_rx_set_oid(), rndis_rx_status(), RNDIS_SET_CMPLT, and type.

Referenced by rndis_rx().

◆ 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().

◆ rndis_filter()

static int rndis_filter ( struct rndis_device rndis,
unsigned int  filter 
)
static

Set receive filter.

Parameters
rndisRNDIS device
filterReceive filter
Return values
rcReturn status code

Definition at line 881 of file rndis.c.

881  {
883  int rc;
884 
885  /* Set receive filter */
887  &value, sizeof ( value ) ) ) != 0 ) {
888  DBGC ( rndis, "RNDIS %s could not set receive filter to %#08x: "
889  "%s\n", rndis->name, filter, strerror ( rc ) );
890  return rc;
891  }
892 
893  return 0;
894 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Device name.
Definition: rndis.h:321
UINT8_t filter
Receive packet filter.
Definition: pxe_api.h:68
#define DBGC(...)
Definition: compiler.h:505
#define cpu_to_le32(value)
Definition: byteswap.h:107
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
unsigned int uint32_t
Definition: stdint.h:12
#define RNDIS_OID_GEN_CURRENT_PACKET_FILTER
OID for packet filter.
Definition: rndis.h:254
static int rndis_oid(struct rndis_device *rndis, unsigned int oid, const void *data, size_t len)
Query or set OID.
Definition: rndis.c:638

References cpu_to_le32, DBGC, filter, rndis_device::name, rc, rndis_oid(), RNDIS_OID_GEN_CURRENT_PACKET_FILTER, strerror(), and value.

Referenced by rndis_close(), and rndis_open().

◆ rndis_open()

static int rndis_open ( struct net_device netdev)
static

Open network device.

Parameters
netdevNetwork device
Return values
rcReturn status code

Definition at line 902 of file rndis.c.

902  {
903  struct rndis_device *rndis = netdev->priv;
904  int rc;
905 
906  /* Open RNDIS device */
907  if ( ( rc = rndis->op->open ( rndis ) ) != 0 ) {
908  DBGC ( rndis, "RNDIS %s could not open: %s\n",
909  rndis->name, strerror ( rc ) );
910  goto err_open;
911  }
912 
913  /* Initialise RNDIS */
914  if ( ( rc = rndis_initialise ( rndis ) ) != 0 )
915  goto err_initialise;
916 
917  /* Set receive filter */
918  if ( ( rc = rndis_filter ( rndis, ( RNDIS_FILTER_UNICAST |
922  RNDIS_FILTER_PROMISCUOUS ) ) ) != 0)
923  goto err_set_filter;
924 
925  /* Update link status */
927  NULL, 0 ) ) != 0 )
928  goto err_query_link;
929 
930  return 0;
931 
932  err_query_link:
933  err_set_filter:
934  rndis_halt ( rndis );
935  err_initialise:
936  rndis->op->close ( rndis );
937  err_open:
938  return rc;
939 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
int(* open)(struct rndis_device *rndis)
Open RNDIS device.
Definition: rndis.h:289
const char * name
Device name.
Definition: rndis.h:321
Multicast packets.
Definition: rndis.h:261
Unicast packets.
Definition: rndis.h:259
#define DBGC(...)
Definition: compiler.h:505
void(* close)(struct rndis_device *rndis)
Close RNDIS device.
Definition: rndis.h:295
#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS
OID for media status.
Definition: rndis.h:271
static int rndis_filter(struct rndis_device *rndis, unsigned int filter)
Set receive filter.
Definition: rndis.c:881
void * priv
Driver private data.
Definition: netdevice.h:425
struct rndis_operations * op
RNDIS operations.
Definition: rndis.h:323
An RNDIS device.
Definition: rndis.h:317
static struct net_device * netdev
Definition: gdbudp.c:52
static int rndis_initialise(struct rndis_device *rndis)
Initialise RNDIS.
Definition: rndis.c:360
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
All multicast packets.
Definition: rndis.h:263
static int rndis_halt(struct rndis_device *rndis)
Halt RNDIS.
Definition: rndis.c:414
All packets.
Definition: rndis.h:267
static int rndis_oid(struct rndis_device *rndis, unsigned int oid, const void *data, size_t len)
Query or set OID.
Definition: rndis.c:638
Broadcast packets.
Definition: rndis.h:265
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References rndis_operations::close, DBGC, rndis_device::name, netdev, NULL, rndis_device::op, rndis_operations::open, net_device::priv, rc, rndis_filter(), RNDIS_FILTER_ALL_MULTICAST, RNDIS_FILTER_BROADCAST, RNDIS_FILTER_MULTICAST, RNDIS_FILTER_PROMISCUOUS, RNDIS_FILTER_UNICAST, rndis_halt(), rndis_initialise(), rndis_oid(), RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, and strerror().

◆ rndis_close()

static void rndis_close ( struct net_device netdev)
static

Close network device.

Parameters
netdevNetwork device

Definition at line 946 of file rndis.c.

946  {
947  struct rndis_device *rndis = netdev->priv;
948 
949  /* Clear receive filter */
950  rndis_filter ( rndis, 0 );
951 
952  /* Halt RNDIS device */
953  rndis_halt ( rndis );
954 
955  /* Close RNDIS device */
956  rndis->op->close ( rndis );
957 }
void(* close)(struct rndis_device *rndis)
Close RNDIS device.
Definition: rndis.h:295
static int rndis_filter(struct rndis_device *rndis, unsigned int filter)
Set receive filter.
Definition: rndis.c:881
void * priv
Driver private data.
Definition: netdevice.h:425
struct rndis_operations * op
RNDIS operations.
Definition: rndis.h:323
An RNDIS device.
Definition: rndis.h:317
static struct net_device * netdev
Definition: gdbudp.c:52
static int rndis_halt(struct rndis_device *rndis)
Halt RNDIS.
Definition: rndis.c:414

References rndis_operations::close, netdev, rndis_device::op, net_device::priv, rndis_filter(), and rndis_halt().

◆ rndis_transmit()

static int rndis_transmit ( struct net_device netdev,
struct io_buffer iobuf 
)
static

Transmit packet.

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

Definition at line 966 of file rndis.c.

967  {
968  struct rndis_device *rndis = netdev->priv;
969 
970  /* Transmit data packet */
971  return rndis_tx_data ( rndis, iobuf );
972 }
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
static int rndis_tx_data(struct rndis_device *rndis, struct io_buffer *iobuf)
Transmit data packet.
Definition: rndis.c:158

References netdev, net_device::priv, and rndis_tx_data().

◆ rndis_poll()

static void rndis_poll ( struct net_device netdev)
static

Poll for completed and received packets.

Parameters
netdevNetwork device

Definition at line 979 of file rndis.c.

979  {
980  struct rndis_device *rndis = netdev->priv;
981 
982  /* Poll RNDIS device */
983  rndis->op->poll ( rndis );
984 }
void * priv
Driver private data.
Definition: netdevice.h:425
struct rndis_operations * op
RNDIS operations.
Definition: rndis.h:323
An RNDIS device.
Definition: rndis.h:317
static struct net_device * netdev
Definition: gdbudp.c:52
void(* poll)(struct rndis_device *rndis)
Poll for completed and received packets.
Definition: rndis.h:313

References netdev, rndis_device::op, rndis_operations::poll, and net_device::priv.

◆ 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().

Variable Documentation

◆ rndis_operations

Initial value:
= {
.open = rndis_open,
.close = rndis_close,
.transmit = rndis_transmit,
.poll = rndis_poll,
}
static int rndis_open(struct net_device *netdev)
Open network device.
Definition: rndis.c:902
static void rndis_close(struct net_device *netdev)
Close network device.
Definition: rndis.c:946
static int rndis_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
Definition: rndis.c:966
static void rndis_poll(struct net_device *netdev)
Poll for completed and received packets.
Definition: rndis.c:979

Network device operations.

Definition at line 987 of file rndis.c.