Add support to wicontrol(8) and wi(4) for enabling and configuring
power management. This will only work on newer firmware revisions; older firmware will silently ignore the attempts to turn power management on. Patches supplied by: Brad Karp <karp@eecs.harvard.edu>
This commit is contained in:
parent
1d420ca902
commit
049e649a10
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_wi.c,v 1.52 1999/05/06 16:28:02 wpaul Exp $
|
||||
* $Id: if_wi.c,v 1.53 1999/05/07 03:14:21 wpaul Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -116,7 +116,7 @@
|
||||
|
||||
#if !defined(lint)
|
||||
static const char rcsid[] =
|
||||
"$Id: if_wi.c,v 1.52 1999/05/06 16:28:02 wpaul Exp $";
|
||||
"$Id: if_wi.c,v 1.53 1999/05/07 03:14:21 wpaul Exp $";
|
||||
#endif
|
||||
|
||||
static struct wi_softc wi_softc[NWI];
|
||||
@ -330,6 +330,8 @@ static int wi_attach(isa_dev)
|
||||
sc->wi_tx_rate = WI_DEFAULT_TX_RATE;
|
||||
sc->wi_max_data_len = WI_DEFAULT_DATALEN;
|
||||
sc->wi_create_ibss = WI_DEFAULT_CREATE_IBSS;
|
||||
sc->wi_pm_enabled = WI_DEFAULT_PM_ENABLED;
|
||||
sc->wi_max_sleep = WI_DEFAULT_MAX_SLEEP;
|
||||
|
||||
/*
|
||||
* Read the default channel from the NIC. This may vary
|
||||
@ -968,6 +970,12 @@ static void wi_setdef(sc, wreq)
|
||||
bzero(sc->wi_ibss_name, sizeof(sc->wi_ibss_name));
|
||||
bcopy((char *)&wreq->wi_val[1], sc->wi_ibss_name, 30);
|
||||
break;
|
||||
case WI_RID_PM_ENABLED:
|
||||
sc->wi_pm_enabled = wreq->wi_val[0];
|
||||
break;
|
||||
case WI_RID_MAX_SLEEP:
|
||||
sc->wi_max_sleep = wreq->wi_val[0];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1106,6 +1114,12 @@ static void wi_init(xsc)
|
||||
/* Access point density */
|
||||
WI_SETVAL(WI_RID_SYSTEM_SCALE, sc->wi_ap_density);
|
||||
|
||||
/* Power Management Enabled */
|
||||
WI_SETVAL(WI_RID_PM_ENABLED, sc->wi_pm_enabled);
|
||||
|
||||
/* Power Managment Max Sleep */
|
||||
WI_SETVAL(WI_RID_MAX_SLEEP, sc->wi_max_sleep);
|
||||
|
||||
/* Specify the IBSS name */
|
||||
WI_SETSTR(WI_RID_OWN_SSID, sc->wi_ibss_name);
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_wireg.h,v 1.30 1999/05/06 16:12:06 wpaul Exp $
|
||||
* $Id: if_wireg.h,v 1.31 1999/05/07 03:14:21 wpaul Exp $
|
||||
*/
|
||||
|
||||
struct wi_counters {
|
||||
@ -74,6 +74,8 @@ struct wi_softc {
|
||||
u_int16_t wi_tx_rate;
|
||||
u_int16_t wi_create_ibss;
|
||||
u_int16_t wi_channel;
|
||||
u_int16_t wi_pm_enabled;
|
||||
u_int16_t wi_max_sleep;
|
||||
char wi_node_name[32];
|
||||
char wi_net_name[32];
|
||||
char wi_ibss_name[32];
|
||||
@ -108,6 +110,10 @@ struct wi_softc {
|
||||
|
||||
#define WI_DEFAULT_CREATE_IBSS 0
|
||||
|
||||
#define WI_DEFAULT_PM_ENABLED 0
|
||||
|
||||
#define WI_DEFAULT_MAX_SLEEP 100
|
||||
|
||||
#define WI_DEFAULT_NODENAME "FreeBSD WaveLAN/IEEE node"
|
||||
|
||||
#define WI_DEFAULT_IBSS "FreeBSD IBSS"
|
||||
@ -464,7 +470,17 @@ struct wi_ltv_ssid {
|
||||
/*
|
||||
* Frame data size.
|
||||
*/
|
||||
#define WI_RID_MAX_DATALEN 0xFC07
|
||||
#define WI_RID_MAX_DATALEN 0xFC07
|
||||
|
||||
/*
|
||||
* ESS power management enable
|
||||
*/
|
||||
#define WI_RID_PM_ENABLED 0xFC09
|
||||
|
||||
/*
|
||||
* ESS max PM sleep internal
|
||||
*/
|
||||
#define WI_RID_MAX_SLEEP 0xFC0C
|
||||
|
||||
/*
|
||||
* Set our station name.
|
||||
|
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_wi.c,v 1.52 1999/05/06 16:28:02 wpaul Exp $
|
||||
* $Id: if_wi.c,v 1.53 1999/05/07 03:14:21 wpaul Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -116,7 +116,7 @@
|
||||
|
||||
#if !defined(lint)
|
||||
static const char rcsid[] =
|
||||
"$Id: if_wi.c,v 1.52 1999/05/06 16:28:02 wpaul Exp $";
|
||||
"$Id: if_wi.c,v 1.53 1999/05/07 03:14:21 wpaul Exp $";
|
||||
#endif
|
||||
|
||||
static struct wi_softc wi_softc[NWI];
|
||||
@ -330,6 +330,8 @@ static int wi_attach(isa_dev)
|
||||
sc->wi_tx_rate = WI_DEFAULT_TX_RATE;
|
||||
sc->wi_max_data_len = WI_DEFAULT_DATALEN;
|
||||
sc->wi_create_ibss = WI_DEFAULT_CREATE_IBSS;
|
||||
sc->wi_pm_enabled = WI_DEFAULT_PM_ENABLED;
|
||||
sc->wi_max_sleep = WI_DEFAULT_MAX_SLEEP;
|
||||
|
||||
/*
|
||||
* Read the default channel from the NIC. This may vary
|
||||
@ -968,6 +970,12 @@ static void wi_setdef(sc, wreq)
|
||||
bzero(sc->wi_ibss_name, sizeof(sc->wi_ibss_name));
|
||||
bcopy((char *)&wreq->wi_val[1], sc->wi_ibss_name, 30);
|
||||
break;
|
||||
case WI_RID_PM_ENABLED:
|
||||
sc->wi_pm_enabled = wreq->wi_val[0];
|
||||
break;
|
||||
case WI_RID_MAX_SLEEP:
|
||||
sc->wi_max_sleep = wreq->wi_val[0];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1106,6 +1114,12 @@ static void wi_init(xsc)
|
||||
/* Access point density */
|
||||
WI_SETVAL(WI_RID_SYSTEM_SCALE, sc->wi_ap_density);
|
||||
|
||||
/* Power Management Enabled */
|
||||
WI_SETVAL(WI_RID_PM_ENABLED, sc->wi_pm_enabled);
|
||||
|
||||
/* Power Managment Max Sleep */
|
||||
WI_SETVAL(WI_RID_MAX_SLEEP, sc->wi_max_sleep);
|
||||
|
||||
/* Specify the IBSS name */
|
||||
WI_SETSTR(WI_RID_OWN_SSID, sc->wi_ibss_name);
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_wireg.h,v 1.30 1999/05/06 16:12:06 wpaul Exp $
|
||||
* $Id: if_wireg.h,v 1.31 1999/05/07 03:14:21 wpaul Exp $
|
||||
*/
|
||||
|
||||
struct wi_counters {
|
||||
@ -74,6 +74,8 @@ struct wi_softc {
|
||||
u_int16_t wi_tx_rate;
|
||||
u_int16_t wi_create_ibss;
|
||||
u_int16_t wi_channel;
|
||||
u_int16_t wi_pm_enabled;
|
||||
u_int16_t wi_max_sleep;
|
||||
char wi_node_name[32];
|
||||
char wi_net_name[32];
|
||||
char wi_ibss_name[32];
|
||||
@ -108,6 +110,10 @@ struct wi_softc {
|
||||
|
||||
#define WI_DEFAULT_CREATE_IBSS 0
|
||||
|
||||
#define WI_DEFAULT_PM_ENABLED 0
|
||||
|
||||
#define WI_DEFAULT_MAX_SLEEP 100
|
||||
|
||||
#define WI_DEFAULT_NODENAME "FreeBSD WaveLAN/IEEE node"
|
||||
|
||||
#define WI_DEFAULT_IBSS "FreeBSD IBSS"
|
||||
@ -464,7 +470,17 @@ struct wi_ltv_ssid {
|
||||
/*
|
||||
* Frame data size.
|
||||
*/
|
||||
#define WI_RID_MAX_DATALEN 0xFC07
|
||||
#define WI_RID_MAX_DATALEN 0xFC07
|
||||
|
||||
/*
|
||||
* ESS power management enable
|
||||
*/
|
||||
#define WI_RID_PM_ENABLED 0xFC09
|
||||
|
||||
/*
|
||||
* ESS max PM sleep internal
|
||||
*/
|
||||
#define WI_RID_MAX_SLEEP 0xFC0C
|
||||
|
||||
/*
|
||||
* Set our station name.
|
||||
|
@ -61,6 +61,10 @@
|
||||
.Fl i Ar iface Fl r Ar RTS threshold
|
||||
.Nm wicontrol
|
||||
.Fl i Ar iface Fl f Ar frequency
|
||||
.Nm wicontrol
|
||||
.Fl i Ar iface Fl P Ar 0|1
|
||||
.Nm wicontrol
|
||||
.Fl i Ar iface Fl S Ar max_sleep_duration
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
@ -175,6 +179,22 @@ channel number between 0 and 14. If an illegal channel is specified, the
|
||||
NIC will revert to its default channel. For NIC sold in the United States,
|
||||
the default channel is 3. Note that two stations must be
|
||||
set to the same channel in order to communicate.
|
||||
.It Fl i Ar iface Fl P Ar 0|1
|
||||
Enable or disable power management on a given interface. Enabling
|
||||
power management uses an alternating sleep/wake protocol to help
|
||||
conserve power on mobile stations, at the cost of some increased
|
||||
receive latency. Power management is off by default. Note that power
|
||||
management requires the cooperation of an access point in order to
|
||||
function; it is not functional in ad-hoc mode. Also, power management
|
||||
is only implemented in Lucent WavePOINT firmware version 2.03 or
|
||||
later, and in WaveLAN PCMCIA adapter firmware 2.00 or later. Older
|
||||
revisions will silently ignore the power management setting. Legal
|
||||
values for this parameter are 0 (off) and 1 (on).
|
||||
.It Fl i Ar iface Fl S Ar max sleep interval
|
||||
Specify the sleep interval to use when power management is enabled.
|
||||
The
|
||||
.Are max sleep interval
|
||||
is specified in milliseconds. The default is 100.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr wi 4 ,
|
||||
|
@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: wicontrol.c,v 1.16 1999/05/06 16:12:06 wpaul Exp $
|
||||
* $Id: wicontrol.c,v 1.17 1999/05/07 03:14:21 wpaul Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -56,7 +56,7 @@
|
||||
static const char copyright[] = "@(#) Copyright (c) 1997, 1998, 1999\
|
||||
Bill Paul. All rights reserved.";
|
||||
static const char rcsid[] =
|
||||
"@(#) $Id: wicontrol.c,v 1.16 1999/05/06 16:12:06 wpaul Exp $";
|
||||
"@(#) $Id: wicontrol.c,v 1.17 1999/05/07 03:14:21 wpaul Exp $";
|
||||
#endif
|
||||
|
||||
static void wi_getval __P((char *, struct wi_req *));
|
||||
@ -308,6 +308,8 @@ static struct wi_table wi_table[] = {
|
||||
{ WI_RID_RTS_THRESH, WI_WORDS, "RTS/CTS handshake threshold:\t\t"},
|
||||
{ WI_RID_CREATE_IBSS, WI_BOOL, "Create IBSS:\t\t\t\t" },
|
||||
{ WI_RID_SYSTEM_SCALE, WI_WORDS, "Access point density:\t\t\t" },
|
||||
{ WI_RID_PM_ENABLED, WI_WORDS, "Power Mgmt (1=on, 0=off):\t\t" },
|
||||
{ WI_RID_MAX_SLEEP, WI_WORDS, "Max sleep time:\t\t\t\t" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
@ -426,6 +428,9 @@ static void usage(p)
|
||||
fprintf(stderr, "\t%s -i iface -m mac address\n", p);
|
||||
fprintf(stderr, "\t%s -i iface -d max data length\n", p);
|
||||
fprintf(stderr, "\t%s -i iface -r RTS threshold\n", p);
|
||||
fprintf(stderr, "\t%s -i iface -f frequenct\n", p);
|
||||
fprintf(stderr, "\t%s -i iface -P power mgmt\n", p);
|
||||
fprintf(stderr, "\t%s -i iface -S max sleep duration\n", p);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
@ -438,7 +443,8 @@ int main(argc, argv)
|
||||
char *iface = NULL;
|
||||
char *p = argv[0];
|
||||
|
||||
while((ch = getopt(argc, argv, "hoc:d:f:i:p:r:q:t:n:s:m:")) != -1) {
|
||||
while((ch = getopt(argc, argv,
|
||||
"hoc:d:f:i:p:r:q:t:n:s:m:P:S:")) != -1) {
|
||||
switch(ch) {
|
||||
case 'o':
|
||||
wi_dumpstats(iface);
|
||||
@ -487,6 +493,14 @@ int main(argc, argv)
|
||||
wi_setstr(iface, WI_RID_OWN_SSID, optarg);
|
||||
exit(0);
|
||||
break;
|
||||
case 'S':
|
||||
wi_setword(iface, WI_RID_MAX_SLEEP, atoi(optarg));
|
||||
exit(0);
|
||||
break;
|
||||
case 'P':
|
||||
wi_setword(iface, WI_RID_PM_ENABLED, atoi(optarg));
|
||||
exit(0);
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
usage(p);
|
||||
|
Loading…
x
Reference in New Issue
Block a user