2023-01-30 07:23:04

by Aloka Dixit

[permalink] [raw]
Subject: [PATCH v3 3/6] wifi: nl80211: configure puncturing in NL80211_CMD_CHANNEL_SWITCH

Retrieve the puncturing bitmap during channel switch operation and
store it in struct cfg80211_csa_settings.

Signed-off-by: Aloka Dixit <[email protected]>
---
include/net/cfg80211.h | 5 +++++
net/mac80211/cfg.c | 5 ++---
net/wireless/nl80211.c | 7 +++++++
3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index c25a558d50ea..7714a44d312e 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1372,6 +1372,10 @@ struct cfg80211_ap_settings {
* @radar_required: whether radar detection is required on the new channel
* @block_tx: whether transmissions should be blocked while changing
* @count: number of beacons until switch
+ * @punct_bitmap: Preamble puncturing bitmap. Each bit represents a 20 MHz
+ * channel with lowest bit corresponding to the lowest frequency. Bit set
+ * to 1 indicates that the channel is punctured. Higher 16 bits are
+ * currently unused.
*/
struct cfg80211_csa_settings {
struct cfg80211_chan_def chandef;
@@ -1384,6 +1388,7 @@ struct cfg80211_csa_settings {
bool radar_required;
bool block_tx;
u8 count;
+ u32 punct_bitmap;
};

/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 185e218e8668..87aab0ba9353 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1297,9 +1297,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
}

if (params->eht_cap) {
- if (!ieee80211_valid_disable_subchannel_bitmap(
- &params->punct_bitmap,
- params->chandef.width))
+ if (!ieee80211_valid_disable_subchannel_bitmap(&params->punct_bitmap,
+ params->chandef.width))
return -EINVAL;
link_conf->eht_puncturing = params->punct_bitmap;
changed |= BSS_CHANGED_EHT_PUNCTURING;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 351c4cc5ec92..efe841ba8865 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10078,6 +10078,13 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[NL80211_ATTR_CH_SWITCH_BLOCK_TX])
params.block_tx = true;

+ if (info->attrs[NL80211_ATTR_PUNCT_BITMAP]) {
+ err = nl80211_parse_punct_bitmap(rdev, info,
+ &params.punct_bitmap);
+ if (err)
+ goto free;
+ }
+
wdev_lock(wdev);
err = rdev_channel_switch(rdev, dev, &params);
wdev_unlock(wdev);
--
2.39.0



2023-01-30 08:43:27

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v3 3/6] wifi: nl80211: configure puncturing in NL80211_CMD_CHANNEL_SWITCH

On Sun, 2023-01-29 at 23:22 -0800, Aloka Dixit wrote:
>
> + * @punct_bitmap: Preamble puncturing bitmap. Each bit represents a 20 MHz
> + * channel with lowest bit corresponding to the lowest frequency. Bit set
> + * to 1 indicates that the channel is punctured. Higher 16 bits are
> + * currently unused.

> @@ -1384,6 +1388,7 @@ struct cfg80211_csa_settings {
> bool radar_required;
> bool block_tx;
> u8 count;
> + u32 punct_bitmap;

again internally I think we can stick to u16 for now

> +++ b/net/mac80211/cfg.c
> @@ -1297,9 +1297,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
> }
>
> if (params->eht_cap) {
> - if (!ieee80211_valid_disable_subchannel_bitmap(
> - &params->punct_bitmap,
> - params->chandef.width))
> + if (!ieee80211_valid_disable_subchannel_bitmap(&params->punct_bitmap,
> + params->chandef.width))
> return -EINVAL;

That got rebased into the wrong patch maybe?

johannes