Message ID | 1456949141-32378-2-git-send-email-zoltan.kiss@linaro.org |
---|---|
State | Superseded |
Headers | show |
Ping On 03/03/16 03:05, Zoltan Kiss wrote: > This makes it possible for other implementations like ODP-DPDK to reuse > classification code while using a different packet API. > > Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> > --- > platform/linux-generic/include/odp_classification_inlines.h | 2 +- > platform/linux-generic/include/odp_packet_internal.h | 10 ++++++++++ > platform/linux-generic/odp_classification.c | 4 ++-- > 3 files changed, 13 insertions(+), 3 deletions(-) > > diff --git a/platform/linux-generic/include/odp_classification_inlines.h b/platform/linux-generic/include/odp_classification_inlines.h > index 96cf77e..2318349 100644 > --- a/platform/linux-generic/include/odp_classification_inlines.h > +++ b/platform/linux-generic/include/odp_classification_inlines.h > @@ -162,7 +162,7 @@ static inline int verify_pmr_dmac(const uint8_t *pkt_addr, > uint64_t dmac_be = 0; > const odph_ethhdr_t *eth; > > - if (!pkt_hdr->input_flags.eth) > + if (!odp_packet_hdr_has_eth(pkt_hdr)) > return 0; > > eth = (const odph_ethhdr_t *)(pkt_addr + pkt_hdr->l2_offset); > diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h > index 85d4924..d9fe544 100644 > --- a/platform/linux-generic/include/odp_packet_internal.h > +++ b/platform/linux-generic/include/odp_packet_internal.h > @@ -258,6 +258,16 @@ 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); > > +static inline int odp_packet_hdr_has_l2(odp_packet_hdr_t *pkt_hdr) > +{ > + return pkt_hdr->input_flags.l2; > +} > + > +static inline int odp_packet_hdr_has_eth(odp_packet_hdr_t *pkt_hdr) > +{ > + return pkt_hdr->input_flags.eth; > +} > + > int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *parseptr); > > int _odp_cls_parse(odp_packet_hdr_t *pkt_hdr, const uint8_t *parseptr); > diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c > index da195ad..4551951 100644 > --- a/platform/linux-generic/odp_classification.c > +++ b/platform/linux-generic/odp_classification.c > @@ -1003,8 +1003,8 @@ cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, const uint8_t *pkt_addr, > const odph_vlanhdr_t *vlan; > uint16_t qos; > > - if (hdr->input_flags.l2 && hdr->input_flags.vlan && > - hdr->input_flags.eth) { > + if (odp_packet_hdr_has_l2(hdr) && hdr->input_flags.vlan && > + odp_packet_hdr_has_eth(hdr)) { > eth = (const odph_ethhdr_t *)(pkt_addr + hdr->l2_offset); > vlan = (const odph_vlanhdr_t *)(ð->type); > qos = odp_be_to_cpu_16(vlan->tci);
Ping On 03/03/16 03:05, Zoltan Kiss wrote: > This makes it possible for other implementations like ODP-DPDK to reuse > classification code while using a different packet API. > > Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> > --- > platform/linux-generic/include/odp_classification_inlines.h | 2 +- > platform/linux-generic/include/odp_packet_internal.h | 10 ++++++++++ > platform/linux-generic/odp_classification.c | 4 ++-- > 3 files changed, 13 insertions(+), 3 deletions(-) > > diff --git a/platform/linux-generic/include/odp_classification_inlines.h b/platform/linux-generic/include/odp_classification_inlines.h > index 96cf77e..2318349 100644 > --- a/platform/linux-generic/include/odp_classification_inlines.h > +++ b/platform/linux-generic/include/odp_classification_inlines.h > @@ -162,7 +162,7 @@ static inline int verify_pmr_dmac(const uint8_t *pkt_addr, > uint64_t dmac_be = 0; > const odph_ethhdr_t *eth; > > - if (!pkt_hdr->input_flags.eth) > + if (!odp_packet_hdr_has_eth(pkt_hdr)) > return 0; > > eth = (const odph_ethhdr_t *)(pkt_addr + pkt_hdr->l2_offset); > diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h > index 85d4924..d9fe544 100644 > --- a/platform/linux-generic/include/odp_packet_internal.h > +++ b/platform/linux-generic/include/odp_packet_internal.h > @@ -258,6 +258,16 @@ 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); > > +static inline int odp_packet_hdr_has_l2(odp_packet_hdr_t *pkt_hdr) > +{ > + return pkt_hdr->input_flags.l2; > +} > + > +static inline int odp_packet_hdr_has_eth(odp_packet_hdr_t *pkt_hdr) > +{ > + return pkt_hdr->input_flags.eth; > +} > + > int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *parseptr); > > int _odp_cls_parse(odp_packet_hdr_t *pkt_hdr, const uint8_t *parseptr); > diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c > index da195ad..4551951 100644 > --- a/platform/linux-generic/odp_classification.c > +++ b/platform/linux-generic/odp_classification.c > @@ -1003,8 +1003,8 @@ cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, const uint8_t *pkt_addr, > const odph_vlanhdr_t *vlan; > uint16_t qos; > > - if (hdr->input_flags.l2 && hdr->input_flags.vlan && > - hdr->input_flags.eth) { > + if (odp_packet_hdr_has_l2(hdr) && hdr->input_flags.vlan && > + odp_packet_hdr_has_eth(hdr)) { > eth = (const odph_ethhdr_t *)(pkt_addr + hdr->l2_offset); > vlan = (const odph_vlanhdr_t *)(ð->type); > qos = odp_be_to_cpu_16(vlan->tci);
Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Regards, Bala On 11 March 2016 at 14:03, Zoltan Kiss <zoltan.kiss@linaro.org> wrote: > Ping > > On 03/03/16 03:05, Zoltan Kiss wrote: > >> This makes it possible for other implementations like ODP-DPDK to reuse >> classification code while using a different packet API. >> >> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> >> --- >> platform/linux-generic/include/odp_classification_inlines.h | 2 +- >> platform/linux-generic/include/odp_packet_internal.h | 10 >> ++++++++++ >> platform/linux-generic/odp_classification.c | 4 ++-- >> 3 files changed, 13 insertions(+), 3 deletions(-) >> >> diff --git a/platform/linux-generic/include/odp_classification_inlines.h >> b/platform/linux-generic/include/odp_classification_inlines.h >> index 96cf77e..2318349 100644 >> --- a/platform/linux-generic/include/odp_classification_inlines.h >> +++ b/platform/linux-generic/include/odp_classification_inlines.h >> @@ -162,7 +162,7 @@ static inline int verify_pmr_dmac(const uint8_t >> *pkt_addr, >> uint64_t dmac_be = 0; >> const odph_ethhdr_t *eth; >> - if (!pkt_hdr->input_flags.eth) >> + if (!odp_packet_hdr_has_eth(pkt_hdr)) >> return 0; >> eth = (const odph_ethhdr_t *)(pkt_addr + pkt_hdr->l2_offset); >> diff --git a/platform/linux-generic/include/odp_packet_internal.h >> b/platform/linux-generic/include/odp_packet_internal.h >> index 85d4924..d9fe544 100644 >> --- a/platform/linux-generic/include/odp_packet_internal.h >> +++ b/platform/linux-generic/include/odp_packet_internal.h >> @@ -258,6 +258,16 @@ 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); >> +static inline int odp_packet_hdr_has_l2(odp_packet_hdr_t *pkt_hdr) >> +{ >> + return pkt_hdr->input_flags.l2; >> +} >> + >> +static inline int odp_packet_hdr_has_eth(odp_packet_hdr_t *pkt_hdr) >> +{ >> + return pkt_hdr->input_flags.eth; >> +} >> + >> int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t >> *parseptr); >> int _odp_cls_parse(odp_packet_hdr_t *pkt_hdr, const uint8_t >> *parseptr); >> diff --git a/platform/linux-generic/odp_classification.c >> b/platform/linux-generic/odp_classification.c >> index da195ad..4551951 100644 >> --- a/platform/linux-generic/odp_classification.c >> +++ b/platform/linux-generic/odp_classification.c >> @@ -1003,8 +1003,8 @@ cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, const >> uint8_t *pkt_addr, >> const odph_vlanhdr_t *vlan; >> uint16_t qos; >> - if (hdr->input_flags.l2 && hdr->input_flags.vlan && >> - hdr->input_flags.eth) { >> + if (odp_packet_hdr_has_l2(hdr) && hdr->input_flags.vlan && >> + odp_packet_hdr_has_eth(hdr)) { >> eth = (const odph_ethhdr_t *)(pkt_addr + hdr->l2_offset); >> vlan = (const odph_vlanhdr_t *)(ð->type); >> qos = odp_be_to_cpu_16(vlan->tci); >> > >
Zoltan, you can not name internal functions with odp_ prefix. So 2 options or move that to API: odp_packet_hdr_has_l2 odp_packet_hdr_has_eth or rename to _odp_.... Best regards, Maxim. On 03/14/16 09:51, Bala Manoharan wrote: > Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org > <mailto:bala.manoharan@linaro.org>> > Please be careful with review. > Regards, > Bala > > On 11 March 2016 at 14:03, Zoltan Kiss <zoltan.kiss@linaro.org > <mailto:zoltan.kiss@linaro.org>> wrote: > > Ping > > On 03/03/16 03:05, Zoltan Kiss wrote: > > This makes it possible for other implementations like ODP-DPDK > to reuse > classification code while using a different packet API. > > Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org > <mailto:zoltan.kiss@linaro.org>> > --- > platform/linux-generic/include/odp_classification_inlines.h | > 2 +- > platform/linux-generic/include/odp_packet_internal.h | > 10 ++++++++++ > platform/linux-generic/odp_classification.c | 4 ++-- > 3 files changed, 13 insertions(+), 3 deletions(-) > > diff --git > a/platform/linux-generic/include/odp_classification_inlines.h > b/platform/linux-generic/include/odp_classification_inlines.h > index 96cf77e..2318349 100644 > --- a/platform/linux-generic/include/odp_classification_inlines.h > +++ b/platform/linux-generic/include/odp_classification_inlines.h > @@ -162,7 +162,7 @@ static inline int verify_pmr_dmac(const > uint8_t *pkt_addr, > uint64_t dmac_be = 0; > const odph_ethhdr_t *eth; > - if (!pkt_hdr->input_flags.eth) > + if (!odp_packet_hdr_has_eth(pkt_hdr)) > return 0; > eth = (const odph_ethhdr_t *)(pkt_addr + > pkt_hdr->l2_offset); > diff --git > a/platform/linux-generic/include/odp_packet_internal.h > b/platform/linux-generic/include/odp_packet_internal.h > index 85d4924..d9fe544 100644 > --- a/platform/linux-generic/include/odp_packet_internal.h > +++ b/platform/linux-generic/include/odp_packet_internal.h > @@ -258,6 +258,16 @@ 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); > +static inline int odp_packet_hdr_has_l2(odp_packet_hdr_t > *pkt_hdr) > +{ > + return pkt_hdr->input_flags.l2; > +} > + > +static inline int odp_packet_hdr_has_eth(odp_packet_hdr_t > *pkt_hdr) > +{ > + return pkt_hdr->input_flags.eth; > +} > + > int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const > uint8_t *parseptr); > int _odp_cls_parse(odp_packet_hdr_t *pkt_hdr, const > uint8_t *parseptr); > diff --git a/platform/linux-generic/odp_classification.c > b/platform/linux-generic/odp_classification.c > index da195ad..4551951 100644 > --- a/platform/linux-generic/odp_classification.c > +++ b/platform/linux-generic/odp_classification.c > @@ -1003,8 +1003,8 @@ cos_t *match_qos_l2_cos(pmr_l2_cos_t > *l2_cos, const uint8_t *pkt_addr, > const odph_vlanhdr_t *vlan; > uint16_t qos; > - if (hdr->input_flags.l2 && hdr->input_flags.vlan && > - hdr->input_flags.eth) { > + if (odp_packet_hdr_has_l2(hdr) && hdr->input_flags.vlan && > + odp_packet_hdr_has_eth(hdr)) { > eth = (const odph_ethhdr_t *)(pkt_addr + > hdr->l2_offset); > vlan = (const odph_vlanhdr_t *)(ð->type); > qos = odp_be_to_cpu_16(vlan->tci); > > > > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp
diff --git a/platform/linux-generic/include/odp_classification_inlines.h b/platform/linux-generic/include/odp_classification_inlines.h index 96cf77e..2318349 100644 --- a/platform/linux-generic/include/odp_classification_inlines.h +++ b/platform/linux-generic/include/odp_classification_inlines.h @@ -162,7 +162,7 @@ static inline int verify_pmr_dmac(const uint8_t *pkt_addr, uint64_t dmac_be = 0; const odph_ethhdr_t *eth; - if (!pkt_hdr->input_flags.eth) + if (!odp_packet_hdr_has_eth(pkt_hdr)) return 0; eth = (const odph_ethhdr_t *)(pkt_addr + pkt_hdr->l2_offset); diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 85d4924..d9fe544 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -258,6 +258,16 @@ 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); +static inline int odp_packet_hdr_has_l2(odp_packet_hdr_t *pkt_hdr) +{ + return pkt_hdr->input_flags.l2; +} + +static inline int odp_packet_hdr_has_eth(odp_packet_hdr_t *pkt_hdr) +{ + return pkt_hdr->input_flags.eth; +} + int _odp_parse_common(odp_packet_hdr_t *pkt_hdr, const uint8_t *parseptr); int _odp_cls_parse(odp_packet_hdr_t *pkt_hdr, const uint8_t *parseptr); diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index da195ad..4551951 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -1003,8 +1003,8 @@ cos_t *match_qos_l2_cos(pmr_l2_cos_t *l2_cos, const uint8_t *pkt_addr, const odph_vlanhdr_t *vlan; uint16_t qos; - if (hdr->input_flags.l2 && hdr->input_flags.vlan && - hdr->input_flags.eth) { + if (odp_packet_hdr_has_l2(hdr) && hdr->input_flags.vlan && + odp_packet_hdr_has_eth(hdr)) { eth = (const odph_ethhdr_t *)(pkt_addr + hdr->l2_offset); vlan = (const odph_vlanhdr_t *)(ð->type); qos = odp_be_to_cpu_16(vlan->tci);
This makes it possible for other implementations like ODP-DPDK to reuse classification code while using a different packet API. Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> --- platform/linux-generic/include/odp_classification_inlines.h | 2 +- platform/linux-generic/include/odp_packet_internal.h | 10 ++++++++++ platform/linux-generic/odp_classification.c | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-)