X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_pmd_virtio%2Fvirtio_ethdev.c;h=e63dbfb9705b26da59d02155f1089991cfda5aba;hb=6065355a03fc743234d4c11fc8e17093bf072617;hp=346948f2b12a443c909a3e5f6c2f01bdf47fbae9;hpb=4ad7a16a13d96b52f42e7c47706e0cbe6e64bf6a;p=dpdk.git diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c index 346948f2b1..e63dbfb970 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.c +++ b/lib/librte_pmd_virtio/virtio_ethdev.c @@ -102,7 +102,7 @@ static int virtio_dev_queue_stats_mapping_set( /* * 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" @@ -499,7 +499,7 @@ virtio_dev_allmulticast_disable(struct rte_eth_dev *dev) /* * 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, @@ -1097,6 +1097,16 @@ virtio_interrupt_handler(__rte_unused struct rte_intr_handle *handle, } +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. @@ -1115,8 +1125,10 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) 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); @@ -1144,14 +1156,13 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) 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);