On Mar 31, 2014, at 9:43 PM, Pravin <pshe...@nicira.com> wrote: > From: Pravin Shelar <pshe...@nicira.com> > > Signed-off-by: Pravin B Shelar <pshe...@nicira.com> > --- > lib/ofpbuf.c | 27 ++++++++++++++++++++++----- > lib/ofpbuf.h | 2 ++ > 2 files changed, 24 insertions(+), 5 deletions(-) > > diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c > index 8763e49..f616b1c 100644 > --- a/lib/ofpbuf.c > +++ b/lib/ofpbuf.c > @@ -23,6 +23,16 @@ > #include "util.h" > > static void > +ofpbuf_init__(struct ofpbuf *b, size_t allocated, enum ofpbuf_source source) > +{ > + b->allocated = allocated; > + b->source = source; > + b->l2 = NULL; > + b->l2_5_ofs = b->l3_ofs = b->l4_ofs = UINT16_MAX; > + list_poison(&b->list_node); > +} > + > +static void > ofpbuf_use__(struct ofpbuf *b, void *base, size_t allocated, > enum ofpbuf_source source) > { > @@ -30,11 +40,7 @@ ofpbuf_use__(struct ofpbuf *b, void *base, size_t > allocated, > ofpbuf_set_data(b, base); > ofpbuf_set_size(b, 0); > > - b->allocated = allocated; > - b->source = source; > - b->l2 = NULL; > - b->l2_5_ofs = b->l3_ofs = b->l4_ofs = UINT16_MAX; > - list_poison(&b->list_node); > + ofpbuf_init__(b, allocated, source); > } > > /* Initializes 'b' as an empty ofpbuf that contains the 'allocated' bytes of > @@ -101,6 +107,17 @@ ofpbuf_use_const(struct ofpbuf *b, const void *data, > size_t size) > ofpbuf_set_size(b, size); > } > > +/* Initializes 'b' as an empty ofpbuf that contains the 'allocated' bytes of > + * memory starting at 'base'. DPDK allocated ofpbuf and *data is allocated > + * from one continous memory region, so in memory data start right after > + * ofpbuf. Therefore there is special method to free this type of > + * buffer. */ > +void > +ofpbuf_init_dpdk(struct ofpbuf *b, size_t allocated) > +{ > + ofpbuf_init__(b, allocated, OFPBUF_DPDK); > +} > +
You could add a comment stating who initializes the ‘data'. ‘size', and ‘base’ in this case. Otherwise looks good to me, Jarno Acked-by: Jarno Rajahalme <jrajaha...@nicira.com> _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev