From patchwork Wed Aug 14 22:18:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jitendra Vegiraju X-Patchwork-Id: 13764204 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB58AC3DA4A for ; Wed, 14 Aug 2024 22:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/ctYwdkcw3ew76VEvy4I7isTLad9fiJBmsnzjqt/Igg=; b=tv4zh8pi89ipBcsR1Gn0O1yvqf mFvQpt5rud0siE4FtkPLe/aca6NFQEGl9IkVPdPDoNE5abZi16Xd5YN7urRCGm2ApqAC/bPTBAq7j +9YZViJiM2zEbIawceMjZ9PziU8ZAMlMFX3eGwPBSiPGb8I2eOVuqVwpNc2jrfEViShB9O21cF0/w ktrj40F1o0nm1QAFD0s2cvUi2RpHNxcY0370ves/oSYqdW4kVnKDBfiztieMKtaA7segoaA9r7vqe VdKJuUaqEWMSJeMuXRcINbQ1gF/V6nD/o01LCQJCZJDJZaWc3tkNvsLtSDcERVokYd9YdBMZ26Ez4 TVTkj3/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seMLJ-00000008QdT-3sTg; Wed, 14 Aug 2024 22:19:45 +0000 Received: from relay.smtp-ext.broadcom.com ([192.19.144.207]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seMK1-00000008QIQ-0KAV for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 22:18:29 +0000 Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 6A0C1C0000F5; Wed, 14 Aug 2024 15:18:22 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 6A0C1C0000F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1723673902; bh=N86+3UAimerDcct0v3/T9AdIwM8FyDpuc+NgjovY1DA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=solAN2rMTW71YOUW5e033JQMzR1nt0dzjQwKshh1Tr8/+Jfg/XlXf5kkT1lQ/zd0N ylL5lCiVBmKP3+dKSj9B1Ec2YmftjludaPcEIjzXBDgvNQYQVga0Mnv4upsexAD1A7 xFYs695TUKmrsjLKCMS70aLUeJ2dsE9f40RDNIs0= Received: from pcie-dev03.dhcp.broadcom.net (pcie-dev03.dhcp.broadcom.net [10.59.171.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 5059518041CAC9; Wed, 14 Aug 2024 15:18:19 -0700 (PDT) From: jitendra.vegiraju@broadcom.com To: netdev@vger.kernel.org Cc: alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, jitendra.vegiraju@broadcom.com, bcm-kernel-feedback-list@broadcom.com, richardcochran@gmail.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, fancer.lancer@gmail.com, rmk+kernel@armlinux.org.uk, ahalaney@redhat.com, xiaolei.wang@windriver.com, rohan.g.thomas@intel.com, Jianheng.Zhang@synopsys.com, leong.ching.swee@intel.com, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org, andrew@lunn.ch, linux@armlinux.org.uk, horms@kernel.org, florian.fainelli@broadcom.com Subject: [net-next v4 1/5] net: stmmac: Add HDMA mapping for dw25gmac support Date: Wed, 14 Aug 2024 15:18:14 -0700 Message-Id: <20240814221818.2612484-2-jitendra.vegiraju@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240814221818.2612484-1-jitendra.vegiraju@broadcom.com> References: <20240814221818.2612484-1-jitendra.vegiraju@broadcom.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240814_151825_294885_CEAE141A X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jitendra Vegiraju Add hdma configuration support in include/linux/stmmac.h file. The hdma configuration includes mapping of virtual DMAs to physical DMAs. Define a new data structure stmmac_hdma_cfg to provide the mapping. Signed-off-by: Jitendra Vegiraju --- include/linux/stmmac.h | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 338991c08f00..1775bd2b7c14 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -89,6 +89,55 @@ struct stmmac_mdio_bus_data { bool needs_reset; }; +/* DW25GMAC Hyper-DMA Overview + * Hyper-DMA allows support for large number of Virtual DMA(VDMA) + * channels using a smaller set of physical DMA channels(PDMA). + * This is supported by the mapping of VDMAs to Traffic Class (TC) + * and PDMA to TC in each traffic direction as shown below. + * + * VDMAs Traffic Class PDMA + * +--------+ +------+ +-----------+ + * |VDMA0 |--------->| TC0 |-------->|PDMA0/TXQ0 | + *TX +--------+ |----->+------+ +-----------+ + *Host=> +--------+ | +------+ +-----------+ => MAC + *SW |VDMA1 |---+ | TC1 | +--->|PDMA1/TXQ1 | + * +--------+ +------+ | +-----------+ + * +--------+ +------+----+ +-----------+ + * |VDMA2 |--------->| TC2 |-------->|PDMA2/TXQ1 | + * +--------+ +------+ +-----------+ + * . . . + * +--------+ +------+ +-----------+ + * |VDMAn-1 |--------->| TCx-1|-------->|PDMAm/TXQm | + * +--------+ +------+ +-----------+ + * + * +------+ +------+ +------+ + * |PDMA0 |--------->| TC0 |-------->|VDMA0 | + * +------+ |----->+------+ +------+ + *MAC => +------+ | +------+ +------+ + *RXQs |PDMA1 |---+ | TC1 | +--->|VDMA1 | => Host + * +------+ +------+ | +------+ + * . . . + */ + +#define STMMAC_DW25GMAC_MAX_NUM_TX_VDMA 128 +#define STMMAC_DW25GMAC_MAX_NUM_RX_VDMA 128 + +#define STMMAC_DW25GMAC_MAX_NUM_TX_PDMA 8 +#define STMMAC_DW25GMAC_MAX_NUM_RX_PDMA 10 + +#define STMMAC_DW25GMAC_MAX_TC 8 + +/* Hyper-DMA mapping configuration + * Traffic Class associated with each VDMA/PDMA mapping + * is stored in corresponding array entry. + */ +struct stmmac_hdma_cfg { + u8 tvdma_tc[STMMAC_DW25GMAC_MAX_NUM_TX_VDMA]; + u8 rvdma_tc[STMMAC_DW25GMAC_MAX_NUM_RX_VDMA]; + u8 tpdma_tc[STMMAC_DW25GMAC_MAX_NUM_TX_PDMA]; + u8 rpdma_tc[STMMAC_DW25GMAC_MAX_NUM_RX_PDMA]; +}; + struct stmmac_dma_cfg { int pbl; int txpbl; @@ -101,6 +150,7 @@ struct stmmac_dma_cfg { bool multi_msi_en; bool dche; bool atds; + struct stmmac_hdma_cfg *hdma_cfg; }; #define AXI_BLEN 7