Changes in distributor tests look good.
All tests pass

W dniu 26.10.2020 o 06:21, Thomas Monjalon pisze:
> The test used the deprecated mbuf field udata64.
> It is moved to a dynamic field in order to allow removal of udata64.
>
> Signed-off-by: Thomas Monjalon <tho...@monjalon.net>
Acked-by: Lukasz Wojciechowski <l.wojciec...@partner.samsung.com>
Tested-by: Lukasz Wojciechowski <l.wojciec...@partner.samsung.com>

> ---
>   app/test/test_distributor.c | 27 ++++++++++++++++++++++-----
>   1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
> index eb889b91d1..074a06f4a2 100644
> --- a/app/test/test_distributor.c
> +++ b/app/test/test_distributor.c
> @@ -10,6 +10,7 @@
>   #include <rte_errno.h>
>   #include <rte_mempool.h>
>   #include <rte_mbuf.h>
> +#include <rte_mbuf_dyn.h>
>   #include <rte_distributor.h>
>   #include <rte_string_fns.h>
>   
> @@ -17,6 +18,10 @@
>   #define BURST 32
>   #define BIG_BATCH 1024
>   
> +static int seq_dynfield_offset;
> +#define SEQ_FIELD(mbuf) \
> +     (*RTE_MBUF_DYNFIELD(mbuf, seq_dynfield_offset, uint32_t *))
> +
>   struct worker_params {
>       char name[64];
>       struct rte_distributor *dist;
> @@ -578,7 +583,7 @@ handle_and_mark_work(void *arg)
>               __atomic_fetch_add(&worker_stats[id].handled_packets, num,
>                               __ATOMIC_RELAXED);
>               for (i = 0; i < num; i++)
> -                     buf[i]->udata64 += id + 1;
> +                     SEQ_FIELD(buf[i]) += id + 1;
>               num = rte_distributor_get_pkt(db, id,
>                               buf, buf, num);
>       }
> @@ -631,10 +636,10 @@ sanity_mark_test(struct worker_params *wp, struct 
> rte_mempool *p)
>                       << shift;
>       }
>       /* Assign a sequence number to each packet. The sequence is shifted,
> -      * so that lower bits of the udate64 will hold mark from worker.
> +      * so that lower bits will hold mark from worker.
>        */
>       for (i = 0; i < buf_count; i++)
> -             bufs[i]->udata64 = i << seq_shift;
> +             SEQ_FIELD(bufs[i]) = i << seq_shift;
>   
>       count = 0;
>       for (i = 0; i < buf_count/burst; i++) {
> @@ -660,8 +665,8 @@ sanity_mark_test(struct worker_params *wp, struct 
> rte_mempool *p)
>   
>       /* Sort returned packets by sent order (sequence numbers). */
>       for (i = 0; i < buf_count; i++) {
> -             seq = returns[i]->udata64 >> seq_shift;
> -             id = returns[i]->udata64 - (seq << seq_shift);
> +             seq = SEQ_FIELD(returns[i]) >> seq_shift;
> +             id = SEQ_FIELD(returns[i]) - (seq << seq_shift);
>               sorted[seq] = id;
>       }
>   
> @@ -805,6 +810,18 @@ test_distributor(void)
>       static struct rte_mempool *p;
>       int i;
>   
> +     static const struct rte_mbuf_dynfield seq_dynfield_desc = {
> +             .name = "test_distributor_dynfield_seq",
> +             .size = sizeof(uint32_t),
> +             .align = __alignof__(uint32_t),
> +     };
> +     seq_dynfield_offset =
> +             rte_mbuf_dynfield_register(&seq_dynfield_desc);
> +     if (seq_dynfield_offset < 0) {
> +             printf("Error registering mbuf field\n");
> +             return TEST_FAILED;
> +     }
> +
>       if (rte_lcore_count() < 2) {
>               printf("Not enough cores for distributor_autotest, expecting at 
> least 2\n");
>               return TEST_SKIPPED;

-- 
Lukasz Wojciechowski
Principal Software Engineer

Samsung R&D Institute Poland
Samsung Electronics
Office +48 22 377 88 25
l.wojciec...@partner.samsung.com

Reply via email to