On Apr 19, 2014, at 10:09 PM, Kmindg G <kmi...@gmail.com> wrote: > On Sat, Apr 19, 2014 at 3:42 AM, Jarno Rajahalme <jrajaha...@nicira.com> > wrote: >> >> /* This is useful for initializing a miniflow for a miniflow_extract() call. >> */ >> static inline void miniflow_initialize(struct miniflow *mf, >> uint32_t buf[FLOW_U32S]) >> { >> mf->map = 0; >> - mf->values = buf; >> + mf->values_inline = (buf == (uint32_t *)(mf + 1)); >> + if (!mf->values_inline) { >> + mf->offline_values = buf; >> + } > > If mf->values_inline is true, the real data is stored in the buf > followed the mf instead of the mf->inline_values. > But, miniflow_values tries to get real data in mf->values_inline later.
In this case the buffer immediately follows the miniflow, and we simply consider them as one data structure. Strictly speaking the last words of the buffer will never be used. So the data will not be stored starting at the provided buffer, but the buffer will be used as storage, if the MINIFLOW_N_INLINE uint32_t inline storage is not enough. Later patches use dynamic allocation of cos_match and cos_subtable structures to provide enough inline storage instead. The miniflow_initialize() is mainly intended for temporary (stack allocated) use. Jarno
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev