mirror of https://github.com/torvalds/linux.git
wifi: cfg80211: modify prototype for change_beacon
Modify the prototype for change_beacon() in struct cfg80211_op to accept cfg80211_ap_settings instead of cfg80211_beacon_data so that it can process data in addition to beacons. Modify the prototypes of ieee80211_change_beacon() and driver specific functions accordingly. Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com> Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com> Link: https://lore.kernel.org/r/20230727174100.11721-4-quic_alokad@quicinc.com [while at it, remove pointless "if (info)" check in tracing that just makes all the lines longer than they need be - it's never NULL] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
3b1c256eb4
commit
66f85d57b7
|
|
@ -2954,7 +2954,7 @@ static int ath6kl_start_ap(struct wiphy *wiphy, struct net_device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ath6kl_change_beacon(struct wiphy *wiphy, struct net_device *dev,
|
static int ath6kl_change_beacon(struct wiphy *wiphy, struct net_device *dev,
|
||||||
struct cfg80211_beacon_data *beacon)
|
struct cfg80211_ap_settings *params)
|
||||||
{
|
{
|
||||||
struct ath6kl_vif *vif = netdev_priv(dev);
|
struct ath6kl_vif *vif = netdev_priv(dev);
|
||||||
|
|
||||||
|
|
@ -2964,7 +2964,7 @@ static int ath6kl_change_beacon(struct wiphy *wiphy, struct net_device *dev,
|
||||||
if (vif->next_mode != AP_NETWORK)
|
if (vif->next_mode != AP_NETWORK)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
return ath6kl_set_ies(vif, beacon);
|
return ath6kl_set_ies(vif, ¶ms->beacon);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ath6kl_stop_ap(struct wiphy *wiphy, struct net_device *dev,
|
static int ath6kl_stop_ap(struct wiphy *wiphy, struct net_device *dev,
|
||||||
|
|
|
||||||
|
|
@ -2082,11 +2082,12 @@ void wil_cfg80211_ap_recovery(struct wil6210_priv *wil)
|
||||||
|
|
||||||
static int wil_cfg80211_change_beacon(struct wiphy *wiphy,
|
static int wil_cfg80211_change_beacon(struct wiphy *wiphy,
|
||||||
struct net_device *ndev,
|
struct net_device *ndev,
|
||||||
struct cfg80211_beacon_data *bcon)
|
struct cfg80211_ap_settings *params)
|
||||||
{
|
{
|
||||||
struct wil6210_priv *wil = wiphy_to_wil(wiphy);
|
struct wil6210_priv *wil = wiphy_to_wil(wiphy);
|
||||||
struct wireless_dev *wdev = ndev->ieee80211_ptr;
|
struct wireless_dev *wdev = ndev->ieee80211_ptr;
|
||||||
struct wil6210_vif *vif = ndev_to_vif(ndev);
|
struct wil6210_vif *vif = ndev_to_vif(ndev);
|
||||||
|
struct cfg80211_beacon_data *bcon = ¶ms->beacon;
|
||||||
int rc;
|
int rc;
|
||||||
u32 privacy = 0;
|
u32 privacy = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5415,13 +5415,13 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev,
|
||||||
|
|
||||||
static s32
|
static s32
|
||||||
brcmf_cfg80211_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
|
brcmf_cfg80211_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
|
||||||
struct cfg80211_beacon_data *info)
|
struct cfg80211_ap_settings *info)
|
||||||
{
|
{
|
||||||
struct brcmf_if *ifp = netdev_priv(ndev);
|
struct brcmf_if *ifp = netdev_priv(ndev);
|
||||||
|
|
||||||
brcmf_dbg(TRACE, "Enter\n");
|
brcmf_dbg(TRACE, "Enter\n");
|
||||||
|
|
||||||
return brcmf_config_ap_mgmt_ie(ifp->vif, info);
|
return brcmf_config_ap_mgmt_ie(ifp->vif, &info->beacon);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
||||||
|
|
@ -1835,10 +1835,11 @@ static int mwifiex_cfg80211_set_cqm_rssi_config(struct wiphy *wiphy,
|
||||||
*/
|
*/
|
||||||
static int mwifiex_cfg80211_change_beacon(struct wiphy *wiphy,
|
static int mwifiex_cfg80211_change_beacon(struct wiphy *wiphy,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
struct cfg80211_beacon_data *data)
|
struct cfg80211_ap_settings *params)
|
||||||
{
|
{
|
||||||
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
|
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
|
||||||
struct mwifiex_adapter *adapter = priv->adapter;
|
struct mwifiex_adapter *adapter = priv->adapter;
|
||||||
|
struct cfg80211_beacon_data *data = ¶ms->beacon;
|
||||||
|
|
||||||
mwifiex_cancel_scan(adapter);
|
mwifiex_cancel_scan(adapter);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1441,11 +1441,11 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
|
static int change_beacon(struct wiphy *wiphy, struct net_device *dev,
|
||||||
struct cfg80211_beacon_data *beacon)
|
struct cfg80211_ap_settings *params)
|
||||||
{
|
{
|
||||||
struct wilc_vif *vif = netdev_priv(dev);
|
struct wilc_vif *vif = netdev_priv(dev);
|
||||||
|
|
||||||
return wilc_add_beacon(vif, 0, 0, beacon);
|
return wilc_add_beacon(vif, 0, 0, ¶ms->beacon);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stop_ap(struct wiphy *wiphy, struct net_device *dev,
|
static int stop_ap(struct wiphy *wiphy, struct net_device *dev,
|
||||||
|
|
|
||||||
|
|
@ -331,11 +331,11 @@ static int qtnf_mgmt_set_appie(struct qtnf_vif *vif,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qtnf_change_beacon(struct wiphy *wiphy, struct net_device *dev,
|
static int qtnf_change_beacon(struct wiphy *wiphy, struct net_device *dev,
|
||||||
struct cfg80211_beacon_data *info)
|
struct cfg80211_ap_settings *info)
|
||||||
{
|
{
|
||||||
struct qtnf_vif *vif = qtnf_netdev_get_priv(dev);
|
struct qtnf_vif *vif = qtnf_netdev_get_priv(dev);
|
||||||
|
|
||||||
return qtnf_mgmt_set_appie(vif, info);
|
return qtnf_mgmt_set_appie(vif, &info->beacon);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qtnf_start_ap(struct wiphy *wiphy, struct net_device *dev,
|
static int qtnf_start_ap(struct wiphy *wiphy, struct net_device *dev,
|
||||||
|
|
|
||||||
|
|
@ -2319,11 +2319,13 @@ static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
|
static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
|
||||||
struct cfg80211_beacon_data *info)
|
struct cfg80211_ap_settings *info)
|
||||||
{
|
{
|
||||||
struct adapter *adapter = rtw_netdev_priv(ndev);
|
struct adapter *adapter = rtw_netdev_priv(ndev);
|
||||||
|
|
||||||
return rtw_add_beacon(adapter, info->head, info->head_len, info->tail, info->tail_len);
|
return rtw_add_beacon(adapter, info->beacon.head,
|
||||||
|
info->beacon.head_len, info->beacon.tail,
|
||||||
|
info->beacon.tail_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev,
|
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev,
|
||||||
|
|
|
||||||
|
|
@ -4495,7 +4495,7 @@ struct cfg80211_ops {
|
||||||
int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
|
int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
|
||||||
struct cfg80211_ap_settings *settings);
|
struct cfg80211_ap_settings *settings);
|
||||||
int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
|
int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
|
||||||
struct cfg80211_beacon_data *info);
|
struct cfg80211_ap_settings *info);
|
||||||
int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev,
|
int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev,
|
||||||
unsigned int link_id);
|
unsigned int link_id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1477,10 +1477,12 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
|
static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
|
||||||
struct cfg80211_beacon_data *params)
|
struct cfg80211_ap_settings *params)
|
||||||
|
|
||||||
{
|
{
|
||||||
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||||
struct ieee80211_link_data *link;
|
struct ieee80211_link_data *link;
|
||||||
|
struct cfg80211_beacon_data *beacon = ¶ms->beacon;
|
||||||
struct beacon_data *old;
|
struct beacon_data *old;
|
||||||
int err;
|
int err;
|
||||||
struct ieee80211_bss_conf *link_conf;
|
struct ieee80211_bss_conf *link_conf;
|
||||||
|
|
@ -1488,7 +1490,7 @@ static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
|
||||||
|
|
||||||
lockdep_assert_wiphy(wiphy);
|
lockdep_assert_wiphy(wiphy);
|
||||||
|
|
||||||
link = sdata_dereference(sdata->link[params->link_id], sdata);
|
link = sdata_dereference(sdata->link[beacon->link_id], sdata);
|
||||||
if (!link)
|
if (!link)
|
||||||
return -ENOLINK;
|
return -ENOLINK;
|
||||||
|
|
||||||
|
|
@ -1504,14 +1506,14 @@ static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
|
||||||
if (!old)
|
if (!old)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
err = ieee80211_assign_beacon(sdata, link, params, NULL, NULL,
|
err = ieee80211_assign_beacon(sdata, link, beacon, NULL, NULL,
|
||||||
&changed);
|
&changed);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (params->he_bss_color_valid &&
|
if (beacon->he_bss_color_valid &&
|
||||||
params->he_bss_color.enabled != link_conf->he_bss_color.enabled) {
|
beacon->he_bss_color.enabled != link_conf->he_bss_color.enabled) {
|
||||||
link_conf->he_bss_color.enabled = params->he_bss_color.enabled;
|
link_conf->he_bss_color.enabled = beacon->he_bss_color.enabled;
|
||||||
changed |= BSS_CHANGED_HE_BSS_COLOR;
|
changed |= BSS_CHANGED_HE_BSS_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6198,7 +6198,7 @@ static int nl80211_set_beacon(struct sk_buff *skb, struct genl_info *info)
|
||||||
unsigned int link_id = nl80211_link_id(info->attrs);
|
unsigned int link_id = nl80211_link_id(info->attrs);
|
||||||
struct net_device *dev = info->user_ptr[1];
|
struct net_device *dev = info->user_ptr[1];
|
||||||
struct wireless_dev *wdev = dev->ieee80211_ptr;
|
struct wireless_dev *wdev = dev->ieee80211_ptr;
|
||||||
struct cfg80211_beacon_data params;
|
struct cfg80211_ap_settings *params;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
|
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
|
||||||
|
|
@ -6211,15 +6211,21 @@ static int nl80211_set_beacon(struct sk_buff *skb, struct genl_info *info)
|
||||||
if (!wdev->links[link_id].ap.beacon_interval)
|
if (!wdev->links[link_id].ap.beacon_interval)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
err = nl80211_parse_beacon(rdev, info->attrs, ¶ms, info->extack);
|
params = kzalloc(sizeof(*params), GFP_KERNEL);
|
||||||
|
if (!params)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
err = nl80211_parse_beacon(rdev, info->attrs, ¶ms->beacon,
|
||||||
|
info->extack);
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
err = rdev_change_beacon(rdev, dev, ¶ms);
|
err = rdev_change_beacon(rdev, dev, params);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
kfree(params.mbssid_ies);
|
kfree(params->beacon.mbssid_ies);
|
||||||
kfree(params.rnr_ies);
|
kfree(params->beacon.rnr_ies);
|
||||||
|
kfree(params);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ static inline int rdev_start_ap(struct cfg80211_registered_device *rdev,
|
||||||
|
|
||||||
static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev,
|
static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev,
|
||||||
struct net_device *dev,
|
struct net_device *dev,
|
||||||
struct cfg80211_beacon_data *info)
|
struct cfg80211_ap_settings *info)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
trace_rdev_change_beacon(&rdev->wiphy, dev, info);
|
trace_rdev_change_beacon(&rdev->wiphy, dev, info);
|
||||||
|
|
|
||||||
|
|
@ -615,49 +615,47 @@ TRACE_EVENT(rdev_start_ap,
|
||||||
|
|
||||||
TRACE_EVENT(rdev_change_beacon,
|
TRACE_EVENT(rdev_change_beacon,
|
||||||
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
|
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
|
||||||
struct cfg80211_beacon_data *info),
|
struct cfg80211_ap_settings *info),
|
||||||
TP_ARGS(wiphy, netdev, info),
|
TP_ARGS(wiphy, netdev, info),
|
||||||
TP_STRUCT__entry(
|
TP_STRUCT__entry(
|
||||||
WIPHY_ENTRY
|
WIPHY_ENTRY
|
||||||
NETDEV_ENTRY
|
NETDEV_ENTRY
|
||||||
__field(int, link_id)
|
__field(int, link_id)
|
||||||
__dynamic_array(u8, head, info ? info->head_len : 0)
|
__dynamic_array(u8, head, info->beacon.head_len)
|
||||||
__dynamic_array(u8, tail, info ? info->tail_len : 0)
|
__dynamic_array(u8, tail, info->beacon.tail_len)
|
||||||
__dynamic_array(u8, beacon_ies, info ? info->beacon_ies_len : 0)
|
__dynamic_array(u8, beacon_ies, info->beacon.beacon_ies_len)
|
||||||
__dynamic_array(u8, proberesp_ies,
|
__dynamic_array(u8, proberesp_ies, info->beacon.proberesp_ies_len)
|
||||||
info ? info->proberesp_ies_len : 0)
|
__dynamic_array(u8, assocresp_ies, info->beacon.assocresp_ies_len)
|
||||||
__dynamic_array(u8, assocresp_ies,
|
__dynamic_array(u8, probe_resp, info->beacon.probe_resp_len)
|
||||||
info ? info->assocresp_ies_len : 0)
|
|
||||||
__dynamic_array(u8, probe_resp, info ? info->probe_resp_len : 0)
|
|
||||||
),
|
),
|
||||||
TP_fast_assign(
|
TP_fast_assign(
|
||||||
WIPHY_ASSIGN;
|
WIPHY_ASSIGN;
|
||||||
NETDEV_ASSIGN;
|
NETDEV_ASSIGN;
|
||||||
if (info) {
|
__entry->link_id = info->beacon.link_id;
|
||||||
__entry->link_id = info->link_id;
|
if (info->beacon.head)
|
||||||
if (info->head)
|
memcpy(__get_dynamic_array(head),
|
||||||
memcpy(__get_dynamic_array(head), info->head,
|
info->beacon.head,
|
||||||
info->head_len);
|
info->beacon.head_len);
|
||||||
if (info->tail)
|
if (info->beacon.tail)
|
||||||
memcpy(__get_dynamic_array(tail), info->tail,
|
memcpy(__get_dynamic_array(tail),
|
||||||
info->tail_len);
|
info->beacon.tail,
|
||||||
if (info->beacon_ies)
|
info->beacon.tail_len);
|
||||||
|
if (info->beacon.beacon_ies)
|
||||||
memcpy(__get_dynamic_array(beacon_ies),
|
memcpy(__get_dynamic_array(beacon_ies),
|
||||||
info->beacon_ies, info->beacon_ies_len);
|
info->beacon.beacon_ies,
|
||||||
if (info->proberesp_ies)
|
info->beacon.beacon_ies_len);
|
||||||
|
if (info->beacon.proberesp_ies)
|
||||||
memcpy(__get_dynamic_array(proberesp_ies),
|
memcpy(__get_dynamic_array(proberesp_ies),
|
||||||
info->proberesp_ies,
|
info->beacon.proberesp_ies,
|
||||||
info->proberesp_ies_len);
|
info->beacon.proberesp_ies_len);
|
||||||
if (info->assocresp_ies)
|
if (info->beacon.assocresp_ies)
|
||||||
memcpy(__get_dynamic_array(assocresp_ies),
|
memcpy(__get_dynamic_array(assocresp_ies),
|
||||||
info->assocresp_ies,
|
info->beacon.assocresp_ies,
|
||||||
info->assocresp_ies_len);
|
info->beacon.assocresp_ies_len);
|
||||||
if (info->probe_resp)
|
if (info->beacon.probe_resp)
|
||||||
memcpy(__get_dynamic_array(probe_resp),
|
memcpy(__get_dynamic_array(probe_resp),
|
||||||
info->probe_resp, info->probe_resp_len);
|
info->beacon.probe_resp,
|
||||||
} else {
|
info->beacon.probe_resp_len);
|
||||||
__entry->link_id = -1;
|
|
||||||
}
|
|
||||||
),
|
),
|
||||||
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id:%d",
|
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", link_id:%d",
|
||||||
WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->link_id)
|
WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->link_id)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue