Commit df3519a3 authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman

staging: wfx: replace wfx_tx_get_tid() with ieee80211_get_tid()

wfx_tx_get_tid() was used as a wrapper around ieee80211_get_tid(). It
did sometime return WFX_MAX_TID to ask to upper layers to not include
the frame in "buffered" counter. The objective of this behavior is not
clear, but tests has shown that wfx_tx_get_tid() can be replaced by
ieee80211_get_tid() without any regressions.

BTW, it is not necessary to save the tid in tx_rpiv since it can be
retrieved from the 802.11 header.
Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-53-Jerome.Pouiller@silabs.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 98511a91
...@@ -283,6 +283,7 @@ static void wfx_tx_manage_pm(struct wfx_vif *wvif, struct ieee80211_hdr *hdr, ...@@ -283,6 +283,7 @@ static void wfx_tx_manage_pm(struct wfx_vif *wvif, struct ieee80211_hdr *hdr,
{ {
u32 mask = ~BIT(tx_priv->raw_link_id); u32 mask = ~BIT(tx_priv->raw_link_id);
struct wfx_sta_priv *sta_priv; struct wfx_sta_priv *sta_priv;
int tid = ieee80211_get_tid(hdr);
spin_lock_bh(&wvif->ps_state_lock); spin_lock_bh(&wvif->ps_state_lock);
if (ieee80211_is_auth(hdr->frame_control)) { if (ieee80211_is_auth(hdr->frame_control)) {
...@@ -298,11 +299,11 @@ static void wfx_tx_manage_pm(struct wfx_vif *wvif, struct ieee80211_hdr *hdr, ...@@ -298,11 +299,11 @@ static void wfx_tx_manage_pm(struct wfx_vif *wvif, struct ieee80211_hdr *hdr,
} }
spin_unlock_bh(&wvif->ps_state_lock); spin_unlock_bh(&wvif->ps_state_lock);
if (sta && tx_priv->tid < WFX_MAX_TID) { if (sta) {
sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; sta_priv = (struct wfx_sta_priv *)&sta->drv_priv;
spin_lock_bh(&sta_priv->lock); spin_lock_bh(&sta_priv->lock);
sta_priv->buffered[tx_priv->tid]++; sta_priv->buffered[tid]++;
ieee80211_sta_set_buffered(sta, tx_priv->tid, true); ieee80211_sta_set_buffered(sta, tid, true);
spin_unlock_bh(&sta_priv->lock); spin_unlock_bh(&sta_priv->lock);
} }
} }
...@@ -418,17 +419,6 @@ static struct hif_ht_tx_parameters wfx_tx_get_tx_parms(struct wfx_dev *wdev, str ...@@ -418,17 +419,6 @@ static struct hif_ht_tx_parameters wfx_tx_get_tx_parms(struct wfx_dev *wdev, str
return ret; return ret;
} }
static u8 wfx_tx_get_tid(struct ieee80211_hdr *hdr)
{
// FIXME: ieee80211_get_tid(hdr) should be sufficient for all cases.
if (!ieee80211_is_data(hdr->frame_control))
return WFX_MAX_TID;
if (ieee80211_is_data_qos(hdr->frame_control))
return ieee80211_get_tid(hdr);
else
return 0;
}
static int wfx_tx_get_icv_len(struct ieee80211_key_conf *hw_key) static int wfx_tx_get_icv_len(struct ieee80211_key_conf *hw_key)
{ {
int mic_space; int mic_space;
...@@ -460,7 +450,6 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, ...@@ -460,7 +450,6 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta,
memset(tx_info->rate_driver_data, 0, sizeof(struct wfx_tx_priv)); memset(tx_info->rate_driver_data, 0, sizeof(struct wfx_tx_priv));
// Fill tx_priv // Fill tx_priv
tx_priv = (struct wfx_tx_priv *)tx_info->rate_driver_data; tx_priv = (struct wfx_tx_priv *)tx_info->rate_driver_data;
tx_priv->tid = wfx_tx_get_tid(hdr);
tx_priv->raw_link_id = wfx_tx_get_raw_link_id(wvif, sta, hdr); tx_priv->raw_link_id = wfx_tx_get_raw_link_id(wvif, sta, hdr);
tx_priv->link_id = tx_priv->raw_link_id; tx_priv->link_id = tx_priv->raw_link_id;
if (ieee80211_has_protected(hdr->frame_control)) if (ieee80211_has_protected(hdr->frame_control))
...@@ -634,11 +623,11 @@ static void wfx_notify_buffered_tx(struct wfx_vif *wvif, struct sk_buff *skb) ...@@ -634,11 +623,11 @@ static void wfx_notify_buffered_tx(struct wfx_vif *wvif, struct sk_buff *skb)
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_sta *sta; struct ieee80211_sta *sta;
struct wfx_sta_priv *sta_priv; struct wfx_sta_priv *sta_priv;
int tid = wfx_tx_get_tid(hdr); int tid = ieee80211_get_tid(hdr);
rcu_read_lock(); // protect sta rcu_read_lock(); // protect sta
sta = ieee80211_find_sta(wvif->vif, hdr->addr1); sta = ieee80211_find_sta(wvif->vif, hdr->addr1);
if (sta && tid < WFX_MAX_TID) { if (sta) {
sta_priv = (struct wfx_sta_priv *)&sta->drv_priv; sta_priv = (struct wfx_sta_priv *)&sta->drv_priv;
spin_lock_bh(&sta_priv->lock); spin_lock_bh(&sta_priv->lock);
WARN(!sta_priv->buffered[tid], "inconsistent notification"); WARN(!sta_priv->buffered[tid], "inconsistent notification");
......
...@@ -38,7 +38,6 @@ struct wfx_tx_priv { ...@@ -38,7 +38,6 @@ struct wfx_tx_priv {
struct ieee80211_key_conf *hw_key; struct ieee80211_key_conf *hw_key;
u8 link_id; u8 link_id;
u8 raw_link_id; u8 raw_link_id;
u8 tid;
} __packed; } __packed;
void wfx_tx_policy_init(struct wfx_vif *wvif); void wfx_tx_policy_init(struct wfx_vif *wvif);
......
...@@ -604,7 +604,7 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -604,7 +604,7 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *) &sta->drv_priv; struct wfx_sta_priv *sta_priv = (struct wfx_sta_priv *) &sta->drv_priv;
int i; int i;
for (i = 0; i < WFX_MAX_TID; i++) for (i = 0; i < ARRAY_SIZE(sta_priv->buffered); i++)
WARN(sta_priv->buffered[i], "release station while Tx is in progress"); WARN(sta_priv->buffered[i], "release station while Tx is in progress");
// FIXME: see note in wfx_sta_add() // FIXME: see note in wfx_sta_add()
if (vif->type == NL80211_IFTYPE_STATION) if (vif->type == NL80211_IFTYPE_STATION)
......
...@@ -12,9 +12,6 @@ ...@@ -12,9 +12,6 @@
#include "hif_api_cmd.h" #include "hif_api_cmd.h"
// FIXME: use IEEE80211_NUM_TIDS
#define WFX_MAX_TID 8
struct wfx_dev; struct wfx_dev;
struct wfx_vif; struct wfx_vif;
...@@ -40,7 +37,7 @@ struct wfx_grp_addr_table { ...@@ -40,7 +37,7 @@ struct wfx_grp_addr_table {
struct wfx_sta_priv { struct wfx_sta_priv {
int link_id; int link_id;
int vif_id; int vif_id;
u8 buffered[WFX_MAX_TID]; u8 buffered[IEEE80211_NUM_TIDS];
// Ensure atomicity of "buffered" and calls to ieee80211_sta_set_buffered() // Ensure atomicity of "buffered" and calls to ieee80211_sta_set_buffered()
spinlock_t lock; spinlock_t lock;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment