summaryrefslogtreecommitdiff
path: root/drivers/net/virtio/virtio_rxtx_simple.c
diff options
context:
space:
mode:
authorZhiyong Yang <zhiyong.yang@intel.com>2017-04-19 14:29:21 +0800
committerYuanhan Liu <yuanhan.liu@linux.intel.com>2017-04-19 10:49:06 +0200
commitb7be4f461ad426b343b105d13c5d89b629d24026 (patch)
tree8fd0ac80f68f7fa47eb91b344f403c92b5e0995a /drivers/net/virtio/virtio_rxtx_simple.c
parent260aae9ad9621e3e758f1443abb8fcbc25ece07c (diff)
downloaddpdk-next-eventdev-b7be4f461ad426b343b105d13c5d89b629d24026.zip
dpdk-next-eventdev-b7be4f461ad426b343b105d13c5d89b629d24026.tar.gz
dpdk-next-eventdev-b7be4f461ad426b343b105d13c5d89b629d24026.tar.xz
net/virtio: support to turn on/off traffic flow
Current virtio_dev_stop only disables interrupt and marks link down, When it is invoked, tx/rx traffic flows still work. This is a strange behavior. The patch supports the switch of flow. Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Diffstat (limited to 'drivers/net/virtio/virtio_rxtx_simple.c')
-rw-r--r--drivers/net/virtio/virtio_rxtx_simple.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/virtio/virtio_rxtx_simple.c b/drivers/net/virtio/virtio_rxtx_simple.c
index b651e53..542cf80 100644
--- a/drivers/net/virtio/virtio_rxtx_simple.c
+++ b/drivers/net/virtio/virtio_rxtx_simple.c
@@ -89,12 +89,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();