[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <89ffac90-0293-4621-8178-99120af354ef@linux.intel.com>
Date: Sat, 6 Jul 2024 00:52:29 +0800
From: "Abdul Rahim, Faizal" <faizal.abdul.rahim@...ux.intel.com>
To: Simon Horman <horms@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Tony Nguyen <anthony.l.nguyen@...el.com>,
Vinicius Costa Gomes <vinicius.gomes@...el.com>,
intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH iwl-net v1 2/4] igc: Fix reset adapter logics when tx mode
change
>> ---
>> drivers/net/ethernet/intel/igc/igc_tsn.c | 26 +++++++++++++++++++++---
>> 1 file changed, 23 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
>> index 02dd41aff634..61f047ebf34d 100644
>> --- a/drivers/net/ethernet/intel/igc/igc_tsn.c
>> +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
>> @@ -49,6 +49,13 @@ static unsigned int igc_tsn_new_flags(struct igc_adapter *adapter)
>> return new_flags;
>> }
>>
>> +static bool igc_tsn_is_tx_mode_in_tsn(struct igc_adapter *adapter)
>> +{
>> + struct igc_hw *hw = &adapter->hw;
>> +
>> + return (bool)(rd32(IGC_TQAVCTRL) & IGC_TQAVCTRL_TRANSMIT_MODE_TSN);
>
> Perhaps it is more a question of taste than anything else.
> But my preference, FIIW, is to avoid casts.
> And I think in this case using !! is a common pattern.
>
> (Completely untested!)
>
> return !!(rd32(IGC_TQAVCTRL) & IGC_TQAVCTRL_TRANSMIT_MODE_TSN);
>
Sure, will update.
>> +
>> + if ((any_tsn_enabled && !igc_tsn_is_tx_mode_in_tsn(adapter)) ||
>> + (!any_tsn_enabled && igc_tsn_is_tx_mode_in_tsn(adapter)))
>> + return true;
>> + else
>> + return false;
>
> Likewise, this is probably more a matter of taste than anything else.
> But I think this could be expressed as:
>
> (Completely untested!)
>
> return (any_tsn_enabled && !igc_tsn_is_tx_mode_in_tsn(adapter)) ||
> (!any_tsn_enabled && igc_tsn_is_tx_mode_in_tsn(adapter));
>
> Similarly in the previous patch of this series.
>
Will update, your suggestion is better, lesser parenthesis.
Thanks.
Powered by blists - more mailing lists