Message ID | 1422476377-31311-1-git-send-email-bill.fischofer@linaro.org |
---|---|
State | New |
Headers | show |
[lng-odp] [PATCHv2] api: packet: odp_packet_flags spec changes The subject is not accurate enough without a good reference to the spec mentioned. Maybe this is more descriptive of this change in isolation from the spec api: packet: odp_packet_flags: Improve fn names On 28 January 2015 at 15:19, Bill Fischofer <bill.fischofer@linaro.org> wrote: > Rename odp_packet_error() to odp_packet_has_error() and delete > odp_packet_errflag_frame_len() for consistency with related > packet APIs Good description of a patches impact to the end user. > as requested and approved by Petri. > Don't put peoples names in the description. Use [1] A Suggested-by: tag indicates that the patch idea is suggested by the person named and ensures credit to the person for the idea. Please note that this tag should not be added without the reporter's permission, especially if the idea was not posted in a public forum. That said, if we diligently credit our idea reporters, they will, hopefully, be inspired to help us again in the future. [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/SubmittingPatches > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > example/generator/odp_generator.c | 2 +- > example/ipsec/odp_ipsec.c | 2 +- > example/l2fwd/odp_l2fwd.c | 2 +- > example/packet/odp_pktio.c | 2 +- > platform/linux-generic/include/api/odp_packet_flags.h | 13 +++---------- > platform/linux-generic/odp_packet_flags.c | 9 +-------- > test/validation/buffer/odp_packet_test.c | 5 +---- > test/validation/odp_pktio.c | 2 +- > 8 files changed, 10 insertions(+), 27 deletions(-) > > diff --git a/example/generator/odp_generator.c > b/example/generator/odp_generator.c > index 492664e..ad62e08 100644 > --- a/example/generator/odp_generator.c > +++ b/example/generator/odp_generator.c > @@ -522,7 +522,7 @@ static void *gen_recv_thread(void *arg) > > pkt = odp_packet_from_event(ev); > /* Drop packets with errors */ > - if (odp_unlikely(odp_packet_error(pkt))) { > + if (odp_unlikely(odp_packet_has_error(pkt))) { > odp_packet_free(pkt); > continue; > } > diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c > index f2d2fc7..22fddb2 100644 > --- a/example/ipsec/odp_ipsec.c > +++ b/example/ipsec/odp_ipsec.c > @@ -616,7 +616,7 @@ static > pkt_disposition_e do_input_verify(odp_packet_t pkt, > pkt_ctx_t *ctx EXAMPLE_UNUSED) > { > - if (odp_unlikely(odp_packet_error(pkt))) > + if (odp_unlikely(odp_packet_has_error(pkt))) > return PKT_DROP; > > if (!odp_packet_has_eth(pkt)) > diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c > index 18403da..305d9ae 100644 > --- a/example/l2fwd/odp_l2fwd.c > +++ b/example/l2fwd/odp_l2fwd.c > @@ -424,7 +424,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], > unsigned len) > for (i = 0, j = 0; i < len; ++i) { > pkt = pkt_tbl[i]; > > - if (odp_unlikely(odp_packet_error(pkt))) { > + if (odp_unlikely(odp_packet_has_error(pkt))) { > odp_packet_free(pkt); /* Drop */ > pkt_cnt--; > } else if (odp_unlikely(i != j++)) { > diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c > index c4c720b..1972dfa 100644 > --- a/example/packet/odp_pktio.c > +++ b/example/packet/odp_pktio.c > @@ -408,7 +408,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], > unsigned len) > for (i = 0, j = 0; i < len; ++i) { > pkt = pkt_tbl[i]; > > - if (odp_unlikely(odp_packet_error(pkt))) { > + if (odp_unlikely(odp_packet_has_error(pkt))) { > odp_packet_free(pkt); /* Drop */ > pkt_cnt--; > } else if (odp_unlikely(i != j++)) { > diff --git a/platform/linux-generic/include/api/odp_packet_flags.h > b/platform/linux-generic/include/api/odp_packet_flags.h > index 24c4065..c239a28 100644 > --- a/platform/linux-generic/include/api/odp_packet_flags.h > +++ b/platform/linux-generic/include/api/odp_packet_flags.h > @@ -32,17 +32,10 @@ extern "C" { > * Checks all error flags at once. > * > * @param pkt Packet handle > - * @return 1 if packet has errors, 0 otherwise > + * @retval 1 packet has errors > + * @retval 0 packet has no errors > */ > -int odp_packet_error(odp_packet_t pkt); > - > -/** > - * Check if error was 'frame length' error > - * > - * @param pkt Packet handle > - * @return 1 if frame length error detected, 0 otherwise > - */ > -int odp_packet_errflag_frame_len(odp_packet_t pkt); > +int odp_packet_has_error(odp_packet_t pkt); > > /** > * Check for L2 header, e.g. ethernet > diff --git a/platform/linux-generic/odp_packet_flags.c > b/platform/linux-generic/odp_packet_flags.c > index 3f0ea9f..e678f66 100644 > --- a/platform/linux-generic/odp_packet_flags.c > +++ b/platform/linux-generic/odp_packet_flags.c > @@ -8,18 +8,11 @@ > #include <odp_packet_internal.h> > > > -int odp_packet_error(odp_packet_t pkt) > +int odp_packet_has_error(odp_packet_t pkt) > { > return (odp_packet_hdr(pkt)->error_flags.all != 0); > } > > -/* Get Error Flags */ > - > -int odp_packet_errflag_frame_len(odp_packet_t pkt) > -{ > - return odp_packet_hdr(pkt)->error_flags.frame_len; > -} > - > /* Get Input Flags */ > > int odp_packet_has_l2(odp_packet_t pkt) > diff --git a/test/validation/buffer/odp_packet_test.c > b/test/validation/buffer/odp_packet_test.c > index c1b28ab..022f9a3 100644 > --- a/test/validation/buffer/odp_packet_test.c > +++ b/test/validation/buffer/odp_packet_test.c > @@ -435,10 +435,7 @@ static void packet_error_flags(void) > * properly set. Just check that function return one of allowed > values. > * @todo: check classified packet when classifier is added in > place. > */ > - err = odp_packet_error(pkt); > - CU_ASSERT(err == 0 || err == 1); > - > - err = odp_packet_errflag_frame_len(pkt); > + err = odp_packet_has_error(pkt); > CU_ASSERT(err == 0 || err == 1); > } > > diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c > index 0985771..03b14f9 100644 > --- a/test/validation/odp_pktio.c > +++ b/test/validation/odp_pktio.c > @@ -342,7 +342,7 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, > pktio_info_t *pktio_b, > if (rx_pkt == ODP_PACKET_INVALID) > break; > CU_ASSERT(odp_packet_input(rx_pkt) == pktio_b->id); > - CU_ASSERT(odp_packet_error(rx_pkt) == 0); > + CU_ASSERT(odp_packet_has_error(rx_pkt) == 0); > odp_packet_free(rx_pkt); > } > > -- > 2.1.0 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
v3 sent with requested rewording. Suggested-by not applicable in this case. Required-by might be a useful tag but would be unnecessary here. Bill On Wed, Jan 28, 2015 at 2:42 PM, Mike Holmes <mike.holmes@linaro.org> wrote: > [lng-odp] [PATCHv2] api: packet: odp_packet_flags spec changes > > The subject is not accurate enough without a good reference to the spec > mentioned. > Maybe this is more descriptive of this change in isolation from the spec > api: packet: odp_packet_flags: Improve fn names > > On 28 January 2015 at 15:19, Bill Fischofer <bill.fischofer@linaro.org> > wrote: > >> Rename odp_packet_error() to odp_packet_has_error() and delete >> odp_packet_errflag_frame_len() for consistency with related >> packet APIs > > > Good description of a patches impact to the end user. > > >> as requested and approved by Petri. >> > > Don't put peoples names in the description. > > Use [1] > > A Suggested-by: tag indicates that the patch idea is suggested by the person > named and ensures credit to the person for the idea. Please note that this > tag should not be added without the reporter's permission, especially if the > idea was not posted in a public forum. That said, if we diligently credit our > idea reporters, they will, hopefully, be inspired to help us again in the > future. > > > [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/SubmittingPatches > > > >> >> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> >> --- >> example/generator/odp_generator.c | 2 +- >> example/ipsec/odp_ipsec.c | 2 +- >> example/l2fwd/odp_l2fwd.c | 2 +- >> example/packet/odp_pktio.c | 2 +- >> platform/linux-generic/include/api/odp_packet_flags.h | 13 +++---------- >> platform/linux-generic/odp_packet_flags.c | 9 +-------- >> test/validation/buffer/odp_packet_test.c | 5 +---- >> test/validation/odp_pktio.c | 2 +- >> 8 files changed, 10 insertions(+), 27 deletions(-) >> >> diff --git a/example/generator/odp_generator.c >> b/example/generator/odp_generator.c >> index 492664e..ad62e08 100644 >> --- a/example/generator/odp_generator.c >> +++ b/example/generator/odp_generator.c >> @@ -522,7 +522,7 @@ static void *gen_recv_thread(void *arg) >> >> pkt = odp_packet_from_event(ev); >> /* Drop packets with errors */ >> - if (odp_unlikely(odp_packet_error(pkt))) { >> + if (odp_unlikely(odp_packet_has_error(pkt))) { >> odp_packet_free(pkt); >> continue; >> } >> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c >> index f2d2fc7..22fddb2 100644 >> --- a/example/ipsec/odp_ipsec.c >> +++ b/example/ipsec/odp_ipsec.c >> @@ -616,7 +616,7 @@ static >> pkt_disposition_e do_input_verify(odp_packet_t pkt, >> pkt_ctx_t *ctx EXAMPLE_UNUSED) >> { >> - if (odp_unlikely(odp_packet_error(pkt))) >> + if (odp_unlikely(odp_packet_has_error(pkt))) >> return PKT_DROP; >> >> if (!odp_packet_has_eth(pkt)) >> diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c >> index 18403da..305d9ae 100644 >> --- a/example/l2fwd/odp_l2fwd.c >> +++ b/example/l2fwd/odp_l2fwd.c >> @@ -424,7 +424,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], >> unsigned len) >> for (i = 0, j = 0; i < len; ++i) { >> pkt = pkt_tbl[i]; >> >> - if (odp_unlikely(odp_packet_error(pkt))) { >> + if (odp_unlikely(odp_packet_has_error(pkt))) { >> odp_packet_free(pkt); /* Drop */ >> pkt_cnt--; >> } else if (odp_unlikely(i != j++)) { >> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c >> index c4c720b..1972dfa 100644 >> --- a/example/packet/odp_pktio.c >> +++ b/example/packet/odp_pktio.c >> @@ -408,7 +408,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], >> unsigned len) >> for (i = 0, j = 0; i < len; ++i) { >> pkt = pkt_tbl[i]; >> >> - if (odp_unlikely(odp_packet_error(pkt))) { >> + if (odp_unlikely(odp_packet_has_error(pkt))) { >> odp_packet_free(pkt); /* Drop */ >> pkt_cnt--; >> } else if (odp_unlikely(i != j++)) { >> diff --git a/platform/linux-generic/include/api/odp_packet_flags.h >> b/platform/linux-generic/include/api/odp_packet_flags.h >> index 24c4065..c239a28 100644 >> --- a/platform/linux-generic/include/api/odp_packet_flags.h >> +++ b/platform/linux-generic/include/api/odp_packet_flags.h >> @@ -32,17 +32,10 @@ extern "C" { >> * Checks all error flags at once. >> * >> * @param pkt Packet handle >> - * @return 1 if packet has errors, 0 otherwise >> + * @retval 1 packet has errors >> + * @retval 0 packet has no errors >> */ >> -int odp_packet_error(odp_packet_t pkt); >> - >> -/** >> - * Check if error was 'frame length' error >> - * >> - * @param pkt Packet handle >> - * @return 1 if frame length error detected, 0 otherwise >> - */ >> -int odp_packet_errflag_frame_len(odp_packet_t pkt); >> +int odp_packet_has_error(odp_packet_t pkt); >> >> /** >> * Check for L2 header, e.g. ethernet >> diff --git a/platform/linux-generic/odp_packet_flags.c >> b/platform/linux-generic/odp_packet_flags.c >> index 3f0ea9f..e678f66 100644 >> --- a/platform/linux-generic/odp_packet_flags.c >> +++ b/platform/linux-generic/odp_packet_flags.c >> @@ -8,18 +8,11 @@ >> #include <odp_packet_internal.h> >> >> >> -int odp_packet_error(odp_packet_t pkt) >> +int odp_packet_has_error(odp_packet_t pkt) >> { >> return (odp_packet_hdr(pkt)->error_flags.all != 0); >> } >> >> -/* Get Error Flags */ >> - >> -int odp_packet_errflag_frame_len(odp_packet_t pkt) >> -{ >> - return odp_packet_hdr(pkt)->error_flags.frame_len; >> -} >> - >> /* Get Input Flags */ >> >> int odp_packet_has_l2(odp_packet_t pkt) >> diff --git a/test/validation/buffer/odp_packet_test.c >> b/test/validation/buffer/odp_packet_test.c >> index c1b28ab..022f9a3 100644 >> --- a/test/validation/buffer/odp_packet_test.c >> +++ b/test/validation/buffer/odp_packet_test.c >> @@ -435,10 +435,7 @@ static void packet_error_flags(void) >> * properly set. Just check that function return one of allowed >> values. >> * @todo: check classified packet when classifier is added in >> place. >> */ >> - err = odp_packet_error(pkt); >> - CU_ASSERT(err == 0 || err == 1); >> - >> - err = odp_packet_errflag_frame_len(pkt); >> + err = odp_packet_has_error(pkt); >> CU_ASSERT(err == 0 || err == 1); >> } >> >> diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c >> index 0985771..03b14f9 100644 >> --- a/test/validation/odp_pktio.c >> +++ b/test/validation/odp_pktio.c >> @@ -342,7 +342,7 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, >> pktio_info_t *pktio_b, >> if (rx_pkt == ODP_PACKET_INVALID) >> break; >> CU_ASSERT(odp_packet_input(rx_pkt) == pktio_b->id); >> - CU_ASSERT(odp_packet_error(rx_pkt) == 0); >> + CU_ASSERT(odp_packet_has_error(rx_pkt) == 0); >> odp_packet_free(rx_pkt); >> } >> >> -- >> 2.1.0 >> >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> http://lists.linaro.org/mailman/listinfo/lng-odp >> > > > > -- > *Mike Holmes* > Linaro Sr Technical Manager > LNG - ODP >
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 492664e..ad62e08 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -522,7 +522,7 @@ static void *gen_recv_thread(void *arg) pkt = odp_packet_from_event(ev); /* Drop packets with errors */ - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); continue; } diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index f2d2fc7..22fddb2 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -616,7 +616,7 @@ static pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx EXAMPLE_UNUSED) { - if (odp_unlikely(odp_packet_error(pkt))) + if (odp_unlikely(odp_packet_has_error(pkt))) return PKT_DROP; if (!odp_packet_has_eth(pkt)) diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 18403da..305d9ae 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -424,7 +424,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i < len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index c4c720b..1972dfa 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -408,7 +408,7 @@ static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len) for (i = 0, j = 0; i < len; ++i) { pkt = pkt_tbl[i]; - if (odp_unlikely(odp_packet_error(pkt))) { + if (odp_unlikely(odp_packet_has_error(pkt))) { odp_packet_free(pkt); /* Drop */ pkt_cnt--; } else if (odp_unlikely(i != j++)) { diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h index 24c4065..c239a28 100644 --- a/platform/linux-generic/include/api/odp_packet_flags.h +++ b/platform/linux-generic/include/api/odp_packet_flags.h @@ -32,17 +32,10 @@ extern "C" { * Checks all error flags at once. * * @param pkt Packet handle - * @return 1 if packet has errors, 0 otherwise + * @retval 1 packet has errors + * @retval 0 packet has no errors */ -int odp_packet_error(odp_packet_t pkt); - -/** - * Check if error was 'frame length' error - * - * @param pkt Packet handle - * @return 1 if frame length error detected, 0 otherwise - */ -int odp_packet_errflag_frame_len(odp_packet_t pkt); +int odp_packet_has_error(odp_packet_t pkt); /** * Check for L2 header, e.g. ethernet diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 3f0ea9f..e678f66 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -8,18 +8,11 @@ #include <odp_packet_internal.h> -int odp_packet_error(odp_packet_t pkt) +int odp_packet_has_error(odp_packet_t pkt) { return (odp_packet_hdr(pkt)->error_flags.all != 0); } -/* Get Error Flags */ - -int odp_packet_errflag_frame_len(odp_packet_t pkt) -{ - return odp_packet_hdr(pkt)->error_flags.frame_len; -} - /* Get Input Flags */ int odp_packet_has_l2(odp_packet_t pkt) diff --git a/test/validation/buffer/odp_packet_test.c b/test/validation/buffer/odp_packet_test.c index c1b28ab..022f9a3 100644 --- a/test/validation/buffer/odp_packet_test.c +++ b/test/validation/buffer/odp_packet_test.c @@ -435,10 +435,7 @@ static void packet_error_flags(void) * properly set. Just check that function return one of allowed values. * @todo: check classified packet when classifier is added in place. */ - err = odp_packet_error(pkt); - CU_ASSERT(err == 0 || err == 1); - - err = odp_packet_errflag_frame_len(pkt); + err = odp_packet_has_error(pkt); CU_ASSERT(err == 0 || err == 1); } diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c index 0985771..03b14f9 100644 --- a/test/validation/odp_pktio.c +++ b/test/validation/odp_pktio.c @@ -342,7 +342,7 @@ static void pktio_txrx_multi(pktio_info_t *pktio_a, pktio_info_t *pktio_b, if (rx_pkt == ODP_PACKET_INVALID) break; CU_ASSERT(odp_packet_input(rx_pkt) == pktio_b->id); - CU_ASSERT(odp_packet_error(rx_pkt) == 0); + CU_ASSERT(odp_packet_has_error(rx_pkt) == 0); odp_packet_free(rx_pkt); }
Rename odp_packet_error() to odp_packet_has_error() and delete odp_packet_errflag_frame_len() for consistency with related packet APIs as requested and approved by Petri. Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 2 +- example/l2fwd/odp_l2fwd.c | 2 +- example/packet/odp_pktio.c | 2 +- platform/linux-generic/include/api/odp_packet_flags.h | 13 +++---------- platform/linux-generic/odp_packet_flags.c | 9 +-------- test/validation/buffer/odp_packet_test.c | 5 +---- test/validation/odp_pktio.c | 2 +- 8 files changed, 10 insertions(+), 27 deletions(-)