]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: use struct for ieee80211_determine_ap_chan() args
authorJohannes Berg <johannes.berg@intel.com>
Tue, 28 Apr 2026 09:25:29 +0000 (11:25 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 5 May 2026 12:49:02 +0000 (14:49 +0200)
There are too many arguments, and we're going to need another one
for DBE. Collect them into a struct instead.

Link: https://patch.msgid.link/20260428112708.25728de3468e.Ic3b172b7a52f5876b3ea702bc1f092111db45f20@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mlme.c

index 1ae83b6558147d8729c31469ced8e569cce8d8b9..d2f16f49931d3aa8e8197ad54582a642ffa9ad05 100644 (file)
@@ -149,20 +149,32 @@ static int ecw2cw(int ecw)
        return (1 << ecw) - 1;
 }
 
+struct ieee80211_determine_ap_chan_data {
+       /* input data */
+       struct ieee80211_channel *channel;
+       const struct ieee802_11_elems *elems;
+       const struct ieee80211_conn_settings *conn;
+       u32 vht_cap_info;
+       bool ignore_ht_channel_mismatch;
+
+       /* target chandef is filled in */
+       struct cfg80211_chan_def *chandef;
+};
+
 static enum ieee80211_conn_mode
 ieee80211_determine_ap_chan(struct ieee80211_sub_if_data *sdata,
-                           struct ieee80211_channel *channel,
-                           u32 vht_cap_info,
-                           const struct ieee802_11_elems *elems,
-                           bool ignore_ht_channel_mismatch,
-                           const struct ieee80211_conn_settings *conn,
-                           struct cfg80211_chan_def *chandef)
+                           struct ieee80211_determine_ap_chan_data *data)
 {
+       bool ignore_ht_channel_mismatch = data->ignore_ht_channel_mismatch;
+       const struct ieee802_11_elems *elems = data->elems;
        const struct ieee80211_ht_operation *ht_oper = elems->ht_operation;
        const struct ieee80211_vht_operation *vht_oper = elems->vht_operation;
        const struct ieee80211_he_operation *he_oper = elems->he_operation;
        const struct ieee80211_eht_operation *eht_oper = elems->eht_operation;
        const struct ieee80211_uhr_operation *uhr_oper = elems->uhr_operation;
+       const struct ieee80211_conn_settings *conn = data->conn;
+       struct ieee80211_channel *channel = data->channel;
+       struct cfg80211_chan_def *chandef = data->chandef;
        struct ieee80211_supported_band *sband =
                sdata->local->hw.wiphy->bands[channel->band];
        struct cfg80211_chan_def vht_chandef;
@@ -288,7 +300,7 @@ ieee80211_determine_ap_chan(struct ieee80211_sub_if_data *sdata,
                memcpy(&he_oper_vht_cap, he_oper->optional, 3);
                he_oper_vht_cap.basic_mcs_set = cpu_to_le16(0);
 
-               if (!ieee80211_chandef_vht_oper(&sdata->local->hw, vht_cap_info,
+               if (!ieee80211_chandef_vht_oper(&sdata->local->hw, data->vht_cap_info,
                                                &he_oper_vht_cap, ht_oper,
                                                &vht_chandef)) {
                        sdata_info(sdata,
@@ -303,7 +315,7 @@ ieee80211_determine_ap_chan(struct ieee80211_sub_if_data *sdata,
        } else if (sband->band == NL80211_BAND_2GHZ) {
                no_vht = true;
        } else if (!ieee80211_chandef_vht_oper(&sdata->local->hw,
-                                              vht_cap_info,
+                                              data->vht_cap_info,
                                               vht_oper, ht_oper,
                                               &vht_chandef)) {
                sdata_info(sdata,
@@ -1085,6 +1097,13 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata,
        enum ieee80211_conn_mode ap_mode;
        unsigned long unknown_rates_selectors[BITS_TO_LONGS(128)] = {};
        unsigned long sta_selectors[BITS_TO_LONGS(128)] = {};
+       struct ieee80211_determine_ap_chan_data ap_chan_data = {
+               .channel = channel,
+               .vht_cap_info = bss->vht_cap_info,
+               .ignore_ht_channel_mismatch = false,
+               .chandef = ap_chandef,
+               .conn = conn,
+       };
        int ret;
 
 again:
@@ -1093,8 +1112,8 @@ again:
        if (!elems)
                return ERR_PTR(-ENOMEM);
 
-       ap_mode = ieee80211_determine_ap_chan(sdata, channel, bss->vht_cap_info,
-                                             elems, false, conn, ap_chandef);
+       ap_chan_data.elems = elems;
+       ap_mode = ieee80211_determine_ap_chan(sdata, &ap_chan_data);
 
        /* this should be impossible since parsing depends on our mode */
        if (WARN_ON(ap_mode > conn->mode)) {
@@ -1322,12 +1341,19 @@ static int ieee80211_config_bw(struct ieee80211_link_data *link,
                               bool update, u64 *changed, u16 stype)
 {
        struct ieee80211_channel *channel = link->conf->chanreq.oper.chan;
+       struct cfg80211_chan_def ap_chandef;
+       struct ieee80211_determine_ap_chan_data ap_chan_data = {
+               .channel = channel,
+               .vht_cap_info = 0,
+               .ignore_ht_channel_mismatch = true,
+               .chandef = &ap_chandef,
+               .elems = elems,
+               .conn = &link->u.mgd.conn,
+       };
        struct ieee80211_sub_if_data *sdata = link->sdata;
        struct ieee80211_chan_req chanreq = {};
-       struct cfg80211_chan_def ap_chandef;
        enum ieee80211_conn_mode ap_mode;
        const char *frame;
-       u32 vht_cap_info = 0;
        u16 ht_opmode;
        int ret;
 
@@ -1355,11 +1381,10 @@ static int ieee80211_config_bw(struct ieee80211_link_data *link,
                return 0;
 
        if (elems->vht_cap_elem)
-               vht_cap_info = le32_to_cpu(elems->vht_cap_elem->vht_cap_info);
+               ap_chan_data.vht_cap_info =
+                       le32_to_cpu(elems->vht_cap_elem->vht_cap_info);
 
-       ap_mode = ieee80211_determine_ap_chan(sdata, channel, vht_cap_info,
-                                             elems, true, &link->u.mgd.conn,
-                                             &ap_chandef);
+       ap_mode = ieee80211_determine_ap_chan(sdata, &ap_chan_data);
 
        if (ap_mode != link->u.mgd.conn.mode) {
                link_info(link,