4 * Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 #include <rte_ethdev.h>
41 #include <rte_memcpy.h>
42 #include <rte_string_fns.h>
43 #include <rte_memzone.h>
44 #include <rte_malloc.h>
45 #include <rte_atomic.h>
46 #include <rte_branch_prediction.h>
48 #include <rte_ether.h>
49 #include <rte_common.h>
51 #include <rte_memory.h>
54 #include "virtio_ethdev.h"
55 #include "virtio_pci.h"
56 #include "virtio_logs.h"
57 #include "virtqueue.h"
60 static int eth_virtio_dev_init(struct eth_driver *eth_drv,
61 struct rte_eth_dev *eth_dev);
62 static int virtio_dev_configure(struct rte_eth_dev *dev);
63 static int virtio_dev_start(struct rte_eth_dev *dev);
64 static void virtio_dev_stop(struct rte_eth_dev *dev);
65 static void virtio_dev_info_get(struct rte_eth_dev *dev,
66 struct rte_eth_dev_info *dev_info);
67 static int virtio_dev_link_update(struct rte_eth_dev *dev,
68 __rte_unused int wait_to_complete);
70 static void virtio_set_hwaddr(struct virtio_hw *hw);
71 static void virtio_get_hwaddr(struct virtio_hw *hw);
73 static void virtio_dev_rx_queue_release(__rte_unused void *rxq);
74 static void virtio_dev_tx_queue_release(__rte_unused void *txq);
76 static void virtio_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
77 static void virtio_dev_stats_reset(struct rte_eth_dev *dev);
78 static void virtio_dev_free_mbufs(struct rte_eth_dev *dev);
81 * The set of PCI devices this driver supports
83 static struct rte_pci_id pci_id_virtio_map[] = {
85 #define RTE_PCI_DEV_ID_DECL_VIRTIO(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
86 #include "rte_pci_dev_ids.h"
88 { .vendor_id = 0, /* sentinel */ },
91 int virtio_dev_queue_setup(struct rte_eth_dev *dev,
94 uint8_t vtpci_queue_idx,
96 unsigned int socket_id,
97 struct virtqueue **pvq)
99 char vq_name[VIRTQUEUE_MAX_NAME_SZ];
100 const struct rte_memzone *mz;
103 struct virtio_hw *hw =
104 VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
105 struct virtqueue *vq = NULL;
107 /* Write the virtqueue index to the Queue Select Field */
108 VIRTIO_WRITE_REG_2(hw, VIRTIO_PCI_QUEUE_SEL, vtpci_queue_idx);
109 PMD_INIT_LOG(DEBUG, "selecting queue: %d\n", vtpci_queue_idx);
112 * Read the virtqueue size from the Queue Size field
113 * Always power of 2 and if 0 virtqueue does not exist
115 vq_size = VIRTIO_READ_REG_2(hw, VIRTIO_PCI_QUEUE_NUM);
116 PMD_INIT_LOG(DEBUG, "vq_size: %d nb_desc:%d\n", vq_size, nb_desc);
120 PMD_INIT_LOG(ERR, "%s: virtqueue does not exist\n", __func__);
122 } else if (!rte_is_power_of_2(vq_size)) {
123 PMD_INIT_LOG(ERR, "%s: virtqueue size is not powerof 2\n", __func__);
125 } else if (nb_desc != vq_size) {
126 PMD_INIT_LOG(ERR, "Warning: nb_desc(%d) is not equal to vq size (%d), fall to vq size\n",
131 if (queue_type == VTNET_RQ) {
132 rte_snprintf(vq_name, sizeof(vq_name), "port%d_rvq%d",
133 dev->data->port_id, queue_idx);
134 vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
135 vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE);
136 memcpy(vq->vq_name, vq_name, sizeof(vq->vq_name));
137 } else if(queue_type == VTNET_TQ) {
138 rte_snprintf(vq_name, sizeof(vq_name), "port%d_tvq%d",
139 dev->data->port_id, queue_idx);
140 vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) +
141 vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE);
142 memcpy(vq->vq_name, vq_name, sizeof(vq->vq_name));
143 } else if(queue_type == VTNET_CQ) {
144 rte_snprintf(vq_name, sizeof(vq_name), "port%d_cvq",
146 vq = rte_zmalloc(vq_name, sizeof(struct virtqueue),
148 memcpy(vq->vq_name, vq_name, sizeof(vq->vq_name));
151 PMD_INIT_LOG(ERR, "%s: Can not allocate virtqueue\n", __func__);
155 vq->port_id = dev->data->port_id;
156 vq->queue_id = queue_idx;
157 vq->vq_queue_index = vtpci_queue_idx;
158 vq->vq_alignment = VIRTIO_PCI_VRING_ALIGN;
159 vq->vq_nentries = vq_size;
160 vq->vq_free_cnt = vq_size;
163 * Reserve a memzone for vring elements
165 size = vring_size(vq_size, VIRTIO_PCI_VRING_ALIGN);
166 vq->vq_ring_size = RTE_ALIGN_CEIL(size, VIRTIO_PCI_VRING_ALIGN);
167 PMD_INIT_LOG(DEBUG, "vring_size: %d, rounded_vring_size: %d\n", size, vq->vq_ring_size);
169 mz = rte_memzone_reserve_aligned(vq_name, vq->vq_ring_size,
170 socket_id, 0, VIRTIO_PCI_VRING_ALIGN);
176 * Virtio PCI device VIRTIO_PCI_QUEUE_PF register is 32bit,
177 * and only accepts 32 bit page frame number.
178 * Check if the allocated physical memory exceeds 16TB.
180 if ( (mz->phys_addr + vq->vq_ring_size - 1) >> (VIRTIO_PCI_QUEUE_ADDR_SHIFT + 32) ) {
181 PMD_INIT_LOG(ERR, "vring address shouldn't be above 16TB!\n");
185 memset(mz->addr, 0, sizeof(mz->len));
187 vq->vq_ring_mem = mz->phys_addr;
188 vq->vq_ring_virt_mem = mz->addr;
189 PMD_INIT_LOG(DEBUG, "vq->vq_ring_mem: 0x%"PRIx64"\n", (uint64_t)mz->phys_addr);
190 PMD_INIT_LOG(DEBUG, "vq->vq_ring_virt_mem: 0x%"PRIx64"\n", (uint64_t)mz->addr);
191 vq->virtio_net_hdr_mz = NULL;
192 vq->virtio_net_hdr_mem = (void *)NULL;
194 if (queue_type == VTNET_TQ) {
196 * For each xmit packet, allocate a virtio_net_hdr
198 rte_snprintf(vq_name, sizeof(vq_name), "port%d_tvq%d_hdrzone",
199 dev->data->port_id, queue_idx);
200 vq->virtio_net_hdr_mz = rte_memzone_reserve_aligned(vq_name,
201 vq_size * sizeof(struct virtio_net_hdr),
202 socket_id, 0, CACHE_LINE_SIZE);
203 if (vq->virtio_net_hdr_mz == NULL) {
207 vq->virtio_net_hdr_mem = (void *)(uintptr_t)vq->virtio_net_hdr_mz->phys_addr;
208 memset(vq->virtio_net_hdr_mz->addr, 0, vq_size * sizeof(struct virtio_net_hdr));
209 } else if (queue_type == VTNET_CQ) {
210 /* Allocate a page for control vq command, data and status */
211 rte_snprintf(vq_name, sizeof(vq_name), "port%d_cvq_hdrzone",
213 vq->virtio_net_hdr_mz = rte_memzone_reserve_aligned(vq_name,
214 PAGE_SIZE, socket_id, 0, CACHE_LINE_SIZE);
215 if (vq->virtio_net_hdr_mz == NULL) {
219 vq->virtio_net_hdr_mem = (void *)(uintptr_t)vq->virtio_net_hdr_mz->phys_addr;
220 memset(vq->virtio_net_hdr_mz->addr, 0, PAGE_SIZE);
224 * Set guest physical address of the virtqueue
225 * in VIRTIO_PCI_QUEUE_PFN config register of device
227 VIRTIO_WRITE_REG_4(hw, VIRTIO_PCI_QUEUE_PFN,
228 mz->phys_addr >> VIRTIO_PCI_QUEUE_ADDR_SHIFT);
234 virtio_dev_cq_queue_setup(struct rte_eth_dev *dev,
235 unsigned int socket_id)
237 struct virtqueue *vq;
238 uint16_t nb_desc = 0;
240 struct virtio_hw *hw =
241 VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
243 PMD_INIT_FUNC_TRACE();
244 ret = virtio_dev_queue_setup(dev, VTNET_CQ, 0, VTNET_SQ_CQ_QUEUE_IDX,
245 nb_desc, socket_id, &vq);
247 PMD_INIT_LOG(ERR, "control vq initialization failed\n");
256 * dev_ops for virtio, bare necessities for basic operation
258 static struct eth_dev_ops virtio_eth_dev_ops = {
259 .dev_configure = virtio_dev_configure,
260 .dev_start = virtio_dev_start,
261 .dev_stop = virtio_dev_stop,
263 .dev_infos_get = virtio_dev_info_get,
264 .stats_get = virtio_dev_stats_get,
265 .stats_reset = virtio_dev_stats_reset,
266 .link_update = virtio_dev_link_update,
267 .mac_addr_add = NULL,
268 .mac_addr_remove = NULL,
269 .rx_queue_setup = virtio_dev_rx_queue_setup,
270 .rx_queue_release = virtio_dev_rx_queue_release, /* meaningfull only to multiple queue */
271 .tx_queue_setup = virtio_dev_tx_queue_setup,
272 .tx_queue_release = virtio_dev_tx_queue_release /* meaningfull only to multiple queue */
276 virtio_dev_atomic_read_link_status(struct rte_eth_dev *dev,
277 struct rte_eth_link *link)
279 struct rte_eth_link *dst = link;
280 struct rte_eth_link *src = &(dev->data->dev_link);
282 if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
283 *(uint64_t *)src) == 0)
290 * Atomically writes the link status information into global
291 * structure rte_eth_dev.
294 * - Pointer to the structure rte_eth_dev to read from.
295 * - Pointer to the buffer to be saved with the link status.
298 * - On success, zero.
299 * - On failure, negative value.
302 virtio_dev_atomic_write_link_status(struct rte_eth_dev *dev,
303 struct rte_eth_link *link)
305 struct rte_eth_link *dst = &(dev->data->dev_link);
306 struct rte_eth_link *src = link;
308 if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
309 *(uint64_t *)src) == 0)
316 virtio_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
318 struct virtio_hw *hw =
319 VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
321 memcpy(stats, &hw->eth_stats, sizeof(*stats));
325 virtio_dev_stats_reset(struct rte_eth_dev *dev)
327 struct virtio_hw *hw =
328 VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
329 /* Reset software totals */
330 memset(&hw->eth_stats, 0, sizeof(hw->eth_stats));
334 virtio_set_hwaddr(struct virtio_hw *hw)
336 vtpci_write_dev_config(hw,
337 offsetof(struct virtio_net_config, mac),
338 &hw->mac_addr, ETHER_ADDR_LEN);
342 virtio_get_hwaddr(struct virtio_hw *hw)
344 if (vtpci_with_feature(hw, VIRTIO_NET_F_MAC)) {
345 vtpci_read_dev_config(hw,
346 offsetof(struct virtio_net_config, mac),
347 &hw->mac_addr, ETHER_ADDR_LEN);
349 eth_random_addr(&hw->mac_addr[0]);
350 virtio_set_hwaddr(hw);
356 virtio_negotiate_features(struct virtio_hw *hw)
358 uint32_t guest_features, mask;
359 mask = VIRTIO_NET_F_CTRL_VQ | VIRTIO_NET_F_CTRL_RX | VIRTIO_NET_F_CTRL_VLAN;
360 mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM ;
362 /* TSO and LRO are only available when their corresponding
363 * checksum offload feature is also negotiated.
365 mask |= VIRTIO_NET_F_HOST_TSO4 | VIRTIO_NET_F_HOST_TSO6 | VIRTIO_NET_F_HOST_ECN;
366 mask |= VIRTIO_NET_F_GUEST_TSO4 | VIRTIO_NET_F_GUEST_TSO6 | VIRTIO_NET_F_GUEST_ECN;
367 mask |= VTNET_LRO_FEATURES;
369 /* rx_mbuf should not be in multiple merged segments */
370 mask |= VIRTIO_NET_F_MRG_RXBUF;
372 /* not negotiating INDIRECT descriptor table support */
373 mask |= VIRTIO_RING_F_INDIRECT_DESC;
375 /* Prepare guest_features: feature that driver wants to support */
376 guest_features = VTNET_FEATURES & ~mask;
378 /* Read device(host) feature bits */
379 hw->host_features = VIRTIO_READ_REG_4(hw, VIRTIO_PCI_HOST_FEATURES);
381 /* Negotiate features: Subset of device feature bits are written back (guest feature bits) */
382 hw->guest_features = vtpci_negotiate_features(hw, guest_features);
386 * This function is based on probe() function in virtio_pci.c
387 * It returns 0 on success.
390 eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv,
391 struct rte_eth_dev *eth_dev)
393 struct rte_pci_device *pci_dev;
394 struct virtio_hw *hw =
395 VIRTIO_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
396 if (RTE_PKTMBUF_HEADROOM < sizeof(struct virtio_net_hdr) ) {
398 "MBUF HEADROOM should be enough to hold virtio net hdr\n");
402 if (! (rte_eal_get_configuration()->flags & EAL_FLG_HIGH_IOPL)) {
404 "IOPL call failed in EAL init - cannot use virtio PMD driver\n");
408 eth_dev->dev_ops = &virtio_eth_dev_ops;
409 eth_dev->rx_pkt_burst = &virtio_recv_pkts;
410 eth_dev->tx_pkt_burst = &virtio_xmit_pkts;
412 if(rte_eal_process_type() == RTE_PROC_SECONDARY)
415 pci_dev = eth_dev->pci_dev;
417 hw->device_id = pci_dev->id.device_id;
418 hw->vendor_id = pci_dev->id.vendor_id;
419 hw->io_base = (uint32_t)(uintptr_t)pci_dev->mem_resource[0].addr;
421 hw->max_rx_queues = VIRTIO_MAX_RX_QUEUES;
422 hw->max_tx_queues = VIRTIO_MAX_TX_QUEUES;
424 /* Reset the device although not necessary at startup */
427 /* Tell the host we've noticed this device. */
428 vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_ACK);
430 /* Tell the host we've known how to drive the device. */
431 vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);
432 virtio_negotiate_features(hw);
433 /* Setting up rx_header size for the device */
434 if(vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF))
435 hw->vtnet_hdr_size = sizeof(struct virtio_net_hdr_mrg_rxbuf);
437 hw->vtnet_hdr_size = sizeof(struct virtio_net_hdr);
439 /* Allocate memory for storing MAC addresses */
440 eth_dev->data->mac_addrs = rte_zmalloc("virtio", ETHER_ADDR_LEN, 0);
441 if (eth_dev->data->mac_addrs == NULL) {
443 "Failed to allocate %d bytes needed to store MAC addresses",
447 /* Copy the permanent MAC address to: virtio_hw */
448 virtio_get_hwaddr(hw);
449 ether_addr_copy((struct ether_addr *) hw->mac_addr,
450 ð_dev->data->mac_addrs[0]);
451 PMD_INIT_LOG(DEBUG, "PORT MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", hw->mac_addr[0],
452 hw->mac_addr[1],hw->mac_addr[2], hw->mac_addr[3], hw->mac_addr[4], hw->mac_addr[5]);
454 if(vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VQ))
455 virtio_dev_cq_queue_setup(eth_dev, SOCKET_ID_ANY);
457 PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
458 eth_dev->data->port_id, pci_dev->id.vendor_id,
459 pci_dev->id.device_id);
463 static struct eth_driver rte_virtio_pmd = {
465 .name = "rte_virtio_pmd",
466 .id_table = pci_id_virtio_map,
467 #ifdef RTE_EAL_UNBIND_PORTS
468 .drv_flags = RTE_PCI_DRV_NEED_IGB_UIO,
471 .eth_dev_init = eth_virtio_dev_init,
472 .dev_private_size = sizeof(struct virtio_adapter),
476 * Driver initialization routine.
477 * Invoked once at EAL init time.
478 * Register itself as the [Poll Mode] Driver of PCI virtio devices.
479 * Returns 0 on success.
482 rte_virtio_pmd_init(void)
484 rte_eth_driver_register(&rte_virtio_pmd);
489 * Only 1 queue is supported, no queue release related operation
492 virtio_dev_rx_queue_release(__rte_unused void *rxq)
497 virtio_dev_tx_queue_release(__rte_unused void *txq)
502 * Configure virtio device
503 * It returns 0 on success.
506 virtio_dev_configure(__rte_unused struct rte_eth_dev *dev)
513 virtio_dev_start(struct rte_eth_dev *dev)
516 struct virtio_hw *hw =
517 VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
519 /* Tell the host we've noticed this device. */
520 vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_ACK);
522 /* Tell the host we've known how to drive the device. */
523 vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);
525 hw->adapter_stopped = 0;
527 /* Do final configuration before rx/tx engine starts */
528 virtio_dev_rxtx_start(dev);
530 /* Check VIRTIO_NET_F_STATUS for link status*/
531 if(vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {
533 vtpci_read_dev_config(hw,
534 offsetof(struct virtio_net_config, status),
535 &status, sizeof(status));
536 if((status & VIRTIO_NET_S_LINK_UP) == 0) {
537 PMD_INIT_LOG(ERR, "Port: %d Link is DOWN\n", dev->data->port_id);
540 PMD_INIT_LOG(DEBUG, "Port: %d Link is UP\n", dev->data->port_id);
543 vtpci_reinit_complete(hw);
546 *Otherwise the tap backend might already stop its queue due to fullness.
547 *vhost backend will have no chance to be waked up
549 virtqueue_notify(dev->data->rx_queues[0]);
550 PMD_INIT_LOG(DEBUG, "Notified backend at initialization\n");
554 static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)
556 struct rte_mbuf * buf;
558 PMD_INIT_LOG(DEBUG, "Before freeing rxq used and unused buf \n");
559 VIRTQUEUE_DUMP((struct virtqueue *)dev->data->rx_queues[0]);
560 while( (buf =(struct rte_mbuf *)virtqueue_detatch_unused(dev->data->rx_queues[0])) != NULL) {
561 rte_pktmbuf_free_seg(buf);
564 PMD_INIT_LOG(DEBUG, "free %d mbufs\n", i);
565 PMD_INIT_LOG(DEBUG, "After freeing rxq used and unused buf\n");
566 VIRTQUEUE_DUMP((struct virtqueue *)dev->data->rx_queues[0]);
567 PMD_INIT_LOG(DEBUG, "Before freeing txq used and unused bufs\n");
568 VIRTQUEUE_DUMP((struct virtqueue *)dev->data->tx_queues[0]);
570 while( (buf = (struct rte_mbuf *)virtqueue_detatch_unused(dev->data->tx_queues[0])) != NULL) {
571 rte_pktmbuf_free_seg(buf);
574 PMD_INIT_LOG(DEBUG, "free %d mbufs\n", i);
575 PMD_INIT_LOG(DEBUG, "After freeing txq used and unused buf\n");
576 VIRTQUEUE_DUMP((struct virtqueue *)dev->data->tx_queues[0]);
580 * Stop device: disable rx and tx functions to allow for reconfiguring.
583 virtio_dev_stop(struct rte_eth_dev *dev)
585 struct virtio_hw *hw =
586 VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
590 virtio_dev_free_mbufs(dev);
594 virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)
596 struct rte_eth_link link, old;
598 struct virtio_hw *hw =
599 VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
600 memset(&link, 0, sizeof(link));
601 virtio_dev_atomic_read_link_status(dev, &link);
603 link.link_duplex = FULL_DUPLEX ;
604 link.link_speed = SPEED_10G ;
605 if(vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {
606 PMD_INIT_LOG(DEBUG, "Get link status from hw\n");
607 vtpci_read_dev_config(hw,
608 offsetof(struct virtio_net_config, status),
609 &status, sizeof(status));
610 if((status & VIRTIO_NET_S_LINK_UP) == 0) {
611 link.link_status = 0;
612 PMD_INIT_LOG(DEBUG, "Port %d is down\n",dev->data->port_id);
614 link.link_status = 1;
615 PMD_INIT_LOG(DEBUG, "Port %d is up\n",dev->data->port_id);
618 link.link_status = 1; //Link up
620 virtio_dev_atomic_write_link_status(dev, &link);
621 if(old.link_status == link.link_status)
628 virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
630 struct virtio_hw *hw = VIRTIO_DEV_PRIVATE_TO_HW(dev->data->dev_private);
631 dev_info->driver_name = dev->driver->pci_drv.name;
632 dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues;
633 dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues;
634 dev_info->min_rx_bufsize = VIRTIO_MIN_RX_BUFSIZE;
635 dev_info->max_rx_pktlen = VIRTIO_MAX_RX_PKTLEN;
636 dev_info->max_mac_addrs = VIRTIO_MAX_MAC_ADDRS;