linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"Ar__n__ __NAL" <arinc.unal@arinc9.com>,
	Daniel Golle <daniel@makrotopia.org>,
	"David S. Miller" <davem@davemloft.net>,
	DENG Qingfang <dqfext@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
	Sean Wang <sean.wang@mediatek.com>,
	Simon Horman <horms@kernel.org>,
	UNGLinuxDriver@microchip.com, Vladimir Oltean <olteanv@gmail.com>,
	Woojung Huh <woojung.huh@microchip.com>
Subject: [PATCH net-next 2/9] net: dsa: add hook to determine whether EEE is supported
Date: Tue, 10 Dec 2024 14:18:16 +0000	[thread overview]
Message-ID: <E1tL144-006cZD-El@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <Z1hNkEb13FMuDQiY@shell.armlinux.org.uk>

Add a hook to determine whether the switch supports EEE. This will
return false if the switch does not, or true if it does. If the
method is not implemented, we assume (currently) that the switch
supports EEE.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 include/net/dsa.h | 1 +
 net/dsa/user.c    | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index 72ae65e7246a..aaa75bbaa0ea 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -988,6 +988,7 @@ struct dsa_switch_ops {
 	/*
 	 * Port's MAC EEE settings
 	 */
+	bool	(*support_eee)(struct dsa_switch *ds, int port);
 	int	(*set_mac_eee)(struct dsa_switch *ds, int port,
 			       struct ethtool_keee *e);
 	int	(*get_mac_eee)(struct dsa_switch *ds, int port,
diff --git a/net/dsa/user.c b/net/dsa/user.c
index 0640247b8f0a..b54f61605a57 100644
--- a/net/dsa/user.c
+++ b/net/dsa/user.c
@@ -1228,6 +1228,10 @@ static int dsa_user_set_eee(struct net_device *dev, struct ethtool_keee *e)
 	struct dsa_switch *ds = dp->ds;
 	int ret;
 
+	/* Check whether the switch supports EEE */
+	if (ds->ops->support_eee && !ds->ops->support_eee(ds, dp->index))
+		return -EOPNOTSUPP;
+
 	/* Port's PHY and MAC both need to be EEE capable */
 	if (!dev->phydev)
 		return -ENODEV;
@@ -1248,6 +1252,10 @@ static int dsa_user_get_eee(struct net_device *dev, struct ethtool_keee *e)
 	struct dsa_switch *ds = dp->ds;
 	int ret;
 
+	/* Check whether the switch supports EEE */
+	if (ds->ops->support_eee && !ds->ops->support_eee(ds, dp->index))
+		return -EOPNOTSUPP;
+
 	/* Port's PHY and MAC both need to be EEE capable */
 	if (!dev->phydev)
 		return -ENODEV;
-- 
2.30.2



  parent reply	other threads:[~2024-12-10 14:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 14:17 [PATCH net-next 0/9] net: dsa: cleanup EEE (part 1) Russell King (Oracle)
2024-12-10 14:18 ` [PATCH net-next 1/9] net: dsa: remove check for dp->pl in EEE methods Russell King (Oracle)
2024-12-10 17:29   ` Florian Fainelli
2024-12-10 14:18 ` Russell King (Oracle) [this message]
2024-12-10 19:34   ` [PATCH net-next 2/9] net: dsa: add hook to determine whether EEE is supported Florian Fainelli
2024-12-10 14:18 ` [PATCH net-next 3/9] net: dsa: provide implementation of .support_eee() Russell King (Oracle)
2024-12-10 17:29   ` Florian Fainelli
2024-12-10 14:18 ` [PATCH net-next 4/9] net: dsa: b53/bcm_sf2: implement .support_eee() method Russell King (Oracle)
2024-12-10 17:30   ` Florian Fainelli
2024-12-10 14:18 ` [PATCH net-next 5/9] net: dsa: mt753x: " Russell King (Oracle)
2024-12-10 17:30   ` Florian Fainelli
2024-12-10 21:45   ` arinc.unal
2024-12-10 14:18 ` [PATCH net-next 6/9] net: dsa: qca8k: " Russell King (Oracle)
2024-12-10 17:30   ` Florian Fainelli
2024-12-10 14:18 ` [PATCH net-next 7/9] net: dsa: mv88e6xxx: " Russell King (Oracle)
2024-12-10 17:30   ` Florian Fainelli
2024-12-10 14:18 ` [PATCH net-next 8/9] net: dsa: ksz: " Russell King (Oracle)
2024-12-10 17:30   ` Florian Fainelli
2024-12-10 14:18 ` [PATCH net-next 9/9] net: dsa: require .support_eee() method to be implemented Russell King (Oracle)
2024-12-10 17:31   ` Florian Fainelli
2024-12-11 15:59 ` [PATCH net-next 0/9] net: dsa: cleanup EEE (part 1) Vladimir Oltean
2024-12-11 16:00 ` Vladimir Oltean
2024-12-12  4:40 ` patchwork-bot+netdevbpf

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=E1tL144-006cZD-El@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=arinc.unal@arinc9.com \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.com \
    --cc=woojung.huh@microchip.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;
as well as URLs for NNTP newsgroup(s).