On 5/21/2020 4:37 PM, Thomas Monjalon wrote:
> 21/05/2020 17:10, Ferruh Yigit:
>> During MTU set (kni_change_mtu) sample application setup queues, which
>> can free and re-allocate queues.
>> Meanwhile sample application keeps continues in Rx/Tx burst calls in
>> different threads, which may cause crash during queue setup.
>>
>> Pausing application Rx/Tx calls before MTU set and starts it back
>> afterwards.
>>
>> Bugzilla ID: 482
>> Fixes: a26b116749a3 ("examples/kni: fix MTU change to setup Tx queue")
>> Cc: sta...@dpdk.org
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yi...@intel.com>
>> ---
>> -/* Callback for request of changing MTU */
>>  static int
>> -kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
>> +kni_change_mtu_(uint16_t port_id, unsigned int new_mtu)
> [...]
>> +/* Callback for request of changing MTU */
>> +static int
>> +kni_change_mtu(uint16_t port_id, unsigned int new_mtu)
>> +{
>> +    int ret;
>> +
>> +    rte_atomic32_inc(&kni_pause);
>> +    ret =  kni_change_mtu_(port_id, new_mtu);
>> +    rte_atomic32_dec(&kni_pause);
>> +
>> +    return ret;
>> +}
> 
> Why creating a new function which is called only once?
> 

Just wrapping the existing one with stop/start the forwarding.

These can be added into the existing function but there are many exit points in
the function, so it will create more clutter and it is more error prone. I think
this way more simple and clear.

Reply via email to