/*
* The set of PCI devices this driver supports
*/
-static struct rte_pci_id pci_id_virtio_map[] = {
+static const struct rte_pci_id pci_id_virtio_map[] = {
#define RTE_PCI_DEV_ID_DECL_VIRTIO(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
#include "rte_pci_dev_ids.h"
vq->vq_ring_mem = mz->phys_addr;
vq->vq_ring_virt_mem = mz->addr;
PMD_INIT_LOG(DEBUG, "vq->vq_ring_mem: 0x%"PRIx64, (uint64_t)mz->phys_addr);
- PMD_INIT_LOG(DEBUG, "vq->vq_ring_virt_mem: 0x%"PRIx64, (uint64_t)mz->addr);
+ PMD_INIT_LOG(DEBUG, "vq->vq_ring_virt_mem: 0x%"PRIx64, (uint64_t)(uintptr_t)mz->addr);
vq->virtio_net_hdr_mz = NULL;
vq->virtio_net_hdr_mem = 0;
/*
* dev_ops for virtio, bare necessities for basic operation
*/
-static struct eth_dev_ops virtio_eth_dev_ops = {
+static const struct eth_dev_ops virtio_eth_dev_ops = {
.dev_configure = virtio_dev_configure,
.dev_start = virtio_dev_start,
.dev_stop = virtio_dev_stop,
}
+static void
+rx_func_get(struct rte_eth_dev *eth_dev)
+{
+ struct virtio_hw *hw = eth_dev->data->dev_private;
+ if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF))
+ eth_dev->rx_pkt_burst = &virtio_recv_mergeable_pkts;
+ else
+ eth_dev->rx_pkt_burst = &virtio_recv_pkts;
+}
+
/*
* This function is based on probe() function in virtio_pci.c
* It returns 0 on success.
eth_dev->dev_ops = &virtio_eth_dev_ops;
eth_dev->tx_pkt_burst = &virtio_xmit_pkts;
- if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+ rx_func_get(eth_dev);
return 0;
+ }
/* Allocate memory for storing MAC addresses */
eth_dev->data->mac_addrs = rte_zmalloc("virtio", ETHER_ADDR_LEN, 0);
vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER);
virtio_negotiate_features(hw);
+ rx_func_get(eth_dev);
+
/* Setting up rx_header size for the device */
- if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {
- eth_dev->rx_pkt_burst = &virtio_recv_mergeable_pkts;
+ if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF))
hw->vtnet_hdr_size = sizeof(struct virtio_net_hdr_mrg_rxbuf);
- } else {
- eth_dev->rx_pkt_burst = &virtio_recv_pkts;
+ else
hw->vtnet_hdr_size = sizeof(struct virtio_net_hdr);
- }
/* Copy the permanent MAC address to: virtio_hw */
virtio_get_hwaddr(hw);