Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4232131pxk; Tue, 8 Sep 2020 14:21:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxL43KOgXb065Q1Uq4ncIgnpW3jI5tFe1R21eVfTYljred9tkQuPfPVu/FfCp5nJg1TTWaQ X-Received: by 2002:a17:906:a256:: with SMTP id bi22mr390172ejb.375.1599600113861; Tue, 08 Sep 2020 14:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599600113; cv=none; d=google.com; s=arc-20160816; b=nCZ8/ul/O0aJhGC8oeWepKw8Pl/9U9nZun74Rk9BwlL6U77ss8Qk7dmdsd/ynIH9ZI ZtGe0VSro/AeXf2lRamuy2bVNVeONh3idmUnjUVFbVWvKwSDUvyjdcRyXHYT7oYd+86R PYTBAvCAOGySFqC8lZY5w3b0HR1bxyM+kMnxC8wcIWJkpFmorWYIw+Ek759mQUYoj8PA EQLA4uiyTsdt3I/unKhIgywSFbF6GGWp629AdI/+6C3xLnF01sNm6nYMRhzRv5PbWMcd m2XaJq19VwKzSv8rWoZqWclSkt9yP+pDd3k7rqeH2COWgSxihlOgqBotMmAuNayAOLQ5 oE4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Is5CAD/ZIm6t03EgYX/3+vaKqFv/sZsDgYtmsy53erk=; b=vW+msTBZDNlzkZKq7ncNhvXC6AZBwfdyiFc5dFezARAK4yoHzBGLMa/HE6vdQiB7Ry OeEaPN7epG77v4RxqN+bBHgvxbzZU5uiISQu9bChs7f07q1p/TVuymbBafRedhwaBVe6 9AuAa1CKyI3dqxpCRIe4n7/IiF8dpE6Pzsjo6eSVVBiRhgPNTRii8LVsvILIm0yGvOZt zFGSZiXIGBtgzMQu/C2qTmY7PQ6QrtluqEy6+thcHKfaH7On3SFN1PFrmlTfwyOYeyng mJG/rjn37vpcZlDpd3RZsNO4lnSrEPRoFYvXx8paiXzEoBz4FVeP0AQfGGG+1Ki94Uj9 fYMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=BstwodcI; 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 h2si158060ejy.315.2020.09.08.14.21.30; Tue, 08 Sep 2020 14:21:53 -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=BstwodcI; 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 S1729851AbgIHVSa (ORCPT + 99 others); Tue, 8 Sep 2020 17:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730168AbgIHVSG (ORCPT ); Tue, 8 Sep 2020 17:18:06 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84D20C061797 for ; Tue, 8 Sep 2020 14:18:01 -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:References:In-Reply-To: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Is5CAD/ZIm6t03EgYX/3+vaKqFv/sZsDgYtmsy53erk=; b=BstwodcIMTAmfYxk8B24SL7Is5 bpmYMOF1qvgqqUjSvwKq7A2XJUU034QYNAe4ceK6q44Cs67GQEoYl0YdrlLItfGuZFrV5FxgIjmLB Hvzgt152c6gkNjWfcgDIf5ap4jbaRVjcIJny4Vgua+RJOUSJAGuLg8l/zhMmKExzxyhs=; Received: from p4ff13fcb.dip0.t-ipconnect.de ([79.241.63.203] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.89) (envelope-from ) id 1kFl03-0002Cx-EU for linux-wireless@vger.kernel.org; Tue, 08 Sep 2020 23:17:59 +0200 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 08/11] mt76: mt7915: simplify mt7915_lmac_mapping Date: Tue, 8 Sep 2020 23:17:53 +0200 Message-Id: <20200908211756.15998-8-nbd@nbd.name> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908211756.15998-1-nbd@nbd.name> References: <20200908211756.15998-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Compared to mac80211 ACs, MT7915 queue numbers are in reverse order There is no need for the defensive WARN_ON_ONCE, so we can simplify the function to avoid the array lookup Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h index ab3f209ff6cd..4b8908fa7eda 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h @@ -258,17 +258,8 @@ mt7915_ext_phy(struct mt7915_dev *dev) static inline u8 mt7915_lmac_mapping(struct mt7915_dev *dev, u8 ac) { - static const u8 lmac_queue_map[] = { - [IEEE80211_AC_BK] = MT_LMAC_AC00, - [IEEE80211_AC_BE] = MT_LMAC_AC01, - [IEEE80211_AC_VI] = MT_LMAC_AC02, - [IEEE80211_AC_VO] = MT_LMAC_AC03, - }; - - if (WARN_ON_ONCE(ac >= ARRAY_SIZE(lmac_queue_map))) - return MT_LMAC_AC01; /* BE */ - - return lmac_queue_map[ac]; + /* LMAC uses the reverse order of mac80211 AC indexes */ + return 3 - ac; } extern const struct ieee80211_ops mt7915_ops; -- 2.28.0