summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2007-12-10 02:31:00 +0000
committersam <sam@FreeBSD.org>2007-12-10 02:31:00 +0000
commit08954540f840d7da2963bbfea3f07480e5b0b7d2 (patch)
treeb8d5c084c22d011d28f55f854b6d93c1ab3a4349
parent3382d2b4e50841b43d672482da6054de38cfac97 (diff)
downloadFreeBSD-src-08954540f840d7da2963bbfea3f07480e5b0b7d2.zip
FreeBSD-src-08954540f840d7da2963bbfea3f07480e5b0b7d2.tar.gz
Wake On Lan (WOL) infrastructure
Submitted by: Stefan Sperling <stsp@stsp.name> Reviewed by: brooks
-rw-r--r--sbin/ifconfig/ifconfig.817
-rw-r--r--sbin/ifconfig/ifconfig.c10
-rw-r--r--sys/net/if.h8
3 files changed, 31 insertions, 4 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 05f0dc1..4dfafc1 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
-.Dd October 31, 2007
+.Dd December 8, 2007
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -387,6 +387,21 @@ large receive offloading, enable LRO on the interface.
If the driver supports
.Xr tcp 4
large receive offloading, disable LRO on the interface.
+.It Cm wol , wol_ucast , wol_mcast , wol_magic
+Enable Wake On Lan (WOL) support, if available.
+WOL is a facility whereby a machine in a low power state may be woken
+in response to a received packet.
+There are three types of packets that may wake a system:
+ucast (directed solely to the machine's mac address),
+mcast (directed to a broadcast or multicast address),
+or
+magic (unicast or multicast frames with a ``magic contents'').
+Not all devices support WOL, those that do indicate the mechanisms
+they support in their capabilities.
+.Cm wol
+is a synonym for enabling all available WOL mechanisms.
+To disable WOL use
+.Fl wol .
.It Cm vlanmtu , vlanhwtag
If the driver offers user-configurable VLAN support, enable
reception of extended frames or tag processing in hardware,
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 3ea1b31..3676396 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -746,7 +746,7 @@ setifname(const char *val, int dummy __unused, int s,
#define IFCAPBITS \
"\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \
-"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO"
+"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC"
/*
* Print the status of the interface. If an address family was
@@ -991,6 +991,14 @@ static struct cmd basic_cmds[] = {
DEF_CMD("-tso", -IFCAP_TSO, setifcap),
DEF_CMD("lro", IFCAP_LRO, setifcap),
DEF_CMD("-lro", -IFCAP_LRO, setifcap),
+ DEF_CMD("wol", IFCAP_WOL, setifcap),
+ DEF_CMD("-wol", -IFCAP_WOL, setifcap),
+ DEF_CMD("wol_ucast", IFCAP_WOL_UCAST, setifcap),
+ DEF_CMD("-wol_ucast", -IFCAP_WOL_UCAST, setifcap),
+ DEF_CMD("wol_mcast", IFCAP_WOL_MCAST, setifcap),
+ DEF_CMD("-wol_mcast", -IFCAP_WOL_MCAST, setifcap),
+ DEF_CMD("wol_magic", IFCAP_WOL_MAGIC, setifcap),
+ DEF_CMD("-wol_magic", -IFCAP_WOL_MAGIC, setifcap),
DEF_CMD("normal", -IFF_LINK0, setifflags),
DEF_CMD("compress", IFF_LINK0, setifflags),
DEF_CMD("noicmp", IFF_LINK1, setifflags),
diff --git a/sys/net/if.h b/sys/net/if.h
index a5a0e96..c649fca 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -209,9 +209,13 @@ struct if_data {
#define IFCAP_TSO4 0x0100 /* can do TCP Segmentation Offload */
#define IFCAP_TSO6 0x0200 /* can do TCP6 Segmentation Offload */
#define IFCAP_LRO 0x0400 /* can do Large Receive Offload */
+#define IFCAP_WOL_UCAST 0x0800 /* wake on any unicast frame */
+#define IFCAP_WOL_MCAST 0x1000 /* wake on any multicast frame */
+#define IFCAP_WOL_MAGIC 0x2000 /* wake on any Magic Packet */
-#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM)
-#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6)
+#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM)
+#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6)
+#define IFCAP_WOL (IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC)
#define IFQ_MAXLEN 50
#define IFNET_SLOWHZ 1 /* granularity is 1 second */
OpenPOWER on IntegriCloud