Call set_linktype now with correct port_num. Only react to beacon
changes if port_num == 0, as we only support AP mode on this port.
Signed-off-by: Martin Kaistra <[email protected]>
---
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 26 +++++++++++--------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 59dd50844f1ae..f929b01615d00 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -4981,6 +4981,7 @@ static void
rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *bss_conf, u64 changed)
{
+ struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv;
struct rtl8xxxu_priv *priv = hw->priv;
struct device *dev = &priv->udev->dev;
struct ieee80211_sta *sta;
@@ -4993,7 +4994,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (changed & BSS_CHANGED_ASSOC) {
dev_dbg(dev, "Changed ASSOC: %i!\n", vif->cfg.assoc);
- rtl8xxxu_set_linktype(priv, vif->type, 0);
+ rtl8xxxu_set_linktype(priv, vif->type, rtlvif->port_num);
if (vif->cfg.assoc) {
u32 ramask;
@@ -5040,7 +5041,8 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
rtl8xxxu_write8(priv, REG_BCN_MAX_ERR, 0xff);
- rtl8xxxu_stop_tx_beacon(priv);
+ if (rtlvif->port_num == 0)
+ rtl8xxxu_stop_tx_beacon(priv);
/* joinbss sequence */
rtl8xxxu_write16(priv, REG_BCN_PSR_RPT,
@@ -5082,7 +5084,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (changed & BSS_CHANGED_BSSID) {
dev_dbg(dev, "Changed BSSID!\n");
- rtl8xxxu_set_bssid(priv, bss_conf->bssid, 0);
+ rtl8xxxu_set_bssid(priv, bss_conf->bssid, rtlvif->port_num);
}
if (changed & BSS_CHANGED_BASIC_RATES) {
@@ -5090,16 +5092,18 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
rtl8xxxu_set_basic_rates(priv, bss_conf->basic_rates);
}
- if (changed & BSS_CHANGED_BEACON_ENABLED) {
- if (bss_conf->enable_beacon)
- rtl8xxxu_start_tx_beacon(priv);
- else
- rtl8xxxu_stop_tx_beacon(priv);
+ /* beacon only supported for port_num = 0 */
+ if (rtlvif->port_num == 0) {
+ if (changed & BSS_CHANGED_BEACON_ENABLED) {
+ if (bss_conf->enable_beacon)
+ rtl8xxxu_start_tx_beacon(priv);
+ else
+ rtl8xxxu_stop_tx_beacon(priv);
+ }
+ if (changed & BSS_CHANGED_BEACON)
+ schedule_work(&priv->update_beacon_work);
}
- if (changed & BSS_CHANGED_BEACON)
- schedule_work(&priv->update_beacon_work);
-
error:
return;
}
--
2.39.2
> -----Original Message-----
> From: Martin Kaistra <[email protected]>
> Sent: Monday, December 18, 2023 10:37 PM
> To: [email protected]
> Cc: Jes Sorensen <[email protected]>; Kalle Valo <[email protected]>; Ping-Ke Shih
> <[email protected]>; Bitterblue Smith <[email protected]>; Sebastian Andrzej Siewior
> <[email protected]>
> Subject: [PATCH 14/20] wifi: rtl8xxxu: support multiple interfaces in bss_info_changed()
>
> Call set_linktype now with correct port_num. Only react to beacon
> changes if port_num == 0, as we only support AP mode on this port.
>
> Signed-off-by: Martin Kaistra <[email protected]>
> ---
> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 26 +++++++++++--------
> 1 file changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> index 59dd50844f1ae..f929b01615d00 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
[...]
> @@ -5090,16 +5092,18 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> rtl8xxxu_set_basic_rates(priv, bss_conf->basic_rates);
> }
>
> - if (changed & BSS_CHANGED_BEACON_ENABLED) {
> - if (bss_conf->enable_beacon)
> - rtl8xxxu_start_tx_beacon(priv);
> - else
> - rtl8xxxu_stop_tx_beacon(priv);
> + /* beacon only supported for port_num = 0 */
> + if (rtlvif->port_num == 0) {
As your design, AP mode must play on port 0. Could mac80211 notify driver BEACON
changed on port 1?
> + if (changed & BSS_CHANGED_BEACON_ENABLED) {
> + if (bss_conf->enable_beacon)
> + rtl8xxxu_start_tx_beacon(priv);
> + else
> + rtl8xxxu_stop_tx_beacon(priv);
> + }
> + if (changed & BSS_CHANGED_BEACON)
> + schedule_work(&priv->update_beacon_work);
> }
>
> - if (changed & BSS_CHANGED_BEACON)
> - schedule_work(&priv->update_beacon_work);
> -
> error:
> return;
> }
Ping-Ke
Am 20.12.23 um 07:09 schrieb Ping-Ke Shih:
>
>
>> -----Original Message-----
>> From: Martin Kaistra <[email protected]>
>> Sent: Monday, December 18, 2023 10:37 PM
>> To: [email protected]
>> Cc: Jes Sorensen <[email protected]>; Kalle Valo <[email protected]>; Ping-Ke Shih
>> <[email protected]>; Bitterblue Smith <[email protected]>; Sebastian Andrzej Siewior
>> <[email protected]>
>> Subject: [PATCH 14/20] wifi: rtl8xxxu: support multiple interfaces in bss_info_changed()
>>
>> Call set_linktype now with correct port_num. Only react to beacon
>> changes if port_num == 0, as we only support AP mode on this port.
>>
>> Signed-off-by: Martin Kaistra <[email protected]>
>> ---
>> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 26 +++++++++++--------
>> 1 file changed, 15 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> index 59dd50844f1ae..f929b01615d00 100644
>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>
> [...]
>
>> @@ -5090,16 +5092,18 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>> rtl8xxxu_set_basic_rates(priv, bss_conf->basic_rates);
>> }
>>
>> - if (changed & BSS_CHANGED_BEACON_ENABLED) {
>> - if (bss_conf->enable_beacon)
>> - rtl8xxxu_start_tx_beacon(priv);
>> - else
>> - rtl8xxxu_stop_tx_beacon(priv);
>> + /* beacon only supported for port_num = 0 */
>> + if (rtlvif->port_num == 0) {
>
> As your design, AP mode must play on port 0. Could mac80211 notify driver BEACON
> changed on port 1?
Looking at mac80211 code, there is an explicit check for vif.type when changed
contains BSS_CHANGED_BEACON or BSS_CHANGED_BEACON_ENABLED. As rtl8xxxu driver
only allows to add NL80211_IFTYPE_AP on port_num = 0, a notification on port 1
will never happen. I will remove this check for v2.
>
>> + if (changed & BSS_CHANGED_BEACON_ENABLED) {
>> + if (bss_conf->enable_beacon)
>> + rtl8xxxu_start_tx_beacon(priv);
>> + else
>> + rtl8xxxu_stop_tx_beacon(priv);
>> + }
>> + if (changed & BSS_CHANGED_BEACON)
>> + schedule_work(&priv->update_beacon_work);
>> }
>>
>> - if (changed & BSS_CHANGED_BEACON)
>> - schedule_work(&priv->update_beacon_work);
>> -
>> error:
>> return;
>> }
>
> Ping-Ke
>