[PATCH] examples/distributor: update dynamic configuration

Omer Yamac omer.yamac at ceng.metu.edu.tr
Tue Jun 28 13:06:26 CEST 2022


Hi David,

I have one more question. When I was working on new patch, I just want 
to make sure what we are doing.
On 27.06.2022 18:51, Hunt, David wrote:
> Hi Ömer,
> 
> I've a few comments:
> 
> On 21/06/2022 21:15, Abdullah Ömer Yamaç wrote:
--clipped--
>> @@ -39,6 +39,7 @@ volatile uint8_t quit_signal_rx;
>>   volatile uint8_t quit_signal_dist;
>>   volatile uint8_t quit_signal_work;
>>   unsigned int power_lib_initialised;
>> +bool enable_lcore_rx_distributor;
>>     static volatile struct app_stats {
>>   	struct {
--clipped--
>> @@ -724,7 +794,12 @@ main(int argc, char *argv[])
>>   	if (ret < 0)
>>   		rte_exit(EXIT_FAILURE, "Invalid distributor parameters\n");
>>   -	if (rte_lcore_count() < 5)
>> +	if (enable_lcore_rx_distributor)
>> +		num_workers = rte_lcore_count() - 3;
>> +	else
>> +		num_workers = rte_lcore_count() - 4;
>> +
> 
> This could be "num_workers = rte_lcore_count() - (4 -
> enable_lcore_rx_distributor)".
> 
For the "if-else" case of enable_lcore_rx_distributor, we will reduce 
the line of codes; but I am not sure about that change. Because the type 
of the variable is bool and we are using arithmetic operation on that 
variable. I think it is a little bit harder for people to understand 
operation. Am I right? I can suggest one more solution. We may change 
the data type to "unsigned int" or Is it okay to leave as before?

--clipped--


More information about the dev mailing list