Message ID | 20230607124647.27682-3-quic_adisi@quicinc.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Kalle Valo |
Headers | show |
Series | wifi: ath11k: fix CAC running state | expand |
On 6/7/2023 5:46 AM, Aditya Kumar Singh wrote: > Currently channel definition's primary channel's DFS CAC time > as well as primary channel's state i.e usable are used to set > the CAC_RUNNING flag for the ath11k radio structure. However, > this is wrong since certain channel definition are possbile > where primary channel may not be a DFS channel but, secondary > channel is a DFS channel. For example - channel 36 with 160 MHz > bandwidth. > In such cases, the flag will not be set which is wrong. > > Fix this issue by using cfg80211_chandef_dfs_usable() function > from cfg80211 which return trues if at least one channel is in > usable state. > > While at it, modify the CAC running debug log message to print > the CAC time as well in milli-seconds. > > Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 > > Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com> Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com> > --- > drivers/net/wireless/ath/ath11k/mac.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c > index a31b8e89684b..31982545266b 100644 > --- a/drivers/net/wireless/ath/ath11k/mac.c > +++ b/drivers/net/wireless/ath/ath11k/mac.c > @@ -5,6 +5,7 @@ > */ > > #include <net/mac80211.h> > +#include <net/cfg80211.h> > #include <linux/etherdevice.h> > #include <linux/bitfield.h> > #include <linux/inetdevice.h> > @@ -7193,6 +7194,7 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif, > struct wmi_vdev_start_req_arg arg = {}; > const struct cfg80211_chan_def *chandef = &ctx->def; > int ret = 0; > + unsigned int dfs_cac_time; > > lockdep_assert_held(&ar->conf_mutex); > > @@ -7272,20 +7274,21 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif, > ath11k_dbg(ab, ATH11K_DBG_MAC, "vdev %pM started, vdev_id %d\n", > arvif->vif->addr, arvif->vdev_id); > > - /* Enable CAC Flag in the driver by checking the channel DFS cac time, > - * i.e dfs_cac_ms value which will be valid only for radar channels > - * and state as NL80211_DFS_USABLE which indicates CAC needs to be > + /* Enable CAC Flag in the driver by checking the all sub-channel's DFS > + * state as NL80211_DFS_USABLE which indicates CAC needs to be > * done before channel usage. This flags is used to drop rx packets. > * during CAC. > */ > /* TODO Set the flag for other interface types as required */ > - if (arvif->vdev_type == WMI_VDEV_TYPE_AP && > - chandef->chan->dfs_cac_ms && > - chandef->chan->dfs_state == NL80211_DFS_USABLE) { > + if (arvif->vdev_type == WMI_VDEV_TYPE_AP && ctx->radar_enabled && > + cfg80211_chandef_dfs_usable(ar->hw->wiphy, chandef)) { > set_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); > + dfs_cac_time = cfg80211_chandef_dfs_cac_time(ar->hw->wiphy, > + chandef); > ath11k_dbg(ab, ATH11K_DBG_MAC, > - "CAC Started in chan_freq %d for vdev %d\n", > - arg.channel.freq, arg.vdev_id); > + "CAC (for %u ms) Started in center_freq %d center_freq1 %d for vdev %d\n", > + dfs_cac_time, arg.channel.freq, chandef->center_freq1, > + arg.vdev_id); > } > > ret = ath11k_mac_set_txbf_conf(arvif);
On 6/7/23 18:16, Aditya Kumar Singh wrote: > Currently channel definition's primary channel's DFS CAC time > as well as primary channel's state i.e usable are used to set > the CAC_RUNNING flag for the ath11k radio structure. However, > this is wrong since certain channel definition are possbile > where primary channel may not be a DFS channel but, secondary > channel is a DFS channel. For example - channel 36 with 160 MHz > bandwidth. > In such cases, the flag will not be set which is wrong. > > Fix this issue by using cfg80211_chandef_dfs_usable() function > from cfg80211 which return trues if at least one channel is in > usable state. > > While at it, modify the CAC running debug log message to print > the CAC time as well in milli-seconds. > > Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 > > Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com> Hi Kalle, The upstream dependency got merged today. I have sent [v2] of this series which was just rebased on latest ToT and the [PATCH v2 1/3] got merged. With this, [PATCH v2 2/3] and [PATCH v2 3/3] are unblocked now. - Aditya
Aditya Kumar Singh <quic_adisi@quicinc.com> writes: > On 6/7/23 18:16, Aditya Kumar Singh wrote: >> Currently channel definition's primary channel's DFS CAC time >> as well as primary channel's state i.e usable are used to set >> the CAC_RUNNING flag for the ath11k radio structure. However, >> this is wrong since certain channel definition are possbile >> where primary channel may not be a DFS channel but, secondary >> channel is a DFS channel. For example - channel 36 with 160 MHz >> bandwidth. >> In such cases, the flag will not be set which is wrong. >> Fix this issue by using cfg80211_chandef_dfs_usable() function >> from cfg80211 which return trues if at least one channel is in >> usable state. >> While at it, modify the CAC running debug log message to print >> the CAC time as well in milli-seconds. >> Tested-on: QCN9074 hw1.0 PCI >> WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 >> Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com> > Hi Kalle, > > The upstream dependency got merged today. I have sent [v2] of this > series which was just rebased on latest ToT and the [PATCH v2 1/3] got > merged. With this, [PATCH v2 2/3] and [PATCH v2 3/3] are unblocked > now. Thanks, this is helpful. I still need to merge wireless-next into ath-next but hopefully that happens next week.
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index a31b8e89684b..31982545266b 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -5,6 +5,7 @@ */ #include <net/mac80211.h> +#include <net/cfg80211.h> #include <linux/etherdevice.h> #include <linux/bitfield.h> #include <linux/inetdevice.h> @@ -7193,6 +7194,7 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif, struct wmi_vdev_start_req_arg arg = {}; const struct cfg80211_chan_def *chandef = &ctx->def; int ret = 0; + unsigned int dfs_cac_time; lockdep_assert_held(&ar->conf_mutex); @@ -7272,20 +7274,21 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif, ath11k_dbg(ab, ATH11K_DBG_MAC, "vdev %pM started, vdev_id %d\n", arvif->vif->addr, arvif->vdev_id); - /* Enable CAC Flag in the driver by checking the channel DFS cac time, - * i.e dfs_cac_ms value which will be valid only for radar channels - * and state as NL80211_DFS_USABLE which indicates CAC needs to be + /* Enable CAC Flag in the driver by checking the all sub-channel's DFS + * state as NL80211_DFS_USABLE which indicates CAC needs to be * done before channel usage. This flags is used to drop rx packets. * during CAC. */ /* TODO Set the flag for other interface types as required */ - if (arvif->vdev_type == WMI_VDEV_TYPE_AP && - chandef->chan->dfs_cac_ms && - chandef->chan->dfs_state == NL80211_DFS_USABLE) { + if (arvif->vdev_type == WMI_VDEV_TYPE_AP && ctx->radar_enabled && + cfg80211_chandef_dfs_usable(ar->hw->wiphy, chandef)) { set_bit(ATH11K_CAC_RUNNING, &ar->dev_flags); + dfs_cac_time = cfg80211_chandef_dfs_cac_time(ar->hw->wiphy, + chandef); ath11k_dbg(ab, ATH11K_DBG_MAC, - "CAC Started in chan_freq %d for vdev %d\n", - arg.channel.freq, arg.vdev_id); + "CAC (for %u ms) Started in center_freq %d center_freq1 %d for vdev %d\n", + dfs_cac_time, arg.channel.freq, chandef->center_freq1, + arg.vdev_id); } ret = ath11k_mac_set_txbf_conf(arvif);
Currently channel definition's primary channel's DFS CAC time as well as primary channel's state i.e usable are used to set the CAC_RUNNING flag for the ath11k radio structure. However, this is wrong since certain channel definition are possbile where primary channel may not be a DFS channel but, secondary channel is a DFS channel. For example - channel 36 with 160 MHz bandwidth. In such cases, the flag will not be set which is wrong. Fix this issue by using cfg80211_chandef_dfs_usable() function from cfg80211 which return trues if at least one channel is in usable state. While at it, modify the CAC running debug log message to print the CAC time as well in milli-seconds. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com> --- drivers/net/wireless/ath/ath11k/mac.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)