[ovs-dev] [PATCH] ofpbuf: Abstract 'l2' pointer and document usage conventions.

Florin Coras fcoras at ac.upc.edu
Fri Apr 4 12:12:30 UTC 2014


Is there any particular reason why 'base' cannot be used as reference 
for computing offsets, instead of 'frame'?

Thanks,
Florin

On 04/02/2014 07:59 PM, Jarno Rajahalme wrote:
>   struct ofpbuf {
>       void *base;                 /* First byte of allocated space. */
>       uint32_t allocated;         /* Number of bytes allocated. */
>       uint32_t size;              /* Number of bytes in use. */
>       void *data;                 /* First byte actually in use. */
>   
> -    void *l2;                   /* Link-level header. */
> -    uint16_t l2_5_ofs;          /* MPLS label stack offset from l2, or
> +    void *frame;                /* Packet frame start, or NULL. */
> +    uint16_t l2_5_ofs;          /* MPLS label stack offset from 'packet', or
>                                    * UINT16_MAX */
> -    uint16_t l3_ofs;            /* Network-level header offset from l2, or
> -                                 * UINT16_MAX. */
> -    uint16_t l4_ofs;            /* Transport-level header offset from l2, or
> -                                   UINT16_MAX. */
> +    uint16_t l3_ofs;            /* Network-level header offset from 'packet',
> +                                   or UINT16_MAX. */
> +    uint16_t l4_ofs;            /* Transport-level header offset from 'packet',
> +                                   or UINT16_MAX. */
>       enum ofpbuf_source source;  /* Source of memory allocated as 'base'. */
>       struct list list_node;      /* Private list element for use by owner. */
>   };




More information about the dev mailing list