diff mbox

[API-NEXT,PATCHv2,3/3] api: packet: clarify valid len range on alloc

Message ID 1433391767-26775-3-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer June 4, 2015, 4:22 a.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 include/odp/api/packet.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Bill Fischofer June 9, 2015, 11:50 a.m. UTC | #1
I agree.  Some additional APIs for this area would be useful.

On Tue, Jun 9, 2015 at 6:42 AM, Savolainen, Petri (Nokia - FI/Espoo) <
petri.savolainen@nokia.com> wrote:

>
>
> > -----Original Message-----
> > From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of ext
> > Bill Fischofer
> > Sent: Thursday, June 04, 2015 7:23 AM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [API-NEXT PATCHv2 3/3] api: packet: clarify valid len
> > range on alloc
> >
> > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> > ---
> >  include/odp/api/packet.h | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> > index 3a454b5..5af4b1c 100644
> > --- a/include/odp/api/packet.h
> > +++ b/include/odp/api/packet.h
> > @@ -65,7 +65,10 @@ extern "C" {
> >   * other packet metadata are set to their default values.
> >   *
> >   * @param pool          Pool handle
> > - * @param len           Packet data length
> > + * @param len           Packet data length. Valid values are 0 through
> > + *                      ODP_CONFIG_PACKET_BUF_LEN_MAX minus
> > + *                      ODP_CONFIG_PACKET_HEADROOM minus
> > + *                      ODP_CONFIG_PACKET_TAILROOM
> >   *
> >   * @return Handle of allocated packet
> >   * @retval ODP_PACKET_INVALID  Packet could not be allocated
>
>
> This gets cryptic. It's better to define new API calls to spec the max
> data length. Here's a proposal. I can send the patch if it's OK. Also the
> trend should be to minimize usage of ODP_CONFIG_XXX in the future (for
> easier binary compatibility).
>
> -Petri
>
> /**
>  * Maximum packet data length of a new packet
>  *
>  * Returns the maximum data length of a packet when allocated from a pool.
> The
>  * length is based on pool default settings (headroom, tailroom, etc). The
> pool
>  * must be a packet pool.
>  *
>  * @param pool          Pool handle
>  *
>  * @return Maximum data length of a new packet
>  */
> uint32_t odp_packet_pool_max_len(odp_pool_t pool);
>
> /**
>  * Maximum packet data length
>  *
>  * Returns the maximum data length of the packet. The length is based on
> the
>  * current buffer space of the packet and pool default settings (headroom,
>  * tailroom, etc). A larger data length may be possible, but would require
>  * re-segmentation and/or non-default head-/tailroom settings.
>  *
>  * @param pkt           Packet handle
>  *
>  * @return Maximum data length of the packet
>  */
> uint32_t odp_packet_max_len(odp_packet_t pkt);
>
>
>
>
>
>
>
>
>
diff mbox

Patch

diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index 3a454b5..5af4b1c 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -65,7 +65,10 @@  extern "C" {
  * other packet metadata are set to their default values.
  *
  * @param pool          Pool handle
- * @param len           Packet data length
+ * @param len           Packet data length. Valid values are 0 through
+ *                      ODP_CONFIG_PACKET_BUF_LEN_MAX minus
+ *                      ODP_CONFIG_PACKET_HEADROOM minus
+ *                      ODP_CONFIG_PACKET_TAILROOM
  *
  * @return Handle of allocated packet
  * @retval ODP_PACKET_INVALID  Packet could not be allocated