Skip to content

Commit 38a45be

Browse files
committed
wifi: mt76: remove dev->wcid_phy_mask
Explicitly check wcid->phy_idx instead. Reduces allocated data size. Link: https://patch.msgid.link/[email protected] Signed-off-by: Felix Fietkau <[email protected]>
1 parent 8233462 commit 38a45be

File tree

7 files changed

+7
-16
lines changed

7 files changed

+7
-16
lines changed

drivers/net/wireless/mediatek/mt76/mac80211.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,8 +1505,6 @@ mt76_sta_add(struct mt76_phy *phy, struct ieee80211_vif *vif,
15051505
}
15061506

15071507
ewma_signal_init(&wcid->rssi);
1508-
if (phy->band_idx == MT_BAND1)
1509-
mt76_wcid_mask_set(dev->wcid_phy_mask, wcid->idx);
15101508
rcu_assign_pointer(dev->wcid[wcid->idx], wcid);
15111509
phy->num_sta++;
15121510

@@ -1533,7 +1531,6 @@ void __mt76_sta_remove(struct mt76_phy *phy, struct ieee80211_vif *vif,
15331531
mt76_wcid_cleanup(dev, wcid);
15341532

15351533
mt76_wcid_mask_clear(dev->wcid_mask, idx);
1536-
mt76_wcid_mask_clear(dev->wcid_phy_mask, idx);
15371534
phy->num_sta--;
15381535
}
15391536
EXPORT_SYMBOL_GPL(__mt76_sta_remove);

drivers/net/wireless/mediatek/mt76/mt76.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,6 @@ struct mt76_dev {
909909
spinlock_t status_lock;
910910

911911
u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
912-
u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
913912

914913
u64 vif_mask;
915914

@@ -1474,7 +1473,7 @@ void __mt76_sta_remove(struct mt76_phy *phy, struct ieee80211_vif *vif,
14741473
void mt76_sta_pre_rcu_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
14751474
struct ieee80211_sta *sta);
14761475

1477-
int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy);
1476+
int mt76_get_min_avg_rssi(struct mt76_dev *dev, u8 phy_idx);
14781477

14791478
int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
14801479
unsigned int link_id, int *dbm);

drivers/net/wireless/mediatek/mt76/mt7603/mac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,7 @@ mt7603_false_cca_check(struct mt7603_dev *dev)
17881788

17891789
mt7603_cca_stats_reset(dev);
17901790

1791-
min_signal = mt76_get_min_avg_rssi(&dev->mt76, false);
1791+
min_signal = mt76_get_min_avg_rssi(&dev->mt76, 0);
17921792
if (!min_signal) {
17931793
dev->sensitivity = 0;
17941794
dev->last_cca_adj = jiffies;

drivers/net/wireless/mediatek/mt76/mt76x0/phy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ mt76x0_phy_update_channel_gain(struct mt76x02_dev *dev)
10711071
u8 gain_delta;
10721072
int low_gain;
10731073

1074-
dev->cal.avg_rssi_all = mt76_get_min_avg_rssi(&dev->mt76, false);
1074+
dev->cal.avg_rssi_all = mt76_get_min_avg_rssi(&dev->mt76, 0);
10751075
if (!dev->cal.avg_rssi_all)
10761076
dev->cal.avg_rssi_all = -75;
10771077

drivers/net/wireless/mediatek/mt76/mt76x2/phy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ void mt76x2_phy_update_channel_gain(struct mt76x02_dev *dev)
280280
int low_gain;
281281
u32 val;
282282

283-
dev->cal.avg_rssi_all = mt76_get_min_avg_rssi(&dev->mt76, false);
283+
dev->cal.avg_rssi_all = mt76_get_min_avg_rssi(&dev->mt76, 0);
284284
if (!dev->cal.avg_rssi_all)
285285
dev->cal.avg_rssi_all = -75;
286286

drivers/net/wireless/mediatek/mt76/mt7925/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,6 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
11881188
if (link_sta != mlink->pri_link) {
11891189
mt76_wcid_cleanup(mdev, wcid);
11901190
mt76_wcid_mask_clear(mdev->wcid_mask, wcid->idx);
1191-
mt76_wcid_mask_clear(mdev->wcid_phy_mask, wcid->idx);
11921191
}
11931192

11941193
if (msta->deflink_id == link_id)

drivers/net/wireless/mediatek/mt76/util.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int mt76_wcid_alloc(u32 *mask, int size)
6464
}
6565
EXPORT_SYMBOL_GPL(mt76_wcid_alloc);
6666

67-
int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy)
67+
int mt76_get_min_avg_rssi(struct mt76_dev *dev, u8 phy_idx)
6868
{
6969
struct mt76_wcid *wcid;
7070
int i, j, min_rssi = 0;
@@ -75,20 +75,16 @@ int mt76_get_min_avg_rssi(struct mt76_dev *dev, bool ext_phy)
7575

7676
for (i = 0; i < ARRAY_SIZE(dev->wcid_mask); i++) {
7777
u32 mask = dev->wcid_mask[i];
78-
u32 phy_mask = dev->wcid_phy_mask[i];
7978

8079
if (!mask)
8180
continue;
8281

83-
for (j = i * 32; mask; j++, mask >>= 1, phy_mask >>= 1) {
82+
for (j = i * 32; mask; j++, mask >>= 1) {
8483
if (!(mask & 1))
8584
continue;
8685

87-
if (!!(phy_mask & 1) != ext_phy)
88-
continue;
89-
9086
wcid = rcu_dereference(dev->wcid[j]);
91-
if (!wcid)
87+
if (!wcid || wcid->phy_idx != phy_idx)
9288
continue;
9389

9490
spin_lock(&dev->rx_lock);

0 commit comments

Comments
 (0)