Skip to content

Commit

Permalink
mac80211: fix sequence number assignment for PS response frames
Browse files Browse the repository at this point in the history
When using intermediate queues, sequence number allocation is deferred
until dequeue. This doesn't work for PS response frames, which bypass
those queues.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Felix Fietkau authored and Johannes Berg committed Sep 12, 2016
1 parent 83843c8 commit df6ef5d
Showing 1 changed file with 33 additions and 32 deletions.
65 changes: 33 additions & 32 deletions net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,36 @@ static __le16 ieee80211_tx_next_seq(struct sta_info *sta, int tid)
return ret;
}

static struct txq_info *ieee80211_get_txq(struct ieee80211_local *local,
struct ieee80211_vif *vif,
struct ieee80211_sta *pubsta,
struct sk_buff *skb)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_txq *txq = NULL;

if ((info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) ||
(info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE))
return NULL;

if (!ieee80211_is_data(hdr->frame_control))
return NULL;

if (pubsta) {
u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;

txq = pubsta->txq[tid];
} else if (vif) {
txq = vif->txq;
}

if (!txq)
return NULL;

return to_txq_info(txq);
}

static ieee80211_tx_result debug_noinline
ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
{
Expand Down Expand Up @@ -853,7 +883,8 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
tx->sta->tx_stats.msdu[tid]++;

if (!tx->sta->sta.txq[0])
if (!ieee80211_get_txq(tx->local, info->control.vif, &tx->sta->sta,
tx->skb))
hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid);

return TX_CONTINUE;
Expand Down Expand Up @@ -1243,36 +1274,6 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
return TX_CONTINUE;
}

static struct txq_info *ieee80211_get_txq(struct ieee80211_local *local,
struct ieee80211_vif *vif,
struct ieee80211_sta *pubsta,
struct sk_buff *skb)
{
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_txq *txq = NULL;

if ((info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) ||
(info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE))
return NULL;

if (!ieee80211_is_data(hdr->frame_control))
return NULL;

if (pubsta) {
u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;

txq = pubsta->txq[tid];
} else if (vif) {
txq = vif->txq;
}

if (!txq)
return NULL;

return to_txq_info(txq);
}

static void ieee80211_set_skb_enqueue_time(struct sk_buff *skb)
{
IEEE80211_SKB_CB(skb)->control.enqueue_time = codel_get_time();
Expand Down Expand Up @@ -3264,7 +3265,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,

if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
*ieee80211_get_qos_ctl(hdr) = tid;
if (!sta->sta.txq[0])
if (!ieee80211_get_txq(local, &sdata->vif, &sta->sta, skb))
hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid);
} else {
info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
Expand Down

0 comments on commit df6ef5d

Please sign in to comment.