[ovs-dev] [PATCH v2 03/15] flow: Introduce parse_dl_type().
Joe Stringer
joe at ovn.org
Tue Apr 19 20:10:52 UTC 2016
On 15 April 2016 at 17:02, Daniele Di Proietto <diproiettod at vmware.com> wrote:
> The function simply returns the ethernet type of the packet (after
> eventually discarding the VLAN tag). It will be used by a following
> commit.
>
> Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
> ---
> lib/flow.c | 14 ++++++++++++--
> lib/flow.h | 1 +
> 2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/lib/flow.c b/lib/flow.c
> index 972a996..0250a7c 100644
> --- a/lib/flow.c
> +++ b/lib/flow.c
> @@ -327,7 +327,7 @@ parse_mpls(const void **datap, size_t *sizep)
> return MIN(count, FLOW_MAX_MPLS_LABELS);
> }
>
> -static inline ovs_be16
> +static inline ALWAYS_INLINE ovs_be16
Usually we try to avoid telling the compiler how to optimise things
like inlining - is there a reasoning around these changes?
On 15 April 2016 at 17:02, Daniele Di Proietto <diproiettod at vmware.com> wrote:
> The function simply returns the ethernet type of the packet (after
> eventually discarding the VLAN tag). It will be used by a following
> commit.
>
> Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
> ---
> lib/flow.c | 14 ++++++++++++--
> lib/flow.h | 1 +
> 2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/lib/flow.c b/lib/flow.c
> index 972a996..0250a7c 100644
> --- a/lib/flow.c
> +++ b/lib/flow.c
> @@ -327,7 +327,7 @@ parse_mpls(const void **datap, size_t *sizep)
> return MIN(count, FLOW_MAX_MPLS_LABELS);
> }
>
> -static inline ovs_be16
> +static inline ALWAYS_INLINE ovs_be16
> parse_vlan(const void **datap, size_t *sizep)
> {
> const struct eth_header *eth = *datap;
> @@ -349,7 +349,7 @@ parse_vlan(const void **datap, size_t *sizep)
> return 0;
> }
>
> -static inline ovs_be16
> +static inline ALWAYS_INLINE ovs_be16
> parse_ethertype(const void **datap, size_t *sizep)
> {
> const struct llc_snap_header *llc;
> @@ -826,6 +826,16 @@ miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
> dst->map = mf.map;
> }
>
> +ovs_be16
> +parse_dl_type(const struct eth_header *data_, size_t size)
> +{
> + const void *data = data_;
> +
> + parse_vlan(&data, &size);
> +
> + return parse_ethertype(&data, &size);
> +}
> +
> /* For every bit of a field that is wildcarded in 'wildcards', sets the
> * corresponding bit in 'flow' to zero. */
> void
> diff --git a/lib/flow.h b/lib/flow.h
> index 6771232..0406198 100644
> --- a/lib/flow.h
> +++ b/lib/flow.h
> @@ -107,6 +107,7 @@ void flow_compose(struct dp_packet *, const struct flow *);
>
> bool parse_ipv6_ext_hdrs(const void **datap, size_t *sizep, uint8_t *nw_proto,
> uint8_t *nw_frag);
> +ovs_be16 parse_dl_type(const struct eth_header *data_, size_t size);
>
> static inline uint64_t
> flow_get_xreg(const struct flow *flow, int idx)
> --
> 2.1.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list