OSDN Git Service

staging: wfx: replace wfx_tx_get_tid() with ieee80211_get_tid()
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Wed, 15 Jan 2020 13:55:18 +0000 (13:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jan 2020 19:59:52 +0000 (20:59 +0100)
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: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-53-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/data_tx.c
drivers/staging/wfx/data_tx.h
drivers/staging/wfx/sta.c
drivers/staging/wfx/sta.h

index 8c9f986..7da1afd 100644 (file)
@@ -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);
        struct wfx_sta_priv *sta_priv;
+       int tid = ieee80211_get_tid(hdr);
 
        spin_lock_bh(&wvif->ps_state_lock);
        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,
        }
        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;
                spin_lock_bh(&sta_priv->lock);
-               sta_priv->buffered[tx_priv->tid]++;
-               ieee80211_sta_set_buffered(sta, tx_priv->tid, true);
+               sta_priv->buffered[tid]++;
+               ieee80211_sta_set_buffered(sta, tid, true);
                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
        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)
 {
        int mic_space;
@@ -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));
        // Fill tx_priv
        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->link_id = tx_priv->raw_link_id;
        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)
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
        struct ieee80211_sta *sta;
        struct wfx_sta_priv *sta_priv;
-       int tid = wfx_tx_get_tid(hdr);
+       int tid = ieee80211_get_tid(hdr);
 
        rcu_read_lock(); // protect sta
        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;
                spin_lock_bh(&sta_priv->lock);
                WARN(!sta_priv->buffered[tid], "inconsistent notification");
index 83720b3..04b2147 100644 (file)
@@ -38,7 +38,6 @@ struct wfx_tx_priv {
        struct ieee80211_key_conf *hw_key;
        u8 link_id;
        u8 raw_link_id;
-       u8 tid;
 } __packed;
 
 void wfx_tx_policy_init(struct wfx_vif *wvif);
index 3395527..aa1a68b 100644 (file)
@@ -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;
        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");
        // FIXME: see note in wfx_sta_add()
        if (vif->type == NL80211_IFTYPE_STATION)
index 47d94d6..e832405 100644 (file)
@@ -12,9 +12,6 @@
 
 #include "hif_api_cmd.h"
 
-// FIXME: use IEEE80211_NUM_TIDS
-#define WFX_MAX_TID               8
-
 struct wfx_dev;
 struct wfx_vif;
 
@@ -40,7 +37,7 @@ struct wfx_grp_addr_table {
 struct wfx_sta_priv {
        int link_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()
        spinlock_t lock;
 };