This change allows iwm(4) users to see which rates they're sending and
receiving packets at (kinda useful for debugging rate scaling issues).
To see rates in tcpdump you need to use -y and -v options.
For example: tcpdump -i iwm0 -y IEEE802_11_RADIO -v type data
Writing to a pcap file and then looking at data rates in wirehark works, too:
tcpdump -i iwm0 -y IEEE802_11_RADIO -v -s 1500 -w /tmp/pcap
wireshark /tmp/pcap
Index: if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.146
diff -u -p -r1.146 if_iwm.c
--- if_iwm.c 1 Nov 2016 13:49:50 -0000 1.146
+++ if_iwm.c 17 Nov 2016 13:46:24 -0000
@@ -3319,12 +3319,9 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, str
tap->wr_tsft = phy_info->system_timestamp;
if (phy_info->phy_flags &
htole16(IWM_RX_RES_PHY_FLAGS_OFDM_HT)) {
-#ifdef notyet
uint8_t mcs = (phy_info->rate_n_flags &
htole32(IWM_RATE_HT_MCS_RATE_CODE_MSK));
-#endif
- /* XXX need a way to pass current MCS in 11n mode */
- tap->wr_rate = 0;
+ tap->wr_rate = (0x80 | mcs);
} else {
uint8_t rate = (phy_info->rate_n_flags &
htole32(IWM_RATE_LEGACY_RATE_MSK));
@@ -3940,9 +3937,11 @@ iwm_tx(struct iwm_softc *sc, struct mbuf
tap->wt_flags = 0;
tap->wt_chan_freq = htole16(ni->ni_chan->ic_freq);
tap->wt_chan_flags = htole16(ni->ni_chan->ic_flags);
- if (rinfo->plcp == IWM_RATE_INVM_PLCP) {
- /* XXX need a way to pass current MCS in 11n mode */
- tap->wt_rate = 0;
+ if ((ni->ni_flags & IEEE80211_NODE_HT) &&
+ !IEEE80211_IS_MULTICAST(wh->i_addr1) &&
+ type == IEEE80211_FC0_TYPE_DATA &&
+ rinfo->plcp == IWM_RATE_INVM_PLCP) {
+ tap->wt_rate = (0x80 | rinfo->ht_plcp);
} else
tap->wt_rate = rinfo->rate;
tap->wt_hwqueue = ac;