iPXE
acm.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Michael Brown <mbrown@fensystems.co.uk>.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 *
19 * You can also choose to distribute this program under the terms of
20 * the Unmodified Binary Distribution Licence (as given in the file
21 * COPYING.UBDL), provided that you have satisfied its requirements.
22 */
23
24FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25FILE_SECBOOT ( PERMITTED );
26
27#include <stdint.h>
28#include <string.h>
29#include <errno.h>
30#include <byteswap.h>
31#include <ipxe/profile.h>
32#include <ipxe/usb.h>
33#include <ipxe/usbnet.h>
34#include <ipxe/rndis.h>
35#include "acm.h"
36
37/** @file
38 *
39 * USB RNDIS driver
40 *
41 */
42
43/** Interrupt completion profiler */
44static struct profiler acm_intr_profiler __profiler =
45 { .name = "acm.intr" };
46
47/** Bulk IN completion profiler */
48static struct profiler acm_in_profiler __profiler =
49 { .name = "acm.in" };
50
51/** Bulk OUT profiler */
52static struct profiler acm_out_profiler __profiler =
53 { .name = "acm.out" };
54
55/******************************************************************************
56 *
57 * USB RNDIS communications interface
58 *
59 ******************************************************************************
60 */
61
62/**
63 * Complete interrupt transfer
64 *
65 * @v ep USB endpoint
66 * @v iobuf I/O buffer
67 * @v rc Completion status code
68 */
69static void acm_intr_complete ( struct usb_endpoint *ep,
70 struct io_buffer *iobuf, int rc ) {
71 struct acm_device *acm = container_of ( ep, struct acm_device,
72 usbnet.intr );
73 struct rndis_device *rndis = acm->rndis;
75
76 /* Profile completions */
77 profile_start ( &acm_intr_profiler );
78
79 /* Ignore packets cancelled when the endpoint closes */
80 if ( ! ep->open )
81 goto ignore;
82
83 /* Drop packets with errors */
84 if ( rc != 0 ) {
85 DBGC ( acm, "ACM %p interrupt failed: %s\n",
86 acm, strerror ( rc ) );
87 DBGC_HDA ( acm, 0, iobuf->data, iob_len ( iobuf ) );
88 goto error;
89 }
90
91 /* Extract message header */
92 if ( iob_len ( iobuf ) < sizeof ( *message ) ) {
93 DBGC ( acm, "ACM %p underlength interrupt:\n", acm );
94 DBGC_HDA ( acm, 0, iobuf->data, iob_len ( iobuf ) );
95 rc = -EINVAL;
96 goto error;
97 }
98 message = iobuf->data;
99
100 /* Parse message header */
101 switch ( message->request ) {
102
104 case cpu_to_le16 ( 0x0001 ) : /* qemu seems to use this value */
105 acm->responded = 1;
106 break;
107
108 default:
109 DBGC ( acm, "ACM %p unrecognised interrupt:\n", acm );
110 DBGC_HDA ( acm, 0, iobuf->data, iob_len ( iobuf ) );
111 rc = -ENOTSUP;
112 goto error;
113 }
114
115 /* Free I/O buffer */
116 free_iob ( iobuf );
117 profile_stop ( &acm_intr_profiler );
118
119 return;
120
121 error:
122 rndis_rx_err ( rndis, iob_disown ( iobuf ), rc );
123 ignore:
124 free_iob ( iobuf );
125 return;
126}
127
128/** Interrupt endpoint operations */
132
133/******************************************************************************
134 *
135 * USB RNDIS data interface
136 *
137 ******************************************************************************
138 */
139
140/**
141 * Complete bulk IN transfer
142 *
143 * @v ep USB endpoint
144 * @v iobuf I/O buffer
145 * @v rc Completion status code
146 */
147static void acm_in_complete ( struct usb_endpoint *ep, struct io_buffer *iobuf,
148 int rc ) {
149 struct acm_device *acm = container_of ( ep, struct acm_device,
150 usbnet.in );
151 struct rndis_device *rndis = acm->rndis;
152
153 /* Profile receive completions */
154 profile_start ( &acm_in_profiler );
155
156 /* Ignore packets cancelled when the endpoint closes */
157 if ( ! ep->open )
158 goto ignore;
159
160 /* Record USB errors against the RNDIS device */
161 if ( rc != 0 ) {
162 DBGC ( acm, "ACM %p bulk IN failed: %s\n",
163 acm, strerror ( rc ) );
164 goto error;
165 }
166
167 /* Hand off to RNDIS */
168 rndis_rx ( rndis, iob_disown ( iobuf ) );
169
170 profile_stop ( &acm_in_profiler );
171 return;
172
173 error:
174 rndis_rx_err ( rndis, iob_disown ( iobuf ), rc );
175 ignore:
176 free_iob ( iobuf );
177}
178
179/** Bulk IN endpoint operations */
181 .complete = acm_in_complete,
182};
183
184/**
185 * Transmit packet
186 *
187 * @v acm USB RNDIS device
188 * @v iobuf I/O buffer
189 * @ret rc Return status code
190 */
191static int acm_out_transmit ( struct acm_device *acm,
192 struct io_buffer *iobuf ) {
193 int rc;
194
195 /* Profile transmissions */
196 profile_start ( &acm_out_profiler );
197
198 /* Enqueue I/O buffer */
199 if ( ( rc = usb_stream ( &acm->usbnet.out, iobuf, 0 ) ) != 0 )
200 return rc;
201
202 profile_stop ( &acm_out_profiler );
203 return 0;
204}
205
206/**
207 * Complete bulk OUT transfer
208 *
209 * @v ep USB endpoint
210 * @v iobuf I/O buffer
211 * @v rc Completion status code
212 */
213static void acm_out_complete ( struct usb_endpoint *ep, struct io_buffer *iobuf,
214 int rc ) {
215 struct acm_device *acm = container_of ( ep, struct acm_device,
216 usbnet.out );
217 struct rndis_device *rndis = acm->rndis;
218
219 /* Report TX completion */
220 rndis_tx_complete_err ( rndis, iobuf, rc );
221}
222
223/** Bulk OUT endpoint operations */
227
228/******************************************************************************
229 *
230 * USB RNDIS control interface
231 *
232 ******************************************************************************
233 */
234
235/**
236 * Send control packet
237 *
238 * @v acm USB RNDIS device
239 * @v iobuf I/O buffer
240 * @ret rc Return status code
241 */
242static int acm_control_transmit ( struct acm_device *acm,
243 struct io_buffer *iobuf ) {
244 struct rndis_device *rndis = acm->rndis;
245 struct usb_device *usb = acm->usb;
246 int rc;
247
248 /* Send packet as an encapsulated command */
249 if ( ( rc = cdc_send_encapsulated_command ( usb, acm->usbnet.comms,
250 iobuf->data,
251 iob_len ( iobuf ) ) ) != 0){
252 DBGC ( acm, "ACM %p could not send encapsulated command: %s\n",
253 acm, strerror ( rc ) );
254 return rc;
255 }
256
257 /* Complete packet immediately */
258 rndis_tx_complete ( rndis, iobuf );
259
260 return 0;
261}
262
263/**
264 * Receive control packet
265 *
266 * @v acm USB RNDIS device
267 * @ret rc Return status code
268 */
269static int acm_control_receive ( struct acm_device *acm ) {
270 struct rndis_device *rndis = acm->rndis;
271 struct usb_device *usb = acm->usb;
272 struct io_buffer *iobuf;
273 struct rndis_header *header;
274 size_t mtu = ACM_RESPONSE_MTU;
275 size_t len;
276 int rc;
277
278 /* Allocate I/O buffer */
279 iobuf = alloc_iob ( mtu );
280 if ( ! iobuf ) {
281 rc = -ENOMEM;
282 goto err_alloc;
283 }
284
285 /* Get encapsulated response */
286 if ( ( rc = cdc_get_encapsulated_response ( usb, acm->usbnet.comms,
287 iobuf->data, mtu ) ) != 0 ){
288 DBGC ( acm, "ACM %p could not get encapsulated response: %s\n",
289 acm, strerror ( rc ) );
290 goto err_get_response;
291 }
292
293 /* Fix up buffer length */
294 header = iobuf->data;
295 len = le32_to_cpu ( header->len );
296 if ( len > mtu ) {
297 DBGC ( acm, "ACM %p overlength encapsulated response\n", acm );
298 DBGC_HDA ( acm, 0, iobuf->data, mtu );
299 rc = -EPROTO;
300 goto err_len;
301 }
302 iob_put ( iobuf, len );
303
304 /* Hand off to RNDIS */
305 rndis_rx ( rndis, iob_disown ( iobuf ) );
306
307 return 0;
308
309 err_len:
310 err_get_response:
311 free_iob ( iobuf );
312 err_alloc:
313 return rc;
314}
315
316/******************************************************************************
317 *
318 * RNDIS interface
319 *
320 ******************************************************************************
321 */
322
323/**
324 * Open RNDIS device
325 *
326 * @v rndis RNDIS device
327 * @ret rc Return status code
328 */
329static int acm_open ( struct rndis_device *rndis ) {
330 struct acm_device *acm = rndis->priv;
331 int rc;
332
333 /* Open USB network device */
334 if ( ( rc = usbnet_open ( &acm->usbnet ) ) != 0 )
335 goto err_open;
336
337 return 0;
338
339 usbnet_close ( &acm->usbnet );
340 err_open:
341 return rc;
342}
343
344/**
345 * Close RNDIS device
346 *
347 * @v rndis RNDIS device
348 */
349static void acm_close ( struct rndis_device *rndis ) {
350 struct acm_device *acm = rndis->priv;
351
352 /* Close USB network device */
353 usbnet_close ( &acm->usbnet );
354}
355
356/**
357 * Transmit packet
358 *
359 * @v rndis RNDIS device
360 * @v iobuf I/O buffer
361 * @ret rc Return status code
362 */
363static int acm_transmit ( struct rndis_device *rndis,
364 struct io_buffer *iobuf ) {
365 struct acm_device *acm = rndis->priv;
366 struct rndis_header *header = iobuf->data;
367
368 /* Sanity check */
369 assert ( iob_len ( iobuf ) >= sizeof ( *header ) );
370 assert ( iob_len ( iobuf ) == le32_to_cpu ( header->len ) );
371
372 /* Transmit packet via appropriate mechanism */
373 if ( header->type == cpu_to_le32 ( RNDIS_PACKET_MSG ) ) {
374 return acm_out_transmit ( acm, iobuf );
375 } else {
376 return acm_control_transmit ( acm, iobuf );
377 }
378}
379
380/**
381 * Poll for completed and received packets
382 *
383 * @v rndis RNDIS device
384 */
385static void acm_poll ( struct rndis_device *rndis ) {
386 struct acm_device *acm = rndis->priv;
387 int rc;
388
389 /* Poll USB bus */
390 usb_poll ( acm->bus );
391
392 /* Refill rings */
393 if ( ( rc = usbnet_refill ( &acm->usbnet ) ) != 0 )
395
396 /* Retrieve encapsulated response, if applicable */
397 if ( acm->responded ) {
398
399 /* Clear flag */
400 acm->responded = 0;
401
402 /* Get encapsulated response */
403 if ( ( rc = acm_control_receive ( acm ) ) != 0 )
405 }
406}
407
408/** USB RNDIS operations */
410 .open = acm_open,
411 .close = acm_close,
412 .transmit = acm_transmit,
413 .poll = acm_poll,
414};
415
416/******************************************************************************
417 *
418 * USB interface
419 *
420 ******************************************************************************
421 */
422
423/**
424 * Probe device
425 *
426 * @v func USB function
427 * @v config Configuration descriptor
428 * @ret rc Return status code
429 */
430static int acm_probe ( struct usb_function *func,
431 struct usb_configuration_descriptor *config ) {
432 struct usb_device *usb = func->usb;
433 struct rndis_device *rndis;
434 struct acm_device *acm;
435 int rc;
436
437 /* Allocate and initialise structure */
438 rndis = alloc_rndis ( sizeof ( *acm ) );
439 if ( ! rndis ) {
440 rc = -ENOMEM;
441 goto err_alloc;
442 }
444 rndis->netdev->dev = &func->dev;
445 acm = rndis->priv;
446 acm->usb = usb;
447 acm->bus = usb->port->hub->bus;
448 acm->rndis = rndis;
449 usbnet_init ( &acm->usbnet, func, &acm_intr_operations,
453
454 /* Describe USB network device */
455 if ( ( rc = usbnet_describe ( &acm->usbnet, config ) ) != 0 ) {
456 DBGC ( acm, "ACM %p could not describe: %s\n",
457 acm, strerror ( rc ) );
458 goto err_describe;
459 }
460
461 /* Register RNDIS device */
462 if ( ( rc = register_rndis ( rndis ) ) != 0 )
463 goto err_register;
464
465 usb_func_set_drvdata ( func, acm );
466 return 0;
467
469 err_register:
470 err_describe:
471 free_rndis ( rndis );
472 err_alloc:
473 return rc;
474}
475
476/**
477 * Remove device
478 *
479 * @v func USB function
480 */
481static void acm_remove ( struct usb_function *func ) {
482 struct acm_device *acm = usb_func_get_drvdata ( func );
483 struct rndis_device *rndis = acm->rndis;
484
485 /* Unregister RNDIS device */
486 unregister_rndis ( rndis );
487
488 /* Free RNDIS device */
489 free_rndis ( rndis );
490}
491
492/** USB CDC-ACM device IDs */
493static struct usb_device_id cdc_acm_ids[] = {
494 USB_ROM ( 0xffff, 0xffff, "cdc-acm", "USB CDC-ACM NIC", 0 ),
495};
496
497/** USB CDC-ACM driver */
498struct usb_driver cdc_acm_driver __usb_driver = {
499 .ids = cdc_acm_ids,
500 .id_count = ( sizeof ( cdc_acm_ids ) / sizeof ( cdc_acm_ids[0] ) ),
503 .score = USB_SCORE_DEPRECATED,
504 .probe = acm_probe,
505 .remove = acm_remove,
506};
507
508/** USB RF-RNDIS device IDs */
509static struct usb_device_id rf_rndis_ids[] = {
510 USB_ROM ( 0xffff, 0xffff, "rf-rndis", "USB RNDIS NIC", 0 ),
511};
512
513/** USB RF-RNDIS driver */
514struct usb_driver rf_rndis_driver __usb_driver = {
515 .ids = rf_rndis_ids,
516 .id_count = ( sizeof ( rf_rndis_ids ) / sizeof ( rf_rndis_ids[0] ) ),
519 .score = USB_SCORE_DEPRECATED,
520 .probe = acm_probe,
521 .remove = acm_remove,
522};
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
static int acm_transmit(struct rndis_device *rndis, struct io_buffer *iobuf)
Transmit packet.
Definition acm.c:363
static void acm_out_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete bulk OUT transfer.
Definition acm.c:213
static int acm_open(struct rndis_device *rndis)
Open RNDIS device.
Definition acm.c:329
static struct usb_endpoint_driver_operations acm_intr_operations
Interrupt endpoint operations.
Definition acm.c:129
static int acm_out_transmit(struct acm_device *acm, struct io_buffer *iobuf)
Transmit packet.
Definition acm.c:191
static int acm_control_transmit(struct acm_device *acm, struct io_buffer *iobuf)
Send control packet.
Definition acm.c:242
static struct rndis_operations acm_operations
USB RNDIS operations.
Definition acm.c:409
static struct usb_device_id rf_rndis_ids[]
USB RF-RNDIS device IDs.
Definition acm.c:509
static void acm_intr_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete interrupt transfer.
Definition acm.c:69
static void acm_close(struct rndis_device *rndis)
Close RNDIS device.
Definition acm.c:349
static void acm_poll(struct rndis_device *rndis)
Poll for completed and received packets.
Definition acm.c:385
static struct usb_endpoint_driver_operations acm_out_operations
Bulk OUT endpoint operations.
Definition acm.c:224
static void acm_remove(struct usb_function *func)
Remove device.
Definition acm.c:481
static int acm_probe(struct usb_function *func, struct usb_configuration_descriptor *config)
Probe device.
Definition acm.c:430
static struct usb_device_id cdc_acm_ids[]
USB CDC-ACM device IDs.
Definition acm.c:493
static int acm_control_receive(struct acm_device *acm)
Receive control packet.
Definition acm.c:269
static void acm_in_complete(struct usb_endpoint *ep, struct io_buffer *iobuf, int rc)
Complete bulk IN transfer.
Definition acm.c:147
static struct usb_endpoint_driver_operations acm_in_operations
Bulk IN endpoint operations.
Definition acm.c:180
USB RNDIS Ethernet driver.
#define USB_PROTOCOL_RADIO_RNDIS
Radio frequency RNDIS device protocol.
Definition acm.h:29
#define USB_CLASS_WIRELESS
Class code for wireless devices.
Definition acm.h:23
#define ACM_IN_MAX_FILL
Bulk IN maximum fill level.
Definition acm.h:56
#define ACM_INTR_MAX_FILL
Interrupt maximum fill level.
Definition acm.h:50
#define ACM_IN_MTU
Bulk IN buffer size.
Definition acm.h:62
#define USB_SUBCLASS_CDC_ACM
CDC-ACM subclass.
Definition acm.h:17
#define USB_SUBCLASS_WIRELESS_RADIO
Radio frequency device subclass.
Definition acm.h:26
#define ACM_RESPONSE_MTU
Encapsulated response buffer size.
Definition acm.h:68
#define USB_PROTOCOL_ACM_RNDIS
CDC-ACM RNDIS device protocol.
Definition acm.h:20
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
struct arbelprm_completion_with_error error
Definition arbel.h:1
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
#define USB_CLASS_CDC
Class code for communications devices.
Definition cdc.h:16
#define CDC_RESPONSE_AVAILABLE
Response available.
Definition cdc.h:45
static int cdc_get_encapsulated_response(struct usb_device *usb, unsigned int interface, void *data, size_t len)
Get encapsulated response.
Definition cdc.h:98
static int cdc_send_encapsulated_command(struct usb_device *usb, unsigned int interface, void *data, size_t len)
Send encapsulated command.
Definition cdc.h:81
ring len
Length.
Definition dwmac.h:226
uint32_t mtu
Maximum MTU.
Definition ena.h:17
struct ena_llq_option header
Header locations.
Definition ena.h:5
Error codes.
#define DBGC(...)
Definition compiler.h:505
#define DBGC_HDA(...)
Definition compiler.h:506
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define EINVAL
Invalid argument.
Definition errno.h:429
#define EPROTO
Protocol error.
Definition errno.h:625
#define ENOMEM
Not enough space.
Definition errno.h:535
#define ENOTSUP
Operation not supported.
Definition errno.h:590
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define le32_to_cpu(value)
Definition byteswap.h:114
#define cpu_to_le32(value)
Definition byteswap.h:108
#define cpu_to_le16(value)
Definition byteswap.h:107
Profiling.
#define __profiler
Declare a profiler.
Definition profile.h:61
static void profile_stop(struct profiler *profiler)
Stop profiling.
Definition profile.h:174
static void profile_start(struct profiler *profiler)
Start profiling.
Definition profile.h:161
Universal Serial Bus (USB)
#define __usb_driver
Declare a USB driver.
Definition usb.h:1453
static void usb_refill_init(struct usb_endpoint *ep, size_t reserve, size_t len, unsigned int max)
Initialise USB endpoint refill.
Definition usb.h:617
#define USB_CLASS_ID(base, subclass, protocol)
Construct USB class ID.
Definition usb.h:1401
static void usb_poll(struct usb_bus *bus)
Poll USB bus.
Definition usb.h:1072
#define USB_ROM(_vendor, _product, _name, _description, _data)
Definition usb.h:1381
static void usb_func_set_drvdata(struct usb_function *func, void *priv)
Set USB function driver private data.
Definition usb.h:707
@ USB_SCORE_DEPRECATED
Deprecated driver.
Definition usb.h:1463
static void * usb_func_get_drvdata(struct usb_function *func)
Get USB function driver private data.
Definition usb.h:718
String functions.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition iobuf.c:153
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
Definition iobuf.c:131
#define iob_put(iobuf, len)
Definition iobuf.h:125
#define iob_disown(iobuf)
Disown an I/O buffer.
Definition iobuf.h:217
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition iobuf.h:160
int register_rndis(struct rndis_device *rndis)
Register RNDIS device.
Definition rndis.c:1027
void unregister_rndis(struct rndis_device *rndis)
Unregister RNDIS device.
Definition rndis.c:1055
void rndis_rx(struct rndis_device *rndis, struct io_buffer *iobuf)
Receive packet from underlying transport layer.
Definition rndis.c:830
void rndis_tx_complete_err(struct rndis_device *rndis, struct io_buffer *iobuf, int rc)
Complete message transmission.
Definition rndis.c:128
void free_rndis(struct rndis_device *rndis)
Free RNDIS device.
Definition rndis.c:1067
void rndis_rx_err(struct rndis_device *rndis, struct io_buffer *iobuf, int rc)
Discard packet from underlying transport layer.
Definition rndis.c:867
struct rndis_device * alloc_rndis(size_t priv_len)
Allocate RNDIS device.
Definition rndis.c:1001
Remote Network Driver Interface Specification.
#define RNDIS_PACKET_MSG
RNDIS packet message.
Definition rndis.h:220
static void rndis_tx_complete(struct rndis_device *rndis, struct io_buffer *iobuf)
Complete message transmission.
Definition rndis.h:365
static void rndis_init(struct rndis_device *rndis, struct rndis_operations *op)
Initialise an RNDIS device.
Definition rndis.h:340
#define container_of(ptr, type, field)
Get containing structure.
Definition stddef.h:36
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
A USB RNDIS network device.
Definition acm.h:32
struct usbnet_device usbnet
USB network device.
Definition acm.h:40
int responded
An encapsulated response is available.
Definition acm.h:43
struct rndis_device * rndis
RNDIS device.
Definition acm.h:38
struct usb_device * usb
USB device.
Definition acm.h:34
struct usb_bus * bus
USB bus.
Definition acm.h:36
A persistent I/O buffer.
Definition iobuf.h:38
void * data
Start of data.
Definition iobuf.h:53
struct device * dev
Underlying hardware device.
Definition netdevice.h:365
A data structure for storing profiling information.
Definition profile.h:27
An RNDIS device.
Definition rndis.h:318
struct net_device * netdev
Network device.
Definition rndis.h:320
void * priv
Driver private data.
Definition rndis.h:326
RNDIS message header.
Definition rndis.h:24
RNDIS device operations.
Definition rndis.h:283
A USB configuration descriptor.
Definition usb.h:210
A USB device ID.
Definition usb.h:1361
A USB device.
Definition usb.h:723
struct usb_port * port
USB port.
Definition usb.h:727
A USB driver.
Definition usb.h:1419
USB endpoint driver operations.
Definition usb.h:489
A USB endpoint.
Definition usb.h:404
int open
Endpoint is open.
Definition usb.h:419
A USB function.
Definition usb.h:674
struct usb_device * usb
USB device.
Definition usb.h:678
struct device dev
Generic device.
Definition usb.h:682
struct usb_bus * bus
USB bus.
Definition usb.h:845
struct usb_hub * hub
USB hub.
Definition usb.h:815
A USB setup data packet.
Definition usb.h:83
struct usb_endpoint out
Bulk OUT endpoint.
Definition usbnet.h:32
struct usb_endpoint intr
Interrupt endpoint.
Definition usbnet.h:28
unsigned int comms
Communications interface.
Definition usbnet.h:21
struct usb_endpoint in
Bulk IN endpoint.
Definition usbnet.h:30
int usb_stream(struct usb_endpoint *ep, struct io_buffer *iobuf, int terminate)
Enqueue USB stream transfer.
Definition usb.c:546
int usbnet_refill(struct usbnet_device *usbnet)
Refill USB network device bulk IN and interrupt endpoints.
Definition usbnet.c:152
int usbnet_open(struct usbnet_device *usbnet)
Open USB network device.
Definition usbnet.c:55
void usbnet_close(struct usbnet_device *usbnet)
Close USB network device.
Definition usbnet.c:128
int usbnet_describe(struct usbnet_device *usbnet, struct usb_configuration_descriptor *config)
Describe USB network device interfaces.
Definition usbnet.c:278
USB network devices.
static void usbnet_init(struct usbnet_device *usbnet, struct usb_function *func, struct usb_endpoint_driver_operations *intr, struct usb_endpoint_driver_operations *in, struct usb_endpoint_driver_operations *out)
Initialise USB network device.
Definition usbnet.h:45
char message[VMCONSOLE_BUFSIZE]
Definition vmconsole.c:54