BACKPORT: wifi: cfg80211/mac80211: separate link params from station params

Put the link_station_parameters structure in the station_parameters
structure (and remove the station_parameters fields already existing
in link_station_parameters).
Now, for an MLD station, the default link is added together with
the station.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 248430009
Change-Id: Iab7cd899b27f6e4b5664c223b3b14c9045fcfa0a
(cherry picked from commit b95eb7f0eee479478eb1a7c0a42a80167708c1df)
[Kiran Kumar Lokere: Skipped the changes in net/mac80211/cfg.c and made
 changes required for compilation]
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
This commit is contained in:
Shaul Triebitz
2022-06-14 13:49:16 +03:00
committed by Treehugger Robot
parent 5b0ceee1bd
commit fcacd896ec
6 changed files with 103 additions and 122 deletions

View File

@@ -1786,29 +1786,31 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv,
wmm_qos_info->qos_info = 0;
config_len += sizeof(struct mwifiex_ie_types_qos_info);
if (params->ht_capa) {
if (params->link_sta_params.ht_capa) {
ht_capab = (struct mwifiex_ie_types_htcap *)(pos +
config_len);
ht_capab->header.type =
cpu_to_le16(WLAN_EID_HT_CAPABILITY);
ht_capab->header.len =
cpu_to_le16(sizeof(struct ieee80211_ht_cap));
memcpy(&ht_capab->ht_cap, params->ht_capa,
memcpy(&ht_capab->ht_cap, params->link_sta_params.ht_capa,
sizeof(struct ieee80211_ht_cap));
config_len += sizeof(struct mwifiex_ie_types_htcap);
}
if (params->supported_rates && params->supported_rates_len) {
if (params->link_sta_params.supported_rates &&
params->link_sta_params.supported_rates_len) {
tlv_rates = (struct host_cmd_tlv_rates *)(pos +
config_len);
tlv_rates->header.type =
cpu_to_le16(WLAN_EID_SUPP_RATES);
tlv_rates->header.len =
cpu_to_le16(params->supported_rates_len);
memcpy(tlv_rates->rates, params->supported_rates,
params->supported_rates_len);
cpu_to_le16(params->link_sta_params.supported_rates_len);
memcpy(tlv_rates->rates,
params->link_sta_params.supported_rates,
params->link_sta_params.supported_rates_len);
config_len += sizeof(struct host_cmd_tlv_rates) +
params->supported_rates_len;
params->link_sta_params.supported_rates_len;
}
if (params->ext_capab && params->ext_capab_len) {
@@ -1822,14 +1824,14 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv,
config_len += sizeof(struct mwifiex_ie_types_extcap) +
params->ext_capab_len;
}
if (params->vht_capa) {
if (params->link_sta_params.vht_capa) {
vht_capab = (struct mwifiex_ie_types_vhtcap *)(pos +
config_len);
vht_capab->header.type =
cpu_to_le16(WLAN_EID_VHT_CAPABILITY);
vht_capab->header.len =
cpu_to_le16(sizeof(struct ieee80211_vht_cap));
memcpy(&vht_capab->vht_cap, params->vht_capa,
memcpy(&vht_capab->vht_cap, params->link_sta_params.vht_capa,
sizeof(struct ieee80211_vht_cap));
config_len += sizeof(struct mwifiex_ie_types_vhtcap);
}

View File

@@ -795,15 +795,15 @@ static void wilc_hif_pack_sta_param(u8 *cur_byte, const u8 *mac,
put_unaligned_le16(params->aid, cur_byte);
cur_byte += 2;
*cur_byte++ = params->supported_rates_len;
if (params->supported_rates_len > 0)
memcpy(cur_byte, params->supported_rates,
params->supported_rates_len);
cur_byte += params->supported_rates_len;
*cur_byte++ = params->link_sta_params.supported_rates_len;
if (params->link_sta_params.supported_rates_len > 0)
memcpy(cur_byte, params->link_sta_params.supported_rates,
params->link_sta_params.supported_rates_len);
cur_byte += params->link_sta_params.supported_rates_len;
if (params->ht_capa) {
if (params->link_sta_params.ht_capa) {
*cur_byte++ = true;
memcpy(cur_byte, params->ht_capa,
memcpy(cur_byte, params->link_sta_params.ht_capa,
sizeof(struct ieee80211_ht_cap));
} else {
*cur_byte++ = false;
@@ -1809,7 +1809,8 @@ int wilc_add_station(struct wilc_vif *vif, const u8 *mac,
wid.id = WID_ADD_STA;
wid.type = WID_BIN;
wid.size = WILC_ADD_STA_LENGTH + params->supported_rates_len;
wid.size = WILC_ADD_STA_LENGTH +
params->link_sta_params.supported_rates_len;
wid.val = kmalloc(wid.size, GFP_KERNEL);
if (!wid.val)
return -ENOMEM;
@@ -1894,7 +1895,8 @@ int wilc_edit_station(struct wilc_vif *vif, const u8 *mac,
wid.id = WID_EDIT_STA;
wid.type = WID_BIN;
wid.size = WILC_ADD_STA_LENGTH + params->supported_rates_len;
wid.size = WILC_ADD_STA_LENGTH +
params->link_sta_params.supported_rates_len;
wid.val = kmalloc(wid.size, GFP_KERNEL);
if (!wid.val)
return -ENOMEM;

View File

@@ -1512,7 +1512,6 @@ enum station_parameters_apply_mask {
STATION_PARAM_APPLY_UAPSD = BIT(0),
STATION_PARAM_APPLY_CAPABILITY = BIT(1),
STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
};
/**
@@ -1596,9 +1595,6 @@ struct link_station_del_parameters {
* Used to change and create a new station.
*
* @vlan: vlan interface station should belong to
* @supported_rates: supported rates in IEEE 802.11 format
* (or NULL for no change)
* @supported_rates_len: number of supported rates
* @sta_flags_mask: station flags that changed
* (bitmask of BIT(%NL80211_STA_FLAG_...))
* @sta_flags_set: station flags values
@@ -1609,8 +1605,6 @@ struct link_station_del_parameters {
* @peer_aid: mesh peer AID or zero for no change
* @plink_action: plink action to take
* @plink_state: set the peer link state for a station
* @ht_capa: HT capabilities of station
* @vht_capa: VHT capabilities of station
* @uapsd_queues: bitmap of queues configured for uapsd. same format
* as the AC bitmap in the QoS info field
* @max_sp: max Service Period. same format as the MAX_SP in the
@@ -1627,19 +1621,11 @@ struct link_station_del_parameters {
* @supported_channels_len: number of supported channels
* @supported_oper_classes: supported oper classes in IEEE 802.11 format
* @supported_oper_classes_len: number of supported operating classes
* @opmode_notif: operating mode field from Operating Mode Notification
* @opmode_notif_used: information if operating mode field is used
* @support_p2p_ps: information if station supports P2P PS mechanism
* @he_capa: HE capabilities of station
* @he_capa_len: the length of the HE capabilities
* @airtime_weight: airtime scheduler weight for this station
* @txpwr: transmit power for an associated station
* @he_6ghz_capa: HE 6 GHz Band capabilities of station
* @eht_capa: EHT capabilities of station
* @eht_capa_len: the length of the EHT capabilities
* @link_sta_params: link related params.
*/
struct station_parameters {
const u8 *supported_rates;
struct net_device *vlan;
u32 sta_flags_mask, sta_flags_set;
u32 sta_modify_mask;
@@ -1647,11 +1633,8 @@ struct station_parameters {
u16 aid;
u16 vlan_id;
u16 peer_aid;
u8 supported_rates_len;
u8 plink_action;
u8 plink_state;
const struct ieee80211_ht_cap *ht_capa;
const struct ieee80211_vht_cap *vht_capa;
u8 uapsd_queues;
u8 max_sp;
enum nl80211_mesh_power_mode local_pm;
@@ -1662,16 +1645,9 @@ struct station_parameters {
u8 supported_channels_len;
const u8 *supported_oper_classes;
u8 supported_oper_classes_len;
u8 opmode_notif;
bool opmode_notif_used;
int support_p2p_ps;
const struct ieee80211_he_cap_elem *he_capa;
u8 he_capa_len;
u16 airtime_weight;
struct sta_txpwr txpwr;
const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
const struct ieee80211_eht_cap_elem *eht_capa;
u8 eht_capa_len;
struct link_station_parameters link_sta_params;
ANDROID_BACKPORT_RESERVED(1);
ANDROID_BACKPORT_RESERVED(2);

View File

@@ -1648,43 +1648,35 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (params->listen_interval >= 0)
sta->listen_interval = params->listen_interval;
if (params->sta_modify_mask & STATION_PARAM_APPLY_STA_TXPOWER) {
sta->sta.txpwr.type = params->txpwr.type;
if (params->txpwr.type == NL80211_TX_POWER_LIMITED)
sta->sta.txpwr.power = params->txpwr.power;
ret = drv_sta_set_txpwr(local, sdata, sta);
if (ret)
return ret;
}
if (params->supported_rates && params->supported_rates_len) {
if (params->link_sta_params.supported_rates &&
params->link_sta_params.supported_rates_len) {
ieee80211_parse_bitrates(&sdata->vif.bss_conf.chandef,
sband, params->supported_rates,
params->supported_rates_len,
sband, params->link_sta_params.supported_rates,
params->link_sta_params.supported_rates_len,
&sta->sta.supp_rates[sband->band]);
}
if (params->ht_capa)
if (params->link_sta_params.ht_capa)
ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
params->ht_capa, sta);
params->link_sta_params.ht_capa, sta);
/* VHT can override some HT caps such as the A-MSDU max length */
if (params->vht_capa)
if (params->link_sta_params.vht_capa)
ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
params->vht_capa, sta);
params->link_sta_params.vht_capa, sta);
if (params->he_capa)
if (params->link_sta_params.he_capa)
ieee80211_he_cap_ie_to_sta_he_cap(sdata, sband,
(void *)params->he_capa,
params->he_capa_len,
(void *)params->he_6ghz_capa,
(void *)params->link_sta_params.he_capa,
params->link_sta_params.he_capa_len,
(void *)params->link_sta_params.he_6ghz_capa,
sta);
if (params->opmode_notif_used) {
if (params->link_sta_params.opmode_notif_used) {
/* returned value is only needed for rc update, but the
* rc isn't initialized here yet, so ignore it
*/
__ieee80211_vht_handle_opmode(sdata, sta, params->opmode_notif,
__ieee80211_vht_handle_opmode(sdata, sta, params->link_sta_params.opmode_notif,
sband->band);
}

View File

@@ -6639,10 +6639,12 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
return -EINVAL;
if (params->sta_modify_mask & STATION_PARAM_APPLY_CAPABILITY)
return -EINVAL;
if (params->supported_rates)
if (params->link_sta_params.supported_rates)
return -EINVAL;
if (params->ext_capab || params->ht_capa || params->vht_capa ||
params->he_capa || params->eht_capa)
if (params->ext_capab || params->link_sta_params.ht_capa ||
params->link_sta_params.vht_capa ||
params->link_sta_params.he_capa ||
params->link_sta_params.eht_capa)
return -EINVAL;
}
@@ -6690,7 +6692,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
return -EINVAL;
/* force (at least) rates when authorizing */
if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED) &&
!params->supported_rates)
!params->link_sta_params.supported_rates)
return -EINVAL;
break;
case CFG80211_STA_TDLS_PEER_ACTIVE:
@@ -6714,7 +6716,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
*/
if (statype != CFG80211_STA_AP_CLIENT_UNASSOC &&
statype != CFG80211_STA_TDLS_PEER_SETUP)
params->opmode_notif_used = false;
params->link_sta_params.opmode_notif_used = false;
return 0;
}
@@ -6835,26 +6837,26 @@ static int nl80211_set_station_tdls(struct genl_info *info,
if (info->attrs[NL80211_ATTR_PEER_AID])
params->aid = nla_get_u16(info->attrs[NL80211_ATTR_PEER_AID]);
if (info->attrs[NL80211_ATTR_HT_CAPABILITY])
params->ht_capa =
params->link_sta_params.ht_capa =
nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]);
if (info->attrs[NL80211_ATTR_VHT_CAPABILITY])
params->vht_capa =
params->link_sta_params.vht_capa =
nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]);
if (info->attrs[NL80211_ATTR_HE_CAPABILITY]) {
params->he_capa =
params->link_sta_params.he_capa =
nla_data(info->attrs[NL80211_ATTR_HE_CAPABILITY]);
params->he_capa_len =
params->link_sta_params.he_capa_len =
nla_len(info->attrs[NL80211_ATTR_HE_CAPABILITY]);
if (info->attrs[NL80211_ATTR_EHT_CAPABILITY]) {
params->eht_capa =
params->link_sta_params.eht_capa =
nla_data(info->attrs[NL80211_ATTR_EHT_CAPABILITY]);
params->eht_capa_len =
params->link_sta_params.eht_capa_len =
nla_len(info->attrs[NL80211_ATTR_EHT_CAPABILITY]);
if (!ieee80211_eht_capa_size_ok((const u8 *)params->he_capa,
(const u8 *)params->eht_capa,
params->eht_capa_len))
if (!ieee80211_eht_capa_size_ok((const u8 *)params->link_sta_params.he_capa,
(const u8 *)params->link_sta_params.eht_capa,
params->link_sta_params.eht_capa_len))
return -EINVAL;
}
}
@@ -6906,7 +6908,6 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
struct station_parameters params;
u8 *mac_addr;
int err;
bool txpwr_set;
memset(&params, 0, sizeof(params));
@@ -6942,9 +6943,9 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
if (info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]) {
params.supported_rates =
params.link_sta_params.supported_rates =
nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]);
params.supported_rates_len =
params.link_sta_params.supported_rates_len =
nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]);
}
@@ -6982,13 +6983,13 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
info->attrs[NL80211_ATTR_LOCAL_MESH_POWER_MODE]);
if (info->attrs[NL80211_ATTR_OPMODE_NOTIF]) {
params.opmode_notif_used = true;
params.opmode_notif =
params.link_sta_params.opmode_notif_used = true;
params.link_sta_params.opmode_notif =
nla_get_u8(info->attrs[NL80211_ATTR_OPMODE_NOTIF]);
}
if (info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY])
params.he_6ghz_capa =
params.link_sta_params.he_6ghz_capa =
nla_data(info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]);
if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT])
@@ -7000,11 +7001,11 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
return -EOPNOTSUPP;
err = nl80211_parse_sta_txpower_setting(info, &params.txpwr, &txpwr_set);
err = nl80211_parse_sta_txpower_setting(info,
&params.link_sta_params.txpwr,
&params.link_sta_params.txpwr_set);
if (err)
return err;
if (txpwr_set)
params.sta_modify_mask |= STATION_PARAM_APPLY_STA_TXPOWER;
/* Include parameters for TDLS peer (will check later) */
err = nl80211_set_station_tdls(info, &params);
@@ -7047,7 +7048,6 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
u8 *mac_addr = NULL;
u32 auth_assoc = BIT(NL80211_STA_FLAG_AUTHENTICATED) |
BIT(NL80211_STA_FLAG_ASSOCIATED);
bool txpwr_set;
memset(&params, 0, sizeof(params));
@@ -7067,10 +7067,13 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
!info->attrs[NL80211_ATTR_PEER_AID])
return -EINVAL;
params.link_sta_params.link_id =
nl80211_link_id_or_invalid(info->attrs);
mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
params.supported_rates =
params.link_sta_params.supported_rates =
nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]);
params.supported_rates_len =
params.link_sta_params.supported_rates_len =
nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]);
params.listen_interval =
nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]);
@@ -7109,39 +7112,39 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
}
if (info->attrs[NL80211_ATTR_HT_CAPABILITY])
params.ht_capa =
params.link_sta_params.ht_capa =
nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]);
if (info->attrs[NL80211_ATTR_VHT_CAPABILITY])
params.vht_capa =
params.link_sta_params.vht_capa =
nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]);
if (info->attrs[NL80211_ATTR_HE_CAPABILITY]) {
params.he_capa =
params.link_sta_params.he_capa =
nla_data(info->attrs[NL80211_ATTR_HE_CAPABILITY]);
params.he_capa_len =
params.link_sta_params.he_capa_len =
nla_len(info->attrs[NL80211_ATTR_HE_CAPABILITY]);
if (info->attrs[NL80211_ATTR_EHT_CAPABILITY]) {
params.eht_capa =
params.link_sta_params.eht_capa =
nla_data(info->attrs[NL80211_ATTR_EHT_CAPABILITY]);
params.eht_capa_len =
params.link_sta_params.eht_capa_len =
nla_len(info->attrs[NL80211_ATTR_EHT_CAPABILITY]);
if (!ieee80211_eht_capa_size_ok((const u8 *)params.he_capa,
(const u8 *)params.eht_capa,
params.eht_capa_len))
if (!ieee80211_eht_capa_size_ok((const u8 *)params.link_sta_params.he_capa,
(const u8 *)params.link_sta_params.eht_capa,
params.link_sta_params.eht_capa_len))
return -EINVAL;
}
}
if (info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY])
params.he_6ghz_capa =
params.link_sta_params.he_6ghz_capa =
nla_data(info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]);
if (info->attrs[NL80211_ATTR_OPMODE_NOTIF]) {
params.opmode_notif_used = true;
params.opmode_notif =
params.link_sta_params.opmode_notif_used = true;
params.link_sta_params.opmode_notif =
nla_get_u8(info->attrs[NL80211_ATTR_OPMODE_NOTIF]);
}
@@ -7158,11 +7161,11 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
NL80211_EXT_FEATURE_AIRTIME_FAIRNESS))
return -EOPNOTSUPP;
err = nl80211_parse_sta_txpower_setting(info, &params.txpwr, &txpwr_set);
err = nl80211_parse_sta_txpower_setting(info,
&params.link_sta_params.txpwr,
&params.link_sta_params.txpwr_set);
if (err)
return err;
if (txpwr_set)
params.sta_modify_mask |= STATION_PARAM_APPLY_STA_TXPOWER;
err = nl80211_parse_sta_channel_info(info, &params);
if (err)
@@ -7181,17 +7184,19 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
* error in this case.
*/
if (!(params.sta_flags_set & BIT(NL80211_STA_FLAG_WME))) {
params.ht_capa = NULL;
params.vht_capa = NULL;
params.link_sta_params.ht_capa = NULL;
params.link_sta_params.vht_capa = NULL;
/* HE and EHT require WME */
if (params.he_capa_len || params.he_6ghz_capa ||
params.eht_capa_len)
if (params.link_sta_params.he_capa_len ||
params.link_sta_params.he_6ghz_capa ||
params.link_sta_params.eht_capa_len)
return -EINVAL;
}
/* Ensure that HT/VHT capabilities are not set for 6 GHz HE STA */
if (params.he_6ghz_capa && (params.ht_capa || params.vht_capa))
if (params.link_sta_params.he_6ghz_capa &&
(params.link_sta_params.ht_capa || params.link_sta_params.vht_capa))
return -EINVAL;
/* When you run into this, adjust the code below for the new flag */

View File

@@ -756,7 +756,7 @@ DECLARE_EVENT_CLASS(station_add_change,
__array(u8, vht_capa, (int)sizeof(struct ieee80211_vht_cap))
__array(char, vlan, IFNAMSIZ)
__dynamic_array(u8, supported_rates,
params->supported_rates_len)
params->link_sta_params.supported_rates_len)
__dynamic_array(u8, ext_capab, params->ext_capab_len)
__dynamic_array(u8, supported_channels,
params->supported_channels_len)
@@ -776,20 +776,23 @@ DECLARE_EVENT_CLASS(station_add_change,
__entry->plink_state = params->plink_state;
__entry->uapsd_queues = params->uapsd_queues;
memset(__entry->ht_capa, 0, sizeof(struct ieee80211_ht_cap));
if (params->ht_capa)
memcpy(__entry->ht_capa, params->ht_capa,
if (params->link_sta_params.ht_capa)
memcpy(__entry->ht_capa,
params->link_sta_params.ht_capa,
sizeof(struct ieee80211_ht_cap));
memset(__entry->vht_capa, 0, sizeof(struct ieee80211_vht_cap));
if (params->vht_capa)
memcpy(__entry->vht_capa, params->vht_capa,
if (params->link_sta_params.vht_capa)
memcpy(__entry->vht_capa,
params->link_sta_params.vht_capa,
sizeof(struct ieee80211_vht_cap));
memset(__entry->vlan, 0, sizeof(__entry->vlan));
if (params->vlan)
memcpy(__entry->vlan, params->vlan->name, IFNAMSIZ);
if (params->supported_rates && params->supported_rates_len)
if (params->link_sta_params.supported_rates &&
params->link_sta_params.supported_rates_len)
memcpy(__get_dynamic_array(supported_rates),
params->supported_rates,
params->supported_rates_len);
params->link_sta_params.supported_rates,
params->link_sta_params.supported_rates_len);
if (params->ext_capab && params->ext_capab_len)
memcpy(__get_dynamic_array(ext_capab),
params->ext_capab,
@@ -806,8 +809,9 @@ DECLARE_EVENT_CLASS(station_add_change,
params->supported_oper_classes_len);
__entry->max_sp = params->max_sp;
__entry->capability = params->capability;
__entry->opmode_notif = params->opmode_notif;
__entry->opmode_notif_used = params->opmode_notif_used;
__entry->opmode_notif = params->link_sta_params.opmode_notif;
__entry->opmode_notif_used =
params->link_sta_params.opmode_notif_used;
),
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", station mac: " MAC_PR_FMT
", station flags mask: %u, station flags set: %u, "