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);
 
 
 #include "hif_api_cmd.h"
 
+struct ieee80211_tx_queue_params;
 struct wfx_dev;
 struct wfx_vif;
 
                       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);
 
 {
        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;
                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)) {
                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;
 
 #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)
 {
        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)
 
 #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 {
        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;