]> git.baikalelectronics.ru Git - kernel.git/commitdiff
wifi: mac80211: use link in TXQ parameter configuration
authorShaul Triebitz <shaul.triebitz@intel.com>
Tue, 2 Aug 2022 12:22:42 +0000 (15:22 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 25 Aug 2022 08:40:57 +0000 (10:40 +0200)
Configure the correct link per the passed parameters.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/cfg.c

index 167acf843d7587b711eee8c447435b95ae0fb723..d97e13b5c3a8de3e7dd6725f106d165b69d16a0d 100644 (file)
 #include "mesh.h"
 #include "wme.h"
 
+static struct ieee80211_link_data *
+ieee80211_link_or_deflink(struct ieee80211_sub_if_data *sdata, int link_id)
+{
+       struct ieee80211_link_data *link;
+
+       if (link_id < 0) {
+               if (sdata->vif.valid_links)
+                       return ERR_PTR(-EINVAL);
+
+               return &sdata->deflink;
+       }
+
+       link = sdata_dereference(sdata->link[link_id], sdata);
+       if (!link)
+               return ERR_PTR(-ENOLINK);
+       return link;
+}
+
 static void ieee80211_set_mu_mimo_follow(struct ieee80211_sub_if_data *sdata,
                                         struct vif_params *params)
 {
@@ -2568,7 +2586,8 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy,
 {
        struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-       struct ieee80211_link_data *link = &sdata->deflink;
+       struct ieee80211_link_data *link =
+               ieee80211_link_or_deflink(sdata, params->link_id);
        struct ieee80211_tx_queue_params p;
 
        if (!local->ops->conf_tx)
@@ -2577,6 +2596,9 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy,
        if (local->hw.queues < IEEE80211_NUM_ACS)
                return -EOPNOTSUPP;
 
+       if (IS_ERR(link))
+               return PTR_ERR(link);
+
        memset(&p, 0, sizeof(p));
        p.aifs = params->aifs;
        p.cw_max = params->cwmax;