Commit f0e741e4 authored by Po-Hao Huang's avatar Po-Hao Huang Committed by Kalle Valo

wifi: rtw88: add bitmap for dynamic port settings

In order to support multiple interfaces, multiple port settings will
be required. Current code always uses port 0 and should be changed.
Declare a bitmap with size equal to hardware port number to record
the current usage.
Signed-off-by: default avatarPo-Hao Huang <phhuang@realtek.com>
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230414121135.17828-2-pkshih@realtek.com
parent eaddda24
...@@ -155,25 +155,30 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw, ...@@ -155,25 +155,30 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw,
struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv; struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv;
enum rtw_net_type net_type; enum rtw_net_type net_type;
u32 config = 0; u32 config = 0;
u8 port = 0; u8 port;
u8 bcn_ctrl = 0; u8 bcn_ctrl = 0;
if (rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_BCN_FILTER)) if (rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_BCN_FILTER))
vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER | vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER |
IEEE80211_VIF_SUPPORTS_CQM_RSSI; IEEE80211_VIF_SUPPORTS_CQM_RSSI;
rtwvif->port = port;
rtwvif->stats.tx_unicast = 0; rtwvif->stats.tx_unicast = 0;
rtwvif->stats.rx_unicast = 0; rtwvif->stats.rx_unicast = 0;
rtwvif->stats.tx_cnt = 0; rtwvif->stats.tx_cnt = 0;
rtwvif->stats.rx_cnt = 0; rtwvif->stats.rx_cnt = 0;
rtwvif->scan_req = NULL; rtwvif->scan_req = NULL;
memset(&rtwvif->bfee, 0, sizeof(struct rtw_bfee)); memset(&rtwvif->bfee, 0, sizeof(struct rtw_bfee));
rtwvif->conf = &rtw_vif_port[port];
rtw_txq_init(rtwdev, vif->txq); rtw_txq_init(rtwdev, vif->txq);
INIT_LIST_HEAD(&rtwvif->rsvd_page_list); INIT_LIST_HEAD(&rtwvif->rsvd_page_list);
mutex_lock(&rtwdev->mutex); mutex_lock(&rtwdev->mutex);
port = find_first_zero_bit(rtwdev->hw_port, RTW_PORT_NUM);
if (port >= RTW_PORT_NUM)
return -EINVAL;
set_bit(port, rtwdev->hw_port);
rtwvif->port = port;
rtwvif->conf = &rtw_vif_port[port];
rtw_leave_lps_deep(rtwdev); rtw_leave_lps_deep(rtwdev);
switch (vif->type) { switch (vif->type) {
...@@ -195,6 +200,7 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw, ...@@ -195,6 +200,7 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw,
break; break;
default: default:
WARN_ON(1); WARN_ON(1);
clear_bit(rtwvif->port, rtwdev->hw_port);
mutex_unlock(&rtwdev->mutex); mutex_unlock(&rtwdev->mutex);
return -EINVAL; return -EINVAL;
} }
...@@ -236,6 +242,7 @@ static void rtw_ops_remove_interface(struct ieee80211_hw *hw, ...@@ -236,6 +242,7 @@ static void rtw_ops_remove_interface(struct ieee80211_hw *hw,
rtwvif->bcn_ctrl = 0; rtwvif->bcn_ctrl = 0;
config |= PORT_SET_BCN_CTRL; config |= PORT_SET_BCN_CTRL;
rtw_vif_port_config(rtwdev, rtwvif, config); rtw_vif_port_config(rtwdev, rtwvif, config);
clear_bit(rtwvif->port, rtwdev->hw_port);
mutex_unlock(&rtwdev->mutex); mutex_unlock(&rtwdev->mutex);
} }
......
...@@ -610,6 +610,7 @@ static void __fw_recovery_work(struct rtw_dev *rtwdev) ...@@ -610,6 +610,7 @@ static void __fw_recovery_work(struct rtw_dev *rtwdev)
rcu_read_unlock(); rcu_read_unlock();
rtw_iterate_stas_atomic(rtwdev, rtw_reset_sta_iter, rtwdev); rtw_iterate_stas_atomic(rtwdev, rtw_reset_sta_iter, rtwdev);
rtw_iterate_vifs_atomic(rtwdev, rtw_reset_vif_iter, rtwdev); rtw_iterate_vifs_atomic(rtwdev, rtw_reset_vif_iter, rtwdev);
bitmap_zero(rtwdev->hw_port, RTW_PORT_NUM);
rtw_enter_ips(rtwdev); rtw_enter_ips(rtwdev);
} }
......
...@@ -395,6 +395,15 @@ enum rtw_snr { ...@@ -395,6 +395,15 @@ enum rtw_snr {
RTW_SNR_NUM RTW_SNR_NUM
}; };
enum rtw_port {
RTW_PORT_0 = 0,
RTW_PORT_1 = 1,
RTW_PORT_2 = 2,
RTW_PORT_3 = 3,
RTW_PORT_4 = 4,
RTW_PORT_NUM
};
enum rtw_wow_flags { enum rtw_wow_flags {
RTW_WOW_FLAG_EN_MAGIC_PKT, RTW_WOW_FLAG_EN_MAGIC_PKT,
RTW_WOW_FLAG_EN_REKEY_PKT, RTW_WOW_FLAG_EN_REKEY_PKT,
...@@ -2036,6 +2045,7 @@ struct rtw_dev { ...@@ -2036,6 +2045,7 @@ struct rtw_dev {
u8 sta_cnt; u8 sta_cnt;
u32 rts_threshold; u32 rts_threshold;
DECLARE_BITMAP(hw_port, RTW_PORT_NUM);
DECLARE_BITMAP(mac_id_map, RTW_MAX_MAC_ID_NUM); DECLARE_BITMAP(mac_id_map, RTW_MAX_MAC_ID_NUM);
DECLARE_BITMAP(flags, NUM_OF_RTW_FLAGS); DECLARE_BITMAP(flags, NUM_OF_RTW_FLAGS);
......
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