c2a915963c2de62f975613ea1be23613586033a7
[openwrt/openwrt.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 26 Sep 2024 19:52:30 +0200
3 Subject: [PATCH] wifi: cfg80211: pass net_device to .set_monitor_channel
4
5 Preparation for allowing multiple monitor interfaces with different channels
6 on a multi-radio wiphy.
7
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 ---
10
11 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c
12 +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
13 @@ -1493,6 +1493,7 @@ out:
14 }
15
16 static int wil_cfg80211_set_channel(struct wiphy *wiphy,
17 + struct net_device *dev,
18 struct cfg80211_chan_def *chandef)
19 {
20 struct wil6210_priv *wil = wiphy_to_wil(wiphy);
21 --- a/drivers/net/wireless/marvell/libertas/cfg.c
22 +++ b/drivers/net/wireless/marvell/libertas/cfg.c
23 @@ -486,6 +486,7 @@ static int lbs_add_wps_enrollee_tlv(u8 *
24 */
25
26 static int lbs_cfg_set_monitor_channel(struct wiphy *wiphy,
27 + struct net_device *dev,
28 struct cfg80211_chan_def *chandef)
29 {
30 struct lbs_private *priv = wiphy_priv(wiphy);
31 --- a/drivers/net/wireless/microchip/wilc1000/cfg80211.c
32 +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
33 @@ -231,6 +231,7 @@ struct wilc_vif *wilc_get_wl_to_vif(stru
34 }
35
36 static int set_channel(struct wiphy *wiphy,
37 + struct net_device *dev,
38 struct cfg80211_chan_def *chandef)
39 {
40 struct wilc *wl = wiphy_priv(wiphy);
41 @@ -1424,7 +1425,7 @@ static int start_ap(struct wiphy *wiphy,
42 struct wilc_vif *vif = netdev_priv(dev);
43 int ret;
44
45 - ret = set_channel(wiphy, &settings->chandef);
46 + ret = set_channel(wiphy, dev, &settings->chandef);
47 if (ret != 0)
48 netdev_err(dev, "Error in setting channel\n");
49
50 --- a/include/net/cfg80211.h
51 +++ b/include/net/cfg80211.h
52 @@ -4700,6 +4700,7 @@ struct cfg80211_ops {
53 struct ieee80211_channel *chan);
54
55 int (*set_monitor_channel)(struct wiphy *wiphy,
56 + struct net_device *dev,
57 struct cfg80211_chan_def *chandef);
58
59 int (*scan)(struct wiphy *wiphy,
60 --- a/net/mac80211/cfg.c
61 +++ b/net/mac80211/cfg.c
62 @@ -879,6 +879,7 @@ static int ieee80211_get_station(struct
63 }
64
65 static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
66 + struct net_device *dev,
67 struct cfg80211_chan_def *chandef)
68 {
69 struct ieee80211_local *local = wiphy_priv(wiphy);
70 --- a/net/wireless/chan.c
71 +++ b/net/wireless/chan.c
72 @@ -1673,6 +1673,7 @@ bool cfg80211_reg_check_beaconing(struct
73 EXPORT_SYMBOL(cfg80211_reg_check_beaconing);
74
75 int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
76 + struct net_device *dev,
77 struct cfg80211_chan_def *chandef)
78 {
79 if (!rdev->ops->set_monitor_channel)
80 @@ -1680,7 +1681,7 @@ int cfg80211_set_monitor_channel(struct
81 if (!cfg80211_has_monitors_only(rdev))
82 return -EBUSY;
83
84 - return rdev_set_monitor_channel(rdev, chandef);
85 + return rdev_set_monitor_channel(rdev, dev, chandef);
86 }
87
88 bool cfg80211_any_usable_channels(struct wiphy *wiphy,
89 --- a/net/wireless/core.h
90 +++ b/net/wireless/core.h
91 @@ -510,6 +510,7 @@ static inline unsigned int elapsed_jiffi
92 }
93
94 int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
95 + struct net_device *dev,
96 struct cfg80211_chan_def *chandef);
97
98 int ieee80211_get_ratemask(struct ieee80211_supported_band *sband,
99 --- a/net/wireless/nl80211.c
100 +++ b/net/wireless/nl80211.c
101 @@ -3562,7 +3562,7 @@ static int __nl80211_set_channel(struct
102 case NL80211_IFTYPE_MESH_POINT:
103 return cfg80211_set_mesh_channel(rdev, wdev, &chandef);
104 case NL80211_IFTYPE_MONITOR:
105 - return cfg80211_set_monitor_channel(rdev, &chandef);
106 + return cfg80211_set_monitor_channel(rdev, dev, &chandef);
107 default:
108 break;
109 }
110 --- a/net/wireless/rdev-ops.h
111 +++ b/net/wireless/rdev-ops.h
112 @@ -445,11 +445,12 @@ rdev_libertas_set_mesh_channel(struct cf
113
114 static inline int
115 rdev_set_monitor_channel(struct cfg80211_registered_device *rdev,
116 + struct net_device *dev,
117 struct cfg80211_chan_def *chandef)
118 {
119 int ret;
120 - trace_rdev_set_monitor_channel(&rdev->wiphy, chandef);
121 - ret = rdev->ops->set_monitor_channel(&rdev->wiphy, chandef);
122 + trace_rdev_set_monitor_channel(&rdev->wiphy, dev, chandef);
123 + ret = rdev->ops->set_monitor_channel(&rdev->wiphy, dev, chandef);
124 trace_rdev_return_int(&rdev->wiphy, ret);
125 return ret;
126 }
127 --- a/net/wireless/trace.h
128 +++ b/net/wireless/trace.h
129 @@ -1318,19 +1318,21 @@ TRACE_EVENT(rdev_libertas_set_mesh_chann
130 );
131
132 TRACE_EVENT(rdev_set_monitor_channel,
133 - TP_PROTO(struct wiphy *wiphy,
134 + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
135 struct cfg80211_chan_def *chandef),
136 - TP_ARGS(wiphy, chandef),
137 + TP_ARGS(wiphy, netdev, chandef),
138 TP_STRUCT__entry(
139 WIPHY_ENTRY
140 + NETDEV_ENTRY
141 CHAN_DEF_ENTRY
142 ),
143 TP_fast_assign(
144 WIPHY_ASSIGN;
145 + NETDEV_ASSIGN;
146 CHAN_DEF_ASSIGN(chandef);
147 ),
148 - TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT,
149 - WIPHY_PR_ARG, CHAN_DEF_PR_ARG)
150 + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT,
151 + WIPHY_PR_ARG, NETDEV_PR_ARG, CHAN_DEF_PR_ARG)
152 );
153
154 TRACE_EVENT(rdev_auth,
155 --- a/net/wireless/wext-compat.c
156 +++ b/net/wireless/wext-compat.c
157 @@ -830,7 +830,7 @@ static int cfg80211_wext_siwfreq(struct
158 ret = -EINVAL;
159 break;
160 }
161 - ret = cfg80211_set_monitor_channel(rdev, &chandef);
162 + ret = cfg80211_set_monitor_channel(rdev, dev, &chandef);
163 break;
164 case NL80211_IFTYPE_MESH_POINT:
165 freq = cfg80211_wext_freq(wextfreq);