Skip to content

Commit

Permalink
wifi: cfg80211: pass net_device to .set_monitor_channel
Browse files Browse the repository at this point in the history
Preparation for allowing multiple monitor interfaces with different channels
on a multi-radio wiphy.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://patch.msgid.link/35fa652dbfebf93343f8b9a08fdef0467a2a02dc.1728462320.git-series.nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
nbd168 authored and jmberg-intel committed Oct 23, 2024
1 parent 006a97c commit 9c4f830
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/wil6210/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,7 @@ int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
}

static int wil_cfg80211_set_channel(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_chan_def *chandef)
{
struct wil6210_priv *wil = wiphy_to_wil(wiphy);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/marvell/libertas/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ static int lbs_add_wps_enrollee_tlv(u8 *tlv, const u8 *ie, size_t ie_len)
*/

static int lbs_cfg_set_monitor_channel(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_chan_def *chandef)
{
struct lbs_private *priv = wiphy_priv(wiphy);
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/microchip/wilc1000/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ struct wilc_vif *wilc_get_wl_to_vif(struct wilc *wl)
}

static int set_channel(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_chan_def *chandef)
{
struct wilc *wl = wiphy_priv(wiphy);
Expand Down Expand Up @@ -1424,7 +1425,7 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev,
struct wilc_vif *vif = netdev_priv(dev);
int ret;

ret = set_channel(wiphy, &settings->chandef);
ret = set_channel(wiphy, dev, &settings->chandef);
if (ret != 0)
netdev_err(dev, "Error in setting channel\n");

Expand Down
1 change: 1 addition & 0 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -4694,6 +4694,7 @@ struct cfg80211_ops {
struct ieee80211_channel *chan);

int (*set_monitor_channel)(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_chan_def *chandef);

int (*scan)(struct wiphy *wiphy,
Expand Down
1 change: 1 addition & 0 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
}

static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_chan_def *chandef)
{
struct ieee80211_local *local = wiphy_priv(wiphy);
Expand Down
3 changes: 2 additions & 1 deletion net/wireless/chan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1628,14 +1628,15 @@ bool cfg80211_reg_check_beaconing(struct wiphy *wiphy,
EXPORT_SYMBOL(cfg80211_reg_check_beaconing);

int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct cfg80211_chan_def *chandef)
{
if (!rdev->ops->set_monitor_channel)
return -EOPNOTSUPP;
if (!cfg80211_has_monitors_only(rdev))
return -EBUSY;

return rdev_set_monitor_channel(rdev, chandef);
return rdev_set_monitor_channel(rdev, dev, chandef);
}

bool cfg80211_any_usable_channels(struct wiphy *wiphy,
Expand Down
1 change: 1 addition & 0 deletions net/wireless/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ static inline unsigned int elapsed_jiffies_msecs(unsigned long start)
}

int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct cfg80211_chan_def *chandef);

int ieee80211_get_ratemask(struct ieee80211_supported_band *sband,
Expand Down
2 changes: 1 addition & 1 deletion net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -3567,7 +3567,7 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
case NL80211_IFTYPE_MESH_POINT:
return cfg80211_set_mesh_channel(rdev, wdev, &chandef);
case NL80211_IFTYPE_MONITOR:
return cfg80211_set_monitor_channel(rdev, &chandef);
return cfg80211_set_monitor_channel(rdev, dev, &chandef);
default:
break;
}
Expand Down
5 changes: 3 additions & 2 deletions net/wireless/rdev-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,12 @@ rdev_libertas_set_mesh_channel(struct cfg80211_registered_device *rdev,

static inline int
rdev_set_monitor_channel(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct cfg80211_chan_def *chandef)
{
int ret;
trace_rdev_set_monitor_channel(&rdev->wiphy, chandef);
ret = rdev->ops->set_monitor_channel(&rdev->wiphy, chandef);
trace_rdev_set_monitor_channel(&rdev->wiphy, dev, chandef);
ret = rdev->ops->set_monitor_channel(&rdev->wiphy, dev, chandef);
trace_rdev_return_int(&rdev->wiphy, ret);
return ret;
}
Expand Down
10 changes: 6 additions & 4 deletions net/wireless/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -1318,19 +1318,21 @@ TRACE_EVENT(rdev_libertas_set_mesh_channel,
);

TRACE_EVENT(rdev_set_monitor_channel,
TP_PROTO(struct wiphy *wiphy,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
struct cfg80211_chan_def *chandef),
TP_ARGS(wiphy, chandef),
TP_ARGS(wiphy, netdev, chandef),
TP_STRUCT__entry(
WIPHY_ENTRY
NETDEV_ENTRY
CHAN_DEF_ENTRY
),
TP_fast_assign(
WIPHY_ASSIGN;
NETDEV_ASSIGN;
CHAN_DEF_ASSIGN(chandef);
),
TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT,
WIPHY_PR_ARG, CHAN_DEF_PR_ARG)
TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT,
WIPHY_PR_ARG, NETDEV_PR_ARG, CHAN_DEF_PR_ARG)
);

TRACE_EVENT(rdev_auth,
Expand Down
2 changes: 1 addition & 1 deletion net/wireless/wext-compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ static int cfg80211_wext_siwfreq(struct net_device *dev,
ret = -EINVAL;
break;
}
ret = cfg80211_set_monitor_channel(rdev, &chandef);
ret = cfg80211_set_monitor_channel(rdev, dev, &chandef);
break;
case NL80211_IFTYPE_MESH_POINT:
freq = cfg80211_wext_freq(wextfreq);
Expand Down

0 comments on commit 9c4f830

Please sign in to comment.