[dpdk-dev,1/2] net/virtio: add data elements to turn on/off traffic flow

Message ID 1490960419-16779-2-git-send-email-zhiyong.yang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Yuanhan Liu
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Yang, Zhiyong March 31, 2017, 11:40 a.m. UTC
  Add "rte_atomic32_t started" to turn on/off the RX/TX flow from
per port perspective.

Add rte_atomic32_t allow_queuing to control traffic flow from
per Queue perspective.

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
 drivers/net/virtio/virtio_pci.h  | 1 +
 drivers/net/virtio/virtio_rxtx.h | 6 ++++++
 2 files changed, 7 insertions(+)
  

Patch

diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h
index 0362acd..952ad62 100644
--- a/drivers/net/virtio/virtio_pci.h
+++ b/drivers/net/virtio/virtio_pci.h
@@ -253,6 +253,7 @@  struct virtio_hw {
 	uint64_t    req_guest_features;
 	uint64_t    guest_features;
 	uint32_t    max_queue_pairs;
+	rte_atomic32_t started;
 	uint16_t	max_mtu;
 	uint16_t    vtnet_hdr_size;
 	uint8_t	    vlan_strip;
diff --git a/drivers/net/virtio/virtio_rxtx.h b/drivers/net/virtio/virtio_rxtx.h
index 28f82d6..03357ae 100644
--- a/drivers/net/virtio/virtio_rxtx.h
+++ b/drivers/net/virtio/virtio_rxtx.h
@@ -60,6 +60,9 @@  struct virtnet_rx {
 	struct virtnet_stats stats;
 
 	const struct rte_memzone *mz; /**< mem zone to populate RX ring. */
+
+	/* a flag indicates whether allow to receive pkts. */
+	rte_atomic32_t allow_queuing;
 };
 
 struct virtnet_tx {
@@ -75,6 +78,9 @@  struct virtnet_tx {
 	struct virtnet_stats stats;
 
 	const struct rte_memzone *mz;    /**< mem zone to populate TX ring. */
+
+	/* a flag indicates whether allow to transmit pkts. */
+	rte_atomic32_t allow_queuing;
 };
 
 struct virtnet_ctl {