Re: [PATCH 6/8] mac80211: A-MPDU Rx adding BAR handling capability

Johannes Berg
2007-12-17T18:25:27Z

[-- Attachment #1: Type: text/plain, Size: 2755 bytes --]

> -u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len);
> +u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
> + unsigned int type);

Please use the proper enum.

> @@ -1530,6 +1533,48 @@ ieee80211_rx_h_data(struct ieee80211_txrx_data *rx)
> }
>
> static ieee80211_txrx_result
> +ieee80211_rx_h_ctrl(struct ieee80211_txrx_data *rx)
> +{
> + struct ieee80211_local *local = rx->local;
> + struct ieee80211_hw *hw = &local->hw;
> + struct sk_buff *skb = rx->skb;
> + struct ieee80211_bar *bar = (struct ieee80211_bar *) skb->data;
> + struct tid_ampdu_rx *tid_agg_rx;
> + u16 start_seq_num;
> + u16 tid;
> +
> + if (likely((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_CTL))
> + return TXRX_CONTINUE;
> +
> + if ((rx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BACK_REQ) {
> + if (!rx->sta)
> + return TXRX_CONTINUE;
> + tid = le16_to_cpu(bar->control) >> 12;
> + tid_agg_rx = &(rx->sta->ampdu_mlme.tid_rx[tid]);
> + if (tid_agg_rx->state != HT_AGG_STATE_OPERATIONAL)
> + return TXRX_CONTINUE;
> +
> + start_seq_num = le16_to_cpu(bar->start_seq_num) >> 4;
> +
> + /* reset session timer */
> + if (tid_agg_rx->timeout) {
> + unsigned long expires =
> + jiffies + (tid_agg_rx->timeout / 1000) * HZ;
> + mod_timer(&tid_agg_rx->session_timer, expires);
> + }
> +
> + /* manage reordering buffer according to requested */
> + /* sequence number */
> + ieee80211_sta_manage_reorder_buf(hw, rx, tid_agg_rx,
> + NULL, start_seq_num, 1);
> +
> + return TXRX_DROP;
> + }
> +
> + return TXRX_CONTINUE;
> +}
> +
> +static ieee80211_txrx_result
> ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx)
> {
> struct ieee80211_sub_if_data *sdata;
> @@ -1680,6 +1725,7 @@ ieee80211_rx_handler ieee80211_rx_handlers[] =
> ieee80211_rx_h_remove_qos_control,
> ieee80211_rx_h_amsdu,
> ieee80211_rx_h_data,
> + ieee80211_rx_h_ctrl,
> ieee80211_rx_h_mgmt,

Maybe we should have a single rx_h_frame function that passes it to
three control/data/mgmt functions depending on the frame type? Not sure
though since data comes first and that's the hot path.

> @@ -163,6 +164,15 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
> case IEEE80211_FTYPE_CTL:
> if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)
> return hdr->addr1;
> + else if ((fc & IEEE80211_FCTL_STYPE) ==
> + IEEE80211_STYPE_BACK_REQ) {
> + switch (type) {
> + case IEEE80211_IF_TYPE_STA:
> + return hdr->addr2;
> + case IEEE80211_IF_TYPE_AP:
> + return hdr->addr1;
> + }

Doesn't that result in a compiler warning? And what does happen if we
receive a BACK_REQ when we're an IBSS/MESH?

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]