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

Jarno Rajahalme jrajahalme at nicira.com
Fri Apr 4 21:47:57 UTC 2014


On Apr 4, 2014, at 5:12 AM, Florin Coras <fcoras at ac.upc.edu> wrote:

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

I haven’t looked into details yet, but it should work. One use of ofpbufs is for collecting actions while going through the flow pipeline, and in some corner cases we get more than 64k actions. We use the ‘frame’ to point to the individual actions when creating them, so it would need to be a 32-bit offset. However, we do not use the layer offset with actions, so those could remain as 16-bit offsets.

  Jarno

> 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. */
>>  };
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list