Linux wireless drivers development
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <sgruszka@redhat.com>
To: linux-wireless@vger.kernel.org
Cc: Helmut Schaa <helmut.schaa@googlemail.com>, Felix Fietkau <nbd@nbd.name>
Subject: [PATCH 02/10] rt2800: identify station based on status WCID
Date: Tue, 14 Feb 2017 13:46:00 +0100	[thread overview]
Message-ID: <1487076368-7020-3-git-send-email-sgruszka@redhat.com> (raw)
In-Reply-To: <1487076368-7020-1-git-send-email-sgruszka@redhat.com>

Add station field to skb_frame_desc and assign it according to status
WCID. This field will be used in the future.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c   | 8 ++++++++
 drivers/net/wireless/ralink/rt2x00/rt2800lib.h   | 1 +
 drivers/net/wireless/ralink/rt2x00/rt2x00queue.h | 3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 8223a15..5de21d2 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -855,11 +855,13 @@ void rt2800_process_rxwi(struct queue_entry *entry,
 void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi)
 {
 	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
+	struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
 	struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
 	struct txdone_entry_desc txdesc;
 	u32 word;
 	u16 mcs, real_mcs;
 	int aggr, ampdu;
+	int wcid;
 
 	/*
 	 * Obtain the status about this packet.
@@ -872,6 +874,7 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi)
 
 	real_mcs = rt2x00_get_field32(status, TX_STA_FIFO_MCS);
 	aggr = rt2x00_get_field32(status, TX_STA_FIFO_TX_AGGRE);
+	wcid = rt2x00_get_field32(status, TX_STA_FIFO_WCID);
 
 	/*
 	 * If a frame was meant to be sent as a single non-aggregated MPDU
@@ -894,6 +897,9 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status, __le32 *txwi)
 		mcs = real_mcs;
 	}
 
+	if (likely(wcid >= WCID_START && wcid <= WCID_END))
+		skbdesc->sta = drv_data->wcid_to_sta[wcid - WCID_START];
+
 	if (aggr == 1 || ampdu == 1)
 		__set_bit(TXDONE_AMPDU, &txdesc.flags);
 
@@ -1468,6 +1474,7 @@ int rt2800_sta_add(struct rt2x00_dev *rt2x00dev, struct ieee80211_vif *vif,
 		return 0;
 
 	__set_bit(wcid - WCID_START, drv_data->sta_ids);
+	drv_data->wcid_to_sta[wcid - WCID_START] = sta;
 
 	/*
 	 * Clean up WCID attributes and write STA address to the device.
@@ -1498,6 +1505,7 @@ int rt2800_sta_remove(struct rt2x00_dev *rt2x00dev, struct ieee80211_sta *sta)
 	 * get renewed when the WCID is reused.
 	 */
 	rt2800_config_wcid(rt2x00dev, NULL, wcid);
+	drv_data->wcid_to_sta[wcid - WCID_START] = NULL;
 	__clear_bit(wcid - WCID_START, drv_data->sta_ids);
 
 	return 0;
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
index 8e1ae13..6811d67 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
@@ -41,6 +41,7 @@ struct rt2800_drv_data {
 	unsigned int tbtt_tick;
 	unsigned int ampdu_factor_cnt[4];
 	DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
+	struct ieee80211_sta *wcid_to_sta[STA_IDS_SIZE];
 };
 
 struct rt2800_ops {
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
index 22d1881..9b297fc 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.h
@@ -102,7 +102,7 @@ enum skb_frame_desc_flags {
  *	of the scope of the skb->data pointer.
  * @iv: IV/EIV data used during encryption/decryption.
  * @skb_dma: (PCI-only) the DMA address associated with the sk buffer.
- * @entry: The entry to which this sk buffer belongs.
+ * @sta: The station where sk buffer was sent.
  */
 struct skb_frame_desc {
 	u8 flags;
@@ -116,6 +116,7 @@ struct skb_frame_desc {
 	__le32 iv[2];
 
 	dma_addr_t skb_dma;
+	struct ieee80211_sta *sta;
 };
 
 /**
-- 
1.8.3.1

  parent reply	other threads:[~2017-02-14 12:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 12:45 [PATCH 00/10] rt2x00 patches 14.02.2017 Stanislaw Gruszka
2017-02-14 12:45 ` [PATCH 01/10] rt2x00: rt2800lib: move rt2800_drv_data declaration into rt2800lib.h Stanislaw Gruszka
2017-02-14 12:46 ` Stanislaw Gruszka [this message]
2017-02-14 13:10   ` [PATCH 02/10] rt2800: identify station based on status WCID Felix Fietkau
2017-02-14 13:32     ` Stanislaw Gruszka
2017-02-14 13:46       ` Felix Fietkau
2017-02-14 12:46 ` [PATCH 03/10] rt2x00: separte filling tx status from rt2x00lib_txdone Stanislaw Gruszka
2017-02-14 12:46 ` [PATCH 04/10] rt2x00: separte clearing entry " Stanislaw Gruszka
2017-02-14 12:46 ` [PATCH 05/10] rt2x00: add txdone nomatch function Stanislaw Gruszka
2017-02-14 12:46 ` [PATCH 06/10] rt2x00: fixup fill_tx_status for nomatch case Stanislaw Gruszka
2017-02-14 13:51   ` Felix Fietkau
2017-02-14 16:32   ` Kalle Valo
2017-02-14 12:46 ` [PATCH 07/10] rt2x00: use txdone_nomatch on rt2800usb Stanislaw Gruszka
2017-02-14 12:46 ` [PATCH 08/10] rt2800: status based rate flags for nomatch case Stanislaw Gruszka
2017-02-14 12:46 ` [PATCH 09/10] rt2800: use TXOP_BACKOFF for probe frames Stanislaw Gruszka
2017-02-14 12:46 ` [PATCH 10/10] rt2x00: fix rt2x00debug_dump_frame comment Stanislaw Gruszka

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=1487076368-7020-3-git-send-email-sgruszka@redhat.com \
    --to=sgruszka@redhat.com \
    --cc=helmut.schaa@googlemail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    /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