On 10/08/2015 11:38 AM, Savolainen, Petri (Nokia - FI/Espoo) wrote: > >> -----Original Message----- >> From: EXT Nicolas Morey-Chaisemartin [mailto:nmo...@kalray.eu] >> Sent: Thursday, October 08, 2015 11:16 AM >> To: Savolainen, Petri (Nokia - FI/Espoo); lng-odp@lists.linaro.org >> Subject: Re: [lng-odp] [API-NEXTv2 7/7] validation: packet: add tests for >> packet alloc/free multi functions >> >> >> >> On 09/30/2015 12:47 PM, Savolainen, Petri (Nokia - FI/Espoo) wrote: >>>> -----Original Message----- >>>> From: lng-odp [mailto:lng-odp-boun...@lists.linaro.org] On Behalf Of EXT >>>> Nicolas Morey-Chaisemartin >>>> Sent: Tuesday, September 29, 2015 5:16 PM >>>> To: lng-odp@lists.linaro.org >>>> Subject: [lng-odp] [API-NEXTv2 7/7] validation: packet: add tests for >>>> packet alloc/free multi functions >>>> + CU_ASSERT_FATAL(odp_packet_alloc_multi(pool, packet_len, >>>> + packet, num_pkt) == num_pkt); >>>> + >>>> + for (i = 0; i < num_pkt; ++i) { >>> Check return value. It can be less than num_pkt. Check only indexes 0 ... >> ret -1. Re-try to allocate rest of the packets. >> This is actually OK becuase we use CU_ASSERT_FATAL and not CU_ASSERT. >> If alloc_multi returned a value different from num_pkt, the test will exit >> before entering the loop. >> >> Nicolas > It's a valid behavior that implementation returns less packets than user > asked. For example, it's better for the performance that implementation > returns all packets that are locally available right away (and prefetch more > on the backgroup) than it would always e.g. spin on waiting more packets from > global pool. Application can proceed with the packets it received and come > back later for the rest. > > A valid implementation could always return 0...1 packets also in the multi > case. > > -Petri > > >
So you'd want to modify the test(s) and allow alloc_multi to return less then num_pkt event if we know that there really are num_pkt packet available? _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp