Skip to content

Commit fa1f108

Browse files
Arend van Sprieljmberg-intel
authored andcommitted
cfg80211: util: add 6GHz channel to freq conversion and vice versa
Extend the functions ieee80211_channel_to_frequency() and ieee80211_frequency_to_channel() to support 6GHz band according specification in 802.11ax D4.1 27.3.22.2. Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> Reviewed-by: Leon Zegers <leon.zegers@broadcom.com> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> Link: https://lore.kernel.org/r/1564745465-21234-4-git-send-email-arend.vanspriel@broadcom.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent f89769c commit fa1f108

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎net/wireless/util.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
9191
else
9292
return 5000 + chan * 5;
9393
break;
94+
case NL80211_BAND_6GHZ:
95+
/* see 802.11ax D4.1 27.3.22.2 */
96+
if (chan <= 253)
97+
return 5940 + chan * 5;
98+
break;
9499
case NL80211_BAND_60GHZ:
95100
if (chan < 7)
96101
return 56160 + chan * 2160;
@@ -111,8 +116,11 @@ int ieee80211_frequency_to_channel(int freq)
111116
return (freq - 2407) / 5;
112117
else if (freq >= 4910 && freq <= 4980)
113118
return (freq - 4000) / 5;
114-
else if (freq <= 45000) /* DMG band lower limit */
119+
else if (freq < 5940)
115120
return (freq - 5000) / 5;
121+
else if (freq <= 45000) /* DMG band lower limit */
122+
/* see 802.11ax D4.1 27.3.22.2 */
123+
return (freq - 5940) / 5;
116124
else if (freq >= 58320 && freq <= 70200)
117125
return (freq - 56160) / 2160;
118126
else

0 commit comments

Comments
 (0)