[dpdk-dev] [PATCH v3 8/9] net/ionic: minor refactorings and helper variables

Andrew Boyer aboyer at pensando.io
Wed Dec 9 15:39:22 CET 2020



> On Dec 9, 2020, at 8:04 AM, Ferruh Yigit <ferruh.yigit at intel.com> wrote:
> 
> On 12/4/2020 8:16 PM, Andrew Boyer wrote:
>> This makes the code clearer and conserves resources.
>> Signed-off-by: Andrew Boyer <aboyer at pensando.io>
>> ---
>>  drivers/net/ionic/ionic_ethdev.c |  5 ++---
>>  drivers/net/ionic/ionic_lif.c    | 15 ++++++++++-----
>>  drivers/net/ionic/ionic_main.c   | 18 +++++++-----------
>>  3 files changed, 19 insertions(+), 19 deletions(-)
>> diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
>> index ce6ca9671..a1c35ace3 100644
>> --- a/drivers/net/ionic/ionic_ethdev.c
>> +++ b/drivers/net/ionic/ionic_ethdev.c
>> @@ -901,7 +901,7 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
>>  	struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
>>  	struct ionic_adapter *adapter = lif->adapter;
>>  	struct ionic_dev *idev = &adapter->idev;
>> -	uint32_t allowed_speeds;
>> +	uint32_t speed, allowed_speeds;
>>  	int err;
>>    	IONIC_PRINT_CALL();
>> @@ -929,8 +929,7 @@ ionic_dev_start(struct rte_eth_dev *eth_dev)
>>  	}
>>    	if (eth_dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED) {
>> -		uint32_t speed = ionic_parse_link_speeds(dev_conf->link_speeds);
>> -
>> +		speed = ionic_parse_link_speeds(dev_conf->link_speeds);
>>  		if (speed)
>>  			ionic_dev_cmd_port_speed(idev, speed);
>>  	}
> 
> Same comment from previous version, what is the reason to increase the scope of the 'speed' variable?
> Functionality is same and isn't it better to have reduced scope?

In a future patch I will be redesigning this code block and speed will have function scope.

I have tried to break things up into digestible bits. Is this not acceptable?

-Andrew


More information about the dev mailing list