public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Wei Fang <wei.fang@nxp.com>
Cc: Claudiu Manoil <claudiu.manoil@nxp.com>,
	Clark Wang <xiaoning.wang@nxp.com>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"christophe.leroy@csgroup.eu" <christophe.leroy@csgroup.eu>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v4 net-next 01/14] net: enetc: add initial netc-lib driver to support NTMP
Date: Mon, 17 Mar 2025 11:28:08 +0200	[thread overview]
Message-ID: <20250317092808.jel2au3cgfwblaxk@skbuf> (raw)
In-Reply-To: <PAXPR04MB851027E5F830F08F3395083888D22@PAXPR04MB8510.eurprd04.prod.outlook.com>

Hi Wei,

On Fri, Mar 14, 2025 at 03:48:21PM +0200, Wei Fang wrote:
> > I mean, I was just suggesting to group the macros with the macros, and
> > the struct fields with the struct fields. Mixing them together looks a
> > bit messy to me. Even worse in the definition of "union netc_cbd" which
> > IMO needs to be reconsidered a bit (a hint given below).
> 
> I think this is a matter of personal preference. I was inspired by some
> of Intel's structure definitions. I think this method allows me to quickly
> understand what fields the member consists of and what bits each field
> occupies.
(...)
> Thanks, but we have added fully NTMP support in downstream, it's a great
> challenge for me to convert it to the 'packing' method. I don't think I have
> too much time to do this conversion. And I also need some time to figure
> out how to use it and whether it is worth doing so.

Ok, I'm not forcing you to use pack_fields(), but given the fact that
bit field overlap is now something that has to be manually checked, and
a bug of this kind already exists in this set, you will have to wait for
me, or other reviewers, to go through the bit field definitions from the
entire set.

> > And I agree with you, I also don't want ntmp_private.h to be exposed to
> > the NTMP API consumers, and I wasn't suggesting that. I just want the
> > NTMP API to spare consumer drivers of the gory details, like for example
> > the buffer layout of a MAC filtering entry, reserved fields, things like
> > that. What I was saying is to keep the buffer layout private to
> > ntmp_private.h, and expose a more abstract data structure to API
> > consumers.
> 
> Sorry, I don't fully understand, for example, if we place the definition
> of "struct maft_keye_data" in ntmp_private.h, how does the debugfs
> get the information from "struct maft_keye_data"? Add a helper function
> in the NTMP driver and export it to enetc driver? And how does
> enetc4_pf_add_si_mac_exact_filter() to set the mac address to "struct
> maft_keye_data", add another helper? If so, I think it is more complicated.

Well, my complaint, which has to do with style and personal preference,
is that exposing packed data structures to NTMP API clients puts an
unnecessary burden on them. For example, NTMP users have to call cpu_to_le16()
to populate data.cfge.si_bitmap. A bug in the packed layout will
potentially have to be fixed in multiple places. The two options for a
more high-level NTMP API that I see are:
- You expose pointers to the packed data structures, but API functions
  provide getters and setters, and the exact buffer layout is only known
  to the NTMP layer.
- The API functions expose "unpacked" data structures, which are more
  abstract and don't contain reserved fields and are in CPU native
  endianness, and the NTMP layer packs them to buffers, either using
  pack_fields() or manually.

Claudiu, what do you think? I can withdraw the request to hide packed
MAFT (and other) struct definitions from include/linux/fsl/ntmp.h if you
think they're fine there.

> > Thank you for posting the downstream layout of struct ntmp_priv which I
> > was already aware of. What I was saying is that the word "private" means
> > an aspect of the implementation which is hidden from other code layers.
> > There's nothing "private" here if the NTMP layer has access to the
> > definition of this structure. I was asking whether you agree that it's
> > more adequate to name this structure "ntmp_client", since it represents
> > the data associated with a consumer of the NTMP API - a NETC SI or (in
> > the future) the switch. Or some other name. But the word "private" seems
> > misused.
> 
> Okay, it seems to make you feel confused, let me rename it later, how about
> "ntmp_user"?

