Fix handling of shortgi: use the local configuration (and implicitly

device capabilities) to decide whether to use short gi.  Drivers
inspect ni_flags to decide whether to send a frame w/ short sgi.
This commit is contained in:
Sam Leffler 2008-09-22 00:14:50 +00:00
parent 44f7a6edcf
commit 49942a9784
3 changed files with 25 additions and 2 deletions

View File

@ -90,7 +90,7 @@ __FBSDID("$FreeBSD$");
#define IEEE80211_NODE_BITS \
"\20\1AUTH\2QOS\3ERP\5PWR_MGT\6AREF\7HT\10HTCOMPAT\11WPS\12TSN" \
"\13AMPDU_RX\14AMPDU_TX\15MIMO_PS\16MIMO_RTS\17RIFS"
"\13AMPDU_RX\14AMPDU_TX\15MIMO_PS\16MIMO_RTS\17RIFS\20SGI20\21SGI40"
#define IEEE80211_ERP_BITS \
"\20\1NON_ERP_PRESENT\2USE_PROTECTION\3LONG_PREAMBLE"

View File

@ -1269,6 +1269,24 @@ htcap_update_mimo_ps(struct ieee80211_node *ni)
return (oflags ^ ni->ni_flags);
}
/*
* Update short GI state according to received htcap
* and local settings.
*/
static __inline void
htcap_update_shortgi(struct ieee80211_node *ni)
{
struct ieee80211vap *vap = ni->ni_vap;
ni->ni_flags &= ~(IEEE80211_NODE_SGI20|IEEE80211_NODE_SGI40);
if ((ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) &&
(vap->iv_flags_ext & IEEE80211_FEXT_SHORTGI20))
ni->ni_flags |= IEEE80211_NODE_SGI20;
if ((ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) &&
(vap->iv_flags_ext & IEEE80211_FEXT_SHORTGI40))
ni->ni_flags |= IEEE80211_NODE_SGI40;
}
/*
* Parse and update HT-related state extracted from
* the HT cap and info ie's.
@ -1284,6 +1302,7 @@ ieee80211_ht_updateparams(struct ieee80211_node *ni,
ieee80211_parse_htcap(ni, htcapie);
if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS)
htcap_update_mimo_ps(ni);
htcap_update_shortgi(ni);
if (htinfoie[0] == IEEE80211_ELEMID_VENDOR)
htinfoie += 4;
@ -1322,6 +1341,7 @@ ieee80211_ht_updatehtcap(struct ieee80211_node *ni, const uint8_t *htcapie)
ieee80211_parse_htcap(ni, htcapie);
if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS)
htcap_update_mimo_ps(ni);
htcap_update_shortgi(ni);
/* NB: honor operating mode constraint */
/* XXX 40 MHZ intolerant */

View File

@ -115,6 +115,8 @@ struct ieee80211_node {
#define IEEE80211_NODE_MIMO_PS 0x001000 /* MIMO power save enabled */
#define IEEE80211_NODE_MIMO_RTS 0x002000 /* send RTS in MIMO PS */
#define IEEE80211_NODE_RIFS 0x004000 /* RIFS enabled */
#define IEEE80211_NODE_SGI20 0x008000 /* Short GI in HT20 enabled */
#define IEEE80211_NODE_SGI40 0x010000 /* Short GI in HT40 enabled */
uint16_t ni_associd; /* association ID */
uint16_t ni_vlan; /* vlan tag */
uint16_t ni_txpower; /* current transmit power */
@ -199,7 +201,8 @@ MALLOC_DECLARE(M_80211_NODE_IE);
#define IEEE80211_NODE_HT_ALL \
(IEEE80211_NODE_HT | IEEE80211_NODE_HTCOMPAT | \
IEEE80211_NODE_AMPDU | IEEE80211_NODE_MIMO_PS | \
IEEE80211_NODE_MIMO_RTS | IEEE80211_NODE_RIFS)
IEEE80211_NODE_MIMO_RTS | IEEE80211_NODE_RIFS | \
IEEE80211_NODE_SGI20 | IEEE80211_NODE_SGI40)
#define IEEE80211_NODE_AID(ni) IEEE80211_AID(ni->ni_associd)