wcn36xx: PHY modifications to support 80MHz operation
v3 cover wcn36xx: PHY modifications to support 80MHz operation
This series is four in a set of seven to add support for wcn3680 at 802.11ac data-rates.
In this set we add the ability to configure up the wcn3680 PHY to get onto 80MHz channels. To do that, the upper unused bits of the hw_value field of the struct ieee80211_channel are used to encode additional PHY settings.
Accessor macros are provided to encode and decode this additional information. Depending on which channel we are on, we need to configure the PHY into one of four modes representing four potential adjacent 20MHz channels.
The modes describe where the primary channel sits in relation to the other three channels giving us 20MHz + 20MHz + 20MHz + 20MHz to get 80MHz.
v3:
- No difference between V3 and V2 below
https://lore.kernel.org/linux-wireless/[email protected]/T/#t
V2:
- No difference between V2 and V1 below
V1:
https://lore.kernel.org/linux-wireless/[email protected]/T/#t
Bryan O'Donoghue (5):
wcn36xx: Add accessor macro HW_VALUE_CHANNEL for hardware channels
wcn36xx: Use HW_VALUE_CHANNEL macro to get channel number
wcn36xx: Add accessor macro HW_VALUE_PHY for PHY settings
wcn36xx: Encode PHY mode for 80MHz channel in hw_value
wcn36xx: Set PHY into correct mode for 80MHz channel width
drivers/net/wireless/ath/wcn36xx/main.c | 50 +++++++++++----------- drivers/net/wireless/ath/wcn36xx/smd.c | 15 +++++-- drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 6 ++- 3 files changed, 42 insertions(+), 29 deletions(-)
Signature · 1 line
2.27.0
PATCH v3 1/5 wcn36xx: Add accessor macro HW_VALUE_CHANNEL for hardware channels
Adds HW_VALUE_CHANNEL(hw_value) an access macro that will be used to extract the channel number from struct ieee80211_channel->hw_value in preparation for also storing PHY settings for 802.11ac in the upper bits of hw_value.
--- drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/wcn36xx.h +3 -1
@@ -83,7 +83,9 @@ enum wcn36xx_ampdu_state { WCN36XX_AMPDU_OPERATIONAL, }; -#define WCN36XX_HW_CHANNEL (__wcn) (__wcn->hw->conf.chandef.chan->hw_value) +#define HW_VALUE_CHANNEL (hw_value) ((hw_value) & 0xFF) +#define WCN36XX_HW_CHANNEL (__wcn)\ + HW_VALUE_CHANNEL(__wcn->hw->conf.chandef.chan->hw_value)#define WCN36XX_BAND (__wcn) (__wcn->hw->conf.chandef.chan->band)#define WCN36XX_CENTER_FREQ (__wcn) (__wcn->hw->conf.chandef.chan->center_freq)#define WCN36XX_LISTEN_INTERVAL (__wcn) (__wcn->hw->conf.listen_interval)
Signature · 1 line
2.27.0
PATCH v3 2/5 wcn36xx: Use HW_VALUE_CHANNEL macro to get channel number
In reply to Bryan O'DonoghueUses HW_VALUE_CHANNEL() to extract the channel number from a struct ieee80211_channel->hw_value. Once done we can use the upper bits of the hw_value to encode PHY related data.
--- drivers/net/wireless/ath/wcn36xx/smd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/wcn36xx/smd.c +4 -2
@@ -758,8 +758,10 @@ int wcn36xx_smd_start_hw_scan(struct wcn36xx *wcn, struct ieee80211_vif *vif, msg_body->num_channel =min_t (u8, req->n_channels,sizeof (msg_body->channels)); -for (i =0 ; i < msg_body->num_channel; i++) - msg_body->channels[i] = req->channels[i]->hw_value; +for (i =0 ; i < msg_body->num_channel; i++) { + msg_body->channels[i] = +HW_VALUE_CHANNEL (req->channels[i]->hw_value); + } msg_body->header.len -=WCN36XX_MAX_SCAN_IE_LEN ;
Signature · 1 line
2.27.0
PATCH v3 3/5 wcn36xx: Add accessor macro HW_VALUE_PHY for PHY settings
In reply to Bryan O'DonoghueAdds HW_VALUE_PHY(hw_value) an access macro that will be used to extract a hardware specific PHY setting for a given channel.
--- drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/wcn36xx/wcn36xx.h +2 -0
@@ -83,6 +83,8 @@ enum wcn36xx_ampdu_state { WCN36XX_AMPDU_OPERATIONAL, }; +#define HW_VALUE_PHY_SHIFT 8 +#define HW_VALUE_PHY (hw_value) ((hw_value) >> HW_VALUE_PHY_SHIFT)#define HW_VALUE_CHANNEL (hw_value) ((hw_value) & 0xFF)#define WCN36XX_HW_CHANNEL (__wcn)\ HW_VALUE_CHANNEL(__wcn->hw->conf.chandef.chan->hw_value)
Signature · 1 line
2.27.0
PATCH v3 4/5 wcn36xx: Encode PHY mode for 80MHz channel in hw_value
In reply to Bryan O'DonoghueThis commit encodes the 802.11ac PHY mode for a given channel in the upper bits of the hw_value field. This allows for a neat read-out and application of the relevant PHY setting.
--- drivers/net/wireless/ath/wcn36xx/main.c | 50 ++++++++++++------------- 1 file changed, 25 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/wcn36xx/main.c +25 -25
@@ -39,10 +39,10 @@ MODULE_PARM_DESC(debug_mask, "Debugging mask"); .max_power = 25, \ } -#define CHAN5G (_freq, _idx) { \ +#define CHAN5G (_freq, _idx, _phy_val) { \ .band = NL80211_BAND_5GHZ, \ .center_freq = (_freq), \ - .hw_value = (_idx), \ + .hw_value = (_phy_val) << HW_VALUE_PHY_SHIFT | HW_VALUE_CHANNEL(_idx), \ .max_power = 25, \ }
@@ -67,29 +67,29 @@ static struct ieee80211_channel wcn_2ghz_channels[] = { };static struct ieee80211_channel wcn_5ghz_channels[] = { -CHAN5G (5180 ,36 ), -CHAN5G (5200 ,40 ), -CHAN5G (5220 ,44 ), -CHAN5G (5240 ,48 ), -CHAN5G (5260 ,52 ), -CHAN5G (5280 ,56 ), -CHAN5G (5300 ,60 ), -CHAN5G (5320 ,64 ), -CHAN5G (5500 ,100 ), -CHAN5G (5520 ,104 ), -CHAN5G (5540 ,108 ), -CHAN5G (5560 ,112 ), -CHAN5G (5580 ,116 ), -CHAN5G (5600 ,120 ), -CHAN5G (5620 ,124 ), -CHAN5G (5640 ,128 ), -CHAN5G (5660 ,132 ), -CHAN5G (5700 ,140 ), -CHAN5G (5745 ,149 ), -CHAN5G (5765 ,153 ), -CHAN5G (5785 ,157 ), -CHAN5G (5805 ,161 ), -CHAN5G (5825 ,165 ) +CHAN5G (5180 ,36 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW ), +CHAN5G (5200 ,40 ,PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW ), +CHAN5G (5220 ,44 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH ), +CHAN5G (5240 ,48 ,PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH ), +CHAN5G (5260 ,52 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW ), +CHAN5G (5280 ,56 ,PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW ), +CHAN5G (5300 ,60 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH ), +CHAN5G (5320 ,64 ,PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH ), +CHAN5G (5500 ,100 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW ), +CHAN5G (5520 ,104 ,PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW ), +CHAN5G (5540 ,108 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH ), +CHAN5G (5560 ,112 ,PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH ), +CHAN5G (5580 ,116 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW ), +CHAN5G (5600 ,120 ,PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW ), +CHAN5G (5620 ,124 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH ), +CHAN5G (5640 ,128 ,PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH ), +CHAN5G (5660 ,132 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW ), +CHAN5G (5700 ,140 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH ), +CHAN5G (5745 ,149 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW ), +CHAN5G (5765 ,153 ,PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW ), +CHAN5G (5785 ,157 ,PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH ), +CHAN5G (5805 ,161 ,PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH ), +CHAN5G (5825 ,165 ,0 ) };#define RATE (_bitrate, _hw_rate, _flags) { \
Signature · 1 line
2.27.0
PATCH v3 5/5 wcn36xx: Set PHY into correct mode for 80MHz channel width
In reply to Bryan O'DonoghueFor the 80MHz channel we need to set the PHY mode to one of four PHY modes that span the 80MHz range.
This patch latches the hw_value PHY field previously defined for 5GHz channels directly to the parameter passed to the firmware.
--- drivers/net/wireless/ath/wcn36xx/smd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/smd.c +8 -1
@@ -1485,6 +1485,7 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn,struct wcn36xx_hal_config_bss_params_v1 *bss;struct wcn36xx_hal_config_bss_params bss_v0;struct wcn36xx_hal_config_sta_params_v1 *sta; +struct cfg80211_chan_def *chandef;int ret; msg_body =kzalloc (sizeof (*msg_body),GFP_KERNEL );
@@ -1524,7 +1525,13 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, bss->dtim_period = bss_v0.dtim_period; bss->tx_channel_width_set = bss_v0.tx_channel_width_set; bss->oper_channel = bss_v0.oper_channel; - bss->ext_channel = bss_v0.ext_channel; + +if (wcn->hw->conf.chandef.width ==NL80211_CHAN_WIDTH_80 ) { + chandef = &wcn->hw->conf.chandef; + bss->ext_channel =HW_VALUE_PHY (chandef->chan->hw_value); + }else { + bss->ext_channel = bss_v0.ext_channel; + } bss->reserved = bss_v0.reserved;
Signature · 1 line
2.27.0