lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <6DD3D5EDF01AE3F5+20230605095527.57898-2-mengyuanlou@net-swift.com>
Date: Mon,  5 Jun 2023 17:52:50 +0800
From: Mengyuan Lou <mengyuanlou@...-swift.com>
To: netdev@...r.kernel.org
Cc: jiawenwu@...stnetic.com,
	Mengyuan Lou <mengyuanlou@...-swift.com>
Subject: [RFC,PATCH net-next 1/3] net: ngbe: add Wake on Lan support

Implement ethtool_ops get_wol.
Implement Wake-on-LAN support.

Magic packets are checked by fw, for now just support
WAKE_MAGIC and do not supoort to set_wol.

Signed-off-by: Mengyuan Lou <mengyuanlou@...-swift.com>
---
 drivers/net/ethernet/wangxun/ngbe/ngbe_ethtool.c | 10 ++++++++++
 drivers/net/ethernet/wangxun/ngbe/ngbe_main.c    |  1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_ethtool.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_ethtool.c
index 5b25834baf38..2bc54fdafb31 100644
--- a/drivers/net/ethernet/wangxun/ngbe/ngbe_ethtool.c
+++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_ethtool.c
@@ -8,12 +8,22 @@
 #include "../libwx/wx_ethtool.h"
 #include "ngbe_ethtool.h"
 
+static void ngbe_get_wol(struct net_device *netdev,
+			 struct ethtool_wolinfo *wol)
+{
+	if (!netdev->wol_enabled)
+		return;
+	wol->supported = WAKE_MAGIC;
+	wol->wolopts = WAKE_MAGIC;
+}
+
 static const struct ethtool_ops ngbe_ethtool_ops = {
 	.get_drvinfo		= wx_get_drvinfo,
 	.get_link		= ethtool_op_get_link,
 	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
 	.set_link_ksettings	= phy_ethtool_set_link_ksettings,
 	.nway_reset		= phy_ethtool_nway_reset,
+	.get_wol		= ngbe_get_wol,
 };
 
 void ngbe_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
index c99a5d3de72e..5d013ac3acd1 100644
--- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
+++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
@@ -628,6 +628,7 @@ static int ngbe_probe(struct pci_dev *pdev,
 	wr32(wx, NGBE_PSR_WKUP_CTL, wx->wol);
 
 	device_set_wakeup_enable(&pdev->dev, wx->wol);
+	netdev->wol_enabled = wx->wol_enabled;
 
 	/* Save off EEPROM version number and Option Rom version which
 	 * together make a unique identify for the eeprom
-- 
2.41.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