diff mbox series

[net-next,2/2] net: phy: broadcom: Add support for WAKE_MDA

Message ID 20231011221242.4180589-4-florian.fainelli@broadcom.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Add WAKE_MDA Wake-on-LAN option | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1361 this patch: 1361
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 1386 this patch: 1386
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1386 this patch: 1386
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Florian Fainelli Oct. 11, 2023, 10:12 p.m. UTC
Add support for waking-up from a custom MAC destination address which
involves programming the BCM54XX_WOL_MPD_DATA2() and
BCM54XX_WOL_MASK() register groups.

Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 drivers/net/phy/bcm-phy-lib.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c
index 876f28fd8256..00c0424f7b63 100644
--- a/drivers/net/phy/bcm-phy-lib.c
+++ b/drivers/net/phy/bcm-phy-lib.c
@@ -827,7 +827,8 @@  EXPORT_SYMBOL_GPL(bcm_phy_cable_test_get_status_rdb);
 					 WAKE_MCAST | \
 					 WAKE_BCAST | \
 					 WAKE_MAGIC | \
-					 WAKE_MAGICSECURE)
+					 WAKE_MAGICSECURE | \
+					 WAKE_MDA)
 
 int bcm_phy_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
 {
@@ -908,6 +909,8 @@  int bcm_phy_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
 			eth_broadcast_addr(da);
 		} else if (wol->wolopts & WAKE_MAGICSECURE) {
 			ether_addr_copy(da, wol->sopass);
+		} else if (wol->wolopts & WAKE_MDA) {
+			ether_addr_copy(da, wol->mac_da);
 		} else if (wol->wolopts & WAKE_MAGIC) {
 			memset(da, 0, sizeof(da));
 			memset(mask, 0xff, sizeof(mask));
@@ -1010,6 +1013,8 @@  void bcm_phy_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
 	}
 
 	if (ctl & BCM54XX_WOL_DIR_PKT_EN) {
+		memcpy(wol->mac_da, da, sizeof(da));
+		wol->wolopts |= WAKE_MDA;
 		if (is_broadcast_ether_addr(da))
 			wol->wolopts |= WAKE_BCAST;
 		else if (is_multicast_ether_addr(da))