Skip to content

Commit

Permalink
wifi: mac80211: consistently use u64 for BSS changes
Browse files Browse the repository at this point in the history
Currently, enum ieee80211_bss_change has more than 32 flags.
Change the type of the corresponding variables from u32 to u64.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230604120651.10354a05eaf1.If19359262fe2728dd523ea6d7c3aa7dc50940411@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Anjaneyulu authored and Johannes Berg committed Jun 6, 2023
1 parent 92747f1 commit 15ddba5
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 111 deletions.
79 changes: 38 additions & 41 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,18 +1101,20 @@ ieee80211_copy_rnr_beacon(u8 *pos, struct cfg80211_rnr_elems *dst,
return offset;
}

static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
struct ieee80211_link_data *link,
struct cfg80211_beacon_data *params,
const struct ieee80211_csa_settings *csa,
const struct ieee80211_color_change_settings *cca)
static int
ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
struct ieee80211_link_data *link,
struct cfg80211_beacon_data *params,
const struct ieee80211_csa_settings *csa,
const struct ieee80211_color_change_settings *cca,
u64 *changed)
{
struct cfg80211_mbssid_elems *mbssid = NULL;
struct cfg80211_rnr_elems *rnr = NULL;
struct beacon_data *new, *old;
int new_head_len, new_tail_len;
int size, err;
u32 changed = BSS_CHANGED_BEACON;
u64 _changed = BSS_CHANGED_BEACON;
struct ieee80211_bss_conf *link_conf = link->conf;

old = sdata_dereference(link->u.ap.beacon, sdata);
Expand Down Expand Up @@ -1219,7 +1221,7 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
return err;
}
if (err == 0)
changed |= BSS_CHANGED_AP_PROBE_RESP;
_changed |= BSS_CHANGED_AP_PROBE_RESP;

if (params->ftm_responder != -1) {
link_conf->ftm_responder = params->ftm_responder;
Expand All @@ -1235,7 +1237,7 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
return err;
}

changed |= BSS_CHANGED_FTM_RESPONDER;
_changed |= BSS_CHANGED_FTM_RESPONDER;
}

rcu_assign_pointer(link->u.ap.beacon, new);
Expand All @@ -1244,7 +1246,8 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
if (old)
kfree_rcu(old, rcu_head);

return changed;
*changed |= _changed;
return 0;
}

static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
Expand Down Expand Up @@ -1446,10 +1449,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL))
link_conf->beacon_tx_rate = params->beacon_rate;

err = ieee80211_assign_beacon(sdata, link, &params->beacon, NULL, NULL);
err = ieee80211_assign_beacon(sdata, link, &params->beacon, NULL, NULL,
&changed);
if (err < 0)
goto error;
changed |= err;

