Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp671165pxv; Thu, 15 Jul 2021 13:04:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpG75hFOh5Kx29FEmDjh0feBL/Ylig4zT4CypxEOFJI9qPQdWC2s5hGx1q9Qn3Rimj9K93 X-Received: by 2002:a6b:794b:: with SMTP id j11mr4370614iop.129.1626379454563; Thu, 15 Jul 2021 13:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626379454; cv=none; d=google.com; s=arc-20160816; b=urkD1hq9Loda80KSjeeKXfHEwI4PJ/TyDbD76t+fMjiIbi4VcLIGWmRAQw+Yk6F0zX jFfgaFrL4IM1VqmtKneLlCEuyFwV/biS6mltFe3tndsrkzdNpo0BJn5fvQFMwKTOHgKO eq6MT/+iLg4UcQru8rv+9Amn39vZssa0L6xvVjZIfFp+o4kCgZgb+UDEwADJgRglDmdH zMnqjvyj9IN6z3cv1vt3JcS5cljmoVUfleYwXZ3Kc2PVTsYdc6vFlydzPPREhb/GZKho ztlKgVPXA5QS1eAOR+Kcs4vKZxfMihQyFfsobAr4ApU/5P/2q57z362M0WeAtVx6LUA1 zfcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=OK+MoTyZsq17izadFHbsWJ086j0/zznA0Pv7m3goF2U=; b=bUje/6Aszhd1vVFJTzWdKYchoOaOldr0hAnq2viCmPpvl340sQdCRuplmJ/xbdCI8d 1BcK3TO1JNjKMUNLVlFORpBASHnkMZwdyrvfKbzkkGUaRv3nJwgKbwPZJbtJeUXFO3M2 wDsGVbnS1U3LBY7deQnbBgxa0ru52I3Uwm6Svqt+6Y+koBKXvxdcbzTbWtV3d1D4sjsB XNOiRqNpS12FzicMdkGT0vpmU/6WUflfGYK9Jrc+tm1ANg3iheBZw9gki0tzR8Jn0uf/ tD4zK8JRoYckoMdy9v6/mJ3VLjCXxKfmONcxjF57UzpRKBWIJJvVB333wZgfUfY8stYo Ygaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=n0LTqFGy; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s1si5604275jat.54.2021.07.15.13.04.01; Thu, 15 Jul 2021 13:04:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=n0LTqFGy; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346700AbhGOUGk (ORCPT + 99 others); Thu, 15 Jul 2021 16:06:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241055AbhGOUGc (ORCPT ); Thu, 15 Jul 2021 16:06:32 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0D4EC08EE76 for ; Thu, 15 Jul 2021 12:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject :Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=OK+MoTyZsq17izadFHbsWJ086j0/zznA0Pv7m3goF2U=; b=n0LTqFGyldprZYDzp4AYeyG04B SgErPCYkoq5smhXDZz0vkJuVUUkZoKs/JO3gsHpEfGKFt4yyLYfnTt+Xxh1b1ct4aOay6Oaey/t6W 3DlK4JaU2tiNW7KG4gl43k2Gst+HDgprPCHzgXYXGz0XnCzfGHDjyb2OmHI0GL2J8cPY=; Received: from p54ae93f7.dip0.t-ipconnect.de ([84.174.147.247] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1m47Rh-00046W-4e; Thu, 15 Jul 2021 21:54:57 +0200 From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: Sean Wang , Ryder Lee Subject: [PATCH v4 1/3] mt76: add mt76_default_basic_rate more devices can rely on Date: Thu, 15 Jul 2021 21:54:52 +0200 Message-Id: <20210715195454.12370-1-nbd@nbd.name> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang add mt76_default_basic_rate to mt76 core more devices can rely on to send frames which require the rate in the basic rates. Suggested-by: Ryder Lee Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mac80211.c | 14 ++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index ee3a5b8d62d2..7403a012ceed 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -1351,3 +1351,17 @@ mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, return hwq; } EXPORT_SYMBOL_GPL(mt76_init_queue); + +u16 mt76_default_basic_rate(struct mt76_phy *phy, struct ieee80211_vif *vif) +{ + int i = ffs(vif->bss_conf.basic_rates) - 1, offset = 0; + struct ieee80211_rate *rate; + + if (phy->chandef.chan->band == NL80211_BAND_5GHZ) + offset = 4; + + rate = &mt76_rates[offset + i]; + + return rate->hw_value; +} +EXPORT_SYMBOL_GPL(mt76_default_basic_rate); diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 0516d3afe262..bf36f9227713 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -891,6 +891,7 @@ int mt76_get_of_eeprom(struct mt76_dev *dev, void *data, int offset, int len); struct mt76_queue * mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, int ring_base); +u16 mt76_default_basic_rate(struct mt76_phy *phy, struct ieee80211_vif *vif); static inline int mt76_init_tx_queue(struct mt76_phy *phy, int qid, int idx, int n_desc, int ring_base) { -- 2.30.1