mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
staging: wfx: simplify hif_set_edca_queue_params() usage
The struct hif_req_edca_queue_params comes from hardware API. It is not
intended to be manipulated in upper layers of the driver.
So, this patch:
1. relocate the handling of this struct in hif_set_edca_queue_params()
(the low level function)
2. replace it in wfx_vif by the mac80211 equivalent: struct
ieee80211_tx_queue_params
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20191217161318.31402-44-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
654e369365
commit
871341db22
|
|
@ -340,19 +340,25 @@ int hif_remove_key(struct wfx_dev *wdev, int idx)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int hif_set_edca_queue_params(struct wfx_vif *wvif,
|
||||
const struct hif_req_edca_queue_params *arg)
|
||||
int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue,
|
||||
const struct ieee80211_tx_queue_params *arg)
|
||||
{
|
||||
int ret;
|
||||
struct hif_msg *hif;
|
||||
struct hif_req_edca_queue_params *body = wfx_alloc_hif(sizeof(*body),
|
||||
&hif);
|
||||
|
||||
// NOTE: queues numerotation are not the same between WFx and Linux
|
||||
memcpy(body, arg, sizeof(*body));
|
||||
cpu_to_le16s(&body->cw_min);
|
||||
cpu_to_le16s(&body->cw_max);
|
||||
cpu_to_le16s(&body->tx_op_limit);
|
||||
WARN_ON(arg->aifs > 255);
|
||||
body->aifsn = arg->aifs;
|
||||
body->cw_min = cpu_to_le16(arg->cw_min);
|
||||
body->cw_max = cpu_to_le16(arg->cw_max);
|
||||
body->tx_op_limit = cpu_to_le16(arg->txop * USEC_PER_TXOP);
|
||||
body->queue_id = 3 - queue;
|
||||
// API 2.0 has changed queue IDs values
|
||||
if (wfx_api_older_than(wvif->wdev, 2, 0) && queue == IEEE80211_AC_BE)
|
||||
body->queue_id = HIF_QUEUE_ID_BACKGROUND;
|
||||
if (wfx_api_older_than(wvif->wdev, 2, 0) && queue == IEEE80211_AC_BK)
|
||||
body->queue_id = HIF_QUEUE_ID_BESTEFFORT;
|
||||
wfx_fill_header(hif, wvif->id, HIF_REQ_ID_EDCA_QUEUE_PARAMS,
|
||||
sizeof(*body));
|
||||
ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "hif_api_cmd.h"
|
||||
|
||||
struct ieee80211_tx_queue_params;
|
||||
struct wfx_dev;
|
||||
struct wfx_vif;
|
||||
|
||||
|
|
@ -52,8 +53,8 @@ int hif_set_bss_params(struct wfx_vif *wvif,
|
|||
const struct hif_req_set_bss_params *arg);
|
||||
int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg);
|
||||
int hif_remove_key(struct wfx_dev *wdev, int idx);
|
||||
int hif_set_edca_queue_params(struct wfx_vif *wvif,
|
||||
const struct hif_req_edca_queue_params *arg);
|
||||
int hif_set_edca_queue_params(struct wfx_vif *wvif, u16 queue,
|
||||
const struct ieee80211_tx_queue_params *arg);
|
||||
int hif_start(struct wfx_vif *wvif, const struct hif_req_start *arg);
|
||||
int hif_beacon_transmit(struct wfx_vif *wvif, bool enable);
|
||||
int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id);
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ static int wfx_get_prio_queue(struct wfx_vif *wvif,
|
|||
{
|
||||
static const int urgent = BIT(WFX_LINK_ID_AFTER_DTIM) |
|
||||
BIT(WFX_LINK_ID_UAPSD);
|
||||
struct hif_req_edca_queue_params *edca;
|
||||
const struct ieee80211_tx_queue_params *edca;
|
||||
unsigned int score, best = -1;
|
||||
int winner = -1;
|
||||
int i;
|
||||
|
|
@ -458,7 +458,7 @@ static int wfx_get_prio_queue(struct wfx_vif *wvif,
|
|||
if (!queued)
|
||||
continue;
|
||||
*total += queued;
|
||||
score = ((edca->aifsn + edca->cw_min) << 16) +
|
||||
score = ((edca->aifs + edca->cw_min) << 16) +
|
||||
((edca->cw_max - edca->cw_min) *
|
||||
(get_random_int() & 0xFFFF));
|
||||
if (score < best && (winner < 0 || i != 3)) {
|
||||
|
|
@ -595,7 +595,7 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev)
|
|||
wvif->pspoll_mask &= ~BIT(tx_priv->raw_link_id);
|
||||
|
||||
/* allow bursting if txop is set */
|
||||
if (wvif->edca_params[queue_num].tx_op_limit)
|
||||
if (wvif->edca_params[queue_num].txop)
|
||||
burst = (int)wfx_tx_queue_get_num_queued(queue, tx_allowed_mask) + 1;
|
||||
else
|
||||
burst = 1;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include "hif_tx.h"
|
||||
#include "hif_tx_mib.h"
|
||||
|
||||
#define TXOP_UNIT 32
|
||||
#define HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES 2
|
||||
|
||||
static u32 wfx_rate_mask_to_hw(struct wfx_dev *wdev, u32 rates)
|
||||
|
|
@ -322,26 +321,13 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
|||
{
|
||||
struct wfx_dev *wdev = hw->priv;
|
||||
struct wfx_vif *wvif = (struct wfx_vif *) vif->drv_priv;
|
||||
struct hif_req_edca_queue_params *edca;
|
||||
|
||||
WARN_ON(queue >= hw->queues);
|
||||
|
||||
mutex_lock(&wdev->conf_mutex);
|
||||
assign_bit(queue, &wvif->uapsd_mask, params->uapsd);
|
||||
edca = &wvif->edca_params[queue];
|
||||
edca->aifsn = params->aifs;
|
||||
edca->cw_min = params->cw_min;
|
||||
edca->cw_max = params->cw_max;
|
||||
edca->tx_op_limit = params->txop * TXOP_UNIT;
|
||||
edca->allowed_medium_time = 0;
|
||||
edca->queue_id = 3 - queue;
|
||||
// API 2.0 has changed queue IDs values
|
||||
if (wfx_api_older_than(wdev, 2, 0) && queue == IEEE80211_AC_BE)
|
||||
edca->queue_id = HIF_QUEUE_ID_BACKGROUND;
|
||||
if (wfx_api_older_than(wdev, 2, 0) && queue == IEEE80211_AC_BK)
|
||||
edca->queue_id = HIF_QUEUE_ID_BESTEFFORT;
|
||||
hif_set_edca_queue_params(wvif, edca);
|
||||
|
||||
memcpy(&wvif->edca_params[queue], params, sizeof(*params));
|
||||
hif_set_edca_queue_params(wvif, queue, params);
|
||||
if (wvif->vif->type == NL80211_IFTYPE_STATION) {
|
||||
hif_set_uapsd_info(wvif, wvif->uapsd_mask);
|
||||
if (wvif->setbssparams_done && wvif->state == WFX_STATE_STA)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include "hif_tx.h"
|
||||
#include "hif_api_general.h"
|
||||
|
||||
#define USEC_PER_TXOP 32 // see struct ieee80211_tx_queue_params
|
||||
|
||||
struct hwbus_ops;
|
||||
|
||||
struct wfx_dev {
|
||||
|
|
@ -114,7 +116,7 @@ struct wfx_vif {
|
|||
bool setbssparams_done;
|
||||
struct wfx_ht_info ht_info;
|
||||
unsigned long uapsd_mask;
|
||||
struct hif_req_edca_queue_params edca_params[IEEE80211_NUM_ACS];
|
||||
struct ieee80211_tx_queue_params edca_params[IEEE80211_NUM_ACS];
|
||||
struct hif_req_set_bss_params bss_params;
|
||||
struct work_struct bss_params_work;
|
||||
struct work_struct set_cts_work;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user