From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EDC02747B; Thu, 24 Apr 2025 12:32:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745497946; cv=none; b=fjBWiE+pKw7glnWm7CQhfl6f1/NaygU3CcFNosduVyMEaC8lHqNrx4lBRb02NMMkhTqslf8ZkuxJNY7hgVXLdiL/eiBeczIio+r8vsREks4+ultd+MhJgnawv8eIXLMU+Jl765w6AvOeBGZpo7V9QrR2vnV459kL/ixlKCtelfI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745497946; c=relaxed/simple; bh=k6X76+6Yj5XPf8BgLpcVSb0Kgc+ov+XYavWDj16lJWE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=W1Ur0CvLxbrPJAhjBanEUl+9DT51Xs+kLHlYQGr8jk/XzAs5bN5RSG8CHPuC4Ro/tLlfRyQGBsSDHxS09ENR4I6MtvLePiw3vmWt4K3dIqAhA9s2XTzCDDqv9x1bDIwb742uwDEGAGXCO6QrLqSqn6Wr5xnzh/BUVe9HTKg9iT4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=M34qZugq; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="M34qZugq" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=R7E0igRN0goWZT53emNsgMknLEdpCU0Z3PHf0cpn4M4=; b=M34qZugqYq7x6S26YtmcPCqPio KuZCRgcANW1O/zmu9txnWc/YLvQN/nqtoLgXeJd4f+LegtaBStGFX/csqPrJVBh12ei7nywbk6UXg fbRBYUKIqedh4axwO40A94m7GYV3fU2H/6tBF+D80hFG4I9Q8n8zHX2y/jEdmztulzaEfyWhugqsL AX6GZ23Abwl1o+To2QruXtMYavNx3xHhZZ1beN/SoG+ZMHy3u/s1BPzmihD+53DIi4zdAdYmdAhbZ 2M6mCZFbF6TRkS0KhJBMX+7RS+V1AwRdvz8SyRqRjfsUjw4Hy3DUFc9f0zabaLP5+gHC3aRRGiKIQ n+OGfgyg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:39516) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u7vkY-0007Mr-0A; Thu, 24 Apr 2025 13:32:18 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.96) (envelope-from ) id 1u7vkU-00015d-0J; Thu, 24 Apr 2025 13:32:14 +0100 Date: Thu, 24 Apr 2025 13:32:13 +0100 From: "Russell King (Oracle)" To: Paolo Abeni Cc: Boon Khai Ng , 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 , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Maxime Coquelin , Alexandre Torgue , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Furong Xu <0x1207@gmail.com>, Matthew Gerlach , Tien Sung Ang , Mun Yew Tham , G Thomas Rohan Subject: Re: [PATCH net-next v4 1/2] net: stmmac: Refactor VLAN implementation Message-ID: References: <20250421162930.10237-1-boon.khai.ng@altera.com> <20250421162930.10237-2-boon.khai.ng@altera.com> <43ef6713-9ae1-468c-bc43-2c7e463e04f4@redhat.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43ef6713-9ae1-468c-bc43-2c7e463e04f4@redhat.com> Sender: Russell King (Oracle) 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 > > Reviewed-by: Matthew Gerlach > > 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!