if (params->fils_discovery.max_interval) {
err = ieee80211_set_fils_discovery(sdata,
Expand Down Expand Up @@ -1506,6 +1509,7 @@ static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
struct beacon_data *old;
int err;
struct ieee80211_bss_conf *link_conf;
u64 changed = 0;

sdata_assert_lock(sdata);

Expand All @@ -1525,17 +1529,18 @@ static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
if (!old)
return -ENOENT;

err = ieee80211_assign_beacon(sdata, link, params, NULL, NULL);
err = ieee80211_assign_beacon(sdata, link, params, NULL, NULL,
&changed);
if (err < 0)
return err;

if (params->he_bss_color_valid &&
params->he_bss_color.enabled != link_conf->he_bss_color.enabled) {
link_conf->he_bss_color.enabled = params->he_bss_color.enabled;
err |= BSS_CHANGED_HE_BSS_COLOR;
changed |= BSS_CHANGED_HE_BSS_COLOR;
}

ieee80211_link_info_change_notify(sdata, link, err);
ieee80211_link_info_change_notify(sdata, link, changed);
return 0;
}

Expand Down Expand Up @@ -1717,7 +1722,7 @@ static void sta_apply_mesh_params(struct ieee80211_local *local,
{
#ifdef CONFIG_MAC80211_MESH
struct ieee80211_sub_if_data *sdata = sta->sdata;
u32 changed = 0;
u64 changed = 0;

if (params->sta_modify_mask & STATION_PARAM_APPLY_PLINK_STATE) {
switch (params->plink_state) {
Expand Down Expand Up @@ -2664,7 +2669,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_link_data *link;
struct ieee80211_supported_band *sband;
u32 changed = 0;
u64 changed = 0;

link = ieee80211_link_or_deflink(sdata, params->link_id, true);
if (IS_ERR(link))
Expand Down Expand Up @@ -3589,7 +3594,7 @@ void ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif, bool block_t
EXPORT_SYMBOL(ieee80211_channel_switch_disconnect);

static int ieee80211_set_after_csa_beacon(struct ieee80211_sub_if_data *sdata,
u32 *changed)
u64 *changed)
{
int err;

Expand All @@ -3600,25 +3605,22 @@ static int ieee80211_set_after_csa_beacon(struct ieee80211_sub_if_data *sdata,

err = ieee80211_assign_beacon(sdata, &sdata->deflink,
sdata->deflink.u.ap.next_beacon,
NULL, NULL);
NULL, NULL, changed);
ieee80211_free_next_beacon(&sdata->deflink);

if (err < 0)
return err;
*changed |= err;
break;
case NL80211_IFTYPE_ADHOC:
err = ieee80211_ibss_finish_csa(sdata);
err = ieee80211_ibss_finish_csa(sdata, changed);
if (err < 0)
return err;
*changed |= err;
break;
#ifdef CONFIG_MAC80211_MESH
case NL80211_IFTYPE_MESH_POINT:
err = ieee80211_mesh_finish_csa(sdata);
err = ieee80211_mesh_finish_csa(sdata, changed);
if (err < 0)
return err;
*changed |= err;
break;
#endif
default:
Expand All @@ -3632,7 +3634,7 @@ static int ieee80211_set_after_csa_beacon(struct ieee80211_sub_if_data *sdata,
static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
u32 changed = 0;
u64 changed = 0;
int err;

sdata_assert_lock(sdata);
Expand Down Expand Up @@ -3729,7 +3731,7 @@ void ieee80211_csa_finalize_work(struct work_struct *work)

static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata,
struct cfg80211_csa_settings *params,
u32 *changed)
u64 *changed)
{
struct ieee80211_csa_settings csa = {};
int err;
Expand Down Expand Up @@ -3776,12 +3778,11 @@ static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata,

err = ieee80211_assign_beacon(sdata, &sdata->deflink,
&params->beacon_csa, &csa,
NULL);
NULL, changed);
if (err < 0) {
ieee80211_free_next_beacon(&sdata->deflink);
return err;
}
*changed |= err;

break;
case NL80211_IFTYPE_ADHOC:
Expand Down Expand Up @@ -3813,10 +3814,9 @@ static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata,

/* see comments in the NL80211_IFTYPE_AP block */
if (params->count > 1) {
err = ieee80211_ibss_csa_beacon(sdata, params);
err = ieee80211_ibss_csa_beacon(sdata, params, changed);
if (err < 0)
return err;
*changed |= err;
}

ieee80211_send_action_csa(sdata, params);
Expand All @@ -3841,12 +3841,11 @@ static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata,

/* see comments in the NL80211_IFTYPE_AP block */
if (params->count > 1) {
err = ieee80211_mesh_csa_beacon(sdata, params);
err = ieee80211_mesh_csa_beacon(sdata, params, changed);
if (err < 0) {
ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE;
return err;
}
*changed |= err;
}

if (ifmsh->csa_role == IEEE80211_MESH_CSA_ROLE_INIT)
Expand Down Expand Up @@ -3880,7 +3879,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_channel_switch ch_switch;
struct ieee80211_chanctx_conf *conf;
struct ieee80211_chanctx *chanctx;
u32 changed = 0;
u64 changed = 0;
int err;

sdata_assert_lock(sdata);
Expand Down Expand Up @@ -4613,7 +4612,7 @@ static int ieee80211_set_sar_specs(struct wiphy *wiphy,

static int
ieee80211_set_after_color_change_beacon(struct ieee80211_sub_if_data *sdata,
u32 *changed)
u64 *changed)
{
switch (sdata->vif.type) {
case NL80211_IFTYPE_AP: {
Expand All @@ -4624,13 +4623,12 @@ ieee80211_set_after_color_change_beacon(struct ieee80211_sub_if_data *sdata,

ret = ieee80211_assign_beacon(sdata, &sdata->deflink,
sdata->deflink.u.ap.next_beacon,
NULL, NULL);
NULL, NULL, changed);
ieee80211_free_next_beacon(&sdata->deflink);

if (ret < 0)
return ret;

*changed |= ret;
break;
}
default:
Expand All @@ -4644,7 +4642,7 @@ ieee80211_set_after_color_change_beacon(struct ieee80211_sub_if_data *sdata,
static int
ieee80211_set_color_change_beacon(struct ieee80211_sub_if_data *sdata,
struct cfg80211_color_change_settings *params,
u32 *changed)
u64 *changed)
{
struct ieee80211_color_change_settings color_change = {};
int err;
Expand All @@ -4667,12 +4665,11 @@ ieee80211_set_color_change_beacon(struct ieee80211_sub_if_data *sdata,

err = ieee80211_assign_beacon(sdata, &sdata->deflink,
&params->beacon_color_change,
NULL, &color_change);
NULL, &color_change, changed);
if (err < 0) {
ieee80211_free_next_beacon(&sdata->deflink);
return err;
}
*changed |= err;
break;
default:
return -EOPNOTSUPP;
Expand All @@ -4683,7 +4680,7 @@ ieee80211_set_color_change_beacon(struct ieee80211_sub_if_data *sdata,

static void
ieee80211_color_change_bss_config_notify(struct ieee80211_sub_if_data *sdata,
u8 color, int enable, u32 changed)
u8 color, int enable, u64 changed)
{
sdata->vif.bss_conf.he_bss_color.color = color;
sdata->vif.bss_conf.he_bss_color.enabled = enable;
Expand Down Expand Up @@ -4711,7 +4708,7 @@ ieee80211_color_change_bss_config_notify(struct ieee80211_sub_if_data *sdata,
static int ieee80211_color_change_finalize(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
u32 changed = 0;
u64 changed = 0;
int err;

sdata_assert_lock(sdata);
Expand Down Expand Up @@ -4808,7 +4805,7 @@ ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev,
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = sdata->local;
u32 changed = 0;
u64 changed = 0;
int err;

sdata_assert_lock(sdata);
Expand Down
4 changes: 2 additions & 2 deletions net/mac80211/chan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ ieee80211_link_use_reserved_reassign(struct ieee80211_link_data *link)
struct ieee80211_vif_chanctx_switch vif_chsw[1] = {};
struct ieee80211_chanctx *old_ctx, *new_ctx;
const struct cfg80211_chan_def *chandef;
u32 changed = 0;
u64 changed = 0;
int err;

lockdep_assert_held(&local->mtx);
Expand Down Expand Up @@ -1634,7 +1634,7 @@ static int ieee80211_vif_use_reserved_switch(struct ieee80211_local *local)
reserved_chanctx_list) {
struct ieee80211_sub_if_data *sdata = link->sdata;
struct ieee80211_bss_conf *link_conf = link->conf;
u32 changed = 0;
u64 changed = 0;

if (!ieee80211_link_has_in_place_reservation(link))
continue;
Expand Down
16 changes: 9 additions & 7 deletions net/mac80211/ibss.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
* Copyright 2013-2014 Intel Mobile Communications GmbH
* Copyright(c) 2016 Intel Deutschland GmbH
* Copyright(c) 2018-2022 Intel Corporation
* Copyright(c) 2018-2023 Intel Corporation
*/

#include <linux/delay.h>
Expand Down Expand Up @@ -226,7 +226,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
struct ieee80211_local *local = sdata->local;
struct ieee80211_mgmt *mgmt;
struct cfg80211_bss *bss;
u32 bss_change;
u64 bss_change;
struct cfg80211_chan_def chandef;
struct ieee80211_channel *chan;
struct beacon_data *presp;
Expand Down Expand Up @@ -478,7 +478,8 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
}

int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
struct cfg80211_csa_settings *csa_settings)
struct cfg80211_csa_settings *csa_settings,
u64 *changed)
{
struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
struct beacon_data *presp, *old_presp;
Expand Down Expand Up @@ -520,10 +521,11 @@ int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
if (old_presp)
kfree_rcu(old_presp, rcu_head);

return BSS_CHANGED_BEACON;
*changed |= BSS_CHANGED_BEACON;
return 0;
}

int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata)
int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata, u64 *changed)
{
struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
struct cfg80211_bss *cbss;
Expand Down Expand Up @@ -552,7 +554,7 @@ int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata)
ifibss->chandef = sdata->deflink.csa_chandef;

/* generate the beacon */
return ieee80211_ibss_csa_beacon(sdata, NULL);
return ieee80211_ibss_csa_beacon(sdata, NULL, changed);
}

void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata)
Expand Down Expand Up @@ -1754,7 +1756,7 @@ void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local)
int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
struct cfg80211_ibss_params *params)
{
u32 changed = 0;
u64 changed = 0;
u32 rate_flags;
struct ieee80211_supported_band *sband;
enum ieee80211_chanctx_mode chanmode;
Expand Down
Loading

0 comments on commit 15ddba5

Please sign in to comment.