Skip to contentSkip to conversation

ath9k: fix a regression in PS frame filter handling

PATCH In review Felix Fietkau 2 participants 2 messages May 10, 2011 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ath9k: fix a regression in PS frame filter handling

Only leave filtering enabled for AP or VLAN interfaces, clear the destination mask for all other interfaces.

---
 drivers/net/wireless/ath/ath9k/main.c |    5 +++++
 drivers/net/wireless/ath/ath9k/xmit.c |    6 ++++++
 2 files changed, 11 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +5 -0
index 3de115d..3d999b7 100644
@@ -1778,6 +1778,11 @@ static int ath9k_sta_add(struct ieee80211_hw *hw,
 	struct ieee80211_key_conf ps_key = { };
 
 	ath_node_attach(sc, sta);
+
+	if (vif->type != NL80211_IFTYPE_AP &&
+	    vif->type != NL80211_IFTYPE_AP_VLAN)
+		return 0;
+
 	an->ps_key = ath_key_config(common, vif, sta, &ps_key);
 
 	return 0;
drivers/net/wireless/ath/ath9k/xmit.c +6 -0
index 744779d..97dd1fa 100644
@@ -1845,6 +1845,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_sta *sta = info->control.sta;
+	struct ieee80211_vif *vif = info->control.vif;
 	struct ath_softc *sc = hw->priv;
 	struct ath_txq *txq = txctl->txq;
 	struct ath_buf *bf;
@@ -1882,6 +1883,11 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
 		memmove(skb->data, skb->data + padsize, padpos);
 	}
 
+	if ((vif && vif->type != NL80211_IFTYPE_AP &&
+	            vif->type != NL80211_IFTYPE_AP_VLAN) ||
+	    !ieee80211_is_data(hdr->frame_control))
+		info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
+
 	setup_frame_info(hw, skb, frmlen);
 
 	/*
Signature · 1 line
1.7.3.2
Tested-by on v2 1/1
#1 lore raw
Quoted 2 lines · Felix Fietkau

Only leave filtering enabled for AP or VLAN interfaces, clear the destination mask for all other interfaces.

I did a quick test with 32 virtual stations and it seems to work fine.

Thanks,
Ben

Quoted 48 lines
---
  drivers/net/wireless/ath/ath9k/main.c |    5 +++++
  drivers/net/wireless/ath/ath9k/xmit.c |    6 ++++++
  2 files changed, 11 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +5 -0
index 3de115d..3d999b7 100644
@@ -1778,6 +1778,11 @@ static int ath9k_sta_add(struct ieee80211_hw *hw,
  	struct ieee80211_key_conf ps_key = { };
 
  	ath_node_attach(sc, sta);
+
+	if (vif->type != NL80211_IFTYPE_AP&&
+	    vif->type != NL80211_IFTYPE_AP_VLAN)
+		return 0;
+
  	an->ps_key = ath_key_config(common, vif, sta,&ps_key);
 
  	return 0;
drivers/net/wireless/ath/ath9k/xmit.c +6 -0
index 744779d..97dd1fa 100644
@@ -1845,6 +1845,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
  	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  	struct ieee80211_sta *sta = info->control.sta;
+	struct ieee80211_vif *vif = info->control.vif;
  	struct ath_softc *sc = hw->priv;
  	struct ath_txq *txq = txctl->txq;
  	struct ath_buf *bf;
@@ -1882,6 +1883,11 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
  		memmove(skb->data, skb->data + padsize, padpos);
  	}
 
+	if ((vif&&  vif->type != NL80211_IFTYPE_AP&&
+	            vif->type != NL80211_IFTYPE_AP_VLAN) ||
+	    !ieee80211_is_data(hdr->frame_control))
+		info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
+
  	setup_frame_info(hw, skb, frmlen);
 
  	/*
Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com