Re: [lng-odp] [API-NEXT PATCHv3 4/6] test/validation/traffic_mngr: Add the new traffic_mngr tests.

2016-02-18 Thread Maxim Uvarov

On 02/18/16 05:03, Bill Fischofer wrote:

+static void flush_leftover_pkts(odp_tm_t odp_tm, odp_pktio_t pktio)
+{
+   odp_packet_t rcv_pkt;
+   odp_time_t   start_time, current_time, duration;
+   uint64_t min_timeout_ns, max_timeout_ns, duration_ns;
+   int  rc;
+
+   /* Set the timeout to be at least 10 milliseconds and at most 100
+* milliseconds */
+   min_timeout_ns = 1000ULL;

10 * ODP_TIME_MSEC_IN_NS

+   max_timeout_ns = 1ULL;

100 * ODP_TIME_MSEC_IN_NS

+   start_time = odp_time_local();


___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv3 4/6] test/validation/traffic_mngr: Add the new traffic_mngr tests.

2016-02-18 Thread Bill Fischofer
Agreed.  Again, this was just a rebase of Barry's earlier patch that
predated that routine.  I can post a follow-on patch to address this.

On Thu, Feb 18, 2016 at 6:52 AM, Maxim Uvarov 
wrote:

> On 02/18/16 05:03, Bill Fischofer wrote:
>
>> +static void busy_wait(uint64_t nanoseconds)
>> +{
>> +   odp_time_t start_time, end_time;
>> +   uint32_t   cnt;
>> +
>> +   start_time = odp_time_local();
>> +   end_time   = odp_time_sum(start_time,
>> + odp_time_local_from_ns(nanoseconds));
>> +
>> +   while (odp_time_cmp(odp_time_local(), end_time) < 0)
>> +   for (cnt = 1; cnt <= 10; cnt++)
>> +   busy_wait_counter++;
>> +}
>>
> incrementing cnt looks like hack. I think odp_cpu_pause() can be used here.
>
> Maxim.
> ___
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv3 4/6] test/validation/traffic_mngr: Add the new traffic_mngr tests.

2016-02-18 Thread Maxim Uvarov

On 02/18/16 05:03, Bill Fischofer wrote:

+   odp_pool_param_init(_param);
+   odp_pktio_param_init(_param);
+
+   pktio_param.in_mode = ODP_PKTIN_MODE_DIRECT;
+   pool_param.pkt.num  = 10 * MAX_PKTS;
+   pool_param.type = ODP_POOL_PACKET;


Just my preference to have init code as match as possible to setting code.


Maxim.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv3 4/6] test/validation/traffic_mngr: Add the new traffic_mngr tests.

2016-02-18 Thread Maxim Uvarov

On 02/18/16 05:03, Bill Fischofer wrote:

+
+static odp_bool_t approx_eq32(uint32_t val, uint32_t correct)
+{
+   uint64_t low_bound, val_times_100, high_bound;
+
+   if (val == correct)
+   return true;
+
+   low_bound = 98  * (uint64_t)correct;
+   val_times_100 = 100 * (uint64_t)val;
+   high_bound= 102 * (uint64_t)correct;
+
+   if ((low_bound <= val_times_100) && (val_times_100 <= high_bound))
+   return true;
+   else
+   return false;
+}


usually checkpatch.pl warns that else  word is not needed here.

I just realized that in some places in code we use TRUE and FALSE, in 
other places it's true and false,
and current odp_bool_t is int and api does not say which exactly values 
it wants to see.


Maxim.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [API-NEXT PATCHv3 4/6] test/validation/traffic_mngr: Add the new traffic_mngr tests.

2016-02-18 Thread Maxim Uvarov

On 02/18/16 05:03, Bill Fischofer wrote:

+static void busy_wait(uint64_t nanoseconds)
+{
+   odp_time_t start_time, end_time;
+   uint32_t   cnt;
+
+   start_time = odp_time_local();
+   end_time   = odp_time_sum(start_time,
+ odp_time_local_from_ns(nanoseconds));
+
+   while (odp_time_cmp(odp_time_local(), end_time) < 0)
+   for (cnt = 1; cnt <= 10; cnt++)
+   busy_wait_counter++;
+}

incrementing cnt looks like hack. I think odp_cpu_pause() can be used here.

Maxim.
___
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp