net/virtio: fix log levels in configure
[dpdk.git] / drivers / net / virtio / virtio_ethdev.c
index 37512e6..f0dec7f 100644 (file)
@@ -424,7 +424,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)
                }
        }
 
-       memset(mz->addr, 0, sizeof(mz->len));
+       memset(mz->addr, 0, mz->len);
 
        vq->vq_ring_mem = mz->phys_addr;
        vq->vq_ring_virt_mem = mz->addr;
@@ -1229,7 +1229,8 @@ virtio_interrupt_handler(void *param)
        if (isr & VIRTIO_PCI_ISR_CONFIG) {
                if (virtio_dev_link_update(dev, 0) == 0)
                        _rte_eth_dev_callback_process(dev,
-                                                     RTE_ETH_EVENT_INTR_LSC, NULL);
+                                                     RTE_ETH_EVENT_INTR_LSC,
+                                                     NULL, NULL);
        }
 
 }
@@ -1355,7 +1356,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
                return -1;
 
        if (!hw->virtio_user_dev) {
-               pci_dev = RTE_DEV_TO_PCI(eth_dev->device);
+               pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
                rte_eth_copy_pci_info(eth_dev, pci_dev);
        }
 
@@ -1537,8 +1538,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 
        if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
                if (!hw->virtio_user_dev) {
-                       ret = virtio_remap_pci(RTE_DEV_TO_PCI(eth_dev->device),
-                                              hw);
+                       ret = virtio_remap_pci(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
                        if (ret)
                                return ret;
                }
@@ -1567,7 +1567,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
         * virtio_user_eth_dev_alloc() before eth_virtio_dev_init() is called.
         */
        if (!hw->virtio_user_dev) {
-               ret = vtpci_init(RTE_DEV_TO_PCI(eth_dev->device), hw);
+               ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
                if (ret)
                        return ret;
        }
@@ -1609,7 +1609,7 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
                                                virtio_interrupt_handler,
                                                eth_dev);
        if (eth_dev->device)
-               rte_pci_unmap_device(RTE_DEV_TO_PCI(eth_dev->device));
+               rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev));
 
        PMD_INIT_LOG(DEBUG, "dev_uninit completed");
 
@@ -1664,8 +1664,20 @@ virtio_dev_configure(struct rte_eth_dev *dev)
 
        PMD_INIT_LOG(DEBUG, "configure");
        req_features = VIRTIO_PMD_DEFAULT_GUEST_FEATURES;
+
+       if (dev->data->dev_conf.intr_conf.rxq) {
+               ret = virtio_init_device(dev, hw->req_guest_features);
+               if (ret < 0)
+                       return ret;
+       }
+
+       /* The name hw_ip_checksum is a bit confusing since it can be
+        * set by the application to request L3 and/or L4 checksums. In
+        * case of virtio, only L4 checksum is supported.
+        */
        if (rxmode->hw_ip_checksum)
                req_features |= (1ULL << VIRTIO_NET_F_GUEST_CSUM);
+
        if (rxmode->enable_lro)
                req_features |=
                        (1ULL << VIRTIO_NET_F_GUEST_TSO4) |
@@ -1680,16 +1692,16 @@ virtio_dev_configure(struct rte_eth_dev *dev)
 
        if (rxmode->hw_ip_checksum &&
                !vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_CSUM)) {
-               PMD_DRV_LOG(NOTICE,
-                       "rx ip checksum not available on this host");
+               PMD_DRV_LOG(ERR,
+                       "rx checksum not available on this host");
                return -ENOTSUP;
        }
 
        if (rxmode->enable_lro &&
                (!vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4) ||
                        !vtpci_with_feature(hw, VIRTIO_NET_F_GUEST_TSO4))) {
-               PMD_DRV_LOG(NOTICE,
-                       "lro not available on this host");
+               PMD_DRV_LOG(ERR,
+                       "Large Receive Offload not available on this host");
                return -ENOTSUP;
        }
 
@@ -1701,7 +1713,7 @@ virtio_dev_configure(struct rte_eth_dev *dev)
 
        if (rxmode->hw_vlan_filter
            && !vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN)) {
-               PMD_DRV_LOG(NOTICE,
+               PMD_DRV_LOG(ERR,
                            "vlan filtering not available on this host");
                return -ENOTSUP;
        }
@@ -1765,6 +1777,11 @@ virtio_dev_start(struct rte_eth_dev *dev)
                virtqueue_notify(rxvq->vq);
        }
 
+       for (i = 0; i < dev->data->nb_tx_queues; i++) {
+               txvq = dev->data->tx_queues[i];
+               virtqueue_notify(txvq->vq);
+       }
+
        PMD_INIT_LOG(DEBUG, "Notified backend at initialization");
 
        for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -1894,7 +1911,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
        dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */
 
-       dev_info->pci_dev = dev->device ? RTE_DEV_TO_PCI(dev->device) : NULL;
+       dev_info->pci_dev = dev->device ? RTE_ETH_DEV_TO_PCI(dev) : NULL;
        dev_info->max_rx_queues =
                RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES);
        dev_info->max_tx_queues =