public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Ron Rindjunsky <ron.rindjunsky@intel.com>
To: linville@tuxdriver.com
Cc: johannes@sipsolutions.net, linux-wireless@vger.kernel.org,
	flamingice@sourmilk.net, tomas.winkler@intel.com,
	yi.zhu@intel.com, Ron Rindjunsky <ron.rindjunsky@intel.com>
Subject: [PATCH 6/8] mac80211: A-MPDU Rx adding BAR handling capability
Date: Mon, 17 Dec 2007 17:57:47 +0200	[thread overview]
Message-ID: <11979070783125-git-send-email-ron.rindjunsky@intel.com> (raw)
In-Reply-To: <11979070692599-git-send-email-ron.rindjunsky@intel.com>

This patch adds the ability to handle Block Ack Request

Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
---
 net/mac80211/ieee80211_i.h |    3 +-
 net/mac80211/rx.c          |   53 ++++++++++++++++++++++++++++++++++++++++---
 net/mac80211/util.c        |   12 +++++++++-
 3 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index cf2256b..ed7ae6f 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -804,7 +804,8 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
 extern void *mac80211_wiphy_privid; /* for wiphy privid */
 extern const unsigned char rfc1042_header[6];
 extern const unsigned char bridge_tunnel_header[6];
-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);
 int ieee80211_is_eapol(const struct sk_buff *skb, int hdrlen);
 int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
 			     int rate, int erp, int short_preamble);
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 7a705eb..ca0e89f 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -64,7 +64,9 @@ static inline int should_drop_frame(struct ieee80211_rx_status *status,
 	if (((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
 			cpu_to_le16(IEEE80211_FTYPE_CTL)) &&
 	    ((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_STYPE)) !=
-			cpu_to_le16(IEEE80211_STYPE_PSPOLL)))
+			cpu_to_le16(IEEE80211_STYPE_PSPOLL)) &&
+	    ((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_STYPE)) !=
+			cpu_to_le16(IEEE80211_STYPE_BACK_REQ)))
 		return 1;
 	return 0;
 }
@@ -803,7 +805,8 @@ ieee80211_rx_h_sta_process(struct ieee80211_txrx_data *rx)
 	 * BSSID to avoid keeping the current IBSS network alive in cases where
 	 * other STAs are using different BSSID. */
 	if (rx->sdata->type == IEEE80211_IF_TYPE_IBSS) {
-		u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len);
+		u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len,
+						IEEE80211_IF_TYPE_IBSS);
 		if (compare_ether_addr(bssid, rx->sdata->u.sta.bssid) == 0)
 			sta->last_rx = jiffies;
 	} else
@@ -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,
 	NULL
 };
@@ -1841,8 +1887,6 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
 		return;
 	}
 
-	bssid = ieee80211_get_bssid(hdr, skb->len);
-
 	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
 		if (!netif_running(sdata->dev))
 			continue;
@@ -1850,6 +1894,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
 		if (sdata->type == IEEE80211_IF_TYPE_MNTR)
 			continue;
 
+		bssid = ieee80211_get_bssid(hdr, skb->len, sdata->type);
 		rx.flags |= IEEE80211_TXRXD_RXRA_MATCH;
 		prepres = prepare_for_handlers(sdata, bssid, &rx, hdr);
 		/* prepare_for_handlers can change sta */
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index fb7fd89..d1a6138 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -131,7 +131,8 @@ void ieee80211_prepare_rates(struct ieee80211_local *local,
 	}
 }
 
-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)
 {
 	u16 fc;
 
@@ -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;
+			}
+		}
 		else
 			return NULL;
 	}
-- 
1.5.3.3

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


  parent reply	other threads:[~2007-12-17 15:58 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-17 15:57 [PATCH 0/8] mac80211/iwlwifi: integrate IEEE802.11n A-MPDU Rx MLME Ron Rindjunsky
2007-12-17 15:57 ` [PATCH 1/8] mac80211: A-MPDU Rx add low level driver API Ron Rindjunsky
2007-12-17 17:54   ` Johannes Berg
2007-12-17 22:38     ` Johannes Berg
2007-12-18 13:41     ` Ron Rindjunsky
2007-12-18 14:01       ` Johannes Berg
2007-12-17 15:57 ` [PATCH 2/8] mac80211: A-MPDU Rx add MLME structures Ron Rindjunsky
2007-12-17 18:08   ` Johannes Berg
2007-12-18 13:41     ` Ron Rindjunsky
2007-12-18 13:59       ` Johannes Berg
2007-12-18 21:18       ` Johannes Berg
2007-12-19 18:59         ` Rindjunsky, Ron
2007-12-17 15:57 ` [PATCH 3/8] mac80211: A-MPDU Rx adding basic functionality Ron Rindjunsky
2007-12-17 18:06   ` Johannes Berg
2007-12-18 13:42     ` Ron Rindjunsky
2007-12-17 15:57 ` [PATCH 4/8] mac80211: A-MPDU Rx MLME data initialization Ron Rindjunsky
2007-12-17 18:09   ` Johannes Berg
2007-12-18 13:43     ` Ron Rindjunsky
2007-12-17 15:57 ` [PATCH 5/8] mac80211: A-MPDU Rx handling aggregation reordering Ron Rindjunsky
2007-12-17 18:18   ` Johannes Berg
2007-12-18 13:44     ` Ron Rindjunsky
2007-12-18 13:57       ` Johannes Berg
2007-12-19 10:57         ` Rindjunsky, Ron
2007-12-19 15:47           ` Johannes Berg
2007-12-19 16:29             ` Winkler, Tomas
2007-12-19 16:36               ` Johannes Berg
2007-12-20 10:14   ` Johannes Berg
2007-12-20 12:32     ` Ron Rindjunsky
2007-12-20 12:41       ` Johannes Berg
2007-12-20 14:15         ` Ron Rindjunsky
2007-12-23 16:15         ` Ron Rindjunsky
2007-12-23 17:28           ` Johannes Berg
2007-12-23 17:38             ` Ron Rindjunsky
2007-12-23 18:15               ` Johannes Berg
2007-12-17 15:57 ` Ron Rindjunsky [this message]
2007-12-17 18:24   ` [PATCH 6/8] mac80211: A-MPDU Rx adding BAR handling capability Johannes Berg
2007-12-18 13:45     ` Ron Rindjunsky
2007-12-18 13:53       ` Johannes Berg
2007-12-19 13:25         ` Rindjunsky, Ron
2007-12-19 15:45           ` Johannes Berg
2007-12-19 18:59             ` Rindjunsky, Ron
2007-12-17 15:57 ` [PATCH 7/8] mac80211: A-MPDU Rx handling DELBA requests Ron Rindjunsky
2007-12-17 18:26   ` Johannes Berg
2007-12-18 13:46     ` Ron Rindjunsky
2007-12-18 13:51       ` Johannes Berg
2007-12-19 13:22         ` Rindjunsky, Ron
2007-12-17 15:57 ` [PATCH 8/8] iwlwifi: A-MPDU Rx flow enabled Ron Rindjunsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11979070783125-git-send-email-ron.rindjunsky@intel.com \
    --to=ron.rindjunsky@intel.com \
    --cc=flamingice@sourmilk.net \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=tomas.winkler@intel.com \
    --cc=yi.zhu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox