ethdev: remove detachable device flag
[dpdk.git] / drivers / net / virtio / virtio_ethdev.c
index 07eb723..d4354f9 100644 (file)
@@ -77,7 +77,7 @@ static int virtio_dev_link_update(struct rte_eth_dev *dev,
 static void virtio_set_hwaddr(struct virtio_hw *hw);
 static void virtio_get_hwaddr(struct virtio_hw *hw);
 
-static void virtio_dev_stats_get(struct rte_eth_dev *dev,
+static int virtio_dev_stats_get(struct rte_eth_dev *dev,
                                 struct rte_eth_stats *stats);
 static int virtio_dev_xstats_get(struct rte_eth_dev *dev,
                                 struct rte_eth_xstat *xstats, unsigned n);
@@ -163,7 +163,7 @@ virtio_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,
        uint32_t head, i;
        int k, sum = 0;
        virtio_net_ctrl_ack status = ~0;
-       struct virtio_pmd_ctrl result;
+       struct virtio_pmd_ctrl *result;
        struct virtqueue *vq;
 
        ctrl->status = status;
@@ -254,10 +254,9 @@ virtio_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,
        PMD_INIT_LOG(DEBUG, "vq->vq_free_cnt=%d\nvq->vq_desc_head_idx=%d",
                        vq->vq_free_cnt, vq->vq_desc_head_idx);
 
-       memcpy(&result, cvq->virtio_net_hdr_mz->addr,
-                       sizeof(struct virtio_pmd_ctrl));
+       result = cvq->virtio_net_hdr_mz->addr;
 
-       return result.status;
+       return result->status;
 }
 
 static int
@@ -965,10 +964,12 @@ virtio_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
        return count;
 }
 
-static void
+static int
 virtio_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
        virtio_update_stats(dev, stats);
+
+       return 0;
 }
 
 static void
@@ -1383,7 +1384,6 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
                rte_eth_copy_pci_info(eth_dev, pci_dev);
        }
 
-       eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
        /* If host does not support both status and MSI-X then disable LSC */
        if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS) && hw->use_msix)
                eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
@@ -1756,6 +1756,9 @@ virtio_dev_configure(struct rte_eth_dev *dev)
                hw->use_simple_tx = 0;
        }
 
+       if (rxmode->hw_ip_checksum)
+               hw->use_simple_rx = 0;
+
        return 0;
 }
 
@@ -1817,6 +1820,8 @@ virtio_dev_start(struct rte_eth_dev *dev)
 
        for (i = 0; i < dev->data->nb_rx_queues; i++) {
                rxvq = dev->data->rx_queues[i];
+               /* Flush the old packets */
+               virtqueue_flush(rxvq->vq);
                virtqueue_notify(rxvq->vq);
        }