Skip to content

Commit

Permalink
iwn: Correct HT40 and SGI flag using in LINK_QUALITY command.
Browse files Browse the repository at this point in the history
  • Loading branch information
zxystd committed Mar 19, 2024
1 parent 7b8ae28 commit 70ef005
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
13 changes: 13 additions & 0 deletions itl80211/openbsd/net80211/ieee80211_ra.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,19 @@ ieee80211_ra_get_rateset(struct ieee80211_ra_node *ra, struct ieee80211com *ic,
panic("%s mcs=%d rs_count=%d sgi=%d nss=%d bw=%d rate==NULL!!!!\n", __FUNCTION__, mcs, ra->active_rs_count, ra->sgi, ra->nss, ra->bw);
}

int
ieee80211_ra_use_ht_sgi(struct ieee80211_node *ni)
{
if ((ni->ni_chw == IEEE80211_CHAN_WIDTH_40) &&
ieee80211_node_supports_ht_chan40(ni)) {
if (ni->ni_flags & IEEE80211_NODE_HT_SGI40)
return 1;
} else if (ni->ni_flags & IEEE80211_NODE_HT_SGI20)
return 1;

return 0;
}

/*
* Update goodput statistics.
*/
Expand Down
2 changes: 2 additions & 0 deletions itl80211/openbsd/net80211/ieee80211_ra.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,6 @@ void ieee80211_ra_choose(struct ieee80211_ra_node *,
/* Get the HT rateset for a particular HT MCS with SGI on/off. */
const struct ieee80211_ra_rate *ieee80211_ra_get_rateset(struct ieee80211_ra_node *, struct ieee80211com *,
struct ieee80211_node *, int);
/* Check whether SGI should be used. */
int ieee80211_ra_use_ht_sgi(struct ieee80211_node *);
#endif /* _NET80211_IEEE80211_RA_H_ */
14 changes: 3 additions & 11 deletions itlwm/hal_iwn/ItlIwn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4047,7 +4047,7 @@ iwn_set_link_quality(struct iwn_softc *sc, struct ieee80211_node *ni)
struct iwn_cmd_link_quality linkq;
struct ieee80211_rateset *rs = &ni->ni_rates;
uint8_t txant;
int i, ridx, ridx_min, ridx_max, j, sgi_ok = 0, is_40mhz = 0, mimo, tab = 0, rflags = 0;
int i, ridx, ridx_min, ridx_max, j, mimo, tab = 0, rflags = 0;

/* Use the first valid TX antenna. */
txant = IWN_LSB(sc->txchainmask);
Expand All @@ -4063,14 +4063,6 @@ iwn_set_link_quality(struct iwn_softc *sc, struct ieee80211_node *ni)
if (ic->ic_flags & IEEE80211_F_USEPROT)
if (sc->hw_type != IWN_HW_REV_TYPE_4965)
linkq.flags |= IWN_LINK_QUAL_FLAGS_SET_STA_TLC_RTS;

if (ieee80211_node_supports_ht_sgi20(ni))
sgi_ok = 1;

if (ni->ni_chw == IEEE80211_CHAN_WIDTH_40) {
is_40mhz = 1;
sgi_ok = ieee80211_node_supports_ht_sgi40(ni);
}

/*
* Fill the LQ rate selection table with legacy and/or HT rates
Expand Down Expand Up @@ -4110,9 +4102,9 @@ iwn_set_link_quality(struct iwn_softc *sc, struct ieee80211_node *ni)
/* First two Tx attempts may use 40MHz/SGI. */
if (j > 1)
break;
if (is_40mhz)
if (iwn_rxon_ht40_enabled(sc))
rflags |= IWN_RFLAG_HT40;
if (sgi_ok)
if (ieee80211_ra_use_ht_sgi(ni))
rflags |= IWN_RFLAG_SGI;
}
} else if (plcp != IWN_RATE_INVM_PLCP) {
Expand Down

0 comments on commit 70ef005

Please sign in to comment.