From patchwork Wed Aug 11 07:59:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 12430281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BA8FC4338F for ; Wed, 11 Aug 2021 08:01:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3502A600CD for ; Wed, 11 Aug 2021 08:01:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3502A600CD Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=NY7li0n7HqnCauws/gQ0wX8CYPh5PXjp1of0o2Cq6Ic=; b=IDPJp16PbGxfxw bPk/ixfJ+0PVi+5h22OArDWnkxvOl+Qp0wwB9feExLVNbxS4zpQ0BKUUZLLPTiDIHKjL9NuNn1HTZ /5w0DWtFtjVhaemejT2Fc7CyQaH73kzO8e9Pj9FiscjdecTvhq29tpQyQIqpz+g7gAm50Qa2+lS/6 vgrmov+dd3OvpZmZG1vZ2TejBGeLz/SS4XoZZa63IMAmrCe/ecmd7doRfaJORO8YSaQUQLlocKVC3 Xeq35hn+Yk1hsSKo9P0M6wYWjyYMHkd5Dy+5wlH1eubnQXTZbleiDi2qyNZOpdH0Ky4+b3Md1aurx OL1ZfJc1Qbtf9UjDqAyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDj93-005x5n-5w; Wed, 11 Aug 2021 07:59:25 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDj8w-005x2U-Ay for linux-arm-kernel@lists.infradead.org; Wed, 11 Aug 2021 07:59:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1628668757; x=1660204757; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=2I1sFJ0ys3mr6bWHkMjdng2WW6R5jCm5BM/OgXNsVnw=; b=YiQ0YvX7+yrHdFhcTvwCZRUFLnngsVAD+tL/AIZF6YyDMz04XEpkvjD8 vBaQrRsPc5gYRGQHVl2m3/mSOjCD2F5wjuTqCOQIaRgD0tFL1kXTgfwbc K3/zu9+ku15BgUaDsThXmSBoTZKhDYFS8HPtISr+zcq58CxbvfppogCDO bVSCDx6xwsYF3vEcYViotEzsR93k00f2o4RXYg7gN4L4XpKVII/YAh1J3 2EAcZ7Sl/pcsBRWnuBO/kKEP9Xa/Lu7shqJYZlFi4sZP90vG9weJ2+jCR WH2ww6o3a54UP7P7ogB0RhD6WGFBSYhkGAp9nMPHqGTiGmvgi1bDoquLL Q==; IronPort-SDR: vJPKiH+0NSDVhf5P0Sb8BtpYgf6gRvqndpavqL3ImdjWG0ffORhcippPGHoPNI2mMTmCk0Mt7s SlFK9bTqhNqn3M95DoCiWA1zVSfw0KiY91uHOX8B6mRyF+6A+yw05rGKSbn4OJdLL86UAoXtPo 7dPf2AMWYWinoSDQtVcQnSSV/j6QfrR1Y6xg7qd5ka5MjmKZ6EOnMygmegsUa5BjHLK5BIcqWm Cqy45xQ40UY4c8ziSfyOamDYYggvE3PSQ1P0CvXH64uI5Py2y2dSdmpo3B8ZAdDhXF/axIAVLj hTqnGhsciXaClJ9q0I4YQuQB X-IronPort-AV: E=Sophos;i="5.84,311,1620716400"; d="scan'208";a="125381699" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Aug 2021 00:59:15 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 11 Aug 2021 00:59:15 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Wed, 11 Aug 2021 00:59:13 -0700 From: Steen Hegelund To: "David S. Miller" , Jakub Kicinski , , , , CC: Steen Hegelund , Alexandre Belloni Subject: [PATCH net-next 0/2] Adding Frame DMA functionality to Sparx5 Date: Wed, 11 Aug 2021 09:59:07 +0200 Message-ID: <20210811075909.543633-1-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210811_005918_507710_B8E34722 X-CRM114-Status: GOOD ( 14.52 ) 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 This add frame DMA functionality to the Sparx5 platform. Until now the Sparx5 SwitchDev driver has been using register based injection and extraction when sending frames to/from the host CPU. With this series the Frame DMA functionality now added. The Frame DMA is only used if the Frame DMA interrupt is configured in the device tree; otherwise the existing register based injection and extraction is used. The Sparx5 has two ports that can be used for sending and receiving frames, but there are 8 channels that can be configured: 6 for injection and 2 for extraction. The additional channels can be used for more advanced scenarios e.g. where virtual cores are used, but currently the driver only uses port 0 and channel 0 and 6 respectively. DCB (data control block) structures are passed to the Frame DMA with suitable information about frame start/end etc, as well as pointers to DB (data blocks) buffers. The Frame DMA engine can use interrupts to signal back when the frames have been injected or extracted. There is a limitation on the DB alignment also for injection: Block must start on 16byte boundaries, and this is why the driver currently copies the data to into separate buffers. The Sparx5 switch core needs a IFH (Internal Frame Header) to pass information from the port to the switch core, and this header is added before injection and stripped after extraction. Steen Hegelund (2): net: sparx5: switchdev: adding frame DMA functionality arm64: dts: sparx5: Add the Sparx5 switch frame DMA support arch/arm64/boot/dts/microchip/sparx5.dtsi | 5 +- .../net/ethernet/microchip/sparx5/Makefile | 2 +- .../ethernet/microchip/sparx5/sparx5_fdma.c | 595 ++++++++++++++++++ .../ethernet/microchip/sparx5/sparx5_main.c | 23 +- .../ethernet/microchip/sparx5/sparx5_main.h | 69 ++ .../ethernet/microchip/sparx5/sparx5_packet.c | 13 +- .../ethernet/microchip/sparx5/sparx5_port.c | 2 +- .../ethernet/microchip/sparx5/sparx5_port.h | 1 + 8 files changed, 698 insertions(+), 12 deletions(-) create mode 100644 drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c --- 2.32.0