2018-03-26 13:36:50

by Sergey Matyukevich

[permalink] [raw]
Subject: [PATCH 0/3] cfg80211: further work on DFS offload enablement

Hello Johannes and all,

Here is a patch set with minor cleanups/updates needed to enable
DFS offload in cfg80211.

Note that the third patch enables DFS offload for qtnfmac driver.
We assume that it should go through wireless-drivers tree after
all cfg80211/nl80211 changes are reviewed and merged. So it is
posted here for reference purposes only.

Besides, minimal set of user-space changes for hostapd has been
already posted to hostapd mailing list.

Thanks,
Sergey

Dmitrii Lebed (3):
cfg80211: fix CAC_STARTED event handling
cfg80211: enable use of non-cleared DFS channels for DFS
qtnfmac: add DFS offload support

drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 9 +++++++++
drivers/net/wireless/quantenna/qtnfmac/event.c | 11 +++++++++++
drivers/net/wireless/quantenna/qtnfmac/qlink.h | 7 +++++--
net/wireless/chan.c | 9 +++++++--
net/wireless/mlme.c | 2 +-
5 files changed, 33 insertions(+), 5 deletions(-)


2018-03-26 13:36:54

by Sergey Matyukevich

[permalink] [raw]
Subject: [PATCH 2/3] cfg80211: enable use of non-cleared DFS channels for DFS offload

From: Dmitry Lebed <[email protected]>

Currently channel switch/start_ap to DFS channel cannot be done to
non-CAC-cleared channel even if DFS offload if enabled.
Make non-cleared DFS channels available if DFS offload is enabled.
CAC will be started by HW after channel change, start_ap call, etc.

Signed-off-by: Dmitry Lebed <[email protected]>
---
net/wireless/chan.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index a48859982a32..2db713d18f71 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -579,6 +579,10 @@ static bool cfg80211_get_chans_dfs_available(struct wiphy *wiphy,
{
struct ieee80211_channel *c;
u32 freq, start_freq, end_freq;
+ bool dfs_offload;
+
+ dfs_offload = wiphy_ext_feature_isset(wiphy,
+ NL80211_EXT_FEATURE_DFS_OFFLOAD);

start_freq = cfg80211_get_start_freq(center_freq, bandwidth);
end_freq = cfg80211_get_end_freq(center_freq, bandwidth);
@@ -596,8 +600,9 @@ static bool cfg80211_get_chans_dfs_available(struct wiphy *wiphy,
if (c->flags & IEEE80211_CHAN_DISABLED)
return false;

- if ((c->flags & IEEE80211_CHAN_RADAR) &&
- (c->dfs_state != NL80211_DFS_AVAILABLE))
+ if ((c->flags & IEEE80211_CHAN_RADAR) &&
+ (c->dfs_state != NL80211_DFS_AVAILABLE) &&
+ !(c->dfs_state == NL80211_DFS_USABLE && dfs_offload))
return false;
}

--
2.11.0

2018-03-26 13:36:51

by Sergey Matyukevich

[permalink] [raw]
Subject: [PATCH 1/3] cfg80211: fix CAC_STARTED event handling

From: Dmitry Lebed <[email protected]>

Exclude CAC_STARTED event from !wdev->cac_started check,
since cac_started will be set later in the same function.

Signed-off-by: Dmitry Lebed <[email protected]>
---
net/wireless/mlme.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 6b6818dd76bd..12b3edf70a7b 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -872,7 +872,7 @@ void cfg80211_cac_event(struct net_device *netdev,

trace_cfg80211_cac_event(netdev, event);

- if (WARN_ON(!wdev->cac_started))
+ if (WARN_ON(!wdev->cac_started && event != NL80211_RADAR_CAC_STARTED))
return;

if (WARN_ON(!wdev->chandef.chan))
--
2.11.0

2018-03-26 13:36:56

by Sergey Matyukevich

[permalink] [raw]
Subject: [PATCH 3/3] qtnfmac: add DFS offload support

From: Dmitry Lebed <[email protected]>

DFS offload support implemented:
- DFS_OFFLOAD feature is advertised depending on HW capabilities
- CAC_STARTED event forwarding from HW implemented
- start_radar_detection() callback now returning -ENOTSUPP
if DFS_OFFLOAD is enabled

Signed-off-by: Dmitry Lebed <[email protected]>
---
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 9 +++++++++
drivers/net/wireless/quantenna/qtnfmac/event.c | 11 +++++++++++
drivers/net/wireless/quantenna/qtnfmac/qlink.h | 7 +++++--
3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
index 0398bece5782..5122dc798064 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
@@ -813,6 +813,9 @@ static int qtnf_start_radar_detection(struct wiphy *wiphy,
struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev);
int ret;

+ if (wiphy_ext_feature_isset(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD))
+ return -ENOTSUPP;
+
ret = qtnf_cmd_start_cac(vif, chandef, cac_time_ms);
if (ret)
pr_err("%s: failed to start CAC ret=%d\n", ndev->name, ret);
@@ -909,6 +912,9 @@ struct wiphy *qtnf_wiphy_allocate(struct qtnf_bus *bus)
{
struct wiphy *wiphy;

+ if (bus->hw_info.hw_capab & QLINK_HW_CAPAB_DFS_OFFLOAD)
+ qtn_cfg80211_ops.start_radar_detection = NULL;
+
wiphy = wiphy_new(&qtn_cfg80211_ops, sizeof(struct qtnf_wmac));
if (!wiphy)
return NULL;
@@ -982,6 +988,9 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac)
WIPHY_FLAG_AP_UAPSD |
WIPHY_FLAG_HAS_CHANNEL_SWITCH;

+ if (hw_info->hw_capab & QLINK_HW_CAPAB_DFS_OFFLOAD)
+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD);
+
wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS |
NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2;

diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c
index bcd415f96412..cb2a6c12f870 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/event.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/event.c
@@ -443,6 +443,17 @@ static int qtnf_event_handle_radar(struct qtnf_vif *vif,
cfg80211_cac_event(vif->netdev, &chandef,
NL80211_RADAR_CAC_ABORTED, GFP_KERNEL);
break;
+ case QLINK_RADAR_CAC_STARTED:
+ if (vif->wdev.cac_started)
+ break;
+
+ if (!wiphy_ext_feature_isset(wiphy,
+ NL80211_EXT_FEATURE_DFS_OFFLOAD))
+ break;
+
+ cfg80211_cac_event(vif->netdev, &chandef,
+ NL80211_RADAR_CAC_STARTED, GFP_KERNEL);
+ break;
default:
pr_warn("%s: unhandled radar event %u\n",
vif->netdev->name, ev->event);
diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink.h b/drivers/net/wireless/quantenna/qtnfmac/qlink.h
index 9bf3ae4d1b3b..9ab27e158023 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/qlink.h
+++ b/drivers/net/wireless/quantenna/qtnfmac/qlink.h
@@ -68,10 +68,12 @@ struct qlink_msg_header {
* @QLINK_HW_CAPAB_STA_INACT_TIMEOUT: device implements a logic to kick-out
* associated STAs due to inactivity. Inactivity timeout period is taken
* from QLINK_CMD_START_AP parameters.
+ * @QLINK_HW_CAPAB_DFS_OFFLOAD: device implements DFS offload functionality
*/
enum qlink_hw_capab {
- QLINK_HW_CAPAB_REG_UPDATE = BIT(0),
- QLINK_HW_CAPAB_STA_INACT_TIMEOUT = BIT(1),
+ QLINK_HW_CAPAB_REG_UPDATE = BIT(0),
+ QLINK_HW_CAPAB_STA_INACT_TIMEOUT = BIT(1),
+ QLINK_HW_CAPAB_DFS_OFFLOAD = BIT(2),
};

enum qlink_iface_type {
@@ -1031,6 +1033,7 @@ enum qlink_radar_event {
QLINK_RADAR_CAC_ABORTED,
QLINK_RADAR_NOP_FINISHED,
QLINK_RADAR_PRE_CAC_EXPIRED,
+ QLINK_RADAR_CAC_STARTED,
};

/**
--
2.11.0

2018-04-24 17:23:00

by Kalle Valo

[permalink] [raw]
Subject: Re: [3/3] qtnfmac: add DFS offload support

Sergey Matyukevich <[email protected]> wrote:

> From: Dmitry Lebed <[email protected]>
>
> DFS offload support implemented:
> - DFS_OFFLOAD feature is advertised depending on HW capabilities
> - CAC_STARTED event forwarding from HW implemented
> - start_radar_detection() callback now returning -ENOTSUPP
> if DFS_OFFLOAD is enabled
>
> Signed-off-by: Dmitry Lebed <[email protected]>

Patch applied to wireless-drivers-next.git, thanks.

fbb93020b89b qtnfmac: add DFS offload support

--
https://patchwork.kernel.org/patch/10307827/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches