Commit c0c345d4 authored by Mohammed Shafi Shajakhan's avatar Mohammed Shafi Shajakhan Committed by Kalle Valo

ath: Fix updating radar flags for coutry code India

As per latest regulatory update for India, channel 52, 56, 60, 64
is no longer restricted to DFS. Enabling DFS/no infra flags in driver
results in applying all DFS related restrictions (like doing CAC etc
before this channel moves to 'available state') for these channels
even though the country code is programmed as 'India' in he hardware,
fix this by relaxing the frequency range while applying RADAR flags
only if the country code is programmed to India. If the frequency range
needs to modified based on different country code, ath_is_radar_freq
can be extended/modified dynamically.
Signed-off-by: default avatarMohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent b9018975
...@@ -254,8 +254,12 @@ bool ath_is_49ghz_allowed(u16 regdomain) ...@@ -254,8 +254,12 @@ bool ath_is_49ghz_allowed(u16 regdomain)
EXPORT_SYMBOL(ath_is_49ghz_allowed); EXPORT_SYMBOL(ath_is_49ghz_allowed);
/* Frequency is one where radar detection is required */ /* Frequency is one where radar detection is required */
static bool ath_is_radar_freq(u16 center_freq) static bool ath_is_radar_freq(u16 center_freq,
struct ath_regulatory *reg)
{ {
if (reg->country_code == CTRY_INDIA)
return (center_freq >= 5500 && center_freq <= 5700);
return (center_freq >= 5260 && center_freq <= 5700); return (center_freq >= 5260 && center_freq <= 5700);
} }
...@@ -306,7 +310,7 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy, ...@@ -306,7 +310,7 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,
enum nl80211_reg_initiator initiator, enum nl80211_reg_initiator initiator,
struct ieee80211_channel *ch) struct ieee80211_channel *ch)
{ {
if (ath_is_radar_freq(ch->center_freq) || if (ath_is_radar_freq(ch->center_freq, reg) ||
(ch->flags & IEEE80211_CHAN_RADAR)) (ch->flags & IEEE80211_CHAN_RADAR))
return; return;
...@@ -395,8 +399,9 @@ ath_reg_apply_ir_flags(struct wiphy *wiphy, ...@@ -395,8 +399,9 @@ ath_reg_apply_ir_flags(struct wiphy *wiphy,
} }
} }
/* Always apply Radar/DFS rules on freq range 5260 MHz - 5700 MHz */ /* Always apply Radar/DFS rules on freq range 5500 MHz - 5700 MHz */
static void ath_reg_apply_radar_flags(struct wiphy *wiphy) static void ath_reg_apply_radar_flags(struct wiphy *wiphy,
struct ath_regulatory *reg)
{ {
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
struct ieee80211_channel *ch; struct ieee80211_channel *ch;
...@@ -409,7 +414,7 @@ static void ath_reg_apply_radar_flags(struct wiphy *wiphy) ...@@ -409,7 +414,7 @@ static void ath_reg_apply_radar_flags(struct wiphy *wiphy)
for (i = 0; i < sband->n_channels; i++) { for (i = 0; i < sband->n_channels; i++) {
ch = &sband->channels[i]; ch = &sband->channels[i];
if (!ath_is_radar_freq(ch->center_freq)) if (!ath_is_radar_freq(ch->center_freq, reg))
continue; continue;
/* We always enable radar detection/DFS on this /* We always enable radar detection/DFS on this
* frequency range. Additionally we also apply on * frequency range. Additionally we also apply on
...@@ -506,7 +511,7 @@ void ath_reg_notifier_apply(struct wiphy *wiphy, ...@@ -506,7 +511,7 @@ void ath_reg_notifier_apply(struct wiphy *wiphy,
struct ath_common *common = container_of(reg, struct ath_common, struct ath_common *common = container_of(reg, struct ath_common,
regulatory); regulatory);
/* We always apply this */ /* We always apply this */
ath_reg_apply_radar_flags(wiphy); ath_reg_apply_radar_flags(wiphy, reg);
/* /*
* This would happen when we have sent a custom regulatory request * This would happen when we have sent a custom regulatory request
...@@ -654,7 +659,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg, ...@@ -654,7 +659,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
} }
wiphy_apply_custom_regulatory(wiphy, regd); wiphy_apply_custom_regulatory(wiphy, regd);
ath_reg_apply_radar_flags(wiphy); ath_reg_apply_radar_flags(wiphy, reg);
ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment