As noted before, the application stipulated headroom and tailroom are the minimums it expects to see honored. If they cannot be, then the allocation fails. The implementation is free to give more than requested, but not less. In the linux-generic implementation, for example, the tailroom is always rounded up to fill out the last segment. This is what allows packets to be created "from scratch" via a simple odp_packet_push_tail() call to sweep out space for the new packet data.
Bill On Mon, Nov 10, 2014 at 3:09 PM, Shmulik Ladkani <[email protected]> wrote: > Hi, > > On Fri, 7 Nov 2014 07:07:32 -0600 Bill Fischofer < > [email protected]> wrote: > > Headroom permits applications to reserve buffer space for additional > > headers but it naturally also can serve to align packet frames. > > [snip] > > > So the call odp_buffer_pool_set_headroom(pool,hr+2); is a natural means > of > > getting Ethernet packets aligned for header addressing purposes in > addition > > to reserving some number of bytes for expansion. > > There are 2 approaches: > > 1. Consider user headroom and packet data alignment as two distinct user > requirements (e.g. presented as 2 different params in the API). > > 2. The user specifies the right headroom which also takes care of > packet data alignment. > > First approach has the slight advantage of preventing the user from > accidentally forgetting to take care of alignment, by means of a more > strict interface, that forces the user to provide and "alignment > requirement". OTOH, such interface may be considered overly explicit. > > Second puts all responsibility on the user; It assumes users are well > aware of their doings. > Thus, it would be extremenly beneficial to document that users also need > to take care of alignment in their provided headroom. > > Also, an approach where the implementation makes additional judgements > and adds more headroom than required (or even "steals" from tailroom) > may come as a surprise to the users. > > Regards, > Shmulik >
_______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
