From patchwork Tue Jan 21 14:13:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryder Lee X-Patchwork-Id: 11344019 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 24688139A for ; Tue, 21 Jan 2020 14:14:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 038FC22314 for ; Tue, 21 Jan 2020 14:14:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="Zaxw1rvg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729360AbgAUOOB (ORCPT ); Tue, 21 Jan 2020 09:14:01 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:20013 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729308AbgAUON5 (ORCPT ); Tue, 21 Jan 2020 09:13:57 -0500 X-UUID: 8e1906cf188648cd810aa3e3060c7c14-20200121 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=5PijtlWhrJ3vYo3oL0POogoDCVJJn4dKgaURDq8yKg0=; b=Zaxw1rvgtJ9ySipDlDT8Vu1tozDUMPEDuho8bkjFJ9kBpzwzoabyuwx++YJBLt8HyNEn4/gXexwZOwUypUj4zKFnYtlFUfMkP9uVdSNeXLEUzSw81uaD3Cor+nCr4scQj+304CNZ9XWCpWTQIRNusLT7mXiBkcNynXPaFS9JTKc=; X-UUID: 8e1906cf188648cd810aa3e3060c7c14-20200121 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 2007033303; Tue, 21 Jan 2020 22:13:51 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 21 Jan 2020 22:13:50 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 21 Jan 2020 22:13:30 +0800 From: Ryder Lee To: Felix Fietkau , Lorenzo Bianconi CC: Shayne Chen , Roy Luo , Sean Wang , , , Ryder Lee Subject: [PATCH 5/7] mt76: mt7615: add a tag sta_rec_wtbl for v2 firmware Date: Tue, 21 Jan 2020 22:13:40 +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 New firmware use tag sta_rec_wtbl to replace MCU_EXT_CMD_WTBL_UPDATE. This can reduce command/event times. Signed-off-by: Ryder Lee Signed-off-by: Shayne Chen Tested-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 22 +++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7615/mcu.h | 9 +++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index c055949b289c..8f4b8d8159db 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -1039,6 +1039,7 @@ int mt7615_mcu_set_bmc(struct mt7615_dev *dev, .conn_type = cpu_to_le32(CONNECTION_INFRA_BC), }, }; + struct sta_rec_wtbl *wtbl = NULL; struct wtbl_req_hdr *wtbl_hdr; struct wtbl_generic *wtbl_g; struct wtbl_rx *wtbl_rx; @@ -1046,6 +1047,13 @@ int mt7615_mcu_set_bmc(struct mt7615_dev *dev, eth_broadcast_addr(req.basic.peer_addr); + 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 = mvif->sta.wcid.idx; @@ -1079,6 +1087,9 @@ int mt7615_mcu_set_bmc(struct mt7615_dev *dev, wtbl_hdr->tlv_num = cpu_to_le16(2); out: + if (wtbl) + wtbl->len = cpu_to_le16(buf - (u8 *)wtbl_hdr); + return mt7615_mcu_send_sta_rec(dev, (u8 *)&req, (u8 *)wtbl_hdr, buf - (u8 *)wtbl_hdr, en); } @@ -1107,6 +1118,7 @@ int mt7615_mcu_set_sta(struct mt7615_dev *dev, struct ieee80211_vif *vif, .aid = cpu_to_le16(sta->aid), }, }; + struct sta_rec_wtbl *wtbl = NULL; struct wtbl_req_hdr *wtbl_hdr; struct wtbl_generic *wtbl_g; struct wtbl_rx *wtbl_rx; @@ -1170,6 +1182,13 @@ int mt7615_mcu_set_sta(struct mt7615_dev *dev, struct ieee80211_vif *vif, } /* wtbl */ + if (dev->fw_ver > MT7615_FIRMWARE_V1) { + wtbl = (struct sta_rec_wtbl *)buf; + wtbl->tag = cpu_to_le16(STA_REC_WTBL); + buf += sizeof(*wtbl); + stlv++; + } + wtbl_hdr = (struct wtbl_req_hdr *)buf; buf += sizeof(*wtbl_hdr); wtbl_hdr->wlan_idx = msta->wcid.idx; @@ -1265,6 +1284,9 @@ int mt7615_mcu_set_sta(struct mt7615_dev *dev, struct ieee80211_vif *vif, } out: + if (wtbl) + wtbl->len = cpu_to_le16(buf - (u8 *)wtbl_hdr); + wtbl_hdr->tlv_num = cpu_to_le16(wtlv); req.hdr.tlv_num = cpu_to_le16(stlv); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h index 8d057c72366a..d978b94aacc1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h @@ -506,9 +506,10 @@ struct sta_rec_ba { __le16 winsize; } __packed; -#define MT7615_STA_REC_UPDATE_MAX_SIZE (sizeof(struct sta_rec_basic) + \ - sizeof(struct sta_rec_ht) + \ - sizeof(struct sta_rec_vht)) +struct sta_rec_wtbl { + __le16 tag; + __le16 len; +} __packed; enum { STA_REC_BASIC, @@ -523,6 +524,8 @@ enum { STA_REC_HT, STA_REC_VHT, STA_REC_APPS, + STA_REC_KEY, + STA_REC_WTBL, STA_REC_MAX_NUM };