nl80211: Trigger channel switch from driver
PATCH 1/1 nl80211: Trigger channel switch from driver
This patch add channel switch event from driver to hostap. same as can be triggered from US via hostapd_cli chan_switch. using the already existing NL80211_CMD_CHANNEL_SWITCH.
--- include/net/cfg80211.h | 11 ++++++ net/wireless/nl80211.c | 83 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+)
include/net/cfg80211.h +11 -0
@@ -7416,6 +7416,17 @@ void cfg80211_ch_switch_started_notify(struct net_device *dev,struct cfg80211_chan_def *chandef, u8 count); +/* +* cfg80211_ch_switch - trigger channel switch from driver +* same as is can be triggered from hostapd_cli chan_switch +* @dev: the device which switched channels +* @chandef: the new channel definition +* @csa_count: the number of TBTTs until the channel switch happens +*/ +bool cfg80211_ch_switch (struct net_device *dev, +struct cfg80211_chan_def *chandef, +u8 csa_count); +/** * ieee80211_operating_class_to_band - convert operating class to band *
net/wireless/nl80211.c +83 -0
89 lines not on this page · raw message
--
2.17.1
________________________________
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Nothing contained herein shall be deemed as a representation, warranty or a commitment by Celeno. No warranties are expressed or implied, including, but not limited to, any implied warranties of non-infringement, merchantability and fitness for a particular purpose.
________________________________
Johannes Berg
maintainerHi Aviad, Shay,
Quoted 2 lines
This patch add channel switch event from driver to hostap. same as can be triggered from US via
hostapd_clichan_switch.
(had to think about "US" here for a bit, "channel switch" totally sent my brain on the regulatory road ... heh)
Quoted 1 line
using the already existing
NL80211_CMD_CHANNEL_SWITCH.
I'm a little confused as to how this would work - did the driver just *do* a channel switch? Or does it want to do a channel switch, and then hostapd has to deal with it? Is it able to? What happens if it doesn't do anything when this happens, e.g. an older version?
Quoted 12 lines
Signed-off-by Aviad Brikman <[email protected]>Signed-off-by Shay Bar <[email protected]>--- include/net/cfg80211.h | 11 ++++++ net/wireless/nl80211.c | 83 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+)include/net/cfg80211.h +0
-0
include/net/cfg80211.h void cfg80211_ch_switch_started_notify(struct net_device *dev, · line 7421
Quoted 6 lines
include/net/cfg80211.h +3
-0@@ -7416,6 +7416,17 @@ void cfg80211_ch_switch_started_notify(struct net_device *dev,struct cfg80211_chan_def *chandef, u8 count); +/* +* cfg80211_ch_switch - trigger channel switch from driver +* same as is can be triggered from hostapd_cli chan_switch
Not sure "same as ... hostapd_cli chan_switch" makes a lot of sense here in the kernel-doc, tbh.
Also, you say "trigger" here, but ...
include/net/cfg80211.h void cfg80211_ch_switch_started_notify(struct net_device *dev, · line 7422
Quoted 1 line
include/net/cfg80211.h +1
-0+* @dev: the device which switched channels
"switched" here, which didn't help my above question at all.
include/net/cfg80211.h void cfg80211_ch_switch_started_notify(struct net_device *dev, · line 7424
Quoted 2 lines
include/net/cfg80211.h +2
-0+* @chandef: the new channel definition +* @csa_count: the number of TBTTs until the channel switch happens
though I guess this makes it a bit clearer, unless it can be zero? :)
include/net/cfg80211.h void cfg80211_ch_switch_started_notify(struct net_device *dev, · line 7428
Quoted 4 lines
include/net/cfg80211.h +4
-0+*/ +bool cfg80211_ch_switch (struct net_device *dev, +struct cfg80211_chan_def *chandef, +u8 csa_count);
nit: indentation
include/net/cfg80211.h void cfg80211_ch_switch_started_notify(struct net_device *dev,
Quoted 10 lines
include/net/cfg80211.h +10
-0+if (chandef->width ==NL80211_CHAN_WIDTH_40 ) { +enum nl80211_channel_type chan_type =NL80211_CHAN_HT40MINUS ; + +if (chandef->center_freq1 > chandef->chan->center_freq) + chan_type =NL80211_CHAN_HT40PLUS ; + +if (nla_put_u32 (msg,NL80211_ATTR_WIPHY_CHANNEL_TYPE , + chan_type)) + goto nla_put_failure; + }
This a bit ties in with the "compatibility" question above - does older hostapd even understand this? I'd suspect not, and then I'm not sure why you'd include these attributes?
Quoted 10 lines
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Nothing contained herein shall be deemed as a representation, warranty or a commitment by Celeno. No warranties are expressed or implied, including, but not limited to, any implied warranties of non- infringement, merchantability and fitness for a particular purpose.
Hm. I guess I'm the "intended [...] person or entity" but I'm still a bit wary about applying patches with that, I guess.
Thanks,
johannes
On 28/09/2020 14:30, Johannes Berg wrote
Quoted 5 lines
Quoted 1 line
using the already existing
NL80211_CMD_CHANNEL_SWITCH.I'm a little confused as to how this would work - did the driver just *do* a channel switch? Or does it want to do a channel switch, and then hostapd has to deal with it? Is it able to? What happens if it doesn't do anything when this happens, e.g. an older version?
The driver "wants" to do channel switch and hostapd, once receiving the above command, will take the same action as if it received a "hostapd_cli chan_switch.
The driver will not assume channel was switched upon sending this command (it will have to wait until hostapd will handle the entire channel switch "loop").
There are many reasons why kernel driver will want to trigger a channel switch (e.g. dynamic channel selection).
With older version of hostapd, it will not be able to handle this command and nothing will happen.
Quoted 5 lines
Quoted 3 lines
+/*
+ *cfg80211_ch_switch- trigger channel switch from driver
+ * same as is can be triggered fromhostapd_clichan_switchNot sure "same as ...
hostapd_clichan_switch" makes a lot of sense here in the kernel-doc, tbh.
can remove the "hostapd_cli chan_switch" reference.
Quoted 4 lines
Also, you say "trigger" here, but ...
Quoted 1 line
+ * @dev: the device which switched channels
"switched" here, which didn't help my above question at all.
Agree "wants to switch" is clearer
Quoted 3 lines
Quoted 2 lines
+ * @chandef: the new channel definition
+ * @csa_count: the number of TBTTs until the channel switch happensthough I guess this makes it a bit clearer, unless it can be zero? :)
csa_count of 0/1 is valid, but it means the channel switch will happen at the current TBTT (see ieee80211_set_csa_beacon())
Quoted 5 lines
include/net/cfg80211.h void cfg80211_ch_switch_started_notify(struct net_device *dev, · line 7428
Quoted 4 lines
+ */
include/net/cfg80211.h +3
-0+bool cfg80211_ch_switch (struct net_device *dev, +struct cfg80211_chan_def *chandef, +u8 csa_count);nit: indentation
will fix
Quoted 5 lines
Quoted 5 lines
net/wireless/nl80211.c +5
-0+if (chandef->width ==NL80211_CHAN_WIDTH_40 ) { +enum nl80211_channel_type chan_type =NL80211_CHAN_HT40MINUS ; + +if (chandef->center_freq1 > chandef->chan->center_freq) + chan_type =NL80211_CHAN_HT40PLUS ;
Quoted 8 lines
net/wireless/nl80211.c void cfg80211_ch_switch_started_notify(struct net_device *dev, · line 16901
Quoted 5 lines
net/wireless/nl80211.c +5
-0+ +if (nla_put_u32 (msg,NL80211_ATTR_WIPHY_CHANNEL_TYPE , + chan_type)) + goto nla_put_failure; + }This a bit ties in with the "compatibility" question above - does older hostapd even understand this? I'd suspect not, and then I'm not sure why you'd include these attributes?
older hostapd will not handle NL80211_CMD_CHANNEL_SWITCH anyway.
Quoted 10 lines
Quoted 10 lines
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Nothing contained herein shall be deemed as a representation, warranty or a commitment by Celeno. No warranties are expressed or implied, including, but not limited to, any implied warranties of non- infringement, merchantability and fitness for a particular purpose.
Quoted 2 lines
Hm. I guess I'm the "intended [...] person or entity" but I'm still a bit wary about applying patches with that, I guess.
:) the disclaimer will be removed from now on.