Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4867076yba; Tue, 30 Apr 2019 05:46:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxyEpAE6OQHePcutXa3P0DE2WLIhYhwpIOJoQjOLfbU8MHzSaL0H8Q7XRJ1ZXu2HGTcwx76 X-Received: by 2002:a63:d408:: with SMTP id a8mr33412136pgh.184.1556628383172; Tue, 30 Apr 2019 05:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556628383; cv=none; d=google.com; s=arc-20160816; b=h/foScILwaneqpBYLvYY07jHniJ2m/T1LhSxMB7YOCarCkG/Q7OilldM3+AJrgPmBy rXO3RL1tu8iJHgwgVsDn7p1SRBiyeGH42N/iXAhrWkk62Tl+B7UlskutdIAQPnohtXhj bzOFpEj6clXZpXd22sSo6e++VU7Vq5k2OX34LoTL7ivRqHIC50q0TuduRCCZrUhATRMa 28qb194yuBVdoxPN7vYVZukEyLQsUacUi0iTO32Fhj3ZiQhUYyOWacAU347umR354lMt OoMVdUUSTVt/ou3pxE6+P6rv8cJr1H6i97RbDlRys7ny9slW6kw2+L7LabGsA2IVNqql kVhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dmarc-filter :dkim-signature:dkim-signature; bh=/aMNSA/7YeVKkDZHPj/BXxLfYN85DgOZ+4/kSrsNn9I=; b=IoIL77QmrYhVkbFBR8VYc3ogkO3GkT3DsQzT37lG1dsb0l1+hk+HrlL56jsGIxQPZ+ n8e/9PgAq3olzzAsxQ4C4t3c4hIhzhOmxd5C1m4A3E0WgSFRGOK1GAoti5tMORxJclbC JYXhIwKgybZsYgi6owac/ElATKPtTQWbapFX8yCQuXGlNYEMMOa+uW417LXA/J0WpDYa Zmd03zxjskuzjPxg+SWEo1F/08ZDpRqfNrrqRQ+tRQbBTjkLZ2N0TeNu12sXyfaUD5Ky EsMiM2G8VR4jt3hEDncGedey+QGSEQbxiVKTZgRh9Gx+3eD47Hw5Mt1cQK7c40X6rixN ENOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=bP8fvG5L; dkim=pass header.i=@codeaurora.org header.s=default header.b=bP8fvG5L; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si37023168plb.346.2019.04.30.05.46.07; Tue, 30 Apr 2019 05:46:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=bP8fvG5L; dkim=pass header.i=@codeaurora.org header.s=default header.b=bP8fvG5L; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727099AbfD3Mps (ORCPT + 99 others); Tue, 30 Apr 2019 08:45:48 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50194 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726166AbfD3Mpr (ORCPT ); Tue, 30 Apr 2019 08:45:47 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BD01B608CE; Tue, 30 Apr 2019 12:45:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1556628346; bh=OGiex3GDZHEnZFPIwAzt/9Cq76d0yKJu/+fGYYhEUYU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=bP8fvG5Lfp/QRHusJhhLo/FvfZfbXlafTkJvmdo+mvyz2Gh2wds0+HaHySJBgJ/oA xix20lhB0EUVNFWoN88fEEW47yWpNTkA5wdfUS/JBE8hs5BxgsPEEGq5VDR8khE0UP QUu/4JdokrrLwPYvuDJw5nAEi6R1fvCP/WR5559k= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 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 D569360769; Tue, 30 Apr 2019 12:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1556628346; bh=OGiex3GDZHEnZFPIwAzt/9Cq76d0yKJu/+fGYYhEUYU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=bP8fvG5Lfp/QRHusJhhLo/FvfZfbXlafTkJvmdo+mvyz2Gh2wds0+HaHySJBgJ/oA xix20lhB0EUVNFWoN88fEEW47yWpNTkA5wdfUS/JBE8hs5BxgsPEEGq5VDR8khE0UP QUu/4JdokrrLwPYvuDJw5nAEi6R1fvCP/WR5559k= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D569360769 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: Cc: , , , , , , , Subject: Re: [PATCH v9 04/14] rtw88: trx files References: <1555653004-1795-1-git-send-email-yhchuang@realtek.com> <1555653004-1795-5-git-send-email-yhchuang@realtek.com> Date: Tue, 30 Apr 2019 15:45:40 +0300 In-Reply-To: <1555653004-1795-5-git-send-email-yhchuang@realtek.com> (yhchuang@realtek.com's message of "Fri, 19 Apr 2019 13:49:54 +0800") Message-ID: <87bm0npsp7.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 writes: > From: Yan-Hsuan Chuang > > trx files for Realtek 802.11ac wireless network chips > > Reviewed-by: Stanislaw Gruszka > Signed-off-by: Yan-Hsuan Chuang [...] > --- /dev/null > +++ b/drivers/net/wireless/realtek/rtw88/rx.h > @@ -0,0 +1,41 @@ > +/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ > +/* Copyright(c) 2018-2019 Realtek Corporation > + */ > + > +#ifndef __RTW_RX_H_ > +#define __RTW_RX_H_ > + > +#define GET_RX_DESC_PHYST(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(26)) > +#define GET_RX_DESC_ICV_ERR(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(15)) > +#define GET_RX_DESC_CRC32(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(14)) > +#define GET_RX_DESC_SWDEC(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(27)) > +#define GET_RX_DESC_C2H(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x02), BIT(28)) > +#define GET_RX_DESC_PKT_LEN(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(13, 0)) > +#define GET_RX_DESC_DRV_INFO_SIZE(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(19, 16)) > +#define GET_RX_DESC_SHIFT(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(25, 24)) > +#define GET_RX_DESC_RX_RATE(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x03), GENMASK(6, 0)) > +#define GET_RX_DESC_MACID(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x01), GENMASK(6, 0)) > +#define GET_RX_DESC_PPDU_CNT(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x02), GENMASK(30, 29)) > +#define GET_RX_DESC_TSFL(rxdesc) \ > + le32_get_bits(*((__le32 *)(rxdesc) + 0x05), GENMASK(31, 0)) I'm not really fond of these "byte macros" or whatever they should be called, you use these a lot in rtw88 but I have seen the same usage also other drivers. The upstream way of doing this is to create a struct, which also acts as a documentation, and you can pass it around different functions. And the GENMASK()s are defined close the struct. Also you could change these defines to static inline functions, which take the struct as a pointer, and that you get type checking from the compiler. And that way you would get rid of that ugly casting as well. -- Kalle Valo