mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: nikita.yoush <nikita.yoush@cogentembedded.com>,
	Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Michael Dege <michael.dege@renesas.com>,
	Christian Mardmoeller <christian.mardmoeller@renesas.com>,
	Dennis Ostermann <dennis.ostermann@renesas.com>,
	nikita.yoush <nikita.yoush@cogentembedded.com>
Subject: RE: [PATCH net-next] net: renesas: rswitch: enable only used MFWD features
Date: Tue, 10 Dec 2024 12:47:05 +0000	[thread overview]
Message-ID: <TYCPR01MB11040ACA8D4956BB6DA52F6DAD83D2@TYCPR01MB11040.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20241209062411.152927-1-nikita.yoush@cogentembedded.com>

Hello Nikita-san,

> From: Nikita Yushchenko, Sent: Monday, December 9, 2024 3:24 PM
> 
> Currently, rswitch driver does not utilize most of MFWD forwarding
> and processing features. It only uses port-based forwarding for ETHA
> ports, and direct descriptor forwarding for GWCA port.
> 
> Update rswitch_fwd_init() to enable exactly that, and keep everything
> else disabled.
> 
> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>

Thank you for the patch. It looks good to me. So,

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

And, I tested the patch on my environment (R-Car S4 Spider), and
it worked without any regression. So,

Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda

> ---
>  drivers/net/ethernet/renesas/rswitch.c | 30 +++++++++++++++++---------
>  drivers/net/ethernet/renesas/rswitch.h | 14 ++++++------
>  2 files changed, 28 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
> index 16b1888270eb..7f17b9656cc3 100644
> --- a/drivers/net/ethernet/renesas/rswitch.c
> +++ b/drivers/net/ethernet/renesas/rswitch.c
> @@ -111,25 +111,35 @@ static void rswitch_top_init(struct rswitch_private *priv)
>  /* Forwarding engine block (MFWD) */
>  static void rswitch_fwd_init(struct rswitch_private *priv)
>  {
> +	u32 all_ports_mask = GENMASK(RSWITCH_NUM_AGENTS - 1, 0);
>  	unsigned int i;
> 
> -	/* For ETHA */
> -	for (i = 0; i < RSWITCH_NUM_PORTS; i++) {
> -		iowrite32(FWPC0_DEFAULT, priv->addr + FWPC0(i));
> +	/* Start with empty configuration */
> +	for (i = 0; i < RSWITCH_NUM_AGENTS; i++) {
> +		/* Disable all port features */
> +		iowrite32(0, priv->addr + FWPC0(i));
> +		/* Disallow L3 forwarding and direct descriptor forwarding */
> +		iowrite32(FIELD_PREP(FWCP1_LTHFW, all_ports_mask),
> +			  priv->addr + FWPC1(i));
> +		/* Disallow L2 forwarding */
> +		iowrite32(FIELD_PREP(FWCP2_LTWFW, all_ports_mask),
> +			  priv->addr + FWPC2(i));
> +		/* Disallow port based forwarding */
>  		iowrite32(0, priv->addr + FWPBFC(i));
>  	}
> 
> -	for (i = 0; i < RSWITCH_NUM_PORTS; i++) {
> +	/* For enabled ETHA ports, setup port based forwarding */
> +	rswitch_for_each_enabled_port(priv, i) {
> +		/* Port based forwarding from port i to GWCA port */
> +		rswitch_modify(priv->addr, FWPBFC(i), FWPBFC_PBDV,
> +			       FIELD_PREP(FWPBFC_PBDV, BIT(priv->gwca.index)));
> +		/* Within GWCA port, forward to Rx queue for port i */
>  		iowrite32(priv->rdev[i]->rx_queue->index,
>  			  priv->addr + FWPBFCSDC(GWCA_INDEX, i));
> -		iowrite32(BIT(priv->gwca.index), priv->addr + FWPBFC(i));
>  	}
> 
> -	/* For GWCA */
> -	iowrite32(FWPC0_DEFAULT, priv->addr + FWPC0(priv->gwca.index));
> -	iowrite32(FWPC1_DDE, priv->addr + FWPC1(priv->gwca.index));
> -	iowrite32(0, priv->addr + FWPBFC(priv->gwca.index));
> -	iowrite32(GENMASK(RSWITCH_NUM_PORTS - 1, 0), priv->addr + FWPBFC(priv->gwca.index));
> +	/* For GWCA port, allow direct descriptor forwarding */
> +	rswitch_modify(priv->addr, FWPC1(priv->gwca.index), FWPC1_DDE, FWPC1_DDE);
>  }
> 
>  /* Gateway CPU agent block (GWCA) */
> diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h
> index 9ac55b4f5b14..741b089c8523 100644
> --- a/drivers/net/ethernet/renesas/rswitch.h
> +++ b/drivers/net/ethernet/renesas/rswitch.h
> @@ -12,6 +12,7 @@
> 
>  #define RSWITCH_MAX_NUM_QUEUES	128
> 
> +#define RSWITCH_NUM_AGENTS	5
>  #define RSWITCH_NUM_PORTS	3
>  #define rswitch_for_each_enabled_port(priv, i)		\
>  	for (i = 0; i < RSWITCH_NUM_PORTS; i++)		\
> @@ -811,6 +812,7 @@ enum rswitch_gwca_mode {
>  #define CABPPFLC_INIT_VALUE	0x00800080
> 
>  /* MFWD */
> +#define FWPC0(i)		(FWPC00 + (i) * 0x10)
>  #define FWPC0_LTHTA		BIT(0)
>  #define FWPC0_IP4UE		BIT(3)
>  #define FWPC0_IP4TE		BIT(4)
> @@ -824,15 +826,15 @@ enum rswitch_gwca_mode {
>  #define FWPC0_MACHMA		BIT(27)
>  #define FWPC0_VLANSA		BIT(28)
> 
> -#define FWPC0(i)		(FWPC00 + (i) * 0x10)
> -#define FWPC0_DEFAULT		(FWPC0_LTHTA | FWPC0_IP4UE | FWPC0_IP4TE | \
> -				 FWPC0_IP4OE | FWPC0_L2SE | FWPC0_IP4EA | \
> -				 FWPC0_IPDSA | FWPC0_IPHLA | FWPC0_MACSDA | \
> -				 FWPC0_MACHLA |	FWPC0_MACHMA | FWPC0_VLANSA)
>  #define FWPC1(i)		(FWPC10 + (i) * 0x10)
> +#define FWCP1_LTHFW		GENMASK(16 + (RSWITCH_NUM_AGENTS - 1), 16)
>  #define FWPC1_DDE		BIT(0)
> 
> -#define	FWPBFC(i)		(FWPBFC0 + (i) * 0x10)
> +#define FWPC2(i)		(FWPC20 + (i) * 0x10)
> +#define FWCP2_LTWFW		GENMASK(16 + (RSWITCH_NUM_AGENTS - 1), 16)
> +
> +#define FWPBFC(i)		(FWPBFC0 + (i) * 0x10)
> +#define FWPBFC_PBDV		GENMASK(RSWITCH_NUM_AGENTS - 1, 0)
> 
>  #define FWPBFCSDC(j, i)         (FWPBFCSDC00 + (i) * 0x10 + (j) * 0x04)
> 
> --
> 2.39.5


  reply	other threads:[~2024-12-10 12:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09  6:24 Nikita Yushchenko
2024-12-10 12:47 ` Yoshihiro Shimoda [this message]
2024-12-11 12:40 ` 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=TYCPR01MB11040ACA8D4956BB6DA52F6DAD83D2@TYCPR01MB11040.jpnprd01.prod.outlook.com \
    --to=yoshihiro.shimoda.uh@renesas.com \
    --cc=andrew@lunn.ch \
    --cc=christian.mardmoeller@renesas.com \
    --cc=davem@davemloft.net \
    --cc=dennis.ostermann@renesas.com \
    --cc=edumazet@google.com \
    --cc=geert+renesas@glider.be \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=michael.dege@renesas.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikita.yoush@cogentembedded.com \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®