From patchwork Thu Aug 19 07:39:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 12446527 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 E3BBAC432BE for ; Thu, 19 Aug 2021 07:42:25 +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 9D62D61131 for ; Thu, 19 Aug 2021 07:42:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9D62D61131 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=F4xKUQ2Nn2i7iDbKSH+cw4R0G6MYv3M4Ln6/alzziSk=; b=PyqoIyuWDx54xi GxzvWT2jJhmyC3DmaKUoo+2QG5r0qMwZfMqqBGz9Wyvw7rHjwWyqu4xdVv3atpWHGAfen47zqDxhl Y8HyLt+0kyWhJe1FjbhRwUJtSppXrro95UFjJFBxkslswbZT42qNwblpnvCrr9r/EvV7vElLglVAP POJl7BRLBiyRFb5F7lvvQDBPYqcb9/u6GBtLnAfOH7cg2yu1TP+D2Kc4qVorLz4EkepxnUH9gjLaY m8dfjjdvAhzgLl3vi5tdUzaquwqbgyo2nBIKDvcgubgbPBzLWrVBQRglSh9/i3x5/vBDHKW+FrHqF npawOgnxVfGoc6uEsVGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGcfC-007Yyy-J3; Thu, 19 Aug 2021 07:40:34 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGceZ-007YvD-Gy for linux-arm-kernel@lists.infradead.org; Thu, 19 Aug 2021 07:40:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1629358796; x=1660894796; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=885MxSHelX5rvkgIZxlOgJCLdDgWmPQvxD6ASda6ECU=; b=C+pdAyI64gPLcZsT84Tf6ab9ajXa50aUNMuPFSePaw8aKFRg7LhqABqM 1npoLEQO+VgJF7jwszgezRDOMllWCE+BDyred2FQSFRLGnpca4xGfwB6z vEUo4w0C+G4vIMgOOMQlEE3mmP0LcvdfiOMx7f/mvg/gPNFUa/lRoX/Q2 gBOy9PMNLxHq4cnDHP8p06khL4BL1mKxkaEMc5p7X5C4AM/eEmW8b8Nh+ AMbPedwYzl0MF/t1F2qz3ymCnb75j/5v70/mqXcZcTb2LFG5hh2zd2JeD OQwOntzsMTXBeTccBv/fyJN0DteHY368Q5auQ86dkV5eiKg5ZPvBfXWBG g==; IronPort-SDR: NWEtWH4zsgK4Mz+fXa0FrlvbpavxFqPrK00OrxFNEuamwDTKe54dZ9/9sgMLFTfE3u3W/Fe4NX 2zEiXAwRtoEdRwDUgLv6034G+KS4hylDwnMX99GHcihdSWMT+GgM/PLu1PAUOM46EdyxTlJQ7+ ftT7qLGOmYwY9PLIlb1nNt3GyCd3RzUDxc4HHGe0jSrlDg7HXb94OxOTex8hXAreUup4VBCZq+ kalA0jvIOw79czpIEyTgOedIyU40VhbfcMYAbE5w+D2ZTGmwxbMx2CgOMcqkUeE8F/wbJ52bnL Uza26TanFGLOoTY4TrkSLgus X-IronPort-AV: E=Sophos;i="5.84,334,1620716400"; d="scan'208";a="132845405" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 19 Aug 2021 00:39:51 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Thu, 19 Aug 2021 00:39:49 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Thu, 19 Aug 2021 00:39:47 -0700 From: Steen Hegelund To: "David S. Miller" , Jakub Kicinski , , , , CC: Steen Hegelund , Alexandre Belloni Subject: [PATCH net-next v2 0/2] Adding Frame DMA functionality to Sparx5 Date: Thu, 19 Aug 2021 09:39:38 +0200 Message-ID: <20210819073940.1589383-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-20210819_003955_616533_739FF360 X-CRM114-Status: GOOD ( 14.38 ) 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 v2: Removed an unused variable (proc_ctrl) from sparx5_fdma_start. 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 | 593 ++++++++++++++++++ .../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, 696 insertions(+), 12 deletions(-) create mode 100644 drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c