Hi Eelco ,
Thanks for Ack. Will also fix the minor changes in next patch š
<SNP>
> > + for (int i = MFEX_IMPL_START_IDX; i < MFEX_IMPL_MAX; i++) {
> > + VLOG_DBG("MFEX study results for implementation %s:"
> > + " (hits %d/%d pkts)",
> > + miniflow_funcs[i].name, stats->impl_hitcount[i],
> > + stats->pkt_count);
> > + }
>
> For all logs above āhits %d/%d pktsā should be āhits %u/%u pktsā
>
Sure.
> > + }
> > +
> > + /* Reset stats so that study function can be called again
> > + * for next traffic type and optimal function ptr can be
> > + * chosen.
> > + */
> > + memset(stats, 0, sizeof(struct study_stats));
> > + }
> > + return mask;
> > +}
> > diff --git a/lib/dpif-netdev-private-extract.c
> > b/lib/dpif-netdev-private-extract.c
> > index 19f350349..4ea111f94 100644
> > --- a/lib/dpif-netdev-private-extract.c
> > +++ b/lib/dpif-netdev-private-extract.c
> > @@ -47,6 +47,11 @@ static struct dpif_miniflow_extract_impl mfex_impls[] =
> {
> > .probe = NULL,
> > .extract_func = NULL,
> > .name = "scalar", },
> > +
> > + [MFEX_IMPL_STUDY] = {
> > + .probe = NULL,
> > + .extract_func = mfex_study_traffic,
> > + .name = "study", },
> > };
> >
> > BUILD_ASSERT_DECL(MFEX_IMPL_MAX == ARRAY_SIZE(mfex_impls)); @@ -
> 166,6
> > +171,12 @@ dp_mfex_impl_get_by_name(const char *name,
> miniflow_extract_func *out_func)
> > return -ENOENT;
> > }
> >
> > +void
> > +dpif_mfex_impl_info_get(struct dpif_miniflow_extract_impl **out_ptr)
> > +{
> > + *out_ptr = mfex_impls;
> > +}
>
> If we are only interested in getting a pointer, why not just return it:
>
> struct dpif_miniflow_extract_impl *dpif_mfex_impl_info_get(void) {
> return mfex_impls;
> }
>
True.
> > uint32_t
> > dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets,
> > struct netdev_flow_key *keys,
> > diff --git a/lib/dpif-netdev-private-extract.h
> > b/lib/dpif-netdev-private-extract.h
> > index de3270c88..32b7ccbb3 100644
> > --- a/lib/dpif-netdev-private-extract.h
> > +++ b/lib/dpif-netdev-private-extract.h
> > @@ -80,6 +80,7 @@ struct dpif_miniflow_extract_impl { enum
> > dpif_miniflow_extract_impl_idx {
> > MFEX_IMPL_AUTOVALIDATOR,
> > MFEX_IMPL_SCALAR,
> > + MFEX_IMPL_STUDY,
> > MFEX_IMPL_MAX
> > };
> >
> > @@ -89,6 +90,9 @@ enum dpif_miniflow_extract_impl_idx {
> >
> > #define MFEX_IMPL_START_IDX MFEX_IMPL_MAX
> >
> > +/* Max count of packets to be compared. */ #define
> MFEX_MAX_PKT_COUNT
> > +(128)
> > +
> > /* This function returns all available implementations to the caller. The
> > * quantity of implementations is returned by the int return value.
> > */
> > @@ -109,6 +113,13 @@ miniflow_extract_func
> > dp_mfex_impl_get_default(void);
> > /* Overrides the default MFEX with the user set MFEX. */ int
> > dp_mfex_impl_set_default_by_name(const char *name);
> >
> > +/* Retrieve the array of miniflow implementations for iteration.
> > + * On error, returns a negative number.
> > + * On success, returns the size of the arrays pointed to by the out
> > parameter.
> > + */
> > +void
> > +dpif_mfex_impl_info_get(struct dpif_miniflow_extract_impl **out_ptr);
> > +
> >
> > /* Initializes the available miniflow extract implementations by probing
> > for
> > * the CPU ISA requirements. As the runtime available CPU ISA does
> > not change @@ -130,4 +141,16 @@
> dpif_miniflow_extract_autovalidator(struct dp_packet_batch *batch,
> > uint32_t keys_size, odp_port_t in_port,
> > struct dp_netdev_pmd_thread
> > *pmd_handle);
> >
> > +/* Retrieve the number of packets by studying packets using different
> > +miniflow
> > + * implementations to choose the best implementation using the
> > +maximum hitmask
> > + * count.
> > + * On error, returns a zero for no packets.
> > + * On success, returns mask of the packets hit.
> > + */
> > +uint32_t
> > +mfex_study_traffic(struct dp_packet_batch *packets,
> > + struct netdev_flow_key *keys,
> > + uint32_t keys_size, odp_port_t in_port,
> > + struct dp_netdev_pmd_thread *pmd_handle);
> > +
> > #endif /* MFEX_AVX512_EXTRACT */
> > --
> > 2.25.1
Regards
Amber
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev