Add two counters to dp_netdev_rxq which will be used for storing the processing cycles of the rxq. Processing cycles will stored in reference to a defined interval. One counter is used to count cycles during the current in progress interval, while the other is used to store the cycles of the last complete interval.
Signed-off-by: Kevin Traynor <ktray...@redhat.com> --- lib/dpif-netdev.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 7352d6f..d2a02af 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -343,4 +343,6 @@ struct dp_netdev_rxq { particular core. */ struct dp_netdev_pmd_thread *pmd; /* pmd thread that will poll this queue. */ + atomic_ullong cyc_curr; /* Current pmd interval proc cycles. */ + atomic_ullong cyc_last; /* Last pmd interval proc cycles. */ }; @@ -665,4 +667,14 @@ static void pmd_load_cached_ports(struct dp_netdev_pmd_thread *pmd) static inline void dp_netdev_pmd_try_optimize(struct dp_netdev_pmd_thread *pmd); +static void +dp_netdev_rxq_set_cyc_curr(struct dp_netdev_rxq *rx, + unsigned long long cycles); +static uint64_t +dp_netdev_rxq_get_cyc_curr(const struct dp_netdev_rxq *rx); +static void +dp_netdev_rxq_set_cyc_last(struct dp_netdev_rxq *rx, + unsigned long long cycles); +static uint64_t +dp_netdev_rxq_get_cyc_last(const struct dp_netdev_rxq *rx); static void @@ -3046,4 +3058,35 @@ cycles_count_intermediate(struct dp_netdev_pmd_thread *pmd, } +static void +dp_netdev_rxq_set_cyc_curr(struct dp_netdev_rxq *rx, + unsigned long long cycles) +{ + atomic_store_relaxed(&rx->cyc_curr, cycles); +} + +static uint64_t +dp_netdev_rxq_get_cyc_curr(const struct dp_netdev_rxq *rx) +{ + unsigned long long tmp; + atomic_read_relaxed(&rx->cyc_curr, &tmp); + return tmp; +} + +static void +dp_netdev_rxq_set_cyc_last(struct dp_netdev_rxq *rx, + unsigned long long cycles) +{ + atomic_store_relaxed(&rx->cyc_last, cycles); +} + +static uint64_t +dp_netdev_rxq_get_cyc_last(const struct dp_netdev_rxq *rx) +{ + unsigned long long tmp; + atomic_read_relaxed(&rx->cyc_last, &tmp); + return tmp; +} + + static int dp_netdev_process_rxq_port(struct dp_netdev_pmd_thread *pmd, -- 1.8.3.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev