netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Subject: Re: [PATCH net-next 3/6] net: enetc: add definition for offset between eMAC and pMAC regs
Date: Sun, 22 Jan 2023 17:29:33 +0100	[thread overview]
Message-ID: <Y81kbbO+X21uVFMb@corigine.com> (raw)
In-Reply-To: <20230119160431.295833-4-vladimir.oltean@nxp.com>

On Thu, Jan 19, 2023 at 06:04:28PM +0200, Vladimir Oltean wrote:
> This is a preliminary patch which replaces the hardcoded 0x1000 present
> in other PM1 (port MAC 1, aka pMAC) register definitions, which is an
> offset to the PM0 (port MAC 0, aka eMAC) equivalent register.
> This definition will be used in more places by future code.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  .../net/ethernet/freescale/enetc/enetc_hw.h   | 104 +++++++++---------
>  1 file changed, 53 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h
> index cc8f1afdc3bc..5c88b3f2a095 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h
> @@ -226,6 +226,8 @@ enum enetc_bdr_type {TX, RX};
>  #define ENETC_MMCSR_ME		BIT(16)
>  #define ENETC_PTCMSDUR(n)	(0x2020 + (n) * 4) /* n = TC index [0..7] */
>  
> +#define ENETC_PMAC_OFFSET	0x1000
> +
>  #define ENETC_PM0_CMD_CFG	0x8008
>  #define ENETC_PM1_CMD_CFG	0x9008
>  #define ENETC_PM0_TX_EN		BIT(0)
> @@ -280,57 +282,57 @@ enum enetc_bdr_type {TX, RX};
>  /* Port MAC counters: Port MAC 0 corresponds to the eMAC and
>   * Port MAC 1 to the pMAC.
>   */
> -#define ENETC_PM_REOCT(mac)	(0x8100 + 0x1000 * (mac))
> -#define ENETC_PM_RALN(mac)	(0x8110 + 0x1000 * (mac))

...

> +#define ENETC_PM_REOCT(mac)	(0x8100 + ENETC_PMAC_OFFSET * (mac))
> +#define ENETC_PM_RALN(mac)	(0x8110 + ENETC_PMAC_OFFSET * (mac))

I'm not sure if it is an improvement, but did you consider something
like this? *completely untested*

#define ENETC_PM(mac, reg)	((reg) + ENETC_PMAC_OFFSET * (mac))
#define ENETC_PM_REOCT(mac)	ENETC_PM(mac, 0x8100)
#define ENETC_PM_RALN(mac)	ENETC_PM(mac, 0x8110)

...

Overall, the patchset looks good to me, FWIIW.

  reply	other threads:[~2023-01-22 16:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 16:04 [PATCH net-next 0/6] ENETC MAC Merge cleanup Vladimir Oltean
2023-01-19 16:04 ` [PATCH net-next 1/6] net: enetc: build common object files into a separate module Vladimir Oltean
2023-01-19 16:04 ` [PATCH net-next 2/6] net: enetc: detect frame preemption hardware capability Vladimir Oltean
2023-01-19 16:04 ` [PATCH net-next 3/6] net: enetc: add definition for offset between eMAC and pMAC regs Vladimir Oltean
2023-01-22 16:29   ` Simon Horman [this message]
2023-01-23 11:24     ` Vladimir Oltean
2023-01-23 12:44       ` Simon Horman
2023-01-19 16:04 ` [PATCH net-next 4/6] net: enetc: stop configuring pMAC in lockstep with eMAC Vladimir Oltean
2023-01-19 16:04 ` [PATCH net-next 5/6] net: enetc: implement software lockstep for port MAC registers Vladimir Oltean
2023-01-19 16:04 ` [PATCH net-next 6/6] net: enetc: stop auto-configuring the port pMAC Vladimir Oltean
2023-01-23 13:20 ` [PATCH net-next 0/6] ENETC MAC Merge cleanup patchwork-bot+netdevbpf

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=Y81kbbO+X21uVFMb@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=xiaoliang.yang_1@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;
as well as URLs for NNTP newsgroup(s).