diff mbox

[RFC,API-NEXT,PATCHv2] api: pool/packet: proposed user metadata APIs

Message ID 1427306629-28828-1-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer March 25, 2015, 6:03 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---

v2 changes:
- Moved udata_size to odp_pool_param_t
- Renamed odp_packet_udata() to odp_packet_user_metadata()
- Removed odp_buffer_udata().  User metadata is for packets only

RFC for proposed minimal API set for user metadata support
based on today's discussions.  Note that all initialization
and management of user metadata contents is the responsibility of
the ODP application. ODP APIs that copy system metadata will also
copy any associated user metadata as part of that operation, but
ODP will otherwise ignore these bytes.

 include/odp/api/packet.h | 12 ++++++++++++
 include/odp/api/pool.h   |  4 +++-
 2 files changed, 15 insertions(+), 1 deletion(-)

--
2.1.0

Comments

Bill Fischofer March 26, 2015, 4:58 p.m. UTC | #1
OK, v3 posted to reflect these changes.  Thanks.

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

>
>
> > -----Original Message-----
> > From: lng-odp-bounces@lists.linaro.org [mailto:lng-odp-
> > bounces@lists.linaro.org] On Behalf Of ext Bill Fischofer
> > Sent: Wednesday, March 25, 2015 8:04 PM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [RFC API-NEXT PATCHv2] api: pool/packet: proposed user
> > metadata APIs
> >
> > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> > ---
> >
> > v2 changes:
> > - Moved udata_size to odp_pool_param_t
> > - Renamed odp_packet_udata() to odp_packet_user_metadata()
> > - Removed odp_buffer_udata().  User metadata is for packets only
> >
> > RFC for proposed minimal API set for user metadata support
> > based on today's discussions.  Note that all initialization
> > and management of user metadata contents is the responsibility of
> > the ODP application. ODP APIs that copy system metadata will also
> > copy any associated user metadata as part of that operation, but
> > ODP will otherwise ignore these bytes.
> >
> >  include/odp/api/packet.h | 12 ++++++++++++
> >  include/odp/api/pool.h   |  4 +++-
> >  2 files changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
> > index a31c54d..28182cc 100644
> > --- a/include/odp/api/packet.h
> > +++ b/include/odp/api/packet.h
> > @@ -467,6 +467,18 @@ uint64_t odp_packet_user_u64(odp_packet_t pkt);
> >  void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t ctx);
> >
> >  /**
> > + * Get address and size of user metadata associated with a packet
> > + *
> > + * @param pkt             Packet handle
> > + * @param udata_size[out] Number of bytes of user metadata available
> > + *                        at the returned address.  If supplied address
> > + *                        is NULL on input, no size is returned.
> > + * @return                Address of the usermeta data for this packet
> > + *                        or NULL if the packet has no user metadata.
> > + */
> > +void *odp_packet_user_metadata(odp_packet_t pkt, uint32_t *udata_size);
>
>
> We don't have to highlight "metadata". It can be just "user data".
>
> We have already,
> odp_packet_user_ptr()
> odp_packet_user_u64()
>
> ,odp_packet_user_data() fits better that convention. Two separate
> functions for the address and size fits better the rest of the packet API.
> Also application needs rarely to check the user data size since it's
> constant (set in pool creation). So, I'd suggest to split into two
> functions,
>
> void *odp_packet_user_data(odp_packet_t pkt);
> uint32_t odp_packet_user_data_size(odp_packet_t pkt);
>
>
> > +
> > +/**
> >   * Layer 2 start pointer
> >   *
> >   * Returns pointer to the start of the layer 2 header. Optionally,
> > outputs
> > diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
> > index 241b98a..47a50fe 100644
> > --- a/include/odp/api/pool.h
> > +++ b/include/odp/api/pool.h
> > @@ -82,7 +82,9 @@ typedef struct odp_pool_param_t {
> >               } tmo;
> >       };
> >
> > -     int type;  /**< Pool type */
> > +     int type;         /**< Pool type */
> > +     int udata_size;   /**< User metadata size in bytes.  Applicable
> only
> > +                          for type ODP_POOL_PACKET, ignored otherwise */
>
> All packet pool parameters go under "struct pkt".
>
> -Petri
>
>
> >  } odp_pool_param_t;
> >
> >  /** Packet pool*/
> > --
> > 2.1.0
> >
> > _______________________________________________
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h
index a31c54d..28182cc 100644
--- a/include/odp/api/packet.h
+++ b/include/odp/api/packet.h
@@ -467,6 +467,18 @@  uint64_t odp_packet_user_u64(odp_packet_t pkt);
 void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t ctx);

 /**
+ * Get address and size of user metadata associated with a packet
+ *
+ * @param pkt             Packet handle
+ * @param udata_size[out] Number of bytes of user metadata available
+ *                        at the returned address.  If supplied address
+ *                        is NULL on input, no size is returned.
+ * @return                Address of the usermeta data for this packet
+ *                        or NULL if the packet has no user metadata.
+ */
+void *odp_packet_user_metadata(odp_packet_t pkt, uint32_t *udata_size);
+
+/**
  * Layer 2 start pointer
  *
  * Returns pointer to the start of the layer 2 header. Optionally, outputs
diff --git a/include/odp/api/pool.h b/include/odp/api/pool.h
index 241b98a..47a50fe 100644
--- a/include/odp/api/pool.h
+++ b/include/odp/api/pool.h
@@ -82,7 +82,9 @@  typedef struct odp_pool_param_t {
 		} tmo;
 	};

-	int type;  /**< Pool type */
+	int type;         /**< Pool type */
+	int udata_size;   /**< User metadata size in bytes.  Applicable only
+			     for type ODP_POOL_PACKET, ignored otherwise */
 } odp_pool_param_t;

 /** Packet pool*/