From: John Crispin <john@phrozen.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
qsdk-review@qca.qualcomm.com
Subject: Re: [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family
Date: Tue, 13 Sep 2016 10:04:49 +0200 [thread overview]
Message-ID: <7f9c1463-1cc0-e230-e7fe-dbb434427251@phrozen.org> (raw)
In-Reply-To: <20160913004047.GB3585@lunn.ch>
On 13/09/2016 02:40, Andrew Lunn wrote:
>> > +static int
>> > +qca8k_get_eee(struct dsa_switch *ds, int port,
>> > + struct ethtool_eee *e)
>> > +{
>> > + struct qca8k_priv *priv = qca8k_to_priv(ds);
>> > + struct ethtool_eee *p = &priv->port_sts[qca8k_phy_to_port(port)].eee;
>> > + u32 lp, adv, supported;
>> > + u16 val;
>> > +
>> > + /* The switch has no way to tell the result of the AN so we need to
>> > + * read the result directly from the PHYs MMD registers
>> > + */
>> > + val = qca8k_phy_mmd_read(priv, port, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE);
>> > + supported = mmd_eee_cap_to_ethtool_sup_t(val);
>> > +
>> > + val = qca8k_phy_mmd_read(priv, port, MDIO_MMD_AN, MDIO_AN_EEE_ADV);
>> > + adv = mmd_eee_adv_to_ethtool_adv_t(val);
>> > +
>> > + val = qca8k_phy_mmd_read(priv, port, MDIO_MMD_AN, MDIO_AN_EEE_LPABLE);
>> > + lp = mmd_eee_adv_to_ethtool_adv_t(val);
>> > +
>> > + e->eee_enabled = p->eee_enabled;
>> > + e->eee_active = !!(supported & adv & lp);
>> > +
>> > + return 0;
>> > +}
> Couldn't you just call phy_ethtool_get_eee(phydev)? Then you don't
> need qca8k_phy_mmd_read()?
Hi Andrew,
this function does indeed duplicate the functionality of
phy_ethtool_get_eee() with the small difference, that e->eee_active is
also set which phy_ethtool_get_eee() does not set.
dsa_slave_get_eee() will call phy_ethtool_get_eee() right after the
get_eee() op has been called. would it be ok to move the code setting
eee_active to phy_ethtool_get_eee(). if thats possible then we could
just have a stub inside the dsa driver with a note saying that the dsa
layer will do the magic for us.
John
next prev parent reply other threads:[~2016-09-13 8:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-12 8:35 [PATCH 0/3] net-next: dsa: add QCA8K support John Crispin
2016-09-12 8:35 ` [PATCH 1/3] Documentation: devicetree: add qca8k binding John Crispin
2016-09-12 11:53 ` Sergei Shtylyov
2016-09-12 8:35 ` [PATCH 2/3] net-next: dsa: add Qualcomm tag RX/TX handler John Crispin
2016-09-12 12:26 ` Andrew Lunn
2016-09-12 8:35 ` [PATCH 3/3] net-next: dsa: add new driver for qca8xxx family John Crispin
2016-09-12 13:16 ` Andrew Lunn
2016-09-12 22:52 ` Andrew Lunn
2016-09-13 0:40 ` Andrew Lunn
2016-09-13 8:04 ` John Crispin [this message]
2016-09-13 15:59 ` Andrew Lunn
2016-09-13 17:09 ` Florian Fainelli
2016-09-13 18:07 ` John Crispin
2016-09-13 18:11 ` Florian Fainelli
2016-09-13 1:23 ` Andrew Lunn
2016-09-13 9:40 ` John Crispin
2016-09-13 13:14 ` Andrew Lunn
2016-09-13 17:11 ` Vivien Didelot
2016-09-13 19:07 ` Andrew Lunn
2016-09-13 19:10 ` John Crispin
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=7f9c1463-1cc0-e230-e7fe-dbb434427251@phrozen.org \
--to=john@phrozen.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=qsdk-review@qca.qualcomm.com \
/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
Powered by JetHome