Message ID | 1460575126-27115-1-git-send-email-bill.fischofer@linaro.org |
---|---|
State | Superseded |
Headers | show |
On Thu, Apr 14, 2016 at 5:21 AM, Savolainen, Petri (Nokia - FI/Espoo) < petri.savolainen@nokia.com> wrote: > Hi, > > There's no need to convert from index to handle. Application should save > handle into its own data structures. Direct index from packet should be > added, since it's very likely that packet descriptor stores an index > anyway. odp_config_pktio_entries() will be renamed to > odp_pktio_max_interfaces() or similar during config.h cleanup. > > So, I think only these two functions under need to be added. > > I'll send a v2 with the suggested changes, however I see no harm in providing the index->handle converter for symmetry. > -Petri > > > /** > * Get pktio interface index > * > * @param pktio Packet IO handle > * > * @return Packet interface index (0..odp_config_pktio_entries()-1) > * @retval <0 On failure (e.g., handle not valid) > */ > int odp_pktio_index(odp_pktio_t pktio); > > > /** > * Packet input interface index > * > * Returns index of the packet IO interface which received the packet or > * <0 when the packet was allocated/reset by the application. > * > * @param pkt Packet handle > * > * @return Packet interface index (0..odp_config_pktio_entries()-1) > * @retval <0 Packet was not received on any interface > */ > int odp_packet_input_index(odp_packet_t pkt); > > > > > -----Original Message----- > > From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT > > Bill Fischofer > > Sent: Wednesday, April 13, 2016 10:19 PM > > To: lng-odp@lists.linaro.org > > Subject: [lng-odp] [API-NEXT PATCH 1/3] api: pktio: add pktio id > > conversion APIs > > > > Add the two APIs odp_pktio_to_id() and odp_pktio_from_id() to enable > > applications to convert PktIO handles to and from indices for managing > > user contexts and related associated data. > > > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > > --- > > include/odp/api/spec/packet_io.h | 20 ++++++++++++++++++++ > > 1 file changed, 20 insertions(+) > > > > diff --git a/include/odp/api/spec/packet_io.h > > b/include/odp/api/spec/packet_io.h > > index 466cab6..60fb722 100644 > > --- a/include/odp/api/spec/packet_io.h > > +++ b/include/odp/api/spec/packet_io.h > > @@ -908,6 +908,26 @@ int odp_pktio_skip_set(odp_pktio_t pktio, uint32_t > > offset); > > int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom); > > > > /** > > + * Get pktio id from handle > > + * > > + * @param pktio Pktio handle > > + * > > + * @return Pktio index (0..odp_config_pktio_entries()-1) > > + * @retval <0 Error (e.g., handle not valid) > > + */ > > +int odp_pktio_to_id(odp_pktio_t pktio); > > + > > +/** > > + * Get pktio handle from id > > + * > > + * @param id Pktio index > > + * > > + * @return Pktio handle > > + * @retval ODP_PKTIO_INVALID on error > > + */ > > +odp_pktio_t odp_pktio_from_id(int id); > > + > > +/** > > * Get printable value for an odp_pktio_t > > * > > * @param pktio odp_pktio_t handle to be printed > > -- > > 2.5.0 > > > > _______________________________________________ > > lng-odp mailing list > > lng-odp@lists.linaro.org > > https://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 466cab6..60fb722 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -908,6 +908,26 @@ int odp_pktio_skip_set(odp_pktio_t pktio, uint32_t offset); int odp_pktio_headroom_set(odp_pktio_t pktio, uint32_t headroom); /** + * Get pktio id from handle + * + * @param pktio Pktio handle + * + * @return Pktio index (0..odp_config_pktio_entries()-1) + * @retval <0 Error (e.g., handle not valid) + */ +int odp_pktio_to_id(odp_pktio_t pktio); + +/** + * Get pktio handle from id + * + * @param id Pktio index + * + * @return Pktio handle + * @retval ODP_PKTIO_INVALID on error + */ +odp_pktio_t odp_pktio_from_id(int id); + +/** * Get printable value for an odp_pktio_t * * @param pktio odp_pktio_t handle to be printed
Add the two APIs odp_pktio_to_id() and odp_pktio_from_id() to enable applications to convert PktIO handles to and from indices for managing user contexts and related associated data. Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- include/odp/api/spec/packet_io.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)