Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Dec 2019 00:58:20 -0500
From:      Ashish Gupta <lrx337@gmail.com>
To:        freebsd-wireless@freebsd.org
Subject:   run(4) driver: 802.11n support for RT3593
Message-ID:  <CAFgaRUVaDbzHfYZdcy0jPqj=PCRVU%2B64q876viC_j8_My2G8UA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi!

I've been messing around with the run driver and the net80211
implementation for a bit with the aim of enabling 802.11ng support (worry
about 11ac later) using monitor mode captures when running my ASUS USB N66
Ralink RT3593 on both linux and freebsd.

The run(4) driver was not sending out HT capability tags with the probe
requests (while the linux driver does). This seemed like a (logical?) first
step on the road to having full 802.11n support in the run driver. The
following patch accomplishes it, although the capabilities need some tuning
in the run driver setup code to be identical with the linux driver.

I don't know why the existing ieee80211 code only does this for IBSS mode,
and not STA mode.

What do you think about this?
And... what would be a good next step to further this mission?

Index: sys/dev/usb/wlan/if_run.c
===================================================================
--- sys/dev/usb/wlan/if_run.c (revision 354552)
+++ sys/dev/usb/wlan/if_run.c (working copy)
@@ -808,6 +808,28 @@
     IEEE80211_C_WME | /* WME */
     IEEE80211_C_WPA; /* WPA1|WPA2(RSN) */

+ /* set device HT capabilities */
+ /* HT Capabilities strictly for 11ng (we dont support 11ac yet..) */
+ ic->ic_htcaps = IEEE80211_HTC_HT | IEEE80211_HTC_AMPDU |
+
+    /* IEEE80211_HTCAP_LDPC | */
+    IEEE80211_HTCAP_CHWIDTH40 |
+    IEEE80211_HTCAP_GREENFIELD |
+    IEEE80211_HTCAP_SMPS_OFF |
+    IEEE80211_HTCAP_SHORTGI20 |
+    IEEE80211_HTCAP_SHORTGI40 |
+    IEEE80211_HTCAP_TXSTBC |
+    IEEE80211_HTCAP_RXSTBC_3STREAM |
+    /* IEEE80211_HTCAP_DSSSCCK40 | */
+
+    IEEE80211_HTCAP_MAXRXAMPDU |
+    IEEE80211_HTCAP_MPDUDENSITY_4;
+
+  /* TODO: Remaining Rx supported mcs, ht extended cap, transmit beam
forming,
+     antenna selection caps. Later.. */
+
+ device_printf(sc->sc_dev, "ic_htcaps = 0x%x\n", ic->ic_htcaps);
+
  ic->ic_cryptocaps =
     IEEE80211_CRYPTO_WEP |
     IEEE80211_CRYPTO_AES_CCM |
@@ -4851,6 +4873,12 @@
  memset(bands, 0, sizeof(bands));
  setbit(bands, IEEE80211_MODE_11B);
  setbit(bands, IEEE80211_MODE_11G);
+
+ if(sc->rf_rev == RT3593_RF_3053) {
+  device_printf(sc->sc_dev, "Adding mode 11ng to RT3593 channels.\n");
+  setbit(bands, IEEE80211_MODE_11NG);
+ }
+
  ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);

  if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 ||
Index: sys/net80211/ieee80211_output.c
===================================================================
--- sys/net80211/ieee80211_output.c (revision 354552)
+++ sys/net80211/ieee80211_output.c (working copy)
@@ -2415,7 +2415,19 @@
  frm = ieee80211_add_htcap_ch(frm, vap, c);
  }

+ if ((vap->iv_opmode == IEEE80211_M_STA) && (vap->iv_flags_ht &
IEEE80211_FHT_HT)) {
+ struct ieee80211_channel *c;
+
  /*
+ * Get the HT channel that we should try upgrading to.
+ * If we can do 40MHz then this'll upgrade it appropriately.
+ */
+ c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan,
+    vap->iv_flags_ht);
+ frm = ieee80211_add_htcap_ch(frm, vap, c);
+ }
+
+ /*
  * XXX TODO: need to figure out what/how to update the
  * VHT channel.
  */

Thanks!
Ashish Gupta



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFgaRUVaDbzHfYZdcy0jPqj=PCRVU%2B64q876viC_j8_My2G8UA>