net/vhost: move to vhost library statistics API
[dpdk.git] / app / test-pmd / noisy_vnf.c
index 382a4c2..a92e810 100644 (file)
@@ -231,7 +231,7 @@ noisy_fwd_end(portid_t pi)
        rte_free(noisy_cfg[pi]);
 }
 
-static void
+static int
 noisy_fwd_begin(portid_t pi)
 {
        struct noisy_config *n;
@@ -273,11 +273,26 @@ noisy_fwd_begin(portid_t pi)
                rte_exit(EXIT_FAILURE,
                         "--noisy-lkup-memory-size must be > 0\n");
        }
+
+       return 0;
+}
+
+static void
+stream_init_noisy_vnf(struct fwd_stream *fs)
+{
+       bool rx_stopped, tx_stopped;
+
+       rx_stopped = ports[fs->rx_port].rxq[fs->rx_queue].state ==
+                                               RTE_ETH_QUEUE_STATE_STOPPED;
+       tx_stopped = ports[fs->tx_port].txq[fs->tx_queue].state ==
+                                               RTE_ETH_QUEUE_STATE_STOPPED;
+       fs->disabled = rx_stopped || tx_stopped;
 }
 
 struct fwd_engine noisy_vnf_engine = {
        .fwd_mode_name  = "noisy",
        .port_fwd_begin = noisy_fwd_begin,
        .port_fwd_end   = noisy_fwd_end,
+       .stream_init    = stream_init_noisy_vnf,
        .packet_fwd     = pkt_burst_noisy_vnf,
 };