net/ngbe: support MAC filters
[dpdk.git] / drivers / net / virtio / virtqueue.c
index 408bba2..65bf792 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "virtqueue.h"
 #include "virtio_logs.h"
-#include "virtio_pci.h"
+#include "virtio.h"
 #include "virtio_rxtx_simple.h"
 
 /*
@@ -32,7 +32,7 @@ virtqueue_detach_unused(struct virtqueue *vq)
        end = (vq->vq_avail_idx + vq->vq_free_cnt) & (vq->vq_nentries - 1);
 
        for (idx = 0; idx < vq->vq_nentries; idx++) {
-               if (hw->use_vec_rx && !vtpci_packed_queue(hw) &&
+               if (hw->use_vec_rx && !virtio_with_packed_queue(hw) &&
                    type == VTNET_RQ) {
                        if (start <= end && idx >= start && idx < end)
                                continue;
@@ -137,7 +137,7 @@ virtqueue_rxvq_flush(struct virtqueue *vq)
 {
        struct virtio_hw *hw = vq->hw;
 
-       if (vtpci_packed_queue(hw))
+       if (virtio_with_packed_queue(hw))
                virtqueue_rxvq_flush_packed(vq);
        else
                virtqueue_rxvq_flush_split(vq);
@@ -175,6 +175,7 @@ virtqueue_rxvq_reset_packed(struct virtqueue *vq)
 
        vring_desc_init_packed(vq, size);
 
+       virtqueue_disable_intr(vq);
        return 0;
 }
 
@@ -185,6 +186,8 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq)
        struct vq_desc_extra *dxp;
        struct virtnet_tx *txvq;
        uint16_t desc_idx;
+       struct virtio_tx_region *txr;
+       struct vring_packed_desc *start_dp;
 
        vq->vq_used_cons_idx = 0;
        vq->vq_desc_head_idx = 0;
@@ -197,6 +200,7 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq)
        vq->vq_packed.event_flags_shadow = 0;
 
        txvq = &vq->txq;
+       txr = txvq->virtio_net_hdr_mz->addr;
        memset(txvq->mz->addr, 0, txvq->mz->len);
        memset(txvq->virtio_net_hdr_mz->addr, 0,
                txvq->virtio_net_hdr_mz->len);
@@ -207,9 +211,21 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq)
                        rte_pktmbuf_free(dxp->cookie);
                        dxp->cookie = NULL;
                }
+
+               if (virtio_with_feature(vq->hw, VIRTIO_RING_F_INDIRECT_DESC)) {
+                       /* first indirect descriptor is always the tx header */
+                       start_dp = txr[desc_idx].tx_packed_indir;
+                       vring_desc_init_indirect_packed(start_dp,
+                                                       RTE_DIM(txr[desc_idx].tx_packed_indir));
+                       start_dp->addr = txvq->virtio_net_hdr_mem
+                                        + desc_idx * sizeof(*txr)
+                                        + offsetof(struct virtio_tx_region, tx_hdr);
+                       start_dp->len = vq->hw->vtnet_hdr_size;
+               }
        }
 
        vring_desc_init_packed(vq, size);
 
+       virtqueue_disable_intr(vq);
        return 0;
 }