On 07/22/2017 03:51 PM, Stokes, Ian 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 <ktray...@redhat.com>
> 
> Think I flagged this before but OVS doesn't compile cleanly after applying 
> this patch.
> 
> lib/dpif-netdev.c:3117:1: error: 'dp_netdev_rxq_get_cycles' defined but not 
> used [-Werror=unused-function]
>  dp_netdev_rxq_get_cycles(struct dp_netdev_rxq *rx,
>  ^~~~~~~~~~~~~~~~~~~~~~~~
> lib/dpif-netdev.c:3109:1: error: 'dp_netdev_rxq_set_cycles' defined but not 
> used [-Werror=unused-function]
>  dp_netdev_rxq_set_cycles(struct dp_netdev_rxq *rx,
> 
> Consider rolling it into patch 4 of the series to avoid the issue.

Hmm, I thought I had fixed this but obviously not :(

As you suggested, I moved them to the next patch where they are first used.

>> ---
>>  lib/dpif-netdev.c | 42 +++++++++++++++++++++++++++++++++++++++---
>>  1 file changed, 39 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 0b8a0c8..273db38
>> 100644
>> --- a/lib/dpif-netdev.c
>> +++ b/lib/dpif-netdev.c
>> @@ -336,4 +336,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
>>
>> @@ -347,4 +354,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];     /* Processing cycles. */
>>  };
> Very minor nit but not crazy about the alignment of the comments within the 
> struct above.
> 

I just deleted the comment as it's not really necessary and it won't
line up with the rest correctly.

>>
>> @@ -671,5 +679,11 @@ 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_cycles(struct dp_netdev_rxq *rx,
>> +                         enum rxq_cycles_counter_type type,
>> +                         unsigned long long cycles); static uint64_t
>> +dp_netdev_rxq_get_cycles(struct dp_netdev_rxq *rx,
>> +                         enum rxq_cycles_counter_type type);
>>  static void
>>  dpif_netdev_xps_revalidate_pmd(const struct dp_netdev_pmd_thread *pmd, @@
>> -3077,4 +3091,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
>> @@ -3085,4 +3100,25 @@ 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);
>> +    }
>> +}
>> +
>> +static void
>> +dp_netdev_rxq_set_cycles(struct dp_netdev_rxq *rx,
>> +                         enum rxq_cycles_counter_type type,
>> +                         unsigned long long cycles) {
>> +   atomic_store_relaxed(&rx->cycles[type], cycles); }
>> +
>> +static uint64_t
>> +dp_netdev_rxq_get_cycles(struct dp_netdev_rxq *rx,
>> +                         enum rxq_cycles_counter_type type) {
>> +    unsigned long long tmp;
>> +    atomic_read_relaxed(&rx->cycles[type], &tmp);
>> +    return tmp;
>>  }
>>
>> @@ -3589,5 +3625,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);
>> @@ -3753,5 +3789,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);
>> --
>> 1.8.3.1
> 

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to