[ovs-dev] [PATCH v4 2/6] dpif-netdev: Add rxq processing cycle counters.
Greg Rose
gvrose8192 at gmail.com
Thu Aug 10 22:55:15 UTC 2017
On 08/09/2017 08:45 AM, Kevin Traynor wrote:
> Add two counters to dp_netdev_rxq which will be used for storing the
> processing cycles of an rxq. Processing cycles will be stored in reference
> to a defined interval. One counter is used for storing cycles during the
> current in progress interval, while the other is used to store the cycles
> of the last fully complete interval.
>
> cycles_count_intermediate was used to count cycles for a pmd. With some small
> additions we can also use it to count the cycles used for processing an rxq.
>
> Signed-off-by: Kevin Traynor <ktraynor at redhat.com>
> ---
> lib/dpif-netdev.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index f35c079..41f16b2 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -340,4 +340,11 @@ enum pmd_cycles_counter_type {
> };
>
> +enum rxq_cycles_counter_type {
> + RXQ_CYCLES_PROC_CURR, /* Cycles spent successfully polling and
> + processing polled packets */
> + RXQ_CYCLES_PROC_LAST,
> + RXQ_N_CYCLES
> +};
> +
> #define XPS_TIMEOUT_MS 500LL
>
> @@ -351,4 +358,5 @@ struct dp_netdev_rxq {
> particular core. */
> struct dp_netdev_pmd_thread *pmd; /* pmd thread that polls this queue. */
> + atomic_ullong cycles[RXQ_N_CYCLES];
> };
>
> @@ -677,5 +685,4 @@ 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
> dpif_netdev_xps_revalidate_pmd(const struct dp_netdev_pmd_thread *pmd,
> @@ -3092,4 +3099,5 @@ cycles_count_end(struct dp_netdev_pmd_thread *pmd,
> static inline void
> cycles_count_intermediate(struct dp_netdev_pmd_thread *pmd,
> + struct dp_netdev_rxq *rxq,
> enum pmd_cycles_counter_type type)
> OVS_NO_THREAD_SAFETY_ANALYSIS
> @@ -3100,4 +3108,8 @@ cycles_count_intermediate(struct dp_netdev_pmd_thread *pmd,
>
> non_atomic_ullong_add(&pmd->cycles.n[type], interval);
> + if (rxq && (type == PMD_CYCLES_PROCESSING)) {
> + /* Add to the amount of current processing cycles. */
> + non_atomic_ullong_add(&rxq->cycles[RXQ_CYCLES_PROC_CURR], interval);
> + }
> }
>
> @@ -3668,5 +3680,5 @@ dpif_netdev_run(struct dpif *dpif)
> port->rxqs[i].rx,
> port->port_no);
> - cycles_count_intermediate(non_pmd, process_packets ?
> + cycles_count_intermediate(non_pmd, NULL, process_packets ?
> PMD_CYCLES_PROCESSING
> : PMD_CYCLES_IDLE);
> @@ -3855,5 +3867,5 @@ reload:
> dp_netdev_process_rxq_port(pmd, poll_list[i].rxq->rx,
> poll_list[i].port_no);
> - cycles_count_intermediate(pmd,
> + cycles_count_intermediate(pmd, NULL,
> process_packets ? PMD_CYCLES_PROCESSING
> : PMD_CYCLES_IDLE);
>
Tested-by: Greg Rose <gvrose8192 at gmail.com>
Reviewed-by: Greg Rose <gvrose8192 at gmail.com>
More information about the dev
mailing list