mirror of
https://github.com/torvalds/linux.git
synced 2024-12-12 14:12:51 +00:00
mt76: move mt76x02_bss_info_changed in mt76x02-lib module
Unify drv_bss_info_changed mac80211 callback and remove duplicated code in mt76x0 and mt76x2 drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
317ed42b70
commit
cc726268e4
@ -71,52 +71,3 @@ int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x0_config);
|
||||
|
||||
void mt76x0_bss_info_changed(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_bss_conf *info, u32 changed)
|
||||
{
|
||||
struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
|
||||
struct mt76x02_dev *dev = hw->priv;
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
|
||||
if (changed & BSS_CHANGED_BSSID)
|
||||
mt76x02_mac_set_bssid(dev, mvif->idx, info->bssid);
|
||||
|
||||
if (changed & BSS_CHANGED_BEACON_ENABLED) {
|
||||
tasklet_disable(&dev->pre_tbtt_tasklet);
|
||||
mt76x02_mac_set_beacon_enable(dev, mvif->idx,
|
||||
info->enable_beacon);
|
||||
tasklet_enable(&dev->pre_tbtt_tasklet);
|
||||
}
|
||||
|
||||
if (changed & BSS_CHANGED_BASIC_RATES) {
|
||||
mt76_wr(dev, MT_LEGACY_BASIC_RATE, info->basic_rates);
|
||||
mt76_wr(dev, MT_VHT_HT_FBK_CFG0, 0x65432100);
|
||||
mt76_wr(dev, MT_VHT_HT_FBK_CFG1, 0xedcba980);
|
||||
mt76_wr(dev, MT_LG_FBK_CFG0, 0xedcba988);
|
||||
mt76_wr(dev, MT_LG_FBK_CFG1, 0x00002100);
|
||||
}
|
||||
|
||||
if (changed & BSS_CHANGED_BEACON_INT) {
|
||||
mt76_rmw_field(dev, MT_BEACON_TIME_CFG,
|
||||
MT_BEACON_TIME_CFG_INTVAL,
|
||||
info->beacon_int << 4);
|
||||
dev->beacon_int = info->beacon_int;
|
||||
dev->tbtt_count = 0;
|
||||
}
|
||||
|
||||
if (changed & BSS_CHANGED_ERP_PREAMBLE)
|
||||
mt76x02_mac_set_short_preamble(dev, info->use_short_preamble);
|
||||
|
||||
if (changed & BSS_CHANGED_ERP_SLOT) {
|
||||
int slottime = info->use_short_slot ? 9 : 20;
|
||||
|
||||
dev->slottime = slottime;
|
||||
mt76x02_set_tx_ackto(dev);
|
||||
}
|
||||
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x0_bss_info_changed);
|
||||
|
@ -62,9 +62,6 @@ int mt76x0_mac_start(struct mt76x02_dev *dev);
|
||||
void mt76x0_mac_stop(struct mt76x02_dev *dev);
|
||||
|
||||
int mt76x0_config(struct ieee80211_hw *hw, u32 changed);
|
||||
void mt76x0_bss_info_changed(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_bss_conf *info, u32 changed);
|
||||
|
||||
/* PHY */
|
||||
void mt76x0_phy_init(struct mt76x02_dev *dev);
|
||||
|
@ -89,7 +89,7 @@ static const struct ieee80211_ops mt76x0e_ops = {
|
||||
.remove_interface = mt76x02_remove_interface,
|
||||
.config = mt76x0_config,
|
||||
.configure_filter = mt76x02_configure_filter,
|
||||
.bss_info_changed = mt76x0_bss_info_changed,
|
||||
.bss_info_changed = mt76x02_bss_info_changed,
|
||||
.sta_add = mt76x02_sta_add,
|
||||
.sta_remove = mt76x02_sta_remove,
|
||||
.set_key = mt76x02_set_key,
|
||||
|
@ -145,7 +145,7 @@ static const struct ieee80211_ops mt76x0u_ops = {
|
||||
.remove_interface = mt76x02_remove_interface,
|
||||
.config = mt76x0_config,
|
||||
.configure_filter = mt76x02_configure_filter,
|
||||
.bss_info_changed = mt76x0_bss_info_changed,
|
||||
.bss_info_changed = mt76x02_bss_info_changed,
|
||||
.sta_add = mt76x02_sta_add,
|
||||
.sta_remove = mt76x02_sta_remove,
|
||||
.set_key = mt76x02_set_key,
|
||||
|
@ -158,6 +158,9 @@ void mt76x02_sw_scan_complete(struct ieee80211_hw *hw,
|
||||
int mt76x02_get_txpower(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif, int *dbm);
|
||||
void mt76x02_sta_ps(struct mt76_dev *dev, struct ieee80211_sta *sta, bool ps);
|
||||
void mt76x02_bss_info_changed(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_bss_conf *info, u32 changed);
|
||||
|
||||
extern const u16 mt76x02_beacon_offsets[16];
|
||||
void mt76x02_init_beacon_config(struct mt76x02_dev *dev);
|
||||
|
@ -647,4 +647,46 @@ void mt76x02_init_beacon_config(struct mt76x02_dev *dev)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x02_init_beacon_config);
|
||||
|
||||
void mt76x02_bss_info_changed(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_bss_conf *info,
|
||||
u32 changed)
|
||||
{
|
||||
struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
|
||||
struct mt76x02_dev *dev = hw->priv;
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
|
||||
if (changed & BSS_CHANGED_BSSID)
|
||||
mt76x02_mac_set_bssid(dev, mvif->idx, info->bssid);
|
||||
|
||||
if (changed & BSS_CHANGED_BEACON_ENABLED) {
|
||||
tasklet_disable(&dev->pre_tbtt_tasklet);
|
||||
mt76x02_mac_set_beacon_enable(dev, mvif->idx,
|
||||
info->enable_beacon);
|
||||
tasklet_enable(&dev->pre_tbtt_tasklet);
|
||||
}
|
||||
|
||||
if (changed & BSS_CHANGED_BEACON_INT) {
|
||||
mt76_rmw_field(dev, MT_BEACON_TIME_CFG,
|
||||
MT_BEACON_TIME_CFG_INTVAL,
|
||||
info->beacon_int << 4);
|
||||
dev->beacon_int = info->beacon_int;
|
||||
dev->tbtt_count = 0;
|
||||
}
|
||||
|
||||
if (changed & BSS_CHANGED_ERP_PREAMBLE)
|
||||
mt76x02_mac_set_short_preamble(dev, info->use_short_preamble);
|
||||
|
||||
if (changed & BSS_CHANGED_ERP_SLOT) {
|
||||
int slottime = info->use_short_slot ? 9 : 20;
|
||||
|
||||
dev->slottime = slottime;
|
||||
mt76x02_set_tx_ackto(dev);
|
||||
}
|
||||
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x02_bss_info_changed);
|
||||
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
|
@ -127,43 +127,6 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
mt76x2_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
struct ieee80211_bss_conf *info, u32 changed)
|
||||
{
|
||||
struct mt76x02_dev *dev = hw->priv;
|
||||
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
|
||||
if (changed & BSS_CHANGED_BSSID)
|
||||
mt76x02_mac_set_bssid(dev, mvif->idx, info->bssid);
|
||||
|
||||
if (changed & BSS_CHANGED_BEACON_INT) {
|
||||
mt76_rmw_field(dev, MT_BEACON_TIME_CFG,
|
||||
MT_BEACON_TIME_CFG_INTVAL,
|
||||
info->beacon_int << 4);
|
||||
dev->beacon_int = info->beacon_int;
|
||||
dev->tbtt_count = 0;
|
||||
}
|
||||
|
||||
if (changed & BSS_CHANGED_BEACON_ENABLED) {
|
||||
tasklet_disable(&dev->pre_tbtt_tasklet);
|
||||
mt76x02_mac_set_beacon_enable(dev, mvif->idx,
|
||||
info->enable_beacon);
|
||||
tasklet_enable(&dev->pre_tbtt_tasklet);
|
||||
}
|
||||
|
||||
if (changed & BSS_CHANGED_ERP_SLOT) {
|
||||
int slottime = info->use_short_slot ? 9 : 20;
|
||||
|
||||
dev->slottime = slottime;
|
||||
mt76x02_set_tx_ackto(dev);
|
||||
}
|
||||
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
mt76x2_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
u32 queues, bool drop)
|
||||
@ -218,7 +181,7 @@ const struct ieee80211_ops mt76x2_ops = {
|
||||
.remove_interface = mt76x02_remove_interface,
|
||||
.config = mt76x2_config,
|
||||
.configure_filter = mt76x02_configure_filter,
|
||||
.bss_info_changed = mt76x2_bss_info_changed,
|
||||
.bss_info_changed = mt76x02_bss_info_changed,
|
||||
.sta_add = mt76x02_sta_add,
|
||||
.sta_remove = mt76x02_sta_remove,
|
||||
.set_key = mt76x02_set_key,
|
||||
|
Loading…
Reference in New Issue
Block a user