Currently no. But will be used in the future if scalable scheduler is merged. Two files loop.c and odp_packet_io.c will use this conversion.
Kevin 2017-04-10 17:08 GMT+08:00 Savolainen, Petri (Nokia - FI/Espoo) < [email protected]>: > > > > -----Original Message----- > > From: lng-odp [mailto:[email protected]] On Behalf Of > Kevin > > Wang > > Sent: Monday, April 10, 2017 8:59 AM > > To: [email protected] > > Cc: Kevin Wang <[email protected]> > > Subject: [lng-odp] [PATCH] linux-gen: packet: add pkt_to_buffer_hdr() > > function > > > > This function is to convert odp_packet_t to odp_buffer_hdr_t ptr. > > > > Signed-off-by: Kevin Wang <[email protected]> > > Reviewed-by: Brian Brooks <[email protected]> > > --- > > platform/linux-generic/include/odp_packet_internal.h | 3 +++ > > platform/linux-generic/odp_packet.c | 5 +++++ > > 2 files changed, 8 insertions(+) > > > > diff --git a/platform/linux-generic/include/odp_packet_internal.h > > b/platform/linux-generic/include/odp_packet_internal.h > > index 0a9f177..acfe42b 100644 > > --- a/platform/linux-generic/include/odp_packet_internal.h > > +++ b/platform/linux-generic/include/odp_packet_internal.h > > @@ -235,6 +235,9 @@ odp_buffer_t _odp_packet_to_buffer(odp_packet_t > pkt); > > /* Convert a buffer handle to a packet handle */ > > odp_packet_t _odp_packet_from_buffer(odp_buffer_t buf); > > > > +/* Convert a packet handle to a buffer hdr handle pointer */ > > +odp_buffer_hdr_t *pkt_to_buffer_hdr(odp_packet_t pkt); > > + > > static inline int packet_hdr_has_l2(odp_packet_hdr_t *pkt_hdr) > > { > > return pkt_hdr->p.input_flags.l2; > > diff --git a/platform/linux-generic/odp_packet.c b/platform/linux- > > generic/odp_packet.c > > index b8aac6b..2233cd1 100644 > > --- a/platform/linux-generic/odp_packet.c > > +++ b/platform/linux-generic/odp_packet.c > > @@ -651,6 +651,11 @@ odp_buffer_t _odp_packet_to_buffer(odp_packet_t > pkt) > > return buffer_handle(packet_hdr(pkt)); > > } > > > > +odp_buffer_hdr_t *pkt_to_buffer_hdr(odp_packet_t pkt) > > +{ > > + return (odp_buffer_hdr_t > > *)(uintptr_t)_odp_packet_to_buffer(pkt); > > +} > > + > > > Why this needs to be added? Which files need this conversion? If it's only > the new code, better keep it internal to the new files. A patches should > keep / improve modularity, instead of loosening it without a reason. > > -Petri > > -- Thanks, Kevin