"ntmp_user" works for me better than "ntmp_priv", thanks. Are you also
going to make the API functions from include/linux/fsl/ntmp.h take
"struct ntmp_user *" as first argument, rather than "struct netc_cbdrs *"?


  reply	other threads:[~2025-03-17  9:33 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11  5:38 [PATCH v4 net-next 00/14] Add more feautues for ENETC v4 - round 2 Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 01/14] net: enetc: add initial netc-lib driver to support NTMP Wei Fang
2025-03-11 12:17   ` Michal Kubiak
2025-03-13 16:35   ` Vladimir Oltean
2025-03-14  3:38     ` Wei Fang
2025-03-14 12:37       ` Vladimir Oltean
2025-03-14 13:48         ` Wei Fang
2025-03-17  9:28           ` Vladimir Oltean [this message]
2025-03-17  9:55             ` Wei Fang
2025-03-17 10:00               ` Vladimir Oltean
2025-03-17 11:39                 ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 02/14] net: enetc: add command BD ring support for i.MX95 ENETC Wei Fang
2025-03-11 12:22   ` Michal Kubiak
2025-03-13 16:49   ` Vladimir Oltean
2025-03-14  4:51     ` Wei Fang
2025-03-14 11:18       ` Vladimir Oltean
2025-03-14 13:56         ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 03/14] net: enetc: move generic MAC filterng interfaces to enetc-core Wei Fang
2025-03-17  9:42   ` Vladimir Oltean
2025-03-17 10:00     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 04/14] net: enetc: add MAC filter for i.MX95 ENETC PF Wei Fang
2025-03-17 14:18   ` Vladimir Oltean
2025-03-18  3:19     ` Wei Fang
2025-03-18  9:29       ` Vladimir Oltean
2025-03-18  9:48         ` Wei Fang
2025-03-18  8:08     ` Claudiu Manoil
2025-03-18  8:47       ` Vladimir Oltean
2025-03-11  5:38 ` [PATCH v4 net-next 05/14] net: enetc: add debugfs interface to dump MAC filter Wei Fang
2025-03-17 14:48   ` Vladimir Oltean
2025-03-18  3:28     ` Wei Fang
2025-03-18 14:54       ` Vladimir Oltean
2025-03-11  5:38 ` [PATCH v4 net-next 06/14] net: enetc: add set/get_rss_table() to enetc_si_ops Wei Fang
2025-03-17 16:42   ` Vladimir Oltean
2025-03-18  5:06     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 07/14] net: enetc: make enetc_set_rss_key() reusable Wei Fang
2025-03-17 16:26   ` Vladimir Oltean
2025-03-18  4:54     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 08/14] net: enetc: add RSS support for i.MX95 ENETC PF Wei Fang
2025-03-17 15:55   ` Vladimir Oltean
2025-03-18  4:47     ` Wei Fang
2025-03-18 11:43       ` Vladimir Oltean
2025-03-18 14:00         ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 09/14] net: enetc: enable RSS feature by default Wei Fang
2025-03-17 16:33   ` Vladimir Oltean
2025-03-18  5:00     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 10/14] net: enetc: move generic VLAN filter interfaces to enetc-core Wei Fang
2025-03-17 17:05   ` Vladimir Oltean
2025-03-18  5:12     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 11/14] net: enetc: move generic VLAN hash filter functions to enetc_pf_common.c Wei Fang
2025-03-18 10:21   ` Vladimir Oltean
2025-03-18 13:57     ` Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 12/14] net: enetc: add VLAN filtering support for i.MX95 ENETC PF Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 13/14] net: enetc: add loopback " Wei Fang
2025-03-11  5:38 ` [PATCH v4 net-next 14/14] MAINTAINERS: add new file ntmp.h to ENETC driver Wei Fang
2025-03-17 17:06   ` Vladimir Oltean
2025-03-18  5:13     ` Wei Fang
2025-03-13 13:50 ` [PATCH v4 net-next 00/14] Add more feautues for ENETC v4 - round 2 Vladimir Oltean
2025-03-14  1:28   ` Wei Fang

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=20250317092808.jel2au3cgfwblaxk@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=christophe.leroy@csgroup.eu \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=imx@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.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