Commit 3ff7a059 authored by Martin Kaistra's avatar Martin Kaistra Committed by Kalle Valo

wifi: rtl8xxxu: support setting bssid register for multiple interfaces

To prepare for concurrent mode, enhance rtl8xxxu_set_bssid() to write the
BSSID of the respective interface to REG_BSSID or REG_BSSID1.

Like done with rtl8xxxu_set_mac(), call rtl8xxxu_set_bssid() with
port_num = 0, until the callers also support multiple interfaces.
Signed-off-by: default avatarMartin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231222101442.626837-10-martin.kaistra@linutronix.de
parent f86dd8ea
...@@ -3603,14 +3603,24 @@ static int rtl8xxxu_set_mac(struct rtl8xxxu_priv *priv, int port_num) ...@@ -3603,14 +3603,24 @@ static int rtl8xxxu_set_mac(struct rtl8xxxu_priv *priv, int port_num)
return 0; return 0;
} }
static int rtl8xxxu_set_bssid(struct rtl8xxxu_priv *priv, const u8 *bssid) static int rtl8xxxu_set_bssid(struct rtl8xxxu_priv *priv, const u8 *bssid, int port_num)
{ {
int i; int i;
u16 reg; u16 reg;
dev_dbg(&priv->udev->dev, "%s: (%pM)\n", __func__, bssid); dev_dbg(&priv->udev->dev, "%s: (%pM)\n", __func__, bssid);
switch (port_num) {
case 0:
reg = REG_BSSID; reg = REG_BSSID;
break;
case 1:
reg = REG_BSSID1;
break;
default:
WARN_ONCE("%s: invalid port_num\n", __func__);
return -EINVAL;
}
for (i = 0; i < ETH_ALEN; i++) for (i = 0; i < ETH_ALEN; i++)
rtl8xxxu_write8(priv, reg + i, bssid[i]); rtl8xxxu_write8(priv, reg + i, bssid[i]);
...@@ -5068,7 +5078,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -5068,7 +5078,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (changed & BSS_CHANGED_BSSID) { if (changed & BSS_CHANGED_BSSID) {
dev_dbg(dev, "Changed BSSID!\n"); dev_dbg(dev, "Changed BSSID!\n");
rtl8xxxu_set_bssid(priv, bss_conf->bssid); rtl8xxxu_set_bssid(priv, bss_conf->bssid, 0);
} }
if (changed & BSS_CHANGED_BASIC_RATES) { if (changed & BSS_CHANGED_BASIC_RATES) {
...@@ -5097,7 +5107,7 @@ static int rtl8xxxu_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -5097,7 +5107,7 @@ static int rtl8xxxu_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct device *dev = &priv->udev->dev; struct device *dev = &priv->udev->dev;
dev_dbg(dev, "Start AP mode\n"); dev_dbg(dev, "Start AP mode\n");
rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid); rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid, 0);
rtl8xxxu_write16(priv, REG_BCN_INTERVAL, vif->bss_conf.beacon_int); rtl8xxxu_write16(priv, REG_BCN_INTERVAL, vif->bss_conf.beacon_int);
priv->fops->report_connect(priv, RTL8XXXU_BC_MC_MACID, 0, true); priv->fops->report_connect(priv, RTL8XXXU_BC_MC_MACID, 0, true);
......
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