Skip to content

Commit 90c8021

Browse files
committed
Merge tag 'mt76-next-2025-03-19' of https://github.com/nbd168/wireless
Felix Fietkau says: ==================== mt76 patches for 6.15 - preparation for mt7996 mlo support - fixes ==================== Signed-off-by: Johannes Berg <[email protected]>
2 parents 3fd552b + 06cccc2 commit 90c8021

32 files changed

+2051
-939
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ struct mt76_vif_link *mt76_get_vif_phy_link(struct mt76_phy *phy,
293293
kfree(mlink);
294294
return ERR_PTR(ret);
295295
}
296+
rcu_assign_pointer(mvif->offchannel_link, mlink);
296297

297298
return mlink;
298299
}
@@ -301,10 +302,12 @@ void mt76_put_vif_phy_link(struct mt76_phy *phy, struct ieee80211_vif *vif,
301302
struct mt76_vif_link *mlink)
302303
{
303304
struct mt76_dev *dev = phy->dev;
305+
struct mt76_vif_data *mvif = mlink->mvif;
304306

305307
if (IS_ERR_OR_NULL(mlink) || !mlink->offchannel)
306308
return;
307309

310+
rcu_assign_pointer(mvif->offchannel_link, NULL);
308311
dev->drv->vif_link_remove(phy, vif, &vif->bss_conf, mlink);
309312
kfree(mlink);
310313
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int l
9595

9696
#ifdef CONFIG_NL80211_TESTMODE
9797
dev->test_mtd.name = devm_kstrdup(dev->dev, part, GFP_KERNEL);
98+
if (!dev->test_mtd.name) {
99+
ret = -ENOMEM;
100+
goto out_put_node;
101+
}
98102
dev->test_mtd.offset = offset;
99103
#endif
100104

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,8 @@ void mt76_free_device(struct mt76_dev *dev)
816816
}
817817
EXPORT_SYMBOL_GPL(mt76_free_device);
818818

819-
static struct mt76_phy *
820-
mt76_vif_phy(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
819+
struct mt76_phy *mt76_vif_phy(struct ieee80211_hw *hw,
820+
struct ieee80211_vif *vif)
821821
{
822822
struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv;
823823
struct mt76_chanctx *ctx;
@@ -831,6 +831,7 @@ mt76_vif_phy(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
831831
ctx = (struct mt76_chanctx *)mlink->ctx->drv_priv;
832832
return ctx->phy;
833833
}
834+
EXPORT_SYMBOL_GPL(mt76_vif_phy);
834835

835836
static void mt76_rx_release_amsdu(struct mt76_phy *phy, enum mt76_rxq_id q)
836837
{
@@ -1697,6 +1698,17 @@ void mt76_wcid_add_poll(struct mt76_dev *dev, struct mt76_wcid *wcid)
16971698
}
16981699
EXPORT_SYMBOL_GPL(mt76_wcid_add_poll);
16991700

1701+
s8 mt76_get_power_bound(struct mt76_phy *phy, s8 txpower)
1702+
{
1703+
int n_chains = hweight16(phy->chainmask);
1704+
1705+
txpower = mt76_get_sar_power(phy, phy->chandef.chan, txpower * 2);
1706+
txpower -= mt76_tx_power_nss_delta(n_chains);
1707+
1708+
return txpower;
1709+
}
1710+
EXPORT_SYMBOL_GPL(mt76_get_power_bound);
1711+
17001712
int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
17011713
unsigned int link_id, int *dbm)
17021714
{

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ struct mt76_wcid {
351351
u8 hw_key_idx;
352352
u8 hw_key_idx2;
353353

354+
u8 offchannel:1;
354355
u8 sta:1;
355356
u8 sta_disabled:1;
356357
u8 amsdu:1;
@@ -491,6 +492,7 @@ struct mt76_hw_cap {
491492
#define MT_DRV_RX_DMA_HDR BIT(3)
492493
#define MT_DRV_HW_MGMT_TXQ BIT(4)
493494
#define MT_DRV_AMSDU_OFFLOAD BIT(5)
495+
#define MT_DRV_IGNORE_TXS_FAILED BIT(6)
494496

495497
struct mt76_driver_ops {
496498
u32 drv_flags;
@@ -769,6 +771,7 @@ struct mt76_testmode_data {
769771

770772
struct mt76_vif_link {
771773
u8 idx;
774+
u8 link_idx;
772775
u8 omac_idx;
773776
u8 band_idx;
774777
u8 wmm_idx;
@@ -786,6 +789,7 @@ struct mt76_vif_link {
786789

787790
struct mt76_vif_data {
788791
struct mt76_vif_link __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
792+
struct mt76_vif_link __rcu *offchannel_link;
789793

790794
struct mt76_phy *roc_phy;
791795
u16 valid_links;
@@ -1224,6 +1228,8 @@ struct mt76_phy *mt76_alloc_phy(struct mt76_dev *dev, unsigned int size,
12241228
u8 band_idx);
12251229
int mt76_register_phy(struct mt76_phy *phy, bool vht,
12261230
struct ieee80211_rate *rates, int n_rates);
1231+
struct mt76_phy *mt76_vif_phy(struct ieee80211_hw *hw,
1232+
struct ieee80211_vif *vif);
12271233

12281234
struct dentry *mt76_register_debugfs_fops(struct mt76_phy *phy,
12291235
const struct file_operations *ops);
@@ -1482,6 +1488,8 @@ void mt76_sta_pre_rcu_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
14821488

14831489
int mt76_get_min_avg_rssi(struct mt76_dev *dev, u8 phy_idx);
14841490

1491+
s8 mt76_get_power_bound(struct mt76_phy *phy, s8 txpower);
1492+
14851493
int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
14861494
unsigned int link_id, int *dbm);
14871495
int mt76_init_sar_power(struct ieee80211_hw *hw,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ enum tx_frag_idx {
314314
#define MT_TXFREE_INFO_COUNT GENMASK(27, 24)
315315
#define MT_TXFREE_INFO_STAT GENMASK(29, 28)
316316

317+
#define MT_TXS_HDR_SIZE 4 /* Unit: DW */
318+
#define MT_TXS_SIZE 12 /* Unit: DW */
319+
317320
#define MT_TXS0_BW GENMASK(31, 29)
318321
#define MT_TXS0_TID GENMASK(28, 26)
319322
#define MT_TXS0_AMPDU BIT(25)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
391391
basic->conn_type = cpu_to_le32(CONNECTION_INFRA_BC);
392392

393393
if (vif->type == NL80211_IFTYPE_STATION &&
394-
!is_zero_ether_addr(link_conf->bssid)) {
394+
link_conf && !is_zero_ether_addr(link_conf->bssid)) {
395395
memcpy(basic->peer_addr, link_conf->bssid, ETH_ALEN);
396396
basic->aid = cpu_to_le16(vif->cfg.aid);
397397
} else {
@@ -1168,7 +1168,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
11681168
.tag = cpu_to_le16(DEV_INFO_ACTIVE),
11691169
.len = cpu_to_le16(sizeof(struct req_tlv)),
11701170
.active = enable,
1171-
.link_idx = mvif->idx,
1171+
.link_idx = mvif->link_idx,
11721172
},
11731173
};
11741174
struct {
@@ -1191,7 +1191,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
11911191
.bmc_tx_wlan_idx = cpu_to_le16(wcid->idx),
11921192
.sta_idx = cpu_to_le16(wcid->idx),
11931193
.conn_state = 1,
1194-
.link_idx = mvif->idx,
1194+
.link_idx = mvif->link_idx,
11951195
},
11961196
};
11971197
int err, idx, cmd, len;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
156156
static const struct mt76_driver_ops drv_ops = {
157157
.txwi_size = sizeof(struct mt76x02_txwi),
158158
.drv_flags = MT_DRV_TX_ALIGNED4_SKBS |
159-
MT_DRV_SW_RX_AIRTIME,
159+
MT_DRV_SW_RX_AIRTIME |
160+
MT_DRV_IGNORE_TXS_FAILED,
160161
.survey_flags = SURVEY_INFO_TIME_TX,
161162
.update_survey = mt76x02_update_channel,
162163
.set_channel = mt76x0_set_channel,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
214214
const struct usb_device_id *id)
215215
{
216216
static const struct mt76_driver_ops drv_ops = {
217-
.drv_flags = MT_DRV_SW_RX_AIRTIME,
217+
.drv_flags = MT_DRV_SW_RX_AIRTIME |
218+
MT_DRV_IGNORE_TXS_FAILED,
218219
.survey_flags = SURVEY_INFO_TIME_TX,
219220
.update_survey = mt76x02_update_channel,
220221
.set_channel = mt76x0_set_channel,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ mt76x2e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2222
static const struct mt76_driver_ops drv_ops = {
2323
.txwi_size = sizeof(struct mt76x02_txwi),
2424
.drv_flags = MT_DRV_TX_ALIGNED4_SKBS |
25-
MT_DRV_SW_RX_AIRTIME,
25+
MT_DRV_SW_RX_AIRTIME |
26+
MT_DRV_IGNORE_TXS_FAILED,
2627
.survey_flags = SURVEY_INFO_TIME_TX,
2728
.update_survey = mt76x02_update_channel,
2829
.set_channel = mt76x2e_set_channel,

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ static const struct usb_device_id mt76x2u_device_table[] = {
2222
{ USB_DEVICE(0x0846, 0x9053) }, /* Netgear A6210 */
2323
{ USB_DEVICE(0x045e, 0x02e6) }, /* XBox One Wireless Adapter */
2424
{ USB_DEVICE(0x045e, 0x02fe) }, /* XBox One Wireless Adapter */
25+
{ USB_DEVICE(0x2357, 0x0137) }, /* TP-Link TL-WDN6200 */
2526
{ },
2627
};
2728

2829
static int mt76x2u_probe(struct usb_interface *intf,
2930
const struct usb_device_id *id)
3031
{
3132
static const struct mt76_driver_ops drv_ops = {
32-
.drv_flags = MT_DRV_SW_RX_AIRTIME,
33+
.drv_flags = MT_DRV_SW_RX_AIRTIME |
34+
MT_DRV_IGNORE_TXS_FAILED,
3335
.survey_flags = SURVEY_INFO_TIME_TX,
3436
.update_survey = mt76x02_update_channel,
3537
.set_channel = mt76x2u_set_channel,

0 commit comments

Comments
 (0)