[PATCH] examples/distributor: update dynamic configuration

Hunt, David david.hunt at intel.com
Tue Jun 28 13:25:45 CEST 2022


On 28/06/2022 12:06, Omer Yamac wrote:
> 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--


Hi Ömer,

    You raise a good point about readability. Let's leave it as you had 
it originally.  Maybe just add a couple of one-line comments? "rx and 
distributor combined, 3 fixed function cores" and "separate rx and 
distributor, 4 fixed function cores?

Rgds,
Dave.




More information about the dev mailing list