Skip to content

Commit b7e56fa

Browse files
Peter Chiunbd168
authored andcommitted
wifi: mt76: mt7915: fix mcu command format for mt7915 tx stats
The mcu command format are different for mt7915 and mt7986. Fix the mt7915_mcu_wed_wa_tx_stats to support mt7915 and mt7986. Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
1 parent 5d581c3 commit b7e56fa

File tree

1 file changed

+24
-12
lines changed
  • drivers/net/wireless/mediatek/mt76/mt7915

1 file changed

+24
-12
lines changed

drivers/net/wireless/mediatek/mt76/mt7915/mcu.c

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3801,30 +3801,38 @@ int mt7915_mcu_wed_wa_tx_stats(struct mt7915_dev *dev, u16 wlan_idx)
38013801
{
38023802
struct {
38033803
__le32 cmd;
3804-
__le32 num;
3805-
__le32 __rsv;
3806-
__le16 wlan_idx;
3807-
} req = {
3804+
__le32 arg0;
3805+
__le32 arg1;
3806+
__le16 arg2;
3807+
} __packed req = {
38083808
.cmd = cpu_to_le32(0x15),
3809-
.num = cpu_to_le32(1),
3810-
.wlan_idx = cpu_to_le16(wlan_idx),
38113809
};
38123810
struct mt7915_mcu_wa_tx_stat {
3813-
__le16 wlan_idx;
3814-
u8 __rsv[2];
3811+
__le16 wcid;
3812+
u8 __rsv2[2];
38153813

38163814
/* tx_bytes is deprecated since WA byte counter uses u32,
38173815
* which easily leads to overflow.
38183816
*/
38193817
__le32 tx_bytes;
38203818
__le32 tx_packets;
3821-
} *res;
3819+
} __packed *res;
38223820
struct mt76_wcid *wcid;
38233821
struct sk_buff *skb;
3824-
int ret;
3822+
int ret, len;
3823+
u16 ret_wcid;
3824+
3825+
if (is_mt7915(&dev->mt76)) {
3826+
req.arg0 = cpu_to_le32(wlan_idx);
3827+
len = sizeof(req) - sizeof(req.arg2);
3828+
} else {
3829+
req.arg0 = cpu_to_le32(1);
3830+
req.arg2 = cpu_to_le16(wlan_idx);
3831+
len = sizeof(req);
3832+
}
38253833

38263834
ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_WA_PARAM_CMD(QUERY),
3827-
&req, sizeof(req), true, &skb);
3835+
&req, len, true, &skb);
38283836
if (ret)
38293837
return ret;
38303838

@@ -3833,7 +3841,11 @@ int mt7915_mcu_wed_wa_tx_stats(struct mt7915_dev *dev, u16 wlan_idx)
38333841

38343842
res = (struct mt7915_mcu_wa_tx_stat *)skb->data;
38353843

3836-
if (le16_to_cpu(res->wlan_idx) != wlan_idx) {
3844+
ret_wcid = le16_to_cpu(res->wcid);
3845+
if (is_mt7915(&dev->mt76))
3846+
ret_wcid &= 0xff;
3847+
3848+
if (ret_wcid != wlan_idx) {
38373849
ret = -EINVAL;
38383850
goto out;
38393851
}

0 commit comments

Comments
 (0)