Skip to content

Commit

Permalink
wifi: rtl8xxxu: support setting bssid register for multiple interfaces
Browse files Browse the repository at this point in the history
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: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231222101442.626837-10-martin.kaistra@linutronix.de
  • Loading branch information
Martin Kaistra authored and Kalle Valo committed Jan 10, 2024
1 parent f86dd8e commit 3ff7a05
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3603,14 +3603,24 @@ static int rtl8xxxu_set_mac(struct rtl8xxxu_priv *priv, int port_num)
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;
u16 reg;

dev_dbg(&priv->udev->dev, "%s: (%pM)\n", __func__, bssid);

reg = REG_BSSID;
switch (port_num) {
case 0:
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++)
rtl8xxxu_write8(priv, reg + i, bssid[i]);
Expand Down Expand Up @@ -5068,7 +5078,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);
rtl8xxxu_set_bssid(priv, bss_conf->bssid, 0);
}

if (changed & BSS_CHANGED_BASIC_RATES) {
Expand Down Expand Up @@ -5097,7 +5107,7 @@ static int rtl8xxxu_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct device *dev = &priv->udev->dev;

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);
priv->fops->report_connect(priv, RTL8XXXU_BC_MC_MACID, 0, true);

Expand Down

0 comments on commit 3ff7a05

Please sign in to comment.