net/i40e: fix VF cannot forward packets issue
[dpdk.git] / drivers / net / virtio / virtio_rxtx_simple.c
index b651e53..b5bc1c4 100644 (file)
@@ -39,7 +39,6 @@
 
 #include <rte_cycles.h>
 #include <rte_memory.h>
-#include <rte_memzone.h>
 #include <rte_branch_prediction.h>
 #include <rte_mempool.h>
 #include <rte_malloc.h>
@@ -65,6 +64,8 @@ virtqueue_enqueue_recv_refill_simple(struct virtqueue *vq,
        struct vring_desc *start_dp;
        uint16_t desc_idx;
 
+       cookie->port = vq->rxq.port_id;
+
        desc_idx = vq->vq_avail_idx & (vq->vq_nentries - 1);
        dxp = &vq->vq_descx[desc_idx];
        dxp->cookie = (void *)cookie;
@@ -89,12 +90,17 @@ virtio_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts,
 {
        struct virtnet_tx *txvq = tx_queue;
        struct virtqueue *vq = txvq->vq;
+       struct virtio_hw *hw = vq->hw;
        uint16_t nb_used;
        uint16_t desc_idx;
        struct vring_desc *start_dp;
        uint16_t nb_tail, nb_commit;
        int i;
        uint16_t desc_idx_max = (vq->vq_nentries >> 1) - 1;
+       uint16_t nb_tx = 0;
+
+       if (unlikely(hw->started == 0))
+               return nb_tx;
 
        nb_used = VIRTQUEUE_NUSED(vq);
        rte_compiler_barrier();