o add support for controlling the power of transmitted frames

o add support for controlling the 11g protection mechanism used
  to protect OFDM frames in a mixed 11b/g network

Reviewed by:	imp
This commit is contained in:
Sam Leffler 2004-03-30 22:57:57 +00:00
parent 7e88a151e0
commit 2e79ca9762
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127648
5 changed files with 54 additions and 0 deletions

View File

@ -873,6 +873,15 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case IEEE80211_IOC_RTSTHRESHOLD:
ireq->i_val = ic->ic_rtsthreshold;
break;
case IEEE80211_IOC_PROTMODE:
ireq->i_val = ic->ic_protmode;
break;
case IEEE80211_IOC_TXPOWER:
if ((ic->ic_caps & IEEE80211_C_TXPMGT) == 0)
error = EINVAL;
else
ireq->i_val = ic->ic_txpower;
break;
default:
error = EINVAL;
break;
@ -1015,6 +1024,29 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ic->ic_rtsthreshold = ireq->i_val;
error = ENETRESET;
break;
case IEEE80211_IOC_PROTMODE:
if (ireq->i_val > IEEE80211_PROT_RTSCTS) {
error = EINVAL;
break;
}
ic->ic_protmode = ireq->i_val;
/* NB: if not operating in 11g this can wait */
if (ic->ic_curmode == IEEE80211_MODE_11G)
error = ENETRESET;
break;
case IEEE80211_IOC_TXPOWER:
if ((ic->ic_caps & IEEE80211_C_TXPMGT) == 0) {
error = EINVAL;
break;
}
if (!(IEEE80211_TXPOWER_MIN < ireq->i_val &&
ireq->i_val < IEEE80211_TXPOWER_MAX)) {
error = EINVAL;
break;
}
ic->ic_txpower = ireq->i_val;
error = ENETRESET;
break;
default:
error = EINVAL;
break;

View File

@ -119,6 +119,11 @@ struct ieee80211req {
#define IEEE80211_POWERSAVE_ON IEEE80211_POWERSAVE_CAM
#define IEEE80211_IOC_POWERSAVESLEEP 11
#define IEEE80211_IOC_RTSTHRESHOLD 12
#define IEEE80211_IOC_PROTMODE 13
#define IEEE80211_PROTMODE_OFF 0
#define IEEE80211_PROTMODE_CTS 1
#define IEEE80211_PROTMODE_RTSCTS 2
#define IEEE80211_IOC_TXPOWER 14
#ifndef IEEE80211_CHAN_ANY
#define IEEE80211_CHAN_ANY 0xffff /* token for ``any channel'' */

View File

@ -102,6 +102,7 @@ ieee80211_node_lateattach(struct ifnet *ifp)
ic->ic_bss = (*ic->ic_node_alloc)(ic);
KASSERT(ic->ic_bss != NULL, ("unable to setup inital BSS node"));
ic->ic_txpower = IEEE80211_TXPOWER_MAX;
ic->ic_bss->ni_chan = IEEE80211_CHAN_ANYC;
}

View File

@ -102,6 +102,7 @@ ieee80211_proto_attach(struct ifnet *ifp)
#endif
ic->ic_fragthreshold = 2346; /* XXX not used yet */
ic->ic_fixed_rate = -1; /* no fixed rate */
ic->ic_protmode = IEEE80211_PROT_CTSONLY;
mtx_init(&ic->ic_mgtq.ifq_mtx, ifp->if_xname, "mgmt send q", MTX_DEF);

View File

@ -49,6 +49,9 @@
#define IEEE80211_CHAN_ANYC \
((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
#define IEEE80211_TXPOWER_MAX 100 /* max power */
#define IEEE80211_TXPOWER_MIN 0 /* kill radio (if possible) */
enum ieee80211_phytype {
IEEE80211_T_DS, /* direct sequence spread spectrum */
IEEE80211_T_FH, /* frequency hopping */
@ -76,6 +79,15 @@ enum ieee80211_opmode {
IEEE80211_M_MONITOR = 8 /* Monitor mode */
};
/*
* 802.11g protection mode.
*/
enum ieee80211_protmode {
IEEE80211_PROT_NONE = 0, /* no protection */
IEEE80211_PROT_CTSONLY = 1, /* CTS to self */
IEEE80211_PROT_RTSCTS = 2, /* RTS-CTS */
};
/*
* Channels are specified by frequency and attributes.
*/
@ -166,6 +178,7 @@ struct ieee80211com {
enum ieee80211_phytype ic_phytype; /* XXX wrong for multi-mode */
enum ieee80211_opmode ic_opmode; /* operation mode */
enum ieee80211_state ic_state; /* 802.11 state */
enum ieee80211_protmode ic_protmode; /* 802.11g protection mode */
struct ifmedia ic_media; /* interface media config */
struct bpf_if *ic_rawbpf; /* packet filter structure */
struct ieee80211_node *ic_bss; /* information for this node */
@ -226,6 +239,8 @@ struct ieee80211com {
#define IEEE80211_F_TXPOW_AUTO 0x00010000 /* TX Power: undefined */
#define IEEE80211_F_SHSLOT 0x00020000 /* CONF: short slot time */
#define IEEE80211_F_SHPREAMBLE 0x00040000 /* CONF: short preamble */
#define IEEE80211_F_USEPROT 0x00100000 /* STATUS: protection enabled */
#define IEEE80211_F_USEBARKER 0x00200000 /* STATUS: use barker preamble*/
/* ic_caps */
#define IEEE80211_C_WEP 0x00000001 /* CAPABILITY: WEP available */