From 237c4b4378b449509155ed9f2b605b3a3c40f873 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Fri, 18 Sep 2015 05:03:01 +0000 Subject: [PATCH] Add a very hacked up station only A-MPDU negotiation path. This is enough to set things up; there are still lots of retransmits seen but it's enough to get things working. --- sys/dev/usb/wlan/if_rsu.c | 35 +++++++++++++++++++++++++++++++++++ sys/dev/usb/wlan/if_rsureg.h | 5 +++++ 2 files changed, 40 insertions(+) diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index 8ed3e5263dc5..530c96570d09 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -1318,6 +1318,35 @@ rsu_event_join_bss(struct rsu_softc *sc, uint8_t *buf, int len) RSU_LOCK(sc); } +static void +rsu_event_addba_req_report(struct rsu_softc *sc, uint8_t *buf, int len) +{ + struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + struct r92s_add_ba_event *ba = (void *) buf; + struct ieee80211_node *ni; + + if (len < sizeof(*ba)) { + device_printf(sc->sc_dev, "%s: short read (%d)\n", __func__, len); + return; + } + + if (vap == NULL) + return; + + device_printf(sc->sc_dev, "%s: mac=%s, tid=%d, ssn=%d\n", + __func__, + ether_sprintf(ba->mac_addr), + (int) ba->tid, + (int) le16toh(ba->ssn)); + + /* XXX do node lookup; this is STA specific */ + + ni = ieee80211_ref_node(vap->iv_bss); + ieee80211_ampdu_rx_start_ext(ni, ba->tid, le16toh(ba->ssn) >> 4, 32); + ieee80211_free_node(ni); +} + static void rsu_rx_event(struct rsu_softc *sc, uint8_t code, uint8_t *buf, int len) { @@ -1370,6 +1399,10 @@ rsu_rx_event(struct rsu_softc *sc, uint8_t code, uint8_t *buf, int len) buf[60] = '\0'; RSU_DPRINTF(sc, RSU_DEBUG_FWDBG, "FWDBG: %s\n", (char *)buf); break; + + case R92S_EVT_ADDBA_REQ_REPORT: + rsu_event_addba_req_report(sc, buf, len); + break; default: RSU_DPRINTF(sc, RSU_DEBUG_ANY, "%s: unhandled code (%d)\n", __func__, code); @@ -1640,6 +1673,8 @@ tr_setup: ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh); if (ni != NULL) { + if (ni->ni_flags & IEEE80211_NODE_HT) + m->m_flags |= M_AMPDU; (void)ieee80211_input(ni, m, rssi, 0); ieee80211_free_node(ni); } else diff --git a/sys/dev/usb/wlan/if_rsureg.h b/sys/dev/usb/wlan/if_rsureg.h index dc5affc68af2..7913a530168a 100644 --- a/sys/dev/usb/wlan/if_rsureg.h +++ b/sys/dev/usb/wlan/if_rsureg.h @@ -593,6 +593,11 @@ struct r92s_tx_desc { uint16_t reserved1; } __packed __aligned(4); +struct r92s_add_ba_event { + uint8_t mac_addr[IEEE80211_ADDR_LEN]; + uint16_t ssn; + uint8_t tid; +}; /* * Driver definitions.