On Fri, Oct 16, 2015 at 10:06:13AM +0200, Nicolas Morey-Chaisemartin wrote:
> Before sending/receiving packet, check that the packet_len configured
>  is supported by the pktios MTU.
> This allows interface that do not support jumbo frame to pass the test.
> However it has the bad side effect of not thoroughly checking the
> pktio if PKT_LEN_NORMAL is smaller than the MTU.

This test does a similar thing;

http://patches.opendataplane.org/patch/3294/

But the test is reported as being inactive rather than just not running
it and reporting it as passed. It depends on the ODP_CUNIT_INFO_CONDITIONAL
series that was merged last week;

http://patches.opendataplane.org/patch/3273/

With that you could make pktio_test_jumbo conditional and leave all
non-jumbo tests unchanged.

> 
> Signed-off-by: Nicolas Morey-Chaisemartin <nmo...@kalray.eu>
> ---
>  test/validation/pktio/pktio.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
> index 5c0799b..8fadbf7 100644
> --- a/test/validation/pktio/pktio.c
> +++ b/test/validation/pktio/pktio.c
> @@ -455,6 +455,7 @@ static void test_txrx(odp_queue_type_t q_type, int 
> num_pkts)
>       int ret, i, if_b;
>       pktio_info_t pktios[MAX_NUM_IFACES];
>       pktio_info_t *io;
> +     uint32_t mtu, min_mtu = UINT32_MAX;
>  
>       /* create pktios and associate input/output queues */
>       for (i = 0; i < num_ifaces; ++i) {
> @@ -475,12 +476,19 @@ static void test_txrx(odp_queue_type_t q_type, int 
> num_pkts)
>  
>               ret = odp_pktio_start(io->id);
>               CU_ASSERT(ret == 0);
> +
> +             mtu = odp_pktio_mtu(io->id);
> +             if (mtu < min_mtu)
> +                     min_mtu = mtu;
>       }
>  
> -     /* if we have two interfaces then send through one and receive on
> -      * another but if there's only one assume it's a loopback */
> -     if_b = (num_ifaces == 1) ? 0 : 1;
> -     pktio_txrx_multi(&pktios[0], &pktios[if_b], num_pkts);
> +     /* Skip test if packet len is larger than the MTU */
> +     if (min_mtu >= packet_len) {
> +             /* if we have two interfaces then send through one and receive
> +              * on another but if there's only one assume it's a loopback */
> +             if_b = (num_ifaces == 1) ? 0 : 1;
> +             pktio_txrx_multi(&pktios[0], &pktios[if_b], num_pkts);
> +     }
>  
>       for (i = 0; i < num_ifaces; ++i) {
>               destroy_inq(pktios[i].id);
> -- 
> 2.6.1.3.g8d02103
> 
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to