staging: wfx: relocate TX_RETRY_POLICY_MAX and TX_RETRY_POLICY_INVALID to hif API
The definitions TX_RETRY_POLICY_MAX and TX_RETRY_POLICY_INVALID are imposed by the hardware. Therefore, they should be located in the hardware interface API. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200406111756.154086-4-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d7dcf8a54e
commit
a4aac6b889
@ -16,8 +16,6 @@
|
|||||||
#include "traces.h"
|
#include "traces.h"
|
||||||
#include "hif_tx_mib.h"
|
#include "hif_tx_mib.h"
|
||||||
|
|
||||||
#define WFX_INVALID_RATE_ID 15
|
|
||||||
|
|
||||||
static int wfx_get_hw_rate(struct wfx_dev *wdev,
|
static int wfx_get_hw_rate(struct wfx_dev *wdev,
|
||||||
const struct ieee80211_tx_rate *rate)
|
const struct ieee80211_tx_rate *rate)
|
||||||
{
|
{
|
||||||
@ -117,7 +115,7 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif,
|
|||||||
if (list_empty(&cache->free)) {
|
if (list_empty(&cache->free)) {
|
||||||
WARN(1, "unable to get a valid Tx policy");
|
WARN(1, "unable to get a valid Tx policy");
|
||||||
spin_unlock_bh(&cache->lock);
|
spin_unlock_bh(&cache->lock);
|
||||||
return WFX_INVALID_RATE_ID;
|
return HIF_TX_RETRY_POLICY_INVALID;
|
||||||
}
|
}
|
||||||
idx = wfx_tx_policy_find(cache, &wanted);
|
idx = wfx_tx_policy_find(cache, &wanted);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
@ -146,7 +144,7 @@ static void wfx_tx_policy_put(struct wfx_vif *wvif, int idx)
|
|||||||
int usage, locked;
|
int usage, locked;
|
||||||
struct tx_policy_cache *cache = &wvif->tx_policy_cache;
|
struct tx_policy_cache *cache = &wvif->tx_policy_cache;
|
||||||
|
|
||||||
if (idx == WFX_INVALID_RATE_ID)
|
if (idx == HIF_TX_RETRY_POLICY_INVALID)
|
||||||
return;
|
return;
|
||||||
spin_lock_bh(&cache->lock);
|
spin_lock_bh(&cache->lock);
|
||||||
locked = list_empty(&cache->free);
|
locked = list_empty(&cache->free);
|
||||||
@ -164,11 +162,11 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
spin_lock_bh(&wvif->tx_policy_cache.lock);
|
spin_lock_bh(&wvif->tx_policy_cache.lock);
|
||||||
for (i = 0; i < HIF_MIB_NUM_TX_RATE_RETRY_POLICIES; ++i)
|
for (i = 0; i < HIF_TX_RETRY_POLICY_MAX; ++i)
|
||||||
if (!policies[i].uploaded &&
|
if (!policies[i].uploaded &&
|
||||||
memzcmp(policies[i].rates, sizeof(policies[i].rates)))
|
memzcmp(policies[i].rates, sizeof(policies[i].rates)))
|
||||||
break;
|
break;
|
||||||
if (i < HIF_MIB_NUM_TX_RATE_RETRY_POLICIES) {
|
if (i < HIF_TX_RETRY_POLICY_MAX) {
|
||||||
policies[i].uploaded = true;
|
policies[i].uploaded = true;
|
||||||
memcpy(tmp_rates, policies[i].rates, sizeof(tmp_rates));
|
memcpy(tmp_rates, policies[i].rates, sizeof(tmp_rates));
|
||||||
spin_unlock_bh(&wvif->tx_policy_cache.lock);
|
spin_unlock_bh(&wvif->tx_policy_cache.lock);
|
||||||
@ -176,7 +174,7 @@ static int wfx_tx_policy_upload(struct wfx_vif *wvif)
|
|||||||
} else {
|
} else {
|
||||||
spin_unlock_bh(&wvif->tx_policy_cache.lock);
|
spin_unlock_bh(&wvif->tx_policy_cache.lock);
|
||||||
}
|
}
|
||||||
} while (i < HIF_MIB_NUM_TX_RATE_RETRY_POLICIES);
|
} while (i < HIF_TX_RETRY_POLICY_MAX);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +198,7 @@ void wfx_tx_policy_init(struct wfx_vif *wvif)
|
|||||||
INIT_LIST_HEAD(&cache->used);
|
INIT_LIST_HEAD(&cache->used);
|
||||||
INIT_LIST_HEAD(&cache->free);
|
INIT_LIST_HEAD(&cache->free);
|
||||||
|
|
||||||
for (i = 0; i < HIF_MIB_NUM_TX_RATE_RETRY_POLICIES; ++i)
|
for (i = 0; i < HIF_TX_RETRY_POLICY_MAX; ++i)
|
||||||
list_add(&cache->cache[i].link, &cache->free);
|
list_add(&cache->cache[i].link, &cache->free);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,7 +306,7 @@ static u8 wfx_tx_get_rate_id(struct wfx_vif *wvif,
|
|||||||
|
|
||||||
rate_id = wfx_tx_policy_get(wvif,
|
rate_id = wfx_tx_policy_get(wvif,
|
||||||
tx_info->driver_rates, &tx_policy_renew);
|
tx_info->driver_rates, &tx_policy_renew);
|
||||||
if (rate_id == WFX_INVALID_RATE_ID)
|
if (rate_id == HIF_TX_RETRY_POLICY_INVALID)
|
||||||
dev_warn(wvif->wdev->dev, "unable to get a valid Tx policy");
|
dev_warn(wvif->wdev->dev, "unable to get a valid Tx policy");
|
||||||
|
|
||||||
if (tx_policy_renew) {
|
if (tx_policy_renew) {
|
||||||
|
@ -26,7 +26,7 @@ struct tx_policy {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct tx_policy_cache {
|
struct tx_policy_cache {
|
||||||
struct tx_policy cache[HIF_MIB_NUM_TX_RATE_RETRY_POLICIES];
|
struct tx_policy cache[HIF_TX_RETRY_POLICY_MAX];
|
||||||
// FIXME: use a trees and drop hash from tx_policy
|
// FIXME: use a trees and drop hash from tx_policy
|
||||||
struct list_head used;
|
struct list_head used;
|
||||||
struct list_head free;
|
struct list_head free;
|
||||||
|
@ -500,7 +500,8 @@ struct hif_mib_tx_rate_retry_policy {
|
|||||||
u8 rates[12];
|
u8 rates[12];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
#define HIF_MIB_NUM_TX_RATE_RETRY_POLICIES 15
|
#define HIF_TX_RETRY_POLICY_MAX 15
|
||||||
|
#define HIF_TX_RETRY_POLICY_INVALID HIF_TX_RETRY_POLICY_MAX
|
||||||
|
|
||||||
struct hif_mib_set_tx_rate_retry_policy {
|
struct hif_mib_set_tx_rate_retry_policy {
|
||||||
u8 num_tx_rate_policies;
|
u8 num_tx_rate_policies;
|
||||||
|
Loading…
Reference in New Issue
Block a user