Message ID | 1439486903-14811-3-git-send-email-zoltan.kiss@linaro.org |
---|---|
State | Superseded |
Headers | show |
Note: I've verified that this also passes, as expected, when the checkpatch issue identified in Part 2/3 is resolved by removing the extra parens. On Thu, Aug 13, 2015 at 12:28 PM, Zoltan Kiss <zoltan.kiss@linaro.org> wrote: > Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> > Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > test/validation/packet/packet.c | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/test/validation/packet/packet.c > b/test/validation/packet/packet.c > index 99a6745..36edc12 100644 > --- a/test/validation/packet/packet.c > +++ b/test/validation/packet/packet.c > @@ -36,6 +36,14 @@ static struct udata_struct { > "abcdefg", > }; > > +static void packet_uarea_init(odp_packet_t pkt, void *uarea_init_arg) > +{ > + void *uarea = odp_packet_user_area(pkt); > + uint32_t uarea_size = odp_packet_user_area_size(pkt); > + > + memcpy(uarea, uarea_init_arg, uarea_size); > +} > + > int packet_suite_init(void) > { > odp_pool_param_t params = { > @@ -44,6 +52,8 @@ int packet_suite_init(void) > .len = PACKET_BUF_LEN, > .num = 100, > .uarea_size = sizeof(struct udata_struct), > + .uarea_init = packet_uarea_init, > + .uarea_init_arg = (void *)&test_packet_udata > }, > .type = ODP_POOL_PACKET, > }; > @@ -64,16 +74,16 @@ int packet_suite_init(void) > > udat = odp_packet_user_area(test_packet); > udat_size = odp_packet_user_area_size(test_packet); > - if (!udat || udat_size != sizeof(struct udata_struct)) > + if (!udat || udat_size != sizeof(struct udata_struct) || > + memcmp(udat, (void *)&test_packet_udata, udat_size)) > return -1; > odp_pool_print(packet_pool); > - memcpy(udat, &test_packet_udata, sizeof(struct udata_struct)); > > udat = odp_packet_user_area(segmented_test_packet); > udat_size = odp_packet_user_area_size(segmented_test_packet); > - if (udat == NULL || udat_size != sizeof(struct udata_struct)) > + if (!udat || udat_size != sizeof(struct udata_struct) || > + memcmp(udat, (void *)&test_packet_udata, udat_size)) > return -1; > - memcpy(udat, &test_packet_udata, sizeof(struct udata_struct)); > > return 0; > } > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/test/validation/packet/packet.c b/test/validation/packet/packet.c index 99a6745..36edc12 100644 --- a/test/validation/packet/packet.c +++ b/test/validation/packet/packet.c @@ -36,6 +36,14 @@ static struct udata_struct { "abcdefg", }; +static void packet_uarea_init(odp_packet_t pkt, void *uarea_init_arg) +{ + void *uarea = odp_packet_user_area(pkt); + uint32_t uarea_size = odp_packet_user_area_size(pkt); + + memcpy(uarea, uarea_init_arg, uarea_size); +} + int packet_suite_init(void) { odp_pool_param_t params = { @@ -44,6 +52,8 @@ int packet_suite_init(void) .len = PACKET_BUF_LEN, .num = 100, .uarea_size = sizeof(struct udata_struct), + .uarea_init = packet_uarea_init, + .uarea_init_arg = (void *)&test_packet_udata }, .type = ODP_POOL_PACKET, }; @@ -64,16 +74,16 @@ int packet_suite_init(void) udat = odp_packet_user_area(test_packet); udat_size = odp_packet_user_area_size(test_packet); - if (!udat || udat_size != sizeof(struct udata_struct)) + if (!udat || udat_size != sizeof(struct udata_struct) || + memcmp(udat, (void *)&test_packet_udata, udat_size)) return -1; odp_pool_print(packet_pool); - memcpy(udat, &test_packet_udata, sizeof(struct udata_struct)); udat = odp_packet_user_area(segmented_test_packet); udat_size = odp_packet_user_area_size(segmented_test_packet); - if (udat == NULL || udat_size != sizeof(struct udata_struct)) + if (!udat || udat_size != sizeof(struct udata_struct) || + memcmp(udat, (void *)&test_packet_udata, udat_size)) return -1; - memcpy(udat, &test_packet_udata, sizeof(struct udata_struct)); return 0; }
Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> --- test/validation/packet/packet.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)