netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Boon Khai Ng <boon.khai.ng@altera.com>,
	netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Furong Xu <0x1207@gmail.com>,
	Matthew Gerlach <matthew.gerlach@altera.com>,
	Tien Sung Ang <tien.sung.ang@altera.com>,
	Mun Yew Tham <mun.yew.tham@altera.com>,
	G Thomas Rohan <rohan.g.thomas@altera.com>
Subject: Re: [PATCH net-next v4 1/2] net: stmmac: Refactor VLAN implementation
Date: Thu, 24 Apr 2025 13:32:13 +0100	[thread overview]
Message-ID: <aAovTY6Q-4S__0Mh@shell.armlinux.org.uk> (raw)
In-Reply-To: <43ef6713-9ae1-468c-bc43-2c7e463e04f4@redhat.com>

On Thu, Apr 24, 2025 at 02:04:04PM +0200, Paolo Abeni wrote:
> On 4/21/25 6:29 PM, Boon Khai Ng wrote:
> > Refactor VLAN implementation by moving common code for DWMAC4 and
> > DWXGMAC IPs into a separate VLAN module. VLAN implementation for
> > DWMAC4 and DWXGMAC differs only for CSR base address, the descriptor
> > for the VLAN ID and VLAN VALID bit field.
> > 
> > The descriptor format for VLAN is not moved to the common code due
> > to hardware-specific differences between DWMAC4 and DWXGMAC.
> > 
> > For the DWMAC4 IP, the Receive Normal Descriptor 0 (RDES0) is
> > formatted as follows:
> >     31                                                0
> >       ------------------------ -----------------------
> > RDES0| Inner VLAN TAG [31:16] | Outer VLAN TAG [15:0] |
> >       ------------------------ -----------------------
> > 
> > For the DWXGMAC IP, the RDES0 format varies based on the
> > Tunneled Frame bit (TNP):
> > 
> > a) For Non-Tunneled Frame (TNP=0)
> > 
> >     31                                                0
> >       ------------------------ -----------------------
> > RDES0| Inner VLAN TAG [31:16] | Outer VLAN TAG [15:0] |
> >       ------------------------ -----------------------
> > 
> > b) For Tunneled Frame (TNP=1)
> > 
> >      31                   8 7                3 2      0
> >       --------------------- ------------------ -------
> > RDES0| VNID/VSID           | Reserved         | OL2L3 |
> >       --------------------- ------------------ ------
> > 
> > The logic for handling tunneled frames is not yet implemented
> > in the dwxgmac2_wrback_get_rx_vlan_tci() function. Therefore,
> > it is prudent to maintain separate functions within their
> > respective descriptor driver files
> > (dwxgmac2_descs.c and dwmac4_descs.c).
> > 
> > Signed-off-by: Boon Khai Ng <boon.khai.ng@altera.com>
> > Reviewed-by: Matthew Gerlach <matthew.gerlach@altera.com>
> 
> This patch does IMHO too many things together, and should be split in
> several ones, i.e.:
> - just moving the code in a separate file
> - rename functions and simbols.
> - other random changes...
> 
> > -	ret = readl_poll_timeout(ioaddr + GMAC_VLAN_TAG, val,
> > -				 !(val & GMAC_VLAN_TAG_CTRL_OB),
> > -				 1000, 500000);
> > -	if (ret) {
> > -		netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n");
> > -		return -EBUSY;
> > -	}
> 
> > +	for (i = 0; i < timeout; i++) {
> > +		val = readl(ioaddr + VLAN_TAG);
> > +		if (!(val & VLAN_TAG_CTRL_OB))
> > +			return 0;
> > +		udelay(1);
> > +	}
> > +
> > +	netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n");
> > +
> > +	return -EBUSY;
> 
> ... like the above on (which looks unnecessary?!?)

Also looks like a backward step, because we ask people to use the helper
macros where possible.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2025-04-24 12:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-21 16:29 [PATCH net-next v4 0/2] Refactoring designware VLAN code Boon Khai Ng
2025-04-21 16:29 ` [PATCH net-next v4 1/2] net: stmmac: Refactor VLAN implementation Boon Khai Ng
2025-04-24 12:04   ` Paolo Abeni
2025-04-24 12:32     ` Russell King (Oracle) [this message]
2025-04-25  7:12       ` Ng, Boon Khai
2025-04-25  7:08     ` Ng, Boon Khai
2025-04-24 12:16   ` Simon Horman
2025-04-28  8:34     ` Ng, Boon Khai
2025-04-21 16:29 ` [PATCH net-next v4 2/2] net: stmmac: dwxgmac2: Add support for HW-accelerated VLAN stripping Boon Khai Ng
2025-04-24 11:53   ` Paolo Abeni
2025-04-25  7:09     ` Ng, Boon Khai
2025-04-24 12:17   ` Simon Horman
2025-04-25  7:15     ` Ng, Boon Khai

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=aAovTY6Q-4S__0Mh@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=0x1207@gmail.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=boon.khai.ng@altera.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=matthew.gerlach@altera.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mun.yew.tham@altera.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rohan.g.thomas@altera.com \
    --cc=tien.sung.ang@altera.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).