Commit 6fabdc4a authored by Chin-Yen Lee's avatar Chin-Yen Lee Committed by Kalle Valo

rtw88: add beacon function setting

Add beacon function setting routines for each hardware port.
If beacon function is not enabled, the hardware is not able
to synchronize with AP's beacon and can miss the beacons
under some scenarios such as PS mode.

For AP and Adhoc modes that require to send beacons, do not
update the TSF, otherwise the beacon interval may be affected.
Signed-off-by: default avatarChin-Yen Lee <timlee@realtek.com>
Signed-off-by: default avatarYan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 44cc4c63
...@@ -85,30 +85,35 @@ static const struct rtw_vif_port rtw_vif_port[] = { ...@@ -85,30 +85,35 @@ static const struct rtw_vif_port rtw_vif_port[] = {
.bssid = {.addr = 0x0618}, .bssid = {.addr = 0x0618},
.net_type = {.addr = 0x0100, .mask = 0x30000}, .net_type = {.addr = 0x0100, .mask = 0x30000},
.aid = {.addr = 0x06a8, .mask = 0x7ff}, .aid = {.addr = 0x06a8, .mask = 0x7ff},
.bcn_ctrl = {.addr = 0x0550, .mask = 0xff},
}, },
[1] = { [1] = {
.mac_addr = {.addr = 0x0700}, .mac_addr = {.addr = 0x0700},
.bssid = {.addr = 0x0708}, .bssid = {.addr = 0x0708},
.net_type = {.addr = 0x0100, .mask = 0xc0000}, .net_type = {.addr = 0x0100, .mask = 0xc0000},
.aid = {.addr = 0x0710, .mask = 0x7ff}, .aid = {.addr = 0x0710, .mask = 0x7ff},
.bcn_ctrl = {.addr = 0x0551, .mask = 0xff},
}, },
[2] = { [2] = {
.mac_addr = {.addr = 0x1620}, .mac_addr = {.addr = 0x1620},
.bssid = {.addr = 0x1628}, .bssid = {.addr = 0x1628},
.net_type = {.addr = 0x1100, .mask = 0x3}, .net_type = {.addr = 0x1100, .mask = 0x3},
.aid = {.addr = 0x1600, .mask = 0x7ff}, .aid = {.addr = 0x1600, .mask = 0x7ff},
.bcn_ctrl = {.addr = 0x0578, .mask = 0xff},
}, },
[3] = { [3] = {
.mac_addr = {.addr = 0x1630}, .mac_addr = {.addr = 0x1630},
.bssid = {.addr = 0x1638}, .bssid = {.addr = 0x1638},
.net_type = {.addr = 0x1100, .mask = 0xc}, .net_type = {.addr = 0x1100, .mask = 0xc},
.aid = {.addr = 0x1604, .mask = 0x7ff}, .aid = {.addr = 0x1604, .mask = 0x7ff},
.bcn_ctrl = {.addr = 0x0579, .mask = 0xff},
}, },
[4] = { [4] = {
.mac_addr = {.addr = 0x1640}, .mac_addr = {.addr = 0x1640},
.bssid = {.addr = 0x1648}, .bssid = {.addr = 0x1648},
.net_type = {.addr = 0x1100, .mask = 0x30}, .net_type = {.addr = 0x1100, .mask = 0x30},
.aid = {.addr = 0x1608, .mask = 0x7ff}, .aid = {.addr = 0x1608, .mask = 0x7ff},
.bcn_ctrl = {.addr = 0x057a, .mask = 0xff},
}, },
}; };
...@@ -120,6 +125,7 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw, ...@@ -120,6 +125,7 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw,
enum rtw_net_type net_type; enum rtw_net_type net_type;
u32 config = 0; u32 config = 0;
u8 port = 0; u8 port = 0;
u8 bcn_ctrl = 0;
rtwvif->port = port; rtwvif->port = port;
rtwvif->vif = vif; rtwvif->vif = vif;
...@@ -136,13 +142,16 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw, ...@@ -136,13 +142,16 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw,
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_MESH_POINT: case NL80211_IFTYPE_MESH_POINT:
net_type = RTW_NET_AP_MODE; net_type = RTW_NET_AP_MODE;
bcn_ctrl = BIT_EN_BCN_FUNCTION | BIT_DIS_TSF_UDT;
break; break;
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
net_type = RTW_NET_AD_HOC; net_type = RTW_NET_AD_HOC;
bcn_ctrl = BIT_EN_BCN_FUNCTION | BIT_DIS_TSF_UDT;
break; break;
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
default: default:
net_type = RTW_NET_NO_LINK; net_type = RTW_NET_NO_LINK;
bcn_ctrl = BIT_EN_BCN_FUNCTION;
break; break;
} }
...@@ -150,6 +159,8 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw, ...@@ -150,6 +159,8 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw,
config |= PORT_SET_MAC_ADDR; config |= PORT_SET_MAC_ADDR;
rtwvif->net_type = net_type; rtwvif->net_type = net_type;
config |= PORT_SET_NET_TYPE; config |= PORT_SET_NET_TYPE;
rtwvif->bcn_ctrl = bcn_ctrl;
config |= PORT_SET_BCN_CTRL;
rtw_vif_port_config(rtwdev, rtwvif, config); rtw_vif_port_config(rtwdev, rtwvif, config);
mutex_unlock(&rtwdev->mutex); mutex_unlock(&rtwdev->mutex);
...@@ -173,6 +184,8 @@ static void rtw_ops_remove_interface(struct ieee80211_hw *hw, ...@@ -173,6 +184,8 @@ static void rtw_ops_remove_interface(struct ieee80211_hw *hw,
config |= PORT_SET_MAC_ADDR; config |= PORT_SET_MAC_ADDR;
rtwvif->net_type = RTW_NET_NO_LINK; rtwvif->net_type = RTW_NET_NO_LINK;
config |= PORT_SET_NET_TYPE; config |= PORT_SET_NET_TYPE;
rtwvif->bcn_ctrl = 0;
config |= PORT_SET_BCN_CTRL;
rtw_vif_port_config(rtwdev, rtwvif, config); rtw_vif_port_config(rtwdev, rtwvif, config);
mutex_unlock(&rtwdev->mutex); mutex_unlock(&rtwdev->mutex);
......
...@@ -308,6 +308,11 @@ void rtw_vif_port_config(struct rtw_dev *rtwdev, ...@@ -308,6 +308,11 @@ void rtw_vif_port_config(struct rtw_dev *rtwdev,
mask = rtwvif->conf->aid.mask; mask = rtwvif->conf->aid.mask;
rtw_write32_mask(rtwdev, addr, mask, rtwvif->aid); rtw_write32_mask(rtwdev, addr, mask, rtwvif->aid);
} }
if (config & PORT_SET_BCN_CTRL) {
addr = rtwvif->conf->bcn_ctrl.addr;
mask = rtwvif->conf->bcn_ctrl.mask;
rtw_write8_mask(rtwdev, addr, mask, rtwvif->bcn_ctrl);
}
} }
static u8 hw_bw_cap_to_bitamp(u8 bw_cap) static u8 hw_bw_cap_to_bitamp(u8 bw_cap)
......
...@@ -431,6 +431,7 @@ enum rtw_vif_port_set { ...@@ -431,6 +431,7 @@ enum rtw_vif_port_set {
PORT_SET_BSSID = BIT(1), PORT_SET_BSSID = BIT(1),
PORT_SET_NET_TYPE = BIT(2), PORT_SET_NET_TYPE = BIT(2),
PORT_SET_AID = BIT(3), PORT_SET_AID = BIT(3),
PORT_SET_BCN_CTRL = BIT(4),
}; };
struct rtw_vif_port { struct rtw_vif_port {
...@@ -438,6 +439,7 @@ struct rtw_vif_port { ...@@ -438,6 +439,7 @@ struct rtw_vif_port {
struct rtw_hw_reg bssid; struct rtw_hw_reg bssid;
struct rtw_hw_reg net_type; struct rtw_hw_reg net_type;
struct rtw_hw_reg aid; struct rtw_hw_reg aid;
struct rtw_hw_reg bcn_ctrl;
}; };
struct rtw_tx_pkt_info { struct rtw_tx_pkt_info {
...@@ -591,6 +593,7 @@ struct rtw_vif { ...@@ -591,6 +593,7 @@ struct rtw_vif {
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
u8 port; u8 port;
u8 bcn_ctrl;
const struct rtw_vif_port *conf; const struct rtw_vif_port *conf;
struct rtw_traffic_stats stats; struct rtw_traffic_stats stats;
......
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