linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: users@rt2x00.serialmonkey.com, linux-wireless@vger.kernel.org,
	Helmut Schaa <helmut.schaa@googlemail.com>,
	Gertjan van Wingerde <gwingerde@gmail.com>
Subject: [PATCH 01/21] rt2x00: Implement tx mpdu aggregation
Date: Tue, 29 Jun 2010 21:38:12 +0200	[thread overview]
Message-ID: <201006292138.13509.IvDoorn@gmail.com> (raw)

From: Helmut Schaa <helmut.schaa@googlemail.com>

In order to implement tx mpdu aggregation we only have to implement
the ampdu_action callback such that mac80211 allows negotiation of
blockack sessions.

The hardware will handle everything on its own as long as the ampdu
flag in the TXWI struct is set up correctly and we translate the tx
status correctly.

For now, refuse requests to start rx aggregation.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
 drivers/net/wireless/rt2x00/rt2800lib.c |   34 ++++++++++++++++++++++++++++++-
 drivers/net/wireless/rt2x00/rt2x00dev.c |   15 +++++++++++++
 2 files changed, 48 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 14c361a..14ff706 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2499,7 +2499,8 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	    IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
 	    IEEE80211_HW_SIGNAL_DBM |
 	    IEEE80211_HW_SUPPORTS_PS |
-	    IEEE80211_HW_PS_NULLFUNC_STACK;
+	    IEEE80211_HW_PS_NULLFUNC_STACK |
+	    IEEE80211_HW_AMPDU_AGGREGATION;
 
 	SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
 	SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -2751,6 +2752,36 @@ static u64 rt2800_get_tsf(struct ieee80211_hw *hw)
 	return tsf;
 }
 
+static int rt2800_ampdu_action(struct ieee80211_hw *hw,
+			       struct ieee80211_vif *vif,
+			       enum ieee80211_ampdu_mlme_action action,
+			       struct ieee80211_sta *sta,
+			       u16 tid, u16 *ssn)
+{
+	struct rt2x00_dev *rt2x00dev = hw->priv;
+	int ret = 0;
+
+	switch (action) {
+	case IEEE80211_AMPDU_RX_START:
+	case IEEE80211_AMPDU_RX_STOP:
+		/* we don't support RX aggregation yet */
+		ret = -ENOTSUPP;
+		break;
+	case IEEE80211_AMPDU_TX_START:
+		ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
+		break;
+	case IEEE80211_AMPDU_TX_STOP:
+		ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
+		break;
+	case IEEE80211_AMPDU_TX_OPERATIONAL:
+		break;
+	default:
+		WARNING(rt2x00dev, "Unknown AMPDU action\n");
+	}
+
+	return ret;
+}
+
 const struct ieee80211_ops rt2800_mac80211_ops = {
 	.tx			= rt2x00mac_tx,
 	.start			= rt2x00mac_start,
@@ -2768,6 +2799,7 @@ const struct ieee80211_ops rt2800_mac80211_ops = {
 	.conf_tx		= rt2800_conf_tx,
 	.get_tsf		= rt2800_get_tsf,
 	.rfkill_poll		= rt2x00mac_rfkill_poll,
+	.ampdu_action		= rt2800_ampdu_action,
 };
 EXPORT_SYMBOL_GPL(rt2800_mac80211_ops);
 
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 339cc84..a914855 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -286,6 +286,21 @@ void rt2x00lib_txdone(struct queue_entry *entry,
 			rt2x00dev->low_level_stats.dot11ACKFailureCount++;
 	}
 
+	/*
+	 * Every single frame has it's own tx status, hence report
+	 * every frame as ampdu of size 1.
+	 *
+	 * TODO: if we can find out how many frames were aggregated
+	 * by the hw we could provide the real ampdu_len to mac80211
+	 * which would allow the rc algorithm to better decide on
+	 * which rates are suitable.
+	 */
+	if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
+		tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
+		tx_info->status.ampdu_len = 1;
+		tx_info->status.ampdu_ack_len = success ? 1 : 0;
+	}
+
 	if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
 		if (success)
 			rt2x00dev->low_level_stats.dot11RTSSuccessCount++;
-- 
1.6.6.1


             reply	other threads:[~2010-06-29 19:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29 19:38 Ivo van Doorn [this message]
2010-06-29 19:38 ` [PATCH 02/21] rt2x00: Write the BSSID to register when interface is added Ivo van Doorn
2010-06-29 19:39   ` [PATCH 03/21] rt2x00: Remove unneeded variable Ivo van Doorn
2010-06-29 19:40     ` [PATCH 04/21] rt2x00: Fix frame dumping for USB devices Ivo van Doorn
2010-06-29 19:40       ` [PATCH 05/21] rt2x00: Move filling of TX URB to rt2x00usb_kick_tx_entry function Ivo van Doorn
2010-06-29 19:41         ` [PATCH 06/21] rt2x00: Merge PCI and USB versions of write_tx_data into single function Ivo van Doorn
2010-06-29 19:41           ` [PATCH 07/21] rt2x00: Move common txdone handling to rt2x00lib_txdone Ivo van Doorn
2010-06-29 19:42             ` [PATCH 08/21] rt2x00: Rename driver write_tx_datadesc callback function Ivo van Doorn
2010-06-29 19:43               ` [PATCH 09/21] rt2x00: Split of TXWI writing to write_tx_data callback in rt2800usb Ivo van Doorn
2010-06-29 19:43                 ` [PATCH 10/21] eeprom_93cx6: Add support for 93c86 EEPROMs Ivo van Doorn
2010-06-29 19:44                   ` [PATCH 11/21] rt2x00: Correctly detect 93C86 EEPROMs in rt2800pci Ivo van Doorn
2010-06-29 19:44                     ` [PATCH 12/21] rt2x00: Align rt2800 EEPROM validation to Ralink vendor driver Ivo van Doorn
2010-06-29 19:45                       ` [PATCH 13/21] rt2x00: Enable multiBSS in rt2800 Ivo van Doorn
2010-06-29 19:46                         ` [PATCH 14/21] rt2x00: Fix beacon updates in rt2800pci Ivo van Doorn
2010-06-29 19:47                           ` [PATCH 15/21] rt2x00: Fix beacon updates in rt61pci Ivo van Doorn
2010-06-29 19:47                             ` [PATCH 16/21] rt2x00: Disable link tuning in AP mode Ivo van Doorn
2010-06-29 19:48                               ` [PATCH 17/21] rt2x00: fix beacon reset on rt2800 Ivo van Doorn
2010-06-29 19:48                                 ` [PATCH 18/21] rt2x00: Fix IEEE80211_HT_CAP_RX_STBC assignment Ivo van Doorn
2010-06-29 19:49                                   ` [PATCH 19/21] rt2x00: Fix antenna initialization Ivo van Doorn
2010-06-29 19:49                                     ` [PATCH 20/21] rt2x00: Always set BBP_CSR_CFG_BBP_RW_MODE to 1 Ivo van Doorn
2010-06-29 19:49                                       ` [PATCH 21/21] rt2x00: Fix compile warning when debug disabled Ivo van Doorn

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=201006292138.13509.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=gwingerde@gmail.com \
    --cc=helmut.schaa@googlemail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=users@rt2x00.serialmonkey.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;
as well as URLs for NNTP newsgroup(s).