From patchwork Sat Feb 1 15:33:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryder Lee X-Patchwork-Id: 11361171 X-Patchwork-Delegate: nbd@nbd.name Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F15D6138D for ; Sat, 1 Feb 2020 15:34:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D06D12070C for ; Sat, 1 Feb 2020 15:34:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="bx3kHoia" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbgBAPeI (ORCPT ); Sat, 1 Feb 2020 10:34:08 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:51861 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727014AbgBAPeI (ORCPT ); Sat, 1 Feb 2020 10:34:08 -0500 X-UUID: 4c6c4c040a154b28a6c4a7c028e620cd-20200201 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=x0RcsqRquhcXQty96nPHhZqu/2xMH1iLFFxG59uudt4=; b=bx3kHoia+tNZhtk6b0JAPZUNNKgaWpapd8mrDAdkdHcKF0yJvjNQQ+1Lhj4rmPYum2Apu+NHEc3FRaHUBdTrVNP9iSb32rmZBQJLerIubRKwSWRWHfpBJCfVvoB9Ltzh2Oc83rTI2yUPSPcZpz0ECsyurgGKS5IjXKp8k55pOMo=; X-UUID: 4c6c4c040a154b28a6c4a7c028e620cd-20200201 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 798518575; Sat, 01 Feb 2020 23:34:02 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 1 Feb 2020 23:34:13 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sat, 1 Feb 2020 23:31:35 +0800 From: Ryder Lee To: Felix Fietkau , Lorenzo Bianconi CC: Shayne Chen , Roy Luo , Sean Wang , Josh Boyer , , , Ryder Lee Subject: [PATCH v2 6/7] mt76: mt7615: switch mt7615_mcu_set_tx_ba to v2 format Date: Sat, 1 Feb 2020 23:33:51 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 In-Reply-To: References: MIME-Version: 1.0 X-MTK: N Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org To adapt new firmware version. Signed-off-by: Ryder Lee Tested-by: Shayne Chen --- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 60 ++++++++++--------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 58eac8fe5511..a7c4538e56fc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -1572,28 +1572,11 @@ int mt7615_mcu_set_tx_ba(struct mt7615_dev *dev, { struct mt7615_sta *msta = (struct mt7615_sta *)params->sta->drv_priv; struct mt7615_vif *mvif = msta->vif; - struct { - struct wtbl_req_hdr hdr; - struct wtbl_ba ba; - } wtbl_req = { - .hdr = { - .wlan_idx = msta->wcid.idx, - .operation = WTBL_SET, - .tlv_num = cpu_to_le16(1), - }, - .ba = { - .tag = cpu_to_le16(WTBL_BA), - .len = cpu_to_le16(sizeof(struct wtbl_ba)), - .tid = params->tid, - .ba_type = MT_BA_TYPE_ORIGINATOR, - .sn = add ? cpu_to_le16(params->ssn) : 0, - .ba_en = add, - }, - }; struct { struct sta_req_hdr hdr; struct sta_rec_ba ba; - } sta_req = { + u8 buf[MT7615_WTBL_UPDATE_MAX_SIZE]; + } __packed req = { .hdr = { .bss_idx = mvif->idx, .wlan_idx = msta->wcid.idx, @@ -1612,7 +1595,32 @@ int mt7615_mcu_set_tx_ba(struct mt7615_dev *dev, .winsize = cpu_to_le16(params->buf_size), }, }; - int ret; + struct sta_rec_wtbl *wtbl = NULL; + struct wtbl_req_hdr *wtbl_hdr; + struct wtbl_ba *wtbl_ba; + u8 *buf = req.buf; + + if (dev->fw_ver > MT7615_FIRMWARE_V1) { + req.hdr.tlv_num = cpu_to_le16(2); + wtbl = (struct sta_rec_wtbl *)buf; + wtbl->tag = cpu_to_le16(STA_REC_WTBL); + buf += sizeof(*wtbl); + } + + wtbl_hdr = (struct wtbl_req_hdr *)buf; + buf += sizeof(*wtbl_hdr); + wtbl_hdr->wlan_idx = msta->wcid.idx; + wtbl_hdr->operation = WTBL_SET; + wtbl_hdr->tlv_num = cpu_to_le16(1); + + wtbl_ba = (struct wtbl_ba *)buf; + buf += sizeof(*wtbl_ba); + wtbl_ba->tag = cpu_to_le16(WTBL_BA); + wtbl_ba->len = cpu_to_le16(sizeof(*wtbl_ba)); + wtbl_ba->tid = params->tid; + wtbl_ba->ba_type = MT_BA_TYPE_ORIGINATOR; + wtbl_ba->sn = add ? cpu_to_le16(params->ssn) : 0; + wtbl_ba->ba_en = add; if (add) { u8 idx, ba_range[] = { 4, 8, 12, 24, 36, 48, 54, 64 }; @@ -1622,16 +1630,14 @@ int mt7615_mcu_set_tx_ba(struct mt7615_dev *dev, break; } - wtbl_req.ba.ba_winsize_idx = idx; + wtbl_ba->ba_winsize_idx = idx; } - ret = __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_WTBL_UPDATE, - &wtbl_req, sizeof(wtbl_req), true); - if (ret) - return ret; + if (wtbl) + wtbl->len = cpu_to_le16(buf - (u8 *)wtbl_hdr); - return __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_STA_REC_UPDATE, - &sta_req, sizeof(sta_req), true); + return mt7615_mcu_send_sta_rec(dev, (u8 *)&req, (u8 *)wtbl_hdr, + buf - (u8 *)wtbl_hdr, true); } int mt7615_mcu_set_rx_ba(struct mt7615_dev *dev,