[PATCH 42/55] staging: wfx: remove unnecessary EDCA initialisation

From: JÃrÃme Pouiller
Date: Mon Dec 16 2019 - 12:08:45 EST


From: JÃrÃme Pouiller <jerome.pouiller@xxxxxxxxxx>

mac80211 already call wfx_conf_tx() on every VIF instanciation. So, the
driver does not need to do it.

Note that current code did dirty things with wvif->edca_params. This
struct was initialized, but only 'queue_id' was really used. The other
members are only used to store temporary values.

Signed-off-by: JÃrÃme Pouiller <jerome.pouiller@xxxxxxxxxx>
---
drivers/staging/wfx/sta.c | 51 +++++----------------------------------
1 file changed, 6 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index d52f618062a6..3504b6b3515e 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -334,6 +334,12 @@ int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
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);

if (wvif->vif->type == NL80211_IFTYPE_STATION) {
@@ -1393,44 +1399,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
int i;
struct wfx_dev *wdev = hw->priv;
struct wfx_vif *wvif = (struct wfx_vif *) vif->drv_priv;
- // FIXME: parameters are set by kernel juste after interface_add.
- // Keep struct hif_req_edca_queue_params blank?
- struct hif_req_edca_queue_params default_edca_params[] = {
- [IEEE80211_AC_VO] = {
- .queue_id = HIF_QUEUE_ID_VOICE,
- .aifsn = 2,
- .cw_min = 3,
- .cw_max = 7,
- .tx_op_limit = TXOP_UNIT * 47,
- },
- [IEEE80211_AC_VI] = {
- .queue_id = HIF_QUEUE_ID_VIDEO,
- .aifsn = 2,
- .cw_min = 7,
- .cw_max = 15,
- .tx_op_limit = TXOP_UNIT * 94,
- },
- [IEEE80211_AC_BE] = {
- .queue_id = HIF_QUEUE_ID_BESTEFFORT,
- .aifsn = 3,
- .cw_min = 15,
- .cw_max = 1023,
- .tx_op_limit = TXOP_UNIT * 0,
- },
- [IEEE80211_AC_BK] = {
- .queue_id = HIF_QUEUE_ID_BACKGROUND,
- .aifsn = 7,
- .cw_min = 15,
- .cw_max = 1023,
- .tx_op_limit = TXOP_UNIT * 0,
- },
- };
-
- BUILD_BUG_ON(ARRAY_SIZE(default_edca_params) != ARRAY_SIZE(wvif->edca_params));
- if (wfx_api_older_than(wdev, 2, 0)) {
- default_edca_params[IEEE80211_AC_BE].queue_id = HIF_QUEUE_ID_BACKGROUND;
- default_edca_params[IEEE80211_AC_BK].queue_id = HIF_QUEUE_ID_BESTEFFORT;
- }

vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER |
IEEE80211_VIF_SUPPORTS_UAPSD |
@@ -1501,13 +1469,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
mutex_unlock(&wdev->conf_mutex);

hif_set_macaddr(wvif, vif->addr);
- for (i = 0; i < IEEE80211_NUM_ACS; i++) {
- memcpy(&wvif->edca_params[i], &default_edca_params[i],
- sizeof(default_edca_params[i]));
- hif_set_edca_queue_params(wvif, &wvif->edca_params[i]);
- }
- wvif->uapsd_mask = 0;
- hif_set_uapsd_info(wvif, wvif->uapsd_mask);

wfx_tx_policy_init(wvif);
wvif = NULL;
--
2.20.1