>
> It's a bug in your patch #1.
> Previously 'n_hit' was calculated as sum of 2 counters.
I see. Must have screwed this up a long time ago.... Completely forgot about
this change.
> kernel datapath treats 'n_hit' as a total number of hits and 'n_mask_hit' as
> a number
> of masked hits from 'n_hit'. See datapath/datapath.c: ovs_dp_process_packet().
Not sure. Have a look at this:
static struct sw_flow *masked_flow_lookup(struct table_instance *ti,
const struct sw_flow_key *unmasked,
const struct sw_flow_mask *mask,
u32 *n_mask_hit)
{
struct sw_flow *flow;
struct hlist_head *head;
u32 hash;
struct sw_flow_key masked_key;
ovs_flow_mask_key(&masked_key, unmasked, false, mask);
hash = flow_hash(&masked_key, &mask->range);
head = find_bucket(ti, hash);
(*n_mask_hit)++;
hlist_for_each_entry_rcu(flow, head, flow_table.node[ti->node_ver]) {
if (flow->mask == mask && flow->flow_table.hash == hash &&
flow_cmp_masked_key(flow, &masked_key, &mask->range))
return flow;
}
return NULL;
}
The n_mask_hit is incremented for every mask (subtable) lookup, no matter if
hit or not.
So it really corresponds to our MASKED _LOOKUP counter. Also in line with the
specification in dpif.h:
/* Statistics for a dpif as a whole. */
struct dpif_dp_stats {
uint64_t n_hit; /* Number of flow table matches. */
uint64_t n_missed; /* Number of flow table misses. */
uint64_t n_lost; /* Number of misses not sent to userspace. */
uint64_t n_flows; /* Number of flows present. */
uint64_t n_mask_hit; /* Number of mega flow masks visited for
flow table matches. */
uint32_t n_masks; /* Number of mega flow masks. */
};
>
> dpctl utility calculates average number of masked hits per packet as
> 'stats.n_mask_hit / (stats.n_hit + stats.n_missed)' and only if
> "stats.n_masks != UINT32_MAX".
> So, (stats.n_hit + stats.n_missed) is the total numer of packets.
>
> See lib/dpctl.c: show_dpif() for details.
Given the above definition of n_mask_hit, what they print in show_dpif() is the
average number of mask/subtable lookups per datapath pass (not per Megaflow hit
as we do in pmd-stats-show). If the number of EMC hits or misses is large this
will not provide the same information.
/Jan
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev