I applied the patch to dpdk_merge here

https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_darball_ovs_commits_dpdk-5Fmerge&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=A2_FCacqbp2moAo3HGFlTuxsjONUGhlN42OBcAuQQ6w&s=b6btPKhgvOFr2GOUYvktND6kaC6jc3fXI-mXfvNgXOU&e=


On 9/1/17, 8:20 AM, "[email protected] on behalf of Ferriter, 
Cian" <[email protected] on behalf of [email protected]> 
wrote:

    Hi,
    
    > -----Original Message-----
    > From: [email protected] [mailto:ovs-dev-
    > [email protected]] On Behalf Of Darrell Ball
    > Sent: 21 August 2017 19:52
    > To: [email protected]; [email protected]
    > Cc: Ilya Maximets <[email protected]>
    > Subject: [ovs-dev] [patch_v5 1/3] dpif-netdev: Fix per packet cycles 
statistics.
    > 
    > From: Ilya Maximets <[email protected]>
    > 
    > DP_STAT_LOOKUP_HIT statistics used mistakenly for calculation of total
    > number of packets. This leads to completely wrong per packet cycles
    > statistics.
    > 
    > For example:
    > 
    >   emc hits:0
    >   megaflow hits:253702308
    >   avg. subtable lookups per hit:1.50
    >   miss:0
    >   lost:0
    >   avg cycles per packet: 248.32 (157498766585/634255770)
    > 
    >   In this case 634255770 total_packets value used for avg
    >   per packet calculation:
    > 
    >     total_packets = 'megaflow hits' + 'megaflow hits' * 1.5
    > 
    >   The real value should be 524.38 (157498766585/253702308)
    > 
    > Fix that by summing only stats that reflect match/not match.
    > It's decided to make direct summing of required values instead of 
disabling
    > some stats in a loop to make calculations more clear and avoid similar 
issues
    > in the future.
    > 
    > CC: Jan Scheurich <[email protected]>
    > Fixes: 3453b4d62a98 ("dpif-netdev: dpcls per in_port with sorted 
subtables")
    > Signed-off-by: Ilya Maximets <[email protected]>
    > Acked-by: Jan Scheurich <[email protected]>
    > ---
    >  lib/dpif-netdev.c | 11 +++++------
    >  1 file changed, 5 insertions(+), 6 deletions(-)
    > 
    > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index e2cd931..17e1666
    > 100644
    > --- a/lib/dpif-netdev.c
    > +++ b/lib/dpif-netdev.c
    > @@ -755,7 +755,7 @@ pmd_info_show_stats(struct ds *reply,
    >                      unsigned long long stats[DP_N_STATS],
    >                      uint64_t cycles[PMD_N_CYCLES])  {
    > -    unsigned long long total_packets = 0;
    > +    unsigned long long total_packets;
    >      uint64_t total_cycles = 0;
    >      int i;
    > 
    > @@ -771,13 +771,12 @@ pmd_info_show_stats(struct ds *reply,
    >          } else {
    >              stats[i] = 0;
    >          }
    > -
    > -        if (i != DP_STAT_LOST) {
    > -            /* Lost packets are already included in DP_STAT_MISS */
    > -            total_packets += stats[i];
    > -        }
    >      }
    > 
    > +    /* Sum of all the matched and not matched packets gives the total.  
*/
    > +    total_packets = stats[DP_STAT_EXACT_HIT] +
    > stats[DP_STAT_MASKED_HIT]
    > +                    + stats[DP_STAT_MISS];
    > +
    >      for (i = 0; i < PMD_N_CYCLES; i++) {
    >          if (cycles[i] > pmd->cycles_zero[i]) {
    >             cycles[i] -= pmd->cycles_zero[i];
    > --
    
    This fixes the problem for me.
    Sending 10000 streams of ETH/IP/UDP traffic to generate both both EMC and 
megaflow hits, I get the following:
    Before Patch Stats:
    pmd thread numa_id 0 core_id 3:
        emc hits:25411897
        megaflow hits:37275141
        avg. subtable lookups per hit:1.00
        miss:4
        lost:0
        idle cycles:303076208372 (92.96%)
        processing cycles:22948778628 (7.04%)
        avg cycles per packet: 3261.48 (326024987000/99962183)
        avg processing cycles per packet: 229.57 (22948778628/99962183)
    
    
    After Patch Stats:
    pmd thread numa_id 0 core_id 3:
        emc hits:25609385
        megaflow hits:37618561
        avg. subtable lookups per hit:1.00
        miss:4
        lost:0
        idle cycles:289432963945 (92.65%)
        processing cycles:22948750732 (7.35%)
        avg cycles per packet: 4940.56 (312381714677/63227950)
        avg processing cycles per packet: 362.95 (22948750732/63227950)
    
    After applying the patch, I get more sensible total_packet values as 
described by Ilya.
    
    Acked-by: Cian Ferriter <[email protected]>
    Tested-by: Cian Ferriter <[email protected]>
    
    
    _______________________________________________
    dev mailing list
    [email protected]
    
https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=QZSKV4VIQ4zgTI2deLBM5Bjxy-6thFsCoONvAFKLKDE&s=fmEjbhhKKaMCJvmKcuJNEoVZ4ZjhIi4BSpjDcxhXnSY&e=
 
    



_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to