netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, nbd@nbd.name, john@phrozen.org,
	sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	Sam.Shih@mediatek.com, linux-mediatek@lists.infradead.org,
	devicetree@vger.kernel.org, robh@kernel.org,
	lorenzo.bianconi@redhat.com
Subject: Re: [PATCH v2 net-next 11/15] net: ethernet: mtk_eth_soc: introduce device register map
Date: Thu, 19 May 2022 09:51:28 +0200	[thread overview]
Message-ID: <YoX3AMlBFfDcl69o@lore-desk> (raw)
In-Reply-To: <20220518084431.66aa1737@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

> On Wed, 18 May 2022 11:48:43 +0200 Lorenzo Bianconi wrote:
> > > On Mon, 16 May 2022 18:06:38 +0200 Lorenzo Bianconi wrote:  
> > > >  /* PDMA RX Base Pointer Register */
> > > > -#define MTK_PRX_BASE_PTR0	0x900
> > > > +#define MTK_PRX_BASE_PTR0	(eth->soc->reg_map[MTK_PDMA_BASE] + 0x100)
> > > >  #define MTK_PRX_BASE_PTR_CFG(x)	(MTK_PRX_BASE_PTR0 + (x * 0x10))  
> > > 
> > > Implicit macro arguments are really unpleasant for people doing
> > > tree-wide changes or otherwise unfamiliar with the driver.
> > > 
> > > Nothing we can do to avoid this?  
> > 
> > I used this approach in order to have just few changes in the codebase. I guess the best
> > option would be to explicitly add eth parameter to the register macros, what do you think?
> 
> I don't think there's a best known practice, you'll have to exercise
> your judgment. Taking a look at a random example of MTK_PDMA_INT_STATUS.
> Looks like that one is already assigned to eth->tx_int_status_reg.
> Maybe that can be generalized? Personally I'd forgo the macros
> completely and just use eth->soc->register_name in the code.

I personally think the code is easier to read if we use macros in this case.
Let's consider MTK_LRO_CTRL_DW1_CFG(), it depends on the particular soc based
on the register map and even on the ring index. I guess the best trade-off we
can get is to explicitly pass eth to the macros as parameter when needed.

Regards,
Lorenzo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2022-05-19  7:51 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 16:06 [PATCH v2 net-next 00/15] introduce mt7986 ethernet support Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 01/15] arm64: dts: mediatek: mt7986: introduce ethernet nodes Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 02/15] dt-bindings: net: mediatek,net: add mt7986-eth binding Lorenzo Bianconi
2022-05-17 14:36   ` Rob Herring
2022-05-16 16:06 ` [PATCH v2 net-next 03/15] net: ethernet: mtk_eth_soc: move tx dma desc configuration in mtk_tx_set_dma_desc Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 04/15] net: ethernet: mtk_eth_soc: add txd_size to mtk_soc_data Lorenzo Bianconi
2022-05-18  1:33   ` Jakub Kicinski
2022-05-18  8:29     ` Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 05/15] net: ethernet: mtk_eth_soc: rely on txd_size in mtk_tx_alloc/mtk_tx_clean Lorenzo Bianconi
2022-05-18  1:35   ` Jakub Kicinski
2022-05-18  8:32     ` Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 06/15] net: ethernet: mtk_eth_soc: rely on txd_size in mtk_desc_to_tx_buf Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 07/15] net: ethernet: mtk_eth_soc: rely on txd_size in txd_to_idx Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 08/15] net: ethernet: mtk_eth_soc: add rxd_size to mtk_soc_data Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 09/15] net: ethernet: mtk_eth_soc: rely on txd_size field in mtk_poll_tx/mtk_poll_rx Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 10/15] net: ethernet: mtk_eth_soc: rely on rxd_size field in mtk_rx_alloc/mtk_rx_clean Lorenzo Bianconi
2022-05-18  1:39   ` Jakub Kicinski
2022-05-18  8:30     ` Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 11/15] net: ethernet: mtk_eth_soc: introduce device register map Lorenzo Bianconi
2022-05-18  1:41   ` Jakub Kicinski
2022-05-18  9:48     ` Lorenzo Bianconi
2022-05-18 15:44       ` Jakub Kicinski
2022-05-19  7:51         ` Lorenzo Bianconi [this message]
2022-05-19 16:12           ` Jakub Kicinski
2022-05-20 18:11             ` Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 12/15] net: ethernet: mtk_eth_soc: introduce MTK_NETSYS_V2 support Lorenzo Bianconi
2022-05-18  1:44   ` Jakub Kicinski
2022-05-18  9:53     ` Lorenzo Bianconi
2022-05-18 15:47       ` Jakub Kicinski
2022-05-18 15:50         ` Felix Fietkau
2022-05-18 16:08           ` Jakub Kicinski
2022-05-16 16:06 ` [PATCH v2 net-next 13/15] net: ethernet: mtk_eth_soc: convert ring dma pointer to void Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 14/15] net: ethernet: mtk_eth_soc: convert scratch_ring " Lorenzo Bianconi
2022-05-16 16:06 ` [PATCH v2 net-next 15/15] net: ethernet: mtk_eth_soc: introduce support for mt7986 chipset Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YoX3AMlBFfDcl69o@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=Sam.Shih@mediatek.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).