Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5395621rwd; Mon, 12 Jun 2023 04:41:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Sy3Ph8kJIWXJ8rVtS/91D81SyKRt9HXWVFWIyNibS3ZUyQlOMGXfr/Cfh7t9lhJ10NyHS X-Received: by 2002:a05:6a21:328c:b0:119:fffb:e37f with SMTP id yt12-20020a056a21328c00b00119fffbe37fmr8328468pzb.10.1686570068475; Mon, 12 Jun 2023 04:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686570068; cv=none; d=google.com; s=arc-20160816; b=uvgmhBejGAOc5JZ4KqDv3iVBwGLR8kKQRnSmXqbH4zfp0axI55ZJOMRPsjHwA+OMXu jyK98w7CC6VpHkgMaev2tixdJFAQ/OityJ3QMKJoO6l8Yz3YOOWcFH6u/jGPl/imIDhZ TffT3QVjZHlx2DLeQ4ioVZ/sZR54T/BwKlIyFI6VMUbYMFoqe2p5nHhsvA/vW0WwVWp8 OGsqi4jkKkT5IRwq5p3lIW2q9feVd3YblSWz0rCFWUjWMSWDRtylwuojlhVeFhEZrkBm DHhzIWOjvmtxpXUY5iOpY/t3KJJJOjKrqhVXtTwquMFmLT56Vubr0oquHzQ1bUr815Kl yS3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=TV21Jmzs5HQxIuTayrf/mU1uRUNmyAiPllP7jU37Xqc=; b=swW01qWviSh0u2+i9nXoNmSs0Ey/L2pwLVptgHg0hnMquE1DWTRPb8jAk2o+8P+2a4 APFxbvJV6kybhj1yrGsofil3M+4gAO+9vPAKGEKe25p+5gFbX8WGJ74325ygwq76capc 5rlT10ooy84J1jy+GIroAok61D4GWI3C/hJmFXRiLfn+LopDrPAXKya/zf+5R1AllCKm XpFiLriKVDr7UZuOLp7kcCHeslLGnktPflTcBQLHMa03pUAISBFE755hNErS8Lzw/Lc9 mqZC8nQaIlkSLw0UHKnAEGsMHo+Kg63TrlFcRPSuzBzi3h7wHqKgbHd3HJwd4S3YA6+f Cp4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="ymw/V7Oe"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020a63350a000000b00537c6c285a0si3514770pga.167.2023.06.12.04.40.53; Mon, 12 Jun 2023 04:41:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="ymw/V7Oe"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234322AbjFLLiP (ORCPT + 99 others); Mon, 12 Jun 2023 07:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235764AbjFLLhy (ORCPT ); Mon, 12 Jun 2023 07:37:54 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 063F77D94; Mon, 12 Jun 2023 04:20:05 -0700 (PDT) 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=TV21Jmzs5HQxIuTayrf/mU1uRUNmyAiPllP7jU37Xqc=; b=ymw/V7OeZAEdwfvrsdF0h7hem3 P2MsH19HdcpAUn5jgAqvtrHcr1v+prQ6HGwnZwNY5HGIVTVMqR8bJpG8QL+R6BsExpfurAJoFyzgO mTOQryoWtvarDKOfsLxbMNlY4uYZLfspASeOE9nXQEDK8Dfo1lMqnEB3HZL8Sowmp65K7AVBv/EzY aasIUJmN6gAT0nfrFXjq4ZYcQTn5A69DWGB9x9Ukm4IF6hFiazutEUzl5rSluwnVo1UP1EfNzIIz1 ibt+BUxG04j1w8PNhucatldK7t5a+HV4nsd0n4ZVyMTW2R7omrRh8b3EhZFgs+t11VfcRezgoQ0R8 4NRkg+oA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:36050) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q8faY-0005e2-JP; Mon, 12 Jun 2023 12:19:58 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q8faS-0004v7-27; Mon, 12 Jun 2023 12:19:52 +0100 Date: Mon, 12 Jun 2023 12:19:52 +0100 From: "Russell King (Oracle)" To: Daniel Golle Cc: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, AngeloGioacchino Del Regno , Matthias Brugger , Lorenzo Bianconi , Mark Lee , Sean Wang , John Crispin , Felix Fietkau , Conor Dooley , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Sam Shih Subject: Re: [PATCH net-next 5/8] net: ethernet: mtk_eth_soc: add MTK_NETSYS_V3 capability bit Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 11, 2023 at 01:38:23AM +0100, Daniel Golle wrote: > @@ -1333,8 +1354,13 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, > mtk_tx_set_dma_desc(dev, itxd, &txd_info); > > itx_buf->flags |= MTK_TX_FLAGS_SINGLE0; > - itx_buf->flags |= (!mac->id) ? MTK_TX_FLAGS_FPORT0 : > - MTK_TX_FLAGS_FPORT1; > + if (mac->id == MTK_GMAC1_ID) > + itx_buf->flags |= MTK_TX_FLAGS_FPORT0; > + else if (mac->id == MTK_GMAC2_ID) > + itx_buf->flags |= MTK_TX_FLAGS_FPORT1; > + else > + itx_buf->flags |= MTK_TX_FLAGS_FPORT2; There appears to be two places that this code structure appears, and this is in the path for packet transmission. I wonder if it would be more efficient to instead do: itx_buf->flags |= MTK_TX_FLAGS_SINGLE0 | mac->tx_flags; with mac->tx_flags appropriately initialised? > @@ -2170,7 +2214,9 @@ static int mtk_poll_tx_qdma(struct mtk_eth *eth, int budget, > tx_buf = mtk_desc_to_tx_buf(ring, desc, > eth->soc->txrx.txd_size); > if (tx_buf->flags & MTK_TX_FLAGS_FPORT1) > - mac = 1; > + mac = MTK_GMAC2_ID; > + else if (tx_buf->flags & MTK_TX_FLAGS_FPORT2) > + mac = MTK_GMAC3_ID; This has me wondering whether the flags are used for hardware or just for the driver's purposes. If it's the latter, can we instead store the MAC index in tx_buf, rather than having to decode a bitfield? I suspect these are just for the driver given that the addition of MTK_TX_FLAGS_FPORT2 changes all subsequent bit numbers in this struct member. > > if (!tx_buf->data) > break; > @@ -3783,7 +3829,26 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset) > mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, reg_map->qdma.int_grp + 4); > mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); > > - if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { > + if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { > + /* PSE should not drop port1, port8 and port9 packets */ > + mtk_w32(eth, 0x00000302, PSE_DROP_CFG); > + > + /* GDM and CDM Threshold */ > + mtk_w32(eth, 0x00000707, MTK_CDMW0_THRES); > + mtk_w32(eth, 0x00000077, MTK_CDMW1_THRES); > + > + /* Disable GDM1 RX CRC stripping */ > + val = mtk_r32(eth, MTK_GDMA_FWD_CFG(0)); > + val &= ~MTK_GDMA_STRP_CRC; > + mtk_w32(eth, val, MTK_GDMA_FWD_CFG(0)); mtk_m32() ? Thanks! -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!