[PATCH 2/3] Set correct TID for data packets

Eugene Krasnikov k.eugene.e at gmail.com
Tue Jul 23 10:45:53 EDT 2013


For MGMT packets TID is 7, while for data frames take TID
from mac80211.

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 main.c    |  4 +++-
 txrx.c    | 26 +++++++++++++++++++-------
 wcn36xx.h |  1 +
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/main.c b/main.c
index c824fce..8ca1245 100644
--- a/main.c
+++ b/main.c
@@ -758,11 +758,13 @@ int wcn36xx_ampdu_action(struct ieee80211_hw *hw,
 		    u8 buf_size)
 {
 	struct wcn36xx *wcn = hw->priv;
-
+	struct wcn_sta *sta_priv = NULL;
 	wcn36xx_dbg(WCN36XX_DBG_MAC, "mac ampdu action action %d tid %d",
 		    action, tid);
 	switch (action) {
 	case IEEE80211_AMPDU_RX_START:
+		sta_priv = (struct wcn_sta *)sta->drv_priv;
+		sta_priv->tid = tid;
 		wcn36xx_smd_add_ba_session(wcn, sta, tid, ssn, 0);
 		wcn36xx_smd_add_ba(wcn);
 		wcn36xx_smd_trigger_ba(wcn);
diff --git a/txrx.c b/txrx.c
index 5dbee04..bdc68c7 100644
--- a/txrx.c
+++ b/txrx.c
@@ -79,14 +79,15 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
 
 static void wcn36xx_set_tx_pdu(struct wcn36xx_tx_bd *bd,
 			 u32 mpdu_header_len,
-			 u32 len)
+			 u32 len,
+			 u16 tid)
 {
 	bd->pdu.mpdu_header_len = mpdu_header_len;
 	bd->pdu.mpdu_header_off = sizeof(*bd);
 	bd->pdu.mpdu_data_off = bd->pdu.mpdu_header_len +
 		bd->pdu.mpdu_header_off;
 	bd->pdu.mpdu_len = len;
-	bd->pdu.tid = WCN36XX_TID;
+	bd->pdu.tid = tid;
 }
 
 static void wcn36xx_set_tx_data(struct wcn36xx_tx_bd *bd,
@@ -202,17 +203,28 @@ int wcn36xx_start_tx(struct wcn36xx *wcn,
 		ieee80211_stop_queues(wcn->hw);
 	}
 
-	wcn36xx_set_tx_pdu(bd, ieee80211_is_data_qos(hdr->frame_control) ?
-			   sizeof(struct ieee80211_qos_hdr) :
-			   sizeof(struct ieee80211_hdr_3addr),
-			   skb->len);
-
 	/* Data frames served first*/
 	if (is_low) {
+		/*
+		 * Sometimes in AP mode mac80211 is trying to send data
+		 * frame to nobody. Why?
+		 */
+		if (!sta_priv)
+			wcn36xx_warn("Sending data packet to nobody");
 		wcn36xx_set_tx_data(bd, wcn, sta_priv, hdr, bcast);
+		wcn36xx_set_tx_pdu(bd,
+			   ieee80211_is_data_qos(hdr->frame_control) ?
+			   sizeof(struct ieee80211_qos_hdr) :
+			   sizeof(struct ieee80211_hdr_3addr),
+			   skb->len, sta_priv ? sta_priv->tid : 0);
 	} else {
 		/* MGMT and CTRL frames are handeld here*/
 		wcn36xx_set_tx_mgmt(bd, wcn, hdr, bcast);
+		wcn36xx_set_tx_pdu(bd,
+			   ieee80211_is_data_qos(hdr->frame_control) ?
+			   sizeof(struct ieee80211_qos_hdr) :
+			   sizeof(struct ieee80211_hdr_3addr),
+			   skb->len, WCN36XX_TID);
 	}
 
 	buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32));
diff --git a/wcn36xx.h b/wcn36xx.h
index f5652a7..565ed79 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -115,6 +115,7 @@ struct wcn36xx_vif {
 };
 
 struct wcn_sta {
+	u16 tid;
 	u8 sta_id;
 	bool is_data_encrypted;
 };
-- 
1.8.2.2




More information about the wcn36xx mailing list