Message ID | 1409937064-1036-2-git-send-email-robking@cisco.com |
---|---|
State | Superseded |
Headers | show |
On 2014-09-05 13:11, Robbie King wrote: > Signed-off-by: Robbie King <robking@cisco.com> Reviewed-by: Anders Roxell <anders.roxell@linaro.org> > --- > platform/linux-generic/include/api/odp_packet.h | 18 ++++++++++++++++++ > .../linux-generic/include/odp_packet_internal.h | 2 ++ > platform/linux-generic/odp_packet.c | 10 ++++++++++ > 3 files changed, 30 insertions(+), 0 deletions(-) > > diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h > index ef4be9e..4a089d1 100644 > --- a/platform/linux-generic/include/api/odp_packet.h > +++ b/platform/linux-generic/include/api/odp_packet.h > @@ -98,6 +98,24 @@ void odp_packet_set_len(odp_packet_t pkt, size_t len); > size_t odp_packet_get_len(odp_packet_t pkt); > > /** > + * Set packet user context > + * > + * @param buf Packet handle > + * @param ctx User context > + * > + */ > +void odp_packet_set_ctx(odp_packet_t buf, const void *ctx); > + > +/** > + * Get packet user context > + * > + * @param buf Packet handle > + * > + * @return User context > + */ > +void *odp_packet_get_ctx(odp_packet_t buf); > + > +/** > * Get address to the start of the packet buffer > * > * The address of the packet buffer is not necessarily the same as the start > diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h > index 0ab3be2..49c59b2 100644 > --- a/platform/linux-generic/include/odp_packet_internal.h > +++ b/platform/linux-generic/include/odp_packet_internal.h > @@ -112,6 +112,8 @@ typedef struct { > > uint32_t frame_len; > > + uint64_t user_ctx; /* user context */ > + > odp_pktio_t input; > > uint32_t pad; > diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c > index 20137d0..64fd0f8 100644 > --- a/platform/linux-generic/odp_packet.c > +++ b/platform/linux-generic/odp_packet.c > @@ -386,3 +386,13 @@ int odp_packet_copy(odp_packet_t pkt_dst, odp_packet_t pkt_src) > > return 0; > } > + > +void odp_packet_set_ctx(odp_packet_t pkt, const void *ctx) > +{ > + odp_packet_hdr(pkt)->user_ctx = (intptr_t)ctx; > +} > + > +void *odp_packet_get_ctx(odp_packet_t pkt) > +{ > + return (void *)(intptr_t)odp_packet_hdr(pkt)->user_ctx; > +} > -- > 1.7.7.6 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp
diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h index ef4be9e..4a089d1 100644 --- a/platform/linux-generic/include/api/odp_packet.h +++ b/platform/linux-generic/include/api/odp_packet.h @@ -98,6 +98,24 @@ void odp_packet_set_len(odp_packet_t pkt, size_t len); size_t odp_packet_get_len(odp_packet_t pkt); /** + * Set packet user context + * + * @param buf Packet handle + * @param ctx User context + * + */ +void odp_packet_set_ctx(odp_packet_t buf, const void *ctx); + +/** + * Get packet user context + * + * @param buf Packet handle + * + * @return User context + */ +void *odp_packet_get_ctx(odp_packet_t buf); + +/** * Get address to the start of the packet buffer * * The address of the packet buffer is not necessarily the same as the start diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 0ab3be2..49c59b2 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -112,6 +112,8 @@ typedef struct { uint32_t frame_len; + uint64_t user_ctx; /* user context */ + odp_pktio_t input; uint32_t pad; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 20137d0..64fd0f8 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -386,3 +386,13 @@ int odp_packet_copy(odp_packet_t pkt_dst, odp_packet_t pkt_src) return 0; } + +void odp_packet_set_ctx(odp_packet_t pkt, const void *ctx) +{ + odp_packet_hdr(pkt)->user_ctx = (intptr_t)ctx; +} + +void *odp_packet_get_ctx(odp_packet_t pkt) +{ + return (void *)(intptr_t)odp_packet_hdr(pkt)->user_ctx; +}
Signed-off-by: Robbie King <robking@cisco.com> --- platform/linux-generic/include/api/odp_packet.h | 18 ++++++++++++++++++ .../linux-generic/include/odp_packet_internal.h | 2 ++ platform/linux-generic/odp_packet.c | 10 ++++++++++ 3 files changed, 30 insertions(+), 0 deletions(-)