From: Michael Chan <michael.chan@broadcom.com>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 05/10] bnxt_en: Add get_eee() and set_eee() ethtool support.
Date: Tue, 5 Apr 2016 03:36:23 -0700 [thread overview]
Message-ID: <CACKFLinJMDC52Bbc_OFQLFAJuoC-DC5kdawkRo1J75Q5v3XOpA@mail.gmail.com> (raw)
In-Reply-To: <1459850858.23351.45.camel@decadent.org.uk>
On Tue, Apr 5, 2016 at 3:07 AM, Ben Hutchings <ben@decadent.org.uk> wrote:
> On Tue, 2016-04-05 at 04:22 -0400, Michael Chan wrote:
>
>> Allow users to get|set EEE parameters.
>>
>> Signed-off-by: Michael Chan <michael.chan@broadcom.com>
>> ---
>> drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 73 +++++++++++++++++++++++
>> 1 file changed, 73 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
>> index 14f0520..3d5c64f 100644
>> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
>> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
>> @@ -1379,6 +1379,77 @@ static int bnxt_set_eeprom(struct net_device *dev,
>> eeprom->len);
>> }
>>
>> +static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata)
>> +{
>> + struct bnxt *bp = netdev_priv(dev);
>> + struct ethtool_eee *eee = &bp->eee;
>> + struct bnxt_link_info *link_info = &bp->link_info;
>> + u32 advertising =
>> + _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0);
>> + int rc = 0;
>> +
>> + if (BNXT_VF(bp))
>> + return 0;
>> +
>> + if (!(bp->flags & BNXT_FLAG_EEE_CAP))
>> + return -EOPNOTSUPP;
>> +
>> + if (!edata->eee_enabled)
>> + goto eee_ok;
> [...]
>> + eee->advertised = edata->advertised;
>> + eee->tx_lpi_enabled = edata->tx_lpi_enabled;
>> + eee->tx_lpi_timer = edata->tx_lpi_timer;
>> +eee_ok:
>> + eee->eee_enabled = edata->eee_enabled;
>> +
>> + if (netif_running(dev))
>> + rc = bnxt_hwrm_set_link_setting(bp, false, true);
>> +
>> + return rc;
>> +}
>> +
>> +static int bnxt_get_eee(struct net_device *dev, struct ethtool_eee *edata)
>> +{
>> + struct bnxt *bp = netdev_priv(dev);
>> +
>> + if (!(bp->flags & BNXT_FLAG_EEE_CAP))
>> + return -EOPNOTSUPP;
>> +
>> + *edata = bp->eee;
>> + if (!bp->eee.eee_enabled) {
>> + edata->advertised = 0;
>> + edata->tx_lpi_enabled = 0;
>
> What about tx_lpi_timer?
We want to keep the tx_lpi_timer value so that it can be used again
when it is turned on again.
The user doesn't have to figure out what value to use if he just wants
to use the default or the last value.
>
> And, wouldn't it make more sense to do these fixups to the internal
> state in bnxt_set_eee()?
I don't understand. If the user is enabling EEE, we take all the
parameters. If he is disabling, we don't take any of the parameters.
>
> Ben.
>
>> + }
>> +
>> + if (!bp->eee.eee_active)
>> + edata->lp_advertised = 0;
>> +
>> + return 0;
>> +}
> [...]
>
> --
> Ben Hutchings
> No political challenge can be met by shopping. - George Monbiot
next prev parent reply other threads:[~2016-04-05 10:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-05 8:22 [PATCH net-next 00/10] bnxt_en: Updates for net-next Michael Chan
2016-04-05 8:22 ` [PATCH net-next 01/10] bnxt_en: Update to Firmware 1.2.2 spec Michael Chan
2016-04-05 8:22 ` [PATCH net-next 02/10] bnxt_en: Improve flow control autoneg with Firmware 1.2.1 interface Michael Chan
2016-04-05 8:22 ` [PATCH net-next 03/10] bnxt_en: Add basic EEE support Michael Chan
2016-04-05 8:22 ` [PATCH net-next 04/10] bnxt_en: Add EEE setup code Michael Chan
2016-04-05 8:22 ` [PATCH net-next 05/10] bnxt_en: Add get_eee() and set_eee() ethtool support Michael Chan
2016-04-05 10:07 ` Ben Hutchings
2016-04-05 10:36 ` Michael Chan [this message]
2016-04-05 21:22 ` Ben Hutchings
2016-04-05 8:22 ` [PATCH net-next 06/10] bnxt_en: Set async event bits when registering with the firmware Michael Chan
2016-04-05 8:22 ` [PATCH net-next 07/10] bnxt_en: Add unsupported SFP+ module warnings Michael Chan
2016-04-05 8:22 ` [PATCH net-next 08/10] bnxt_en: Provide NVM information via Ethtool GEEPROM Michael Chan
2016-04-05 8:22 ` [PATCH net-next 09/10] bnxt_en: Check for valid forced speed during ethtool -s Michael Chan
2016-04-05 8:22 ` [PATCH net-next 10/10] bnxt_en: Improve ethtool .get_settings() Michael Chan
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=CACKFLinJMDC52Bbc_OFQLFAJuoC-DC5kdawkRo1J75Q5v3XOpA@mail.gmail.com \
--to=michael.chan@broadcom.com \
--cc=ben@decadent.org.uk \
--cc=davem@davemloft.net \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).