All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nithin Nayak Sujir" <nsujir@broadcom.com>
To: "Joe Perches" <joe@perches.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	stable@vger.kernel.org, "Michael Chan" <mchan@broadcom.com>
Subject: Re: [PATCH net 1/2] tg3: Skip powering down function 0 on certain serdes devices
Date: Mon, 13 May 2013 11:31:21 -0700	[thread overview]
Message-ID: <51913179.7080204@broadcom.com> (raw)
In-Reply-To: <1368469301.1913.24.camel@joe-AO722>



On 05/13/2013 11:21 AM, Joe Perches wrote:
> On Mon, 2013-05-13 at 11:03 -0700, Nithin Nayak Sujir wrote:
>> On the 5718, 5719 and 5720 serdes devices, powering down function 0
>> results in all the other ports being powered down. Add code to skip
>> function 0 power down.
>>
>> Cc: <stable@vger.kernel.org>
>> Signed-off-by: Michael Chan <mchan@broadcom.com>
>> Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
>> ---
>>   drivers/net/ethernet/broadcom/tg3.c | 24 ++++++++++++++++++------
>>   1 file changed, 18 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
>> index 728d42a..737f035 100644
>> --- a/drivers/net/ethernet/broadcom/tg3.c
>> +++ b/drivers/net/ethernet/broadcom/tg3.c
>> @@ -2957,6 +2957,23 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed)
>>   	return 0;
>>   }
>>
>> +static bool tg3_phy_power_bug(struct tg3 *tp)
>> +{
>> +	if (tg3_asic_rev(tp) == ASIC_REV_5700 ||
>> +	    tg3_asic_rev(tp) == ASIC_REV_5704 ||
>> +	    (tg3_asic_rev(tp) == ASIC_REV_5780 &&
>> +	     (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) ||
>> +	    (tg3_asic_rev(tp) == ASIC_REV_5717 &&
>> +	     !tp->pci_fn) ||
>> +	    ((tg3_asic_rev(tp) == ASIC_REV_5719 ||
>> +	      tg3_asic_rev(tp) == ASIC_REV_5720) &&
>> +	     (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) &&
>> +	     !tp->pci_fn))
>> +		return true;
>
> I think this would be a lot easier to read and
> more easily extended using a switch/case like:
>

Will do, I'll resubmit with this change.

> static bool tg3_phy_power_bug(struct tg3 *tp)
> {
> 	switch (tg3_asic_rev(tp)) {
> 	case ASIC_REV_5700:
> 	case ASIC_REV_5704:
> 		return true;
> 	case ASIC_REV_5717:
> 		if (!tp_>pci_fn)
> 			return true;
> 		return false;
> 	case ASIC_REV_5719:
> 	case ASIC_REV_5720:
> 		if ((tp_>phy_flags & TG3_PHYFLG_PHY_SERDES) &&
> 		    !tp->pci_fn)
> 			return true;
> 		return false;
> 	case ASIC_REV_5780:
> 		if (tp->phy_flags & TG3_PHYFLG_MII_SERDES)
> 			return true;
> 		return false;
> 	}
>
> 	return false;
> }
>
>
>

  reply	other threads:[~2013-05-13 18:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 18:03 [PATCH net 0/2] tg3: 2 bugfixes - TSO data corruption and phy power down Nithin Nayak Sujir
2013-05-13 18:03 ` [PATCH net 1/2] tg3: Skip powering down function 0 on certain serdes devices Nithin Nayak Sujir
2013-05-13 18:21   ` Joe Perches
2013-05-13 18:31     ` Nithin Nayak Sujir [this message]
2013-05-13 18:03 ` [PATCH net 2/2] tg3: Fix data corruption on 5725 with TSO Nithin Nayak Sujir

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51913179.7080204@broadcom.com \
    --to=nsujir@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=joe@perches.com \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.