From: Florian Fainelli <florian.fainelli@broadcom.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <florian.fainelli@broadcom.com>,
Doug Berger <opendmb@gmail.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Tariq Toukan <tariqt@nvidia.com>, Gal Pressman <gal@nvidia.com>,
Willem de Bruijn <willemb@google.com>,
Daniil Tatianin <d-tatianin@yandex-team.ru>,
Simon Horman <horms@kernel.org>,
Justin Chen <justin.chen@broadcom.com>,
Ratheesh Kannoth <rkannoth@marvell.com>,
Joe Damato <jdamato@fastly.com>,
Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
Jiri Pirko <jiri@resnulli.us>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH net-next 5/5] net: bcmgenet: Interrogate PHY for WAKE_FILTER programming
Date: Wed, 25 Oct 2023 10:33:00 -0700 [thread overview]
Message-ID: <20231025173300.1776832-6-florian.fainelli@broadcom.com> (raw)
In-Reply-To: <20231025173300.1776832-1-florian.fainelli@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 2516 bytes --]
Determine whether the PHY can support waking up from the user programmed
network filter, and if it can utilize it.
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 16 ++++++++++++++++
drivers/net/phy/bcm-phy-lib.c | 12 +++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 9282403d1bf6..9d01c13552eb 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1524,6 +1524,14 @@ static int bcmgenet_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
struct bcmgenet_priv *priv = netdev_priv(dev);
int err = 0;
+ if (dev->phydev) {
+ err = phy_ethtool_set_rxnfc(dev->phydev, cmd);
+ if (err != -EOPNOTSUPP)
+ return err;
+
+ err = 0;
+ }
+
switch (cmd->cmd) {
case ETHTOOL_SRXCLSRLINS:
err = bcmgenet_insert_flow(dev, cmd);
@@ -1579,6 +1587,14 @@ static int bcmgenet_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
int err = 0;
int i = 0;
+ if (dev->phydev) {
+ err = phy_ethtool_get_rxnfc(dev->phydev, cmd, rule_locs);
+ if (err != -EOPNOTSUPP)
+ return err;
+
+ err = 0;
+ }
+
switch (cmd->cmd) {
case ETHTOOL_GRXRINGS:
cmd->data = priv->hw_params->rx_queues ?: 1;
diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c
index cfbeedc5ee81..569aeab68f97 100644
--- a/drivers/net/phy/bcm-phy-lib.c
+++ b/drivers/net/phy/bcm-phy-lib.c
@@ -888,6 +888,15 @@ int bcm_phy_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
if (wol->wolopts & WAKE_FILTER)
goto program_ctl;
+ /* Enabling options other than WAKE_FILTER nullifies the one and only
+ * network rule that we support.
+ */
+ if (!(wol->wolopts & WAKE_FILTER)) {
+ ret = bcm_phy_write_exp(phydev, BCM54XX_WOL_SEC_KEY_8B, 0);
+ if (ret < 0)
+ return ret;
+ }
+
/* When using WAKE_MAGIC, we program the magic pattern filter to match
* the device's MAC address and we accept any MAC DA in the Ethernet
* frame.
@@ -1175,9 +1184,10 @@ static int bcm_phy_set_rule(struct phy_device *phydev,
da = nfc->fs.m_u.ether_spec.h_dest;
for (i = 0; i < ETH_ALEN / 2; i++) {
+ u16 mask = da[i * 2] << 8 | da[i * 2 + 1];
ret = bcm_phy_write_exp(phydev,
BCM54XX_WOL_MASK(2 - i),
- da[i * 2] << 8 | da[i * 2 + 1]);
+ ~mask);
if (ret < 0)
return ret;
}
--
2.34.1
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]
next prev parent reply other threads:[~2023-10-25 17:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 17:32 [PATCH net-next 0/5] WAKE_FILTER for Broadcom PHY (v2) Florian Fainelli
2023-10-25 17:32 ` [PATCH net-next 1/5] net: ethtool: Make RXNFC walking code accept a callback Florian Fainelli
2023-10-25 17:32 ` [PATCH net-next 2/5] net: ethtool: Add validation for WAKE_FILTER Florian Fainelli
2023-10-25 17:32 ` [PATCH net-next 3/5] net: phy: Add pluming for ethtool_{get,set}_rxnfc Florian Fainelli
2023-10-25 17:32 ` [PATCH net-next 4/5] net: phy: broadcom: Add support for WAKE_FILTER Florian Fainelli
2023-10-26 1:10 ` Vincent MAILHOL
2023-10-26 2:13 ` Vincent MAILHOL
2023-10-26 17:55 ` Florian Fainelli
2023-10-26 21:56 ` Jakub Kicinski
2023-10-26 22:26 ` Florian Fainelli
2023-10-27 2:50 ` Vincent MAILHOL
2023-10-25 17:33 ` Florian Fainelli [this message]
2023-10-25 17:37 ` [PATCH net-next 5/5] net: bcmgenet: Interrogate PHY for WAKE_FILTER programming Florian Fainelli
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=20231025173300.1776832-6-florian.fainelli@broadcom.com \
--to=florian.fainelli@broadcom.com \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=d-tatianin@yandex-team.ru \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=jdamato@fastly.com \
--cc=jiri@resnulli.us \
--cc=justin.chen@broadcom.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mailhol.vincent@wanadoo.fr \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=tariqt@nvidia.com \
--cc=vladimir.oltean@nxp.com \
--cc=willemb@google.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