Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7649036rwi; Mon, 24 Oct 2022 18:15:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SqKkt8W3j8jPDyAGb+P2Icr42/wg/jhBPvjoSFjcIla9jzvxzAIlzpSpUellYgG+GskuI X-Received: by 2002:aa7:818f:0:b0:562:dc99:8a84 with SMTP id g15-20020aa7818f000000b00562dc998a84mr36101825pfi.30.1666660548510; Mon, 24 Oct 2022 18:15:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666660548; cv=none; d=google.com; s=arc-20160816; b=g49vGWaoE7aled3cl4NqPReAIsECCGdH25m+x7DTWMoPCrjwLndVNeexsoAihkeqPr 7zhB+RhbYA06zrONKj5C1dcySVkhSPmb9ozbGU6C9hf4tpU3LmgvbOZEegvsgZffy1Bj wa/JQPQ8/JPDIcOBjbefqtLmFMOm19UPVB0ylR40GpbCNu6f1tmzuDmYlG0uwgmdDKoo cNZ5Evu588STSjNn/X7CqVrE+Lni7WwBEdN+Cg3k5JZkE11HKkpGgPmTvGCi6GWHaBvq i/sSuIeqSSmlRguS3rY24EGKIIou7b/0TajyVBAEFCKLOQiQpPedK/VZYMbgiw/oVCkS VCOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=S60QWh2u+ENNyc/oOBO8S02pSM05EoJivJ9ovxNPLIw=; b=M+etXe8d7CyBE+1jf7rnmYrVjFGXXr5E0D6ollhHrmQKXAxzhrCu/o+oJjLUMA2cla BFsfd15knu+89tn1rEwwEdxgHmVB4Tne16ABSS9xDjpcr/28VtUPqUz/o3nFBVaHMzwD RSG+gbT1RWqWqQXo0RGL+SfCNW1TtIq7ouFVxXuSklJWUP0jbRiDV6BYKCZWGh25cvWm D64i+HeDCBDjb0rCffATfUh+FgCiUCH6QUGV6TbcaiRPxILAS+EnkUHnXw/X1j1GXtd2 WEpRV7pxVEvWr2Jwj0LsgoGMKxCjR6n7++cKwLeYHJ1epeOGfNu5MCr5WJyL8HXKssXW +kzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=LqimzUeM; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nl9-20020a17090b384900b00212e420aaa3si12063638pjb.184.2022.10.24.18.15.39; Mon, 24 Oct 2022 18:15:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=LqimzUeM; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230428AbiJYBPC (ORCPT + 65 others); Mon, 24 Oct 2022 21:15:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231346AbiJYBOf (ORCPT ); Mon, 24 Oct 2022 21:14:35 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABEFE12D39 for ; Mon, 24 Oct 2022 17:31:09 -0700 (PDT) X-UUID: 2237ceaf7ce74651baf6b271c570f5d6-20221025 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=S60QWh2u+ENNyc/oOBO8S02pSM05EoJivJ9ovxNPLIw=; b=LqimzUeMGIU4VpifX/QzUXOkXD9eeqgpHDoViIj8sJjtUu19H10TCfU0Uryft7+tw29lEGmmFjoLiDWn07cwkhfyDG3KAVHkTDB9I4p4nJP3cnyrF/zvXVTGu3/cCTuCuqd6DqxPb5Il+XDAXSYS5aYQoEpMsRuypoAdYPViz10=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.12,REQID:0e50cdd1-0237-4cad-a1f0-7059da7095a7,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:62cd327,CLOUDID:8992f56c-89d3-4bfa-baad-dc632a24bca3,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 2237ceaf7ce74651baf6b271c570f5d6-20221025 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 631811380; Tue, 25 Oct 2022 08:31:03 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Tue, 25 Oct 2022 08:31:02 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 25 Oct 2022 08:31:02 +0800 From: Ryder Lee To: Felix Fietkau , CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , Ryder Lee Subject: [PATCH 1/2] wifi: mt76: mt7915: enable use_cts_prot support Date: Tue, 25 Oct 2022 08:31:00 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,RDNS_NONE, SPF_HELO_PASS,T_SPF_TEMPERROR,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This adds selectable RTC/CTS enablement for each interface. Signed-off-by: Ryder Lee Change-Id: I5eb7851b513d4140d879676154e2abe769969c01 --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 13 +++++++++++++ drivers/net/wireless/mediatek/mt76/mt7915/main.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 1ce2b91353e7..8b637dfe81fc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -232,6 +232,19 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev) rcu_read_unlock(); } +void mt7915_mac_enable_rtscts(struct mt7915_dev *dev, + struct ieee80211_vif *vif, bool enable) +{ + struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; + u32 addr; + + addr = mt7915_mac_wtbl_lmac_addr(dev, mvif->sta.wcid.idx, 5); + if (enable) + mt76_set(dev, addr, BIT(5)); + else + mt76_clear(dev, addr, BIT(5)); +} + static int mt7915_mac_fill_rx(struct mt7915_dev *dev, struct sk_buff *skb) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c index ac320182c2ce..1eb50811f4b0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c @@ -598,6 +598,9 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw, mt7915_mcu_add_obss_spr(dev, vif, info->he_obss_pd.enable); } + if (changed & BSS_CHANGED_ERP_CTS_PROT) + mt7915_mac_enable_rtscts(dev, vif, info->use_cts_prot); + if (changed & BSS_CHANGED_ERP_SLOT) { int slottime = info->use_short_slot ? 9 : 20; diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h index b0b57ee1e00f..ff5b01b279b8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h @@ -554,6 +554,8 @@ bool mt7915_mac_wtbl_update(struct mt7915_dev *dev, int idx, u32 mask); void mt7915_mac_reset_counters(struct mt7915_phy *phy); void mt7915_mac_cca_stats_reset(struct mt7915_phy *phy); void mt7915_mac_enable_nf(struct mt7915_dev *dev, bool ext_phy); +void mt7915_mac_enable_rtscts(struct mt7915_dev *dev, + struct ieee80211_vif *vif, bool enable); void mt7915_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi, struct sk_buff *skb, struct mt76_wcid *wcid, int pid, struct ieee80211_key_conf *key, -- 2.36.1