[ovs-dev] [PATCH 1/4] ofpbuf: simplify ofpbuf_l4_size()

Jarno Rajahalme jrajahalme at nicira.com
Tue Mar 3 18:33:43 UTC 2015


> On Mar 3, 2015, at 8:29 AM, Ben Pfaff <blp at nicira.com> wrote:
> 
> On Mon, Mar 02, 2015 at 10:51:27AM -0800, Pravin B Shelar wrote:
>> Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
>> ---
>> lib/ofpbuf.h |    5 +----
>> 1 files changed, 1 insertions(+), 4 deletions(-)
>> 
>> diff --git a/lib/ofpbuf.h b/lib/ofpbuf.h
>> index 4e7038d..82588e3 100644
>> --- a/lib/ofpbuf.h
>> +++ b/lib/ofpbuf.h
>> @@ -336,10 +336,7 @@ static inline void ofpbuf_set_l4(struct ofpbuf *b, void *l4)
>> 
>> static inline size_t ofpbuf_l4_size(const struct ofpbuf *b)
>> {
>> -    return b->l4_ofs != UINT16_MAX
>> -        ? (const char *)ofpbuf_tail(b) - (const char *)ofpbuf_l4(b)
>> -        - ofpbuf_l2_pad_size(b)
>> -        : 0;
>> +    return b->l4_ofs != UINT16_MAX ? ofpbuf_size(b) - b->l4_ofs : 0;
>> }
> 
> I think that this change makes the new assumption that b->frame ==
> b->data.  I have a hard time deciding whether that's important.

A lot of our packet handling code already makes that assumption. Maybe we should document this?

  Jarno

> Assuming you've thought about it and it's OK,
> Acked-by: Ben Pfaff <blp at nicira.com <mailto:blp at nicira.com>>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org <mailto:dev at openvswitch.org>
> http://openvswitch.org/mailman/listinfo/dev <http://openvswitch.org/mailman/listinfo/dev>



More information about the dev mailing list