Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA098CA9EAC for ; Sat, 19 Oct 2019 11:18:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B8B320869 for ; Sat, 19 Oct 2019 11:18:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="i7JTMK2L"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="i7JTMK2L" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725877AbfJSLSr (ORCPT ); Sat, 19 Oct 2019 07:18:47 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52716 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbfJSLSr (ORCPT ); Sat, 19 Oct 2019 07:18:47 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CE6C060D51; Sat, 19 Oct 2019 11:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1571483926; bh=tzXbFW4kYaZiiNhGwwEw45iiXOQBfAG34KD6qlnzorw=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=i7JTMK2Lfg2rU7cfv+QRTFLwwpwkWnsemr6tKK23V+pYNDHnbnhh6PXksiY5U/fTP Hl9E+AvKT69DQJZz5STnc5C3neSBlgVT5w/tU6TQAkkWW0xnpOyEga5fSq9shudKn/ mkNal9TF5gEyLaA+3pKoZO+FevT41koCCep9QzFE= Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 121B360615; Sat, 19 Oct 2019 11:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1571483926; bh=tzXbFW4kYaZiiNhGwwEw45iiXOQBfAG34KD6qlnzorw=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=i7JTMK2Lfg2rU7cfv+QRTFLwwpwkWnsemr6tKK23V+pYNDHnbnhh6PXksiY5U/fTP Hl9E+AvKT69DQJZz5STnc5C3neSBlgVT5w/tU6TQAkkWW0xnpOyEga5fSq9shudKn/ mkNal9TF5gEyLaA+3pKoZO+FevT41koCCep9QzFE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 121B360615 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: Chris Chiu Cc: Tony Chuang , linux-wireless , Brian Norris Subject: Re: [PATCH v2 5/6] rtw88: add set_bitrate_mask support References: <20191016123301.2649-1-yhchuang@realtek.com> <20191016123301.2649-6-yhchuang@realtek.com> Date: Sat, 19 Oct 2019 14:18:42 +0300 In-Reply-To: (Chris Chiu's message of "Thu, 17 Oct 2019 18:25:46 +0800") Message-ID: <87h845vv8t.fsf@kamboji.qca.qualcomm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Chris Chiu writes: > On Wed, Oct 16, 2019 at 8:33 PM wrote: >> >> From: Tzu-En Huang >> > >> + >> + band = hal->current_band_type; >> + if (band == RTW_BAND_2G) { >> + band = NL80211_BAND_2GHZ; >> + cfg_mask = mask->control[band].legacy; >> + } else if (band == RTW_BAND_5G) { >> + band = NL80211_BAND_5GHZ; >> + cfg_mask = mask->control[band].legacy << 4; >> + } >> + >> + if (!is_vht_enable) { >> + if (ra_mask & RA_MASK_HT_RATES_1SS) >> + cfg_mask |= mask->control[band].ht_mcs[0] << 12; >> + if (ra_mask & RA_MASK_HT_RATES_2SS) >> + cfg_mask |= mask->control[band].ht_mcs[1] << 20; >> + } else { >> + if (ra_mask & RA_MASK_VHT_RATES_1SS) >> + cfg_mask |= mask->control[band].vht_mcs[0] << 12; >> + if (ra_mask & RA_MASK_VHT_RATES_2SS) >> + cfg_mask |= mask->control[band].vht_mcs[1] << 22; >> + } >> + >> + ra_mask &= cfg_mask; >> + >> + return ra_mask; >> +} >> + > > I believe you can replace the 4, 12, 20, 22 with a more descriptive macro. Good point. GENMASK() and FIELD_PREP() are my favourites. Or maybe u64_encode_bits() is actually better than FIELD_PREP(), as cfg_mask is u64? -- https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches