From patchwork Mon Aug 7 05:51:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13343036 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 3139117D9 for ; Mon, 7 Aug 2023 05:52:53 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE489170B; Sun, 6 Aug 2023 22:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J1/r/6/L2Nm6OmP4o3BT2qUE0qrGSsvjAuqadRYvy37h0hLVkn+AEtV7YQ0Ouu45+B4RLU2KkjMWpGG9CJIkxX6XVoXh4162L8oXdARff5KIno5HdD2RvKchzRdScX6Ut+Lo9Zz17h7djeivDd5NgdmpZJ7HS+pyDqMPt/Ryf1ZYak/buDyhlx87Fik0w4ZcS/zW8uaLWsU39bHHQeVBYhautLU6XVcEhNTF6MmojSNaIadjsA04S7Er17gokupUIvbXjVOCI06biMnNTgwTIfDvU92U9LuqzY5zZe1lfCJ1Fc9P0JWLHwFWg3sNCaIBbUQUWtaUF2FUlz/LaEAoKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OieXksdWjxEWShSwdTIrHnqGCRT91Z5IVj6KjeOSkA4=; b=HPa1x2xMWwtPd0qcBBr43LPhMY6vOSlN+z/Mo5G6Fuv62SOrGC2OJiHaOyIufroyay1YzOQwr12+9jzcxUyhlKxeqeuf5AMXLwyLXwkWdW5aVv2sp0ekXFUCZLjmyglfCejyyrJMRqcYdFMIFgQWg6t8tgFEvuQ1dEDBu1ZXliQs3LnsJJd0TPWAqtvDIJqf6XRLJxKgjx8OEwCL9ScGBiwP/yrhu5ULBONrjUuka9f8DDY3VbTXv0CHrVlythy7IrVWxWGdRQk3vjirzhQlj62SKFVmtWQ8SzU3pSpeZdlnxbZN3O7Gbqf95QjuzPVaFoWbAlB0+ZSZUnq8JdI9Cw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OieXksdWjxEWShSwdTIrHnqGCRT91Z5IVj6KjeOSkA4=; b=Ko8ez+6Wmy6S5Ly9gBW+GIcU5XniqrohFeleIY2ock2+/euYDUXN1j47dYlcJt6diCsoAjCZFENFYkwkSTeSFR+/k+zbfwOLUzlbZ52XL+KWMNWeXz4DkitfC6BgJPs3gKiZY0wQ4fSFRDiNl8t3Gqbr3yz+y1/vA7FwZRGoO5c= Received: from CY5P221CA0047.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:4::16) by DS7PR12MB8291.namprd12.prod.outlook.com (2603:10b6:8:e6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:52:43 +0000 Received: from CY4PEPF0000E9D1.namprd03.prod.outlook.com (2603:10b6:930:4:cafe::95) by CY5P221CA0047.outlook.office365.com (2603:10b6:930:4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27 via Frontend Transport; Mon, 7 Aug 2023 05:52:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D1.mail.protection.outlook.com (10.167.241.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Mon, 7 Aug 2023 05:52:43 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 00:52:14 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sun, 6 Aug 2023 22:52:14 -0700 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 7 Aug 2023 00:52:10 -0500 From: Radhey Shyam Pandey To: , , , , , , , , , CC: , , , , , , Radhey Shyam Pandey Subject: [PATCH net-next v5 01/10] dt-bindings: dmaengine: xilinx_dma:Add xlnx,axistream-connected property Date: Mon, 7 Aug 2023 11:21:40 +0530 Message-ID: <1691387509-2113129-2-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D1:EE_|DS7PR12MB8291:EE_ X-MS-Office365-Filtering-Correlation-Id: 95836797-2b7b-46a3-a4db-08db970a848e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4/yXmZEh9TfRHpZlk13K+ugy+qxDFmi54ph5TEhyuMbxCJtb7R0q+Zzb2GvkSSVhCj2qlWXwjfRVJoEtj0CGgojUIesm5cXZJDViZ6W3AEIXUKpsPjqhJ53V1Iq3/8jb2xiPnOwaXZH5rNHKiq67mhwxJQrdU4EM2ZWcGbT2XpOd2VXO6TLogD+lcUjBzpTMO3KSAaIvuEFPDMLiz3QuJYrpoOvLAdr5OTeeGgksjfpXJUwYPDPXw0gRhKX1VlFsJgayoUoLe8uMMcpp9Hyi5eC1qXK+T22HxbIhDq64XLQ2hyZF5N/S8kpJ09Ivvtb94Aajb6uJfp4OK6oQvCYTCqWzMyNFDckFU0NkI5bwb3VjvGmUaC4HeFaeJbocrbI6twrvg0aZjDMgUL4M4IUrrX1KWGnxvrXt2bLRdhY1UiLfAVNbZ+8GMviDtjKvcitkBjdyD0S4mjQVX4er2gYWJ0T4GZs+Kcy8AGznno20X03/rjL9wQmqSPWojvN/MRBYeSsaO7BrUOhjDIxVbHCKnYKJKmTZNnufeDlA6ezSSPAXmU11DI9HkQbsaJh8fge0qsJ8f46d09/J+dzhx89a1fO7/q/2TXlXev85lX0ePmoLSHTK1n577g9A1LMHC2HBhad4Fwe5wvXxyxs53wenodtGtFIhKA0QmfMReJiYspLdBgwCyYXjkeFpP5xzVqakVf59eNO2Pg7wXIoMNRrDFB+lJrC0+sEngwXbyXtF7G6dRwdvMtDF8JLof1+0z7JvcBprX9AljMt9b13JrSidsCGJz52gooQjYFIpBECa0B0CzhBX9spFdpRA7Eadm53e X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(376002)(346002)(396003)(1800799003)(186006)(451199021)(82310400008)(40470700004)(46966006)(36840700001)(47076005)(4326008)(70206006)(70586007)(2906002)(336012)(6666004)(5660300002)(36860700001)(7416002)(41300700001)(8936002)(316002)(8676002)(40480700001)(81166007)(921005)(356005)(2616005)(54906003)(110136005)(426003)(478600001)(82740400003)(36756003)(26005)(86362001)(40460700003)(966005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:52:43.1371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 95836797-2b7b-46a3-a4db-08db970a848e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D1.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8291 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Add an optional AXI DMA property 'xlnx,axistream-connected'. This can be specified to indicate that DMA is connected to a streaming IP in the hardware design and dma driver needs to do some additional handling i.e pass metadata and perform streaming IP specific configuration. Signed-off-by: Radhey Shyam Pandey Acked-by: Rob Herring --- Changes for v5: - New patch in this series. Just a note that dmaengine series was earlier sent as separate series[1] and now it's merged with axiethernet series[2]. [1]: https://lore.kernel.org/all/20221124102745.2620370-1-sarath.babu.naidu.gaddam@amd.com [2]: https://lore.kernel.org/all/20230630053844.1366171-1-sarath.babu.naidu.gaddam@amd.com - Switch to amd.com email address. --- Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt b/Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt index d1700a5c36bf..fea5b09a439d 100644 --- a/Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt +++ b/Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt @@ -49,6 +49,10 @@ Optional properties for AXI DMA and MCDMA: register as configured in h/w. Takes values {8...26}. If the property is missing or invalid then the default value 23 is used. This is the maximum value that is supported by all IP versions. + +Optional properties for AXI DMA: +- xlnx,axistream-connected: Tells whether DMA is connected to AXI stream IP. + Optional properties for VDMA: - xlnx,flush-fsync: Tells which channel to Flush on Frame sync. It takes following values: From patchwork Mon Aug 7 05:51:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13343034 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 72ABB1369 for ; Mon, 7 Aug 2023 05:52:28 +0000 (UTC) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2047.outbound.protection.outlook.com [40.107.101.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3CA21708; Sun, 6 Aug 2023 22:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DfaUW6+0Q7M4aGsBt1sjCbaDvmowAtyQZNevL3ysh3/5E68FVdSdyJSSDYUhtetZJzz2rPNSDAbY863UbyVeHCPyBMfwFxNMS9IHx5gGbVg9dB+5evORRAYO3Q0iUzN2U8kEaa5brWBAZYzBcRRo0xNkgBMwLKT9tKI3RwzoVnmfucEZW7CFaM8QTryy7n3yM6DO3KMS8VF+VdSVCO33KASVr8mauhoWHx379jPKWPZk74tPXRRUvEXxF8ieZ9YhGrAio3/XHCVMibo8t/NxlX5KKvelPZARDKQO12CrDy2+c9eDnbjyNvnKP7YyrbYMm08aB0HMb6MHVDMv9fJRjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=X0B4MvpdrdKeTkVRPn2zNuBFROl2iMhLHaWi6Fx9x80=; b=FEcNsWhphxwmfU486nH2CSeta76S8Z84kbA+1+scgNrrVzSOa+J9DtQ6Qo0G0ucuFNzwni1mYUfZmypZ9SnZBTbM2asbDR/SefERgaLmGHBMpIzHjFlHD5IQDF5c8zGN7IgxARBKqBbhwBzWRXgRPBJfDIvOXSZlDuyWEVaPW+8GBYS9zNLhQjbDQ6dYLjF/123I2hiwD3LoskCm32MpA4U0ZfQA6tmuOShQOSpGhN9rzYwvbfOpAMcqUppXcpFHOaQAv9csk8s/XBm3cAFYOWVJAS7IUnyQciE6dCBMv32vDKA9uXQfnDf/1ibYNQC8eyAIfVZuoUvkR/OY5Uqsyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X0B4MvpdrdKeTkVRPn2zNuBFROl2iMhLHaWi6Fx9x80=; b=noQ0+36zfnI35MPbKZL+J6LMjgREvZBQ8kz0TwbDxZbekeVv9cPAx2mdDHvK6jYAmIG3lJHaiE5j+fn2fiN6N0gzTpKN3srmZAK8nsjpm0HE91rGUigx00s1ks250i7PMnfEnoJS1QfanZwkFkHED6BUMyilyCU5XWr5cgJ/wwE= Received: from BYAPR07CA0035.namprd07.prod.outlook.com (2603:10b6:a02:bc::48) by MW3PR12MB4443.namprd12.prod.outlook.com (2603:10b6:303:2d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26; Mon, 7 Aug 2023 05:52:22 +0000 Received: from CO1PEPF000044F0.namprd05.prod.outlook.com (2603:10b6:a02:bc:cafe::b1) by BYAPR07CA0035.outlook.office365.com (2603:10b6:a02:bc::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.21 via Frontend Transport; Mon, 7 Aug 2023 05:52:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1PEPF000044F0.mail.protection.outlook.com (10.167.241.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Mon, 7 Aug 2023 05:52:23 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 00:52:18 -0500 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 7 Aug 2023 00:52:14 -0500 From: Radhey Shyam Pandey To: , , , , , , , , , CC: , , , , , , Radhey Shyam Pandey Subject: [PATCH net-next v5 02/10] dt-bindings: dmaengine: xilinx_dma: Add xlnx,irq-delay property Date: Mon, 7 Aug 2023 11:21:41 +0530 Message-ID: <1691387509-2113129-3-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F0:EE_|MW3PR12MB4443:EE_ X-MS-Office365-Filtering-Correlation-Id: 39316a0c-3a24-4e4b-1cc6-08db970a7928 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9dRl2YB/E+Z7m8owhDvMwkwEU1UzBA2489e8gRj4/9VeMfwghRkAUrO5+hUV1f1/g3XyQLHVAGc6iY3/iEpLagDxA+WZ9RkqQOmnOTQk7T0+lqm+0uq53LXLL3iiQuyNT9RYnZM3Ee52bHdUUrzI+AY0ugavXy2BtinQSFsrkgdGt1JvU16PFsWsczgRIiojjioG8lJzFSs/U6v+HYihCQO9M0S6qOkFoeZYYdS6srKmy5H8yI4oWSTBO8nHhjEKIVXgQu5bLruDT8DUleG8FQYYj8BhBXWRh5MGmeWtTWHHWhFydoSAX7/F5+S7qmsEmOXAxvInpEVvkKYzCkeEUIm3KuU4erZtn+NMjvnuFCV9PYnjYtAIIJZEt26DDChpZZfhvtQJl21P3i/gonle1lydfEVf4yyZd5b8WKv62Ew4Cm4erzsL8cr8kf/0TVPYPyHx4uIs01rw3hw5RzegyckE55nMVOSzf4ovUriQtGlX1W8BA+pp9XAabYWO4vS9rl9BfzwDKXLqk2Z/bWUjZHCvWZ1q2Sw13w4GmV/6cLrOnLf6wiNXxbvCak+x1vT21VHRuk0lOrCJHC5icZnWCV8tuxoGNm87i8YBzG5+Zil1QYTwxPlrbdxk6lJpR42GsNfxvsGqcGkE/Fb+0sZeAhP+mxnT7mqmGjJ82uY4ZeLfanPWPk4o2U0IT379Jp3h0pAUvzoDw5DMeAOG5aFV0Uac0l1cC5c4/grZEyg96eyhhzFTCfzvysdyupNFFGlU3ZUsFzTeGNpVzYLXP8PbmB7cxeDwDO7sk4aOvlGZ4NoHA2Lb8IvT3vqc2een6p/F X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(136003)(376002)(39860400002)(82310400008)(451199021)(1800799003)(186006)(46966006)(36840700001)(40470700004)(36860700001)(36756003)(86362001)(83380400001)(81166007)(921005)(356005)(82740400003)(40460700003)(40480700001)(6666004)(966005)(26005)(336012)(41300700001)(316002)(70206006)(4326008)(478600001)(110136005)(54906003)(2906002)(5660300002)(426003)(2616005)(47076005)(7416002)(8936002)(8676002)(70586007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:52:23.9633 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39316a0c-3a24-4e4b-1cc6-08db970a7928 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4443 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Add an optional AXI DMA property 'xlnx,irq-delay'. It specifies interrupt timeout value and causes the DMA engine to generate an interrupt after the delay time period has expired. Timer begins counting at the end of a packet and resets with receipt of a new packet or a timeout event occurs. This property is useful when AXI DMA is connected to the streaming IP i.e axiethernet where inter packet latency is critical while still taking the benefit of interrupt coalescing. Signed-off-by: Radhey Shyam Pandey Acked-by: Rob Herring --- Changes for v5: - New patch in this series. Just a note that dmaengine series was earlier sent as separate series[1] and now it's merged with axiethernet series[2]. [1]: https://lore.kernel.org/all/20221124102745.2620370-1-sarath.babu.naidu.gaddam@amd.com [2]: https://lore.kernel.org/all/20230630053844.1366171-1-sarath.babu.naidu.gaddam@amd.com - Switch to amd.com email address. --- Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt b/Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt index fea5b09a439d..590d1948f202 100644 --- a/Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt +++ b/Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt @@ -52,7 +52,9 @@ Optional properties for AXI DMA and MCDMA: Optional properties for AXI DMA: - xlnx,axistream-connected: Tells whether DMA is connected to AXI stream IP. - +- xlnx,irq-delay: Tells the interrupt delay timeout value. Valid range is from + 0-255. Setting this value to zero disables the delay timer interrupt. + 1 timeout interval = 125 * clock period of SG clock. Optional properties for VDMA: - xlnx,flush-fsync: Tells which channel to Flush on Frame sync. It takes following values: From patchwork Mon Aug 7 05:51:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13343038 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 62CA020F8 for ; Mon, 7 Aug 2023 05:52:54 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D2BB1711; Sun, 6 Aug 2023 22:52:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SUImmXVfyxZJOp4knzl/9pqSlqNntqNdTIEbMfvxnDTAFTYo0MAZm4Eo7E0XcQwFsxns76q4r5c+QsX/W0AaeqrDAE4gGTLdCsrsDzyGFwhVQF8+roNW+UKynb1ajavoD85Zuz+C0rmP82sU5Pkx4FBN1VQs1333cP03+inw9f/J80oipbP3ebqHH9Qqu8PEe1SlUKZzCJpQqO0+kbl81SNEGAehGvPNn16EYLH84hgBVD7XqNYVF8PSAg/IF7lv0jrpLNhr45CWhmykr5HEP6s1DMJbDf8cHtAwU9b5yxsh00odCV2Viw/bAY9/BACtzquixWvkkuclMhGMwBhUtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=maKd0XBrQrtfUNAiqhGM55X9ITlMGpwwevkmoWteh64=; b=W8xv/1I6RGvN/2/1ceeMKgJu3AQ7K7w6nPCF8f0dVfIQQcHGDc2BSAxDzEHdnrL7H7a8xXdImf/tKdCJxC8LpnpWX6n6QZHPG2swqKIQ/WfwLkHBg7YJMbzvotog1npLgOMG9g8VZ7t+7FAmosngDC3wMIe666R9aSfp7Qi/lVJaKKuwG5DB0pMQqugm2gDjXYyBhZXhenmWpLCF9728tXtp7dvGumJdcZ46WWCq+hepsakuuyNK2rz2v9q7sp3T8llChNEXQFKJ6iwu5gfwwP9o0rZl0awbC9NajPpRDpO4WTm6/ZLVGROjKrDoLPxIq5BzpZYwnT6RL/mtUd/DPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=maKd0XBrQrtfUNAiqhGM55X9ITlMGpwwevkmoWteh64=; b=J9VWjqFxVF0nithTwwTOGhiF5hhWgSI/w0W9hsAkxGYq8EV7KB6keIT5lUGOtX3rqnwgEOJGcoQ0VwhM9FVnhWU4IcptyKY7LWtrpqAlgA+nJzTuq6+o7n0VSgNsOGPjNYCbUXsq0K3EUStW3izlKqm4s49IM0mMmQjJAKYItxU= Received: from CYZPR05CA0009.namprd05.prod.outlook.com (2603:10b6:930:89::26) by MW3PR12MB4427.namprd12.prod.outlook.com (2603:10b6:303:52::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26; Mon, 7 Aug 2023 05:52:40 +0000 Received: from CY4PEPF0000E9D2.namprd03.prod.outlook.com (2603:10b6:930:89:cafe::76) by CYZPR05CA0009.outlook.office365.com (2603:10b6:930:89::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.15 via Frontend Transport; Mon, 7 Aug 2023 05:52:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D2.mail.protection.outlook.com (10.167.241.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Mon, 7 Aug 2023 05:52:43 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 00:52:36 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 00:52:23 -0500 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 7 Aug 2023 00:52:19 -0500 From: Radhey Shyam Pandey To: , , , , , , , , , CC: , , , , , , Radhey Shyam Pandey Subject: [PATCH net-next v5 03/10] dmaengine: xilinx_dma: Pass AXI4-Stream control words to dma client Date: Mon, 7 Aug 2023 11:21:42 +0530 Message-ID: <1691387509-2113129-4-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D2:EE_|MW3PR12MB4427:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ade9099-b0c3-4984-f380-08db970a847f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2WaHYWHHwZHk/spKTgxO+c0r/0CWgqF2HJflRstA7riA4KXjBXNXmxfI71eD+VAA2yPCxCxVvfA4FoCvliQvjpQO30/zTqZhluH98beJOtBQLGMgWF6RmQ7nw3p0nM/s0LJ2ILT2/880hUM6cyyV6nyBZXNjq+Ne5ovHv7vS8ZUE1ga1Ryh56S2H66gwqnCDKpV7cIRIsOBKIspK8e99Epjn3CEQ01Vnmgt1ttNl/U7qCztz9B5/b3FIUGkXmqhYkaOkSvmMbnDd112kmHWwl3tVfUgKu4CrwU/UNI/rFXpUtW3Tn9R281xIBQSI119HjSSHZIp8lPfaZalxz87lIm7lkTK6x/Kv1GSD7Gfx7W2TiK3+csglv5CSvl4s5oiJdh+nsdY+uyTuu84SSEroZabPOjRAU+jxqsX+hRllPrIndASyg58IZHU88SSdZDp2WiuawWKAZiqjvM8hk/eJeDQ7n+rg3u4lzwLzQj6/YHdvTn3j2wwfulcRlncW9JVRtgcxL1i34a+GJJ8nt02I320mybFNkaDx5BCy6vD7D28S0aHYvFV17H1Hvp0df1aGHkPThPhxHYinKO5xiV9BpM84D36xz0hvFV2NPQV1dHPmMJy4zD0xUv8kDfPfYMwalcyzQfTAxp9UkFfMNNeeXOQt7kV/8GbkE7IYuMz9QvR0YrFJ9BiKDS99Xi3WggBn/ViTlW1LF94YGGTYh9IvLr7JqpYGmLF+w5M4OmkmbvZRtJiPokLDLvf8GeQNfoYVMa26/T6SplI1lDepJkTsmtrI60u3NgVYqsEwID8RJyBuAhBoEWNtvO59cf6eHuWx X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(396003)(346002)(376002)(451199021)(186006)(82310400008)(1800799003)(40470700004)(46966006)(36840700001)(40480700001)(336012)(40460700003)(2616005)(36756003)(966005)(4326008)(316002)(86362001)(81166007)(478600001)(921005)(82740400003)(54906003)(110136005)(356005)(70206006)(70586007)(6666004)(41300700001)(26005)(426003)(8676002)(8936002)(47076005)(36860700001)(2906002)(7416002)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:52:43.0252 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ade9099-b0c3-4984-f380-08db970a847f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4427 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Read DT property to check if AXI DMA is connected to streaming IP i.e axiethernet. If connected i.e xlnx,axistream-connected property is present in the dma node then pass AXI4-Stream control words to dma client using metadata_ops dmaengine API. If not connected then driver won't support metadata_ops dmaengine API and continue to support all legacy usecases. Signed-off-by: Radhey Shyam Pandey --- Changes for v5: - New patch in this series. Just a note that dmaengine series was earlier sent as separate series[1] and now it's merged with axiethernet series[2]. [1]: https://lore.kernel.org/all/20221124102745.2620370-1-sarath.babu.naidu.gaddam@amd.com [2]: https://lore.kernel.org/all/20230630053844.1366171-1-sarath.babu.naidu.gaddam@amd.com - Modified the commit description to describe driver behavior when xlnx,axistream-connected is not present. - Switch to amd.com email address. --- drivers/dma/xilinx/xilinx_dma.c | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index ac09f0e5f58d..d526e472b905 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -493,6 +493,7 @@ struct xilinx_dma_config { * @s2mm_chan_id: DMA s2mm channel identifier * @mm2s_chan_id: DMA mm2s channel identifier * @max_buffer_len: Max buffer length + * @has_axistream_connected: AXI DMA connected to AXI Stream IP */ struct xilinx_dma_device { void __iomem *regs; @@ -511,6 +512,7 @@ struct xilinx_dma_device { u32 s2mm_chan_id; u32 mm2s_chan_id; u32 max_buffer_len; + bool has_axistream_connected; }; /* Macros */ @@ -623,6 +625,29 @@ static inline void xilinx_aximcdma_buf(struct xilinx_dma_chan *chan, } } +/** + * xilinx_dma_get_metadata_ptr- Populate metadata pointer and payload length + * @tx: async transaction descriptor + * @payload_len: metadata payload length + * @max_len: metadata max length + * Return: The app field pointer. + */ +static void *xilinx_dma_get_metadata_ptr(struct dma_async_tx_descriptor *tx, + size_t *payload_len, size_t *max_len) +{ + struct xilinx_dma_tx_descriptor *desc = to_dma_tx_descriptor(tx); + struct xilinx_axidma_tx_segment *seg; + + *max_len = *payload_len = sizeof(u32) * XILINX_DMA_NUM_APP_WORDS; + seg = list_first_entry(&desc->segments, + struct xilinx_axidma_tx_segment, node); + return seg->hw.app; +} + +static struct dma_descriptor_metadata_ops xilinx_dma_metadata_ops = { + .get_ptr = xilinx_dma_get_metadata_ptr, +}; + /* ----------------------------------------------------------------------------- * Descriptors and segments alloc and free */ @@ -2221,6 +2246,9 @@ static struct dma_async_tx_descriptor *xilinx_dma_prep_slave_sg( segment->hw.control |= XILINX_DMA_BD_EOP; } + if (chan->xdev->has_axistream_connected) + desc->async_tx.metadata_ops = &xilinx_dma_metadata_ops; + return &desc->async_tx; error: @@ -3067,6 +3095,11 @@ static int xilinx_dma_probe(struct platform_device *pdev) } } + if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { + xdev->has_axistream_connected = + of_property_read_bool(node, "xlnx,axistream-connected"); + } + if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { err = of_property_read_u32(node, "xlnx,num-fstores", &num_frames); @@ -3092,6 +3125,10 @@ static int xilinx_dma_probe(struct platform_device *pdev) else xdev->ext_addr = false; + /* Set metadata mode */ + if (xdev->has_axistream_connected) + xdev->common.desc_metadata_modes = DESC_METADATA_ENGINE; + /* Set the dma mask bits */ err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); if (err < 0) { From patchwork Mon Aug 7 05:51:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13343037 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 A98101C04 for ; Mon, 7 Aug 2023 05:52:53 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2079.outbound.protection.outlook.com [40.107.223.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46918171B; Sun, 6 Aug 2023 22:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=InrDuJY0t302wycHpLm5n4Jz3wU3MssAKz6sQJULk1hZkDtQhRIL+Xn5yMGJirLbo5zABRAar901jqtxoLA31lAkwWnKRqgmA9Bp2P3S/hPNOKrOIR5vDPwLX0R6YPZ9Ta4/XGNQsHyEeK2hKwVW2Zpo2BJuh4rcrL9cUONULbB6/+2Lt/SQ3RYNjt/AaD9G8XS6zpa3tjSi5fbnn27NiQa19+hx+UNlcLmi1ecuIEgHqKbd6J3L2nlk6Qld264yT9N3NdqsPQf8XlhLbahP9H4InTawX7jdXEMqQTNqxQ9khCXpgImvZI6fFAGRLtf5RVx/KVK8KKEM+Vtz2PF/yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=C4kmAr3BLf7v+CPfaK9S+TTv9wF6I3BI8aOmVeruI8Q=; b=krujImEwE4fVBETIsBjczIJ6r2I7MYE6W3QwXhlEaHGg1wdwsTo0CNNOTXfB8LHTOnCbBqowMYOIKS6k2YBzSH2vR5vhHblrRi2Hqmssyz4SmN7qVHNytwsg5byka/bj4/o/RWgMZtvUFkxksdJr7cQRnEyaFgaAFOya8B78cqFJqTqiXk4KpWG3tA6NiZ2iBdTxQNqPTGuDdmcc7BPAOBiDpzp8LVQ5IbrXgZrZeduU7TJ5x8ko5L3ExtdHRU3JGNg1kCyJUbQ7d/VAp5Co87pGTf/zbeyP26NnDYrdG4ctaneTjsBviQeo3XvYggxbI20VYmjwmlWDbk4WTwhRXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C4kmAr3BLf7v+CPfaK9S+TTv9wF6I3BI8aOmVeruI8Q=; b=Hi/ym1Xt19PBmMynyG/iru3s+Xi/1E6LkeVQ1R5FfyO9yPHy+WVVjmmwo87i24PRmjH4rYucPmED9NAQiKnAcuE+ow58oKFvzvTu0TelaTBa5L6cMKnXNUNFOpmVJmlEMefk7dnEzl0luetxVzi4ai7lGxcpS8NEKql1KR0t1vc= Received: from CYZPR05CA0021.namprd05.prod.outlook.com (2603:10b6:930:89::13) by PH8PR12MB7326.namprd12.prod.outlook.com (2603:10b6:510:216::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 05:52:43 +0000 Received: from CY4PEPF0000E9D2.namprd03.prod.outlook.com (2603:10b6:930:89:cafe::c) by CYZPR05CA0021.outlook.office365.com (2603:10b6:930:89::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.15 via Frontend Transport; Mon, 7 Aug 2023 05:52:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D2.mail.protection.outlook.com (10.167.241.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Mon, 7 Aug 2023 05:52:43 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 00:52:37 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sun, 6 Aug 2023 22:52:28 -0700 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 7 Aug 2023 00:52:24 -0500 From: Radhey Shyam Pandey To: , , , , , , , , , CC: , , , , , , Radhey Shyam Pandey Subject: [PATCH net-next v5 04/10] dmaengine: xilinx_dma: Increase AXI DMA transaction segment count Date: Mon, 7 Aug 2023 11:21:43 +0530 Message-ID: <1691387509-2113129-5-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D2:EE_|PH8PR12MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: 2b348bc0-c58c-4cd1-8cf7-08db970a84da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YfV60tsF4E8A+/p9IvI8TdsPKgE7R5cg3o/QpziSgbYx6mgDlf9zitzTMav5wDGpd1zTRoLl5E+d8nbbH1TYO/kV4IlnAqoZWCJ8wiAc28zgTBjH72SXpmjpjJ4+OR7ffMWfKCZFhqdOYyTs2N1ALOuIoF6TuW9vjiqw0lpwRtxuM6ToXk8M1Xvu+xk4ZkRzGPKbN4hppUR2yg+b2POSFnFugcN34oiEbxjYnI+7hMgj3JRCuj6VrOZsQXcAFKCHp6ZLu2/9AGwdx1EFjIMOBZ0WCkVOJZDUvdkVeS97FEdY3m/vbWdYhgeyD/MRd+iojcFZZjygRrd2b0QxLWQtplgYmsdWCjgOsNT3W3qyQvBjIhOy88kBRtvvCDL/diqjLCrtC9ytQGwQ5JCzV/zV3KhMjxPqacDXPlB1hb8Ca+z1fAf7ic6P7mZpMpGJoj2gDP+CNgCmq60c8VOElI3DBvvzAXbhWyh+NiVyksnZUulELLjdCeg/pSreYP8tVSiLi4m2J0OsnuaDzmpObfE3aAIWnhFjJz3pmVTHAxeOReCHMFVm0cVtrHSKwAQ2EuuM7y9WkqLSwVI56qinlI6DEbuLuNQeGqDjS+c8mDJSQ4lvMopruwb15ESxJnBr9iOeCXjuSHrxENLFPUiu2pHvyVkY2Da9P3GP0bU9tUGP4oHEBhbqCFm+TbIoZ9MNU2qYYsksQAHlSd0umxgJmofjVgi0rOGECwIPfXP0Orh5Gi5BojuWLbq7UnPNQTq3/OTgDxDXHGgwj4GMc4hZe2kjZuOpnndmz+r6nldqieO/KTE2RsxAxcNquGhA3lfVHfxB X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(396003)(376002)(136003)(39860400002)(1800799003)(186006)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(83380400001)(426003)(47076005)(36860700001)(2616005)(40460700003)(921005)(40480700001)(54906003)(110136005)(2906002)(4326008)(8936002)(316002)(5660300002)(8676002)(7416002)(336012)(70586007)(70206006)(86362001)(966005)(478600001)(81166007)(82740400003)(6666004)(356005)(41300700001)(36756003)(26005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:52:43.6345 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2b348bc0-c58c-4cd1-8cf7-08db970a84da X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7326 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Increase AXI DMA transaction segments count to ensure that even in high load we always get a free segment in prepare descriptor for a DMA_SLAVE transaction. Signed-off-by: Radhey Shyam Pandey --- Changes for v5: - New patch in this series. Just a note that dmaengine series was earlier sent as separate series[1] and now it's merged with axiethernet series[2]. [1]: https://lore.kernel.org/all/20221124102745.2620370-1-sarath.babu.naidu.gaddam@amd.com [2]: https://lore.kernel.org/all/20230630053844.1366171-1-sarath.babu.naidu.gaddam@amd.com - Switch to amd.com email address. --- drivers/dma/xilinx/xilinx_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index d526e472b905..7f3c57fbe1e3 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -178,7 +178,7 @@ #define XILINX_DMA_BD_SOP BIT(27) #define XILINX_DMA_BD_EOP BIT(26) #define XILINX_DMA_COALESCE_MAX 255 -#define XILINX_DMA_NUM_DESCS 255 +#define XILINX_DMA_NUM_DESCS 512 #define XILINX_DMA_NUM_APP_WORDS 5 /* AXI CDMA Specific Registers/Offsets */ From patchwork Mon Aug 7 05:51:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13343039 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 284C13D7B for ; Mon, 7 Aug 2023 05:52:57 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2061.outbound.protection.outlook.com [40.107.223.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11E2B1732; Sun, 6 Aug 2023 22:52:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b3dxiXP9z2Wtury/aH6+x0OEj/Lt5CKHSFhnYd0h2fGaSEh9oMau1uuGMEgjg/jnM1bQgL4x4NkBrZH+M9X/lxkfwCVuK3jtt9BC6HUpVjh2g/ImscD8r9eY9SsD0I+7u4rLRAMOwSJt4IH/FcJIVopIwYGa8FMIFYNqmhR5TEQl2sAtN6P2/4VTwEndGOdjTcvDcp7YGlMBlObOzUXxRzMDLuwoaOt45JOlPRh/avRjlhQndgiuuuapqyirofgafvS5GUdDEVEY5ylLQMDg4IbxRzDpxG0NvTAzZi62G62m363dNlyTl+MM6FeA2JTpNyiM/XQtZlwi1W1MkAgzsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OoT7yjUMcSpDetWkCNKKFM3dm40eVZSUVdW6CNBand4=; b=Xp39q7VwUA65wdA1d/pHOZRps96lMHB4CfCTiov2qnp/i8VmiQj395l6JjU05m+8Fv7Joeo15vE9A3qBPMD1aWHCL5jWH7ZGDo7v48pGpQ3riHNT0p7zG4pUiRZSLQ16ohJzOxNnFvHuEgbhLNBKDqZ5x6yFbZ+sC4RL3XWbP/ifC5GcoiO1rnRsQvfRvXHcw0SzP/QmSgJ1WFhbte0q4+P62LkZOOrKJcsqjf5TVUiaKPkSsjIFYjKF5hyHxd8yj3N7iPLgoMhGZREArTLVM8kzZD+owxNEMI/TodkdtGjQrYaiEkLoJprni+V1enRFJQCOtL0y1FTWzQF7GjEnGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OoT7yjUMcSpDetWkCNKKFM3dm40eVZSUVdW6CNBand4=; b=s7L+VmshQHzu2bT6yTrAZ7N70qSyomK9WYXW1Rgj2ggqA+eDdKZo6tXe3srF5ZSEWZ1QDHg66zQQn+/9k66qj1XDE6nrjnC/cGazuH9cLOpd1SGbvLUiyK7BQ0KPE4hSL68zTBcBGKvpv8uPqFs6WWfVQD58e3/+0quOdeWkxq4= Received: from SJ0PR13CA0195.namprd13.prod.outlook.com (2603:10b6:a03:2c3::20) by DM6PR12MB4546.namprd12.prod.outlook.com (2603:10b6:5:2ae::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26; Mon, 7 Aug 2023 05:52:45 +0000 Received: from CO1PEPF000044EE.namprd05.prod.outlook.com (2603:10b6:a03:2c3:cafe::a1) by SJ0PR13CA0195.outlook.office365.com (2603:10b6:a03:2c3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.16 via Frontend Transport; Mon, 7 Aug 2023 05:52:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1PEPF000044EE.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Mon, 7 Aug 2023 05:52:44 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 00:52:41 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sun, 6 Aug 2023 22:52:41 -0700 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 7 Aug 2023 00:52:37 -0500 From: Radhey Shyam Pandey To: , , , , , , , , , CC: , , , , , , Radhey Shyam Pandey Subject: [PATCH net-next v5 05/10] dmaengine: xilinx_dma: Freeup active list based on descriptor completion bit Date: Mon, 7 Aug 2023 11:21:44 +0530 Message-ID: <1691387509-2113129-6-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044EE:EE_|DM6PR12MB4546:EE_ X-MS-Office365-Filtering-Correlation-Id: e378a51d-7016-438c-ba99-08db970a8563 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: coxkfka5XRR62IMPeVO1Y4gIPHqUeW4tPMbqtvgDPxaUHLj9z86FwGi9WMGEPg89GX9H8k3oRh558a1MD0LgK9AgsJy2rOrKF3kH05KtTywYjOzfQXLatikGrQNvAFjeC7Db4gNjCgUlulmD1RpGAxcJzTCnY/ED1Kk52juLqCDPKpxqvGPk4zkz4wbv0DCjXWqRdTRVV9TD/7n+GQkfP0geY2LV++WYZ7BBBl9tYvJ026XxY0ndjDkAjlIn1jzQ68NkKkmoLlUskiq4Uc7ZFUrQwE7uDyX9fVcpsJiZFU8WxdykrHjsory/fNtRX/hs3B1dljBCSLK0jZrlSB0uGkZyldmCrJYLVTBVUBQzHIjdZut/knwpxhJrcuBMBF5OyezhjRKXZECwoki+PEmt44tZQaFX/x3YpAhWrgscu/baknMxvuv+yU8Ut2Q0F+zUcrPmaBXlvARfUrNFQxX7NhMoNjIZnhQ0HjRGm7yl974STYA8lw8P9v5E0NTLOxLWioo9p06N8ATg/nIfNdvFKJLPnMuWusfh8ealpEXtVWxXHqBH8X0O1XZlTGt3xpIBuDSDi3sIp7U+tUJS/0UQT2kfHEp6cUVOLOyeTWI4eJA0czYtaMJz9zqSJf2+pYhDF4t23GpE1WKyqefGHAD+/s2a5b0+1JzjWPoD3OZSrTibclyM4PeCrpg3zY6XmkHrbDyRTK6dPbeTbYuD1AOHxpc0PVCGKvH1XQ+IrB3laNYy/1VxkwwGhjno0mBZwvvHwwv6e5S1NRXgKJf2ZA6A5rkJdq9tqDIddIVc8BQlJiFFrFFQ5c2z91kUy8ITnLPK X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(396003)(39860400002)(376002)(136003)(346002)(451199021)(82310400008)(1800799003)(186006)(46966006)(36840700001)(40470700004)(966005)(40480700001)(26005)(40460700003)(36756003)(54906003)(110136005)(5660300002)(7416002)(86362001)(4326008)(2906002)(70206006)(70586007)(41300700001)(8936002)(8676002)(316002)(6666004)(921005)(356005)(478600001)(81166007)(82740400003)(2616005)(47076005)(36860700001)(426003)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:52:44.4711 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e378a51d-7016-438c-ba99-08db970a8563 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4546 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org AXIDMA IP in SG mode sets completion bit to 1 when the transfer is completed. Read this bit to move descriptor from active list to the done list. This feature is needed when interrupt delay timeout and IRQThreshold is enabled i.e Dly_IrqEn is triggered w/o completing interrupt threshold. Signed-off-by: Radhey Shyam Pandey --- Changes for v5: - New patch in this series. Just a note that dmaengine series was earlier sent as separate series[1] and now it's merged with axiethernet series[2]. [1]: https://lore.kernel.org/all/20221124102745.2620370-1-sarath.babu.naidu.gaddam@amd.com [2]: https://lore.kernel.org/all/20230630053844.1366171-1-sarath.babu.naidu.gaddam@amd.com - Switch to amd.com email address. --- drivers/dma/xilinx/xilinx_dma.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 7f3c57fbe1e3..3b721da827e0 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -177,6 +177,7 @@ #define XILINX_DMA_CR_COALESCE_SHIFT 16 #define XILINX_DMA_BD_SOP BIT(27) #define XILINX_DMA_BD_EOP BIT(26) +#define XILINX_DMA_BD_COMP_MASK BIT(31) #define XILINX_DMA_COALESCE_MAX 255 #define XILINX_DMA_NUM_DESCS 512 #define XILINX_DMA_NUM_APP_WORDS 5 @@ -1708,6 +1709,14 @@ static void xilinx_dma_complete_descriptor(struct xilinx_dma_chan *chan) return; list_for_each_entry_safe(desc, next, &chan->active_list, node) { + if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) { + struct xilinx_axidma_tx_segment *seg; + + seg = list_last_entry(&desc->segments, + struct xilinx_axidma_tx_segment, node); + if (!(seg->hw.status & XILINX_DMA_BD_COMP_MASK) && chan->has_sg) + break; + } if (chan->has_sg && chan->xdev->dma_config->dmatype != XDMA_TYPE_VDMA) desc->residue = xilinx_dma_get_residue(chan, desc); From patchwork Mon Aug 7 05:51:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13343040 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 C88753FFA for ; Mon, 7 Aug 2023 05:52:57 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2053.outbound.protection.outlook.com [40.107.93.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ED2B1736; Sun, 6 Aug 2023 22:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ogokvdz9FyeHnHomvLl6xbxMgi/LExbEILquMWCC5iEIfuYb2nAEzuTWQsArWyBVG3do3g+ztHbqJeLWqf9tSjvPksTmLoQ9tmWR+dWqboaGldcBADJY6WJl+TL8qiDhjBFSf3DXVdnHZdNZLX3YI73j9cZbYA5rgke3ZOOknL8vt9PavkH+kkBfwBttrFMPBG2v/PBHMqVCpVXg7AF5/2+ePBDavA6aez9S7kSXd20rPHKvLoiaAlwPEEgcA40IN89WhvHo92GLv+5sQDR2N7D19gV5dSxE+b6G+EoLeYeOVKZLjGDLFF+fcF/kOPpDr03czZIpfv2zoCjoYke42Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iIExSt6D/p0GQ4YgybFuMZp4GJRUC4R6qvzrhQd9fz4=; b=doADOnHUAouD5wIyU1jD+CCoqjh9OnouFK1QCeMthYI2ch4ievz44IhLG/I9oEWSSNMtUzAnVmmUPUrxC9HWNzbfYg5heGFftdehxEwtbauKWk/u9UzBWeBqnA6F17sfRcLEWEe/dxfUL3D0anqO4N93NCAkGWeqFhFlKIU/mxXGo3NqxVhQZGZUVUxmHM2gTFdFV/hpBiBIecDeQh2s6M7JiaZZnjmAkqtzk55Szc1JOd2IEJKsvpmnbtmpdoMzTKT6AZvTELcz24vu9MhWn/x2Kn0UJBGtCQfTNDT24LPaEZqjsQH1Glce+cRvqr9nIHAk2rcCl6hjY2uaIKvkWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iIExSt6D/p0GQ4YgybFuMZp4GJRUC4R6qvzrhQd9fz4=; b=pu1UOFZe67P72OgKB2wywSd5Sucq82LqNR00ZvtbiHntNSD+0L3+UkaqFa3RZrcrEow1s5kfrbYnQGHKE+xjln8f6ANzXjva2QEk1ou+bXtA80eVf7xnoFguV1+Jwt4JFYZlzZvtfPIC7RZJckdziiGeX69ES0Be9iC0IWMD1Wc= Received: from SJ0PR13CA0208.namprd13.prod.outlook.com (2603:10b6:a03:2c3::33) by CY5PR12MB6526.namprd12.prod.outlook.com (2603:10b6:930:31::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26; Mon, 7 Aug 2023 05:52:47 +0000 Received: from CO1PEPF000044EE.namprd05.prod.outlook.com (2603:10b6:a03:2c3:cafe::f2) by SJ0PR13CA0208.outlook.office365.com (2603:10b6:a03:2c3::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.15 via Frontend Transport; Mon, 7 Aug 2023 05:52:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1PEPF000044EE.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Mon, 7 Aug 2023 05:52:49 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 00:52:46 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sun, 6 Aug 2023 22:52:45 -0700 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 7 Aug 2023 00:52:41 -0500 From: Radhey Shyam Pandey To: , , , , , , , , , CC: , , , , , , Radhey Shyam Pandey Subject: [PATCH net-next v5 06/10] dmaengine: xilinx_dma: Use tasklet_hi_schedule for timing critical usecase Date: Mon, 7 Aug 2023 11:21:45 +0530 Message-ID: <1691387509-2113129-7-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044EE:EE_|CY5PR12MB6526:EE_ X-MS-Office365-Filtering-Correlation-Id: 6391a4c5-f507-419e-3489-08db970a8868 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SRZ70rxG5ykNrlUoUOA3Z5oBplZXBBWeDjdgot0YugGUruGf2Ns4QPf7eo9HMGNJqrsicLUPaZM4TzHdKohQK1MblnnyvtXCWymLqiRZF333t9NOErZYKMfUpOcUZ196tKfgEhswcP0G5jUjDjNQKeFvsEUSF0cJ7Tv6pLWH8ynrLyIty6nCDGpEXuYSnlvp52K20Gr+tmihuUKXUDwCczSTU1dWGq7jB9c1PLz7akKOjE0rG3elYSEKoaQEDEIUtVMIJFO8GfGHrcely5afrsNnEtCBRPIT+g7VfsT6Mb/0pfDj2dB611NK2BJPYJFQ3oOZs9LHRTxQ7+XaiU2mdC9yVUFQYwklYhTyeiXZiRpzYkzR8lpleF30zBihsURU8goSntkLZVx7lhKF9S3sWivU6G6tSVx7gp4POnALjw2tqaq/6QJ30fZS6oF8rL7wSdCvYPE5I8UE61squzu0aEI1arTy5HNcAx6LlyehNBSH53VK3RE7EUxGTb7QkDL5nFU2HQExMqtb5uQjephykZT0Hh07G1dJ6ZfLaumRhbJ/EUB6KED/6FaIuJJdXn+9sBVpEwyxmwxiKkuPD9LXFxOdCoksh4A6ZArAM0kvL3IS0aO4Ppbg69ubnuXdBXUJ9+KT+9aFsuDcOoStyyEfqd43XRvbxcrwPdHerTRr/MuCNL9hbcF3DdC/W2afPxRypdfBtMeSoADyAODjoHAGjOfINJwqgYwrpBbIjpXkJNEu50qa4A14wnBKHC5/cu/PHwa2bHmMlDWUUlj80a4+nwjQTEhRi2kLx68QS9VFmlji0CVy5uK5SEBcf7elSy+p X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(396003)(39860400002)(346002)(136003)(82310400008)(451199021)(186006)(1800799003)(46966006)(40470700004)(36840700001)(86362001)(40480700001)(41300700001)(336012)(478600001)(40460700003)(8676002)(8936002)(26005)(7416002)(426003)(2616005)(5660300002)(47076005)(83380400001)(2906002)(36756003)(54906003)(110136005)(36860700001)(316002)(356005)(966005)(70206006)(70586007)(921005)(81166007)(4326008)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:52:49.5180 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6391a4c5-f507-419e-3489-08db970a8868 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6526 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Schedule tasklet with high priority to ensure that callback processing is prioritized. It improves throughput for netdev dma clients. Signed-off-by: Radhey Shyam Pandey --- Changes for v5: - New patch in this series. Just a note that dmaengine series was earlier sent as separate series[1] and now it's merged with axiethernet series[2]. [1]: https://lore.kernel.org/all/20221124102745.2620370-1-sarath.babu.naidu.gaddam@amd.com [2]: https://lore.kernel.org/all/20230630053844.1366171-1-sarath.babu.naidu.gaddam@amd.com - Switch to amd.com email address. --- drivers/dma/xilinx/xilinx_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 3b721da827e0..6c1c63a38f70 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -1850,7 +1850,7 @@ static irqreturn_t xilinx_mcdma_irq_handler(int irq, void *data) spin_unlock(&chan->lock); } - tasklet_schedule(&chan->tasklet); + tasklet_hi_schedule(&chan->tasklet); return IRQ_HANDLED; } From patchwork Mon Aug 7 05:51:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13343041 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 BDE6F1382 for ; Mon, 7 Aug 2023 05:53:13 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 897A610F6; Sun, 6 Aug 2023 22:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TJxEYtlJaBy6nCPNeHT0lTvf1gDWWe0fQ7GJNXDrcHZUNJPPr6e2JfB3tBhB/R8jZTjQd6LaLtea75YZvT556eR33ewvq97mfAJA+dFL1FLURj6y7nNCd+Ti4kf+pS4sm4YFfGuaKWmElYuhyeJk/nyacMy0uYcyGs7Y1pbyz8El9yF5+AHupvqyaEk3KGsUyEy4l6RIenuzQJ3fFZM1X5eAWs/t+QQ8i0ACQtUhS1c1xMLEGS09qo5+CMR1gLPmIhzT73HOrKyq0krGd9whclIUv7b6Tee8KnkIEKXHSdSdxgGFcTmYAxIgQQ2PU7IdrxNPuouYCYCiwok1SOtbXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bVkuV+hqzWMGKNn2qVg35oaPk+pWRr1972EbPaetRCY=; b=D7ORaN7id/mqfOiGnOsuACHLor9syq7J5rW+nKU79QKRWJVvmLNt1fe0ZDAy1sgJXTsMCKR3pjjI8i9tKAXHA8r+4nI0JKvaY2VW1IkdEX7dmf59JzJJ53Fd4BeH4E5uNs+ojwgFm7r2n7hBtEvGY6Gh+IlSdLtpsA0aVP/3WF70MPAXTPOBYqVMurxU4fZ5Oo2IpoctHIvKHKIwcv1cWwPX/9qOY+rjo9IkHeotlMXP17093Fe0jWRiMkl3IdR5MuYCY6lRXDLqXvggUnHz7XX/mxqYHa7NpMApURW3uPS7l6QGKGiFlcwkKriIldSlkOC7LQ719vnJnK24yfdO2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bVkuV+hqzWMGKNn2qVg35oaPk+pWRr1972EbPaetRCY=; b=YyIFDYdVnyqhSDttylbPUzsr2uu4jjClru/42epFZjorxl5CgVNIkHdTa63JPrnXpM/xeLhaYXkNCP34tE79NfbrGzpM2NsLhwq+GJnTZbORtRyQTH9/Psv2QYo7k/kUMjMeMHllO6q9gSZHqNcjonJJjTugsqIRtpqCXvW7Gic= Received: from SJ0PR05CA0032.namprd05.prod.outlook.com (2603:10b6:a03:33f::7) by DS0PR12MB8218.namprd12.prod.outlook.com (2603:10b6:8:f2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26; Mon, 7 Aug 2023 05:53:08 +0000 Received: from CO1PEPF000044F5.namprd05.prod.outlook.com (2603:10b6:a03:33f:cafe::dc) by SJ0PR05CA0032.outlook.office365.com (2603:10b6:a03:33f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.19 via Frontend Transport; Mon, 7 Aug 2023 05:53:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1PEPF000044F5.mail.protection.outlook.com (10.167.241.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Mon, 7 Aug 2023 05:53:02 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 00:53:01 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sun, 6 Aug 2023 22:52:50 -0700 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 7 Aug 2023 00:52:46 -0500 From: Radhey Shyam Pandey To: , , , , , , , , , CC: , , , , , , Radhey Shyam Pandey Subject: [PATCH net-next v5 07/10] dmaengine: xilinx_dma: Program interrupt delay timeout Date: Mon, 7 Aug 2023 11:21:46 +0530 Message-ID: <1691387509-2113129-8-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F5:EE_|DS0PR12MB8218:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c558b65-d473-497b-d684-08db970a901d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rd+gwZCgwjw7Ay2oflc8yU3V5YTx/tvaamwFbFIltpyjbvyumShHBRTeKrK+e2rSV1c0JZm63a+Ih6re3HEg4ML44snFs0oZLUfrfgwe2H7g5fDp+oTMniZ8yvgvDbnwm1f6waoiotwR9c3GdQ662xzcRqEyH0/MnA2RV3hPWYXKF0eFuvnJmyPRM4wzVUmA2bt+Lz+vpOSbCw8REKKC2GsRRN0PGD1AKbV7+Z7U8eNwRb88wzKhVwC34DKayNrBEP8AmysWe4TYYtrwFqu0f96cUiqyXdos7NOjynDw9A99RUO1wm0CgFNRznJess8W7vUJAq6r13AtINsOgpmavrs1NvLSrIeNQWOIuUvvIwohu5CAq7Mb0zhq3cTqwC1719ahvDa1Gu2a7DSGFhpFmWYWGBleLl8VzVkLiG7qDAyaK9LehV74WNPnVFfh9vk3MW3QkLoKHdVxyWtXCATSUBR3Jp3tk5L+Km3EVJv/EvLF3twvrWpZs1TzNJv8EDvOEz5IOFgKzByvzxSHg3BZi36pU/MPotT4e7TrSqoKlQLXTs5W0azoe9hYuJgQftdUr5unRS/yqpunB3wCU27/WAgxTeWSGBUm+DB9Ne5LdjCUpXglsOQF3bRI576teeZl9NmAPhLK0iMYgE4mXpkxb14rcCfcqP8Fy0cGwRUru1i36M6jzRilLznoTUxzISXShPbJt+HHrru53I8sSKP//lfkGTYzZO1LqMSv+ERxz+chcuClahwOmlnOrj4R8+T4Nn9nHo+EOBZHs61QfmR4RzxIdmLJF2WRF/aKVvSKgbIRcAh3dMXuN7Oj99MlU3c4 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(39860400002)(396003)(136003)(82310400008)(186006)(1800799003)(451199021)(40470700004)(46966006)(36840700001)(426003)(41300700001)(26005)(2906002)(5660300002)(83380400001)(7416002)(36860700001)(47076005)(8936002)(8676002)(2616005)(40460700003)(40480700001)(336012)(81166007)(478600001)(86362001)(921005)(316002)(82740400003)(356005)(110136005)(54906003)(70586007)(70206006)(4326008)(966005)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:53:02.4836 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c558b65-d473-497b-d684-08db970a901d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8218 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Program IRQDelay for AXI DMA. The interrupt timeout mechanism causes the DMA engine to generate an interrupt after the delay time period has expired. It enables dmaengine to respond in real-time even though interrupt coalescing is configured. It also remove the placeholder for delay interrupt and merge it with frame completion interrupt. Since by default interrupt delay timeout is disabled this feature addition has no functional impact on VDMA, MCDMA and CDMA IP's. Signed-off-by: Radhey Shyam Pandey --- Changes for v5: - New patch in this series. Just a note that dmaengine series was earlier sent as separate series[1] and now it's merged with axiethernet series[2]. [1]: https://lore.kernel.org/all/20221124102745.2620370-1-sarath.babu.naidu.gaddam@amd.com [2]: https://lore.kernel.org/all/20230630053844.1366171-1-sarath.babu.naidu.gaddam@amd.com - Modified commit description to add "MCDMA" along with VDMA and CDMA IP. - Switch to amd.com email address. --- drivers/dma/xilinx/xilinx_dma.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 6c1c63a38f70..e9f70cad4934 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -173,8 +173,10 @@ #define XILINX_DMA_MAX_TRANS_LEN_MAX 23 #define XILINX_DMA_V2_MAX_TRANS_LEN_MAX 26 #define XILINX_DMA_CR_COALESCE_MAX GENMASK(23, 16) +#define XILINX_DMA_CR_DELAY_MAX GENMASK(31, 24) #define XILINX_DMA_CR_CYCLIC_BD_EN_MASK BIT(4) #define XILINX_DMA_CR_COALESCE_SHIFT 16 +#define XILINX_DMA_CR_DELAY_SHIFT 24 #define XILINX_DMA_BD_SOP BIT(27) #define XILINX_DMA_BD_EOP BIT(26) #define XILINX_DMA_BD_COMP_MASK BIT(31) @@ -411,6 +413,7 @@ struct xilinx_dma_tx_descriptor { * @stop_transfer: Differentiate b/w DMA IP's quiesce * @tdest: TDEST value for mcdma * @has_vflip: S2MM vertical flip + * @irq_delay: Interrupt delay timeout */ struct xilinx_dma_chan { struct xilinx_dma_device *xdev; @@ -449,6 +452,7 @@ struct xilinx_dma_chan { int (*stop_transfer)(struct xilinx_dma_chan *chan); u16 tdest; bool has_vflip; + u8 irq_delay; }; /** @@ -1561,6 +1565,9 @@ static void xilinx_dma_start_transfer(struct xilinx_dma_chan *chan) if (chan->has_sg) xilinx_write(chan, XILINX_DMA_REG_CURDESC, head_desc->async_tx.phys); + reg &= ~XILINX_DMA_CR_DELAY_MAX; + reg |= chan->irq_delay << XILINX_DMA_CR_DELAY_SHIFT; + dma_ctrl_write(chan, XILINX_DMA_REG_DMACR, reg); xilinx_dma_start(chan); @@ -1898,15 +1905,8 @@ static irqreturn_t xilinx_dma_irq_handler(int irq, void *data) } } - if (status & XILINX_DMA_DMASR_DLY_CNT_IRQ) { - /* - * Device takes too long to do the transfer when user requires - * responsiveness. - */ - dev_dbg(chan->dev, "Inter-packet latency too long\n"); - } - - if (status & XILINX_DMA_DMASR_FRM_CNT_IRQ) { + if (status & (XILINX_DMA_DMASR_FRM_CNT_IRQ | + XILINX_DMA_DMASR_DLY_CNT_IRQ)) { spin_lock(&chan->lock); xilinx_dma_complete_descriptor(chan); chan->idle = true; @@ -2833,6 +2833,8 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev, /* Retrieve the channel properties from the device tree */ has_dre = of_property_read_bool(node, "xlnx,include-dre"); + of_property_read_u8(node, "xlnx,irq-delay", &chan->irq_delay); + chan->genlock = of_property_read_bool(node, "xlnx,genlock-mode"); err = of_property_read_u32(node, "xlnx,datawidth", &value); From patchwork Mon Aug 7 05:51:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13343042 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 E5D101382 for ; Mon, 7 Aug 2023 05:55:47 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2051.outbound.protection.outlook.com [40.107.237.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 919761738; Sun, 6 Aug 2023 22:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GF1YtN/31VOUPEWFv188X6FxB/OsRNne+L4qYDl99eIsCho04lOfzd+euqdvwbrUHrmyOm6fTI0kdmYz2hqWqqSF8PGMp6WVhi69snptXN0iBRMTGuEbE6zMh78EoDwKH7j8mUkglRlYsA/05yBFPQn5FjpIeYWv9IMBJpyoiacpI77DtMArUoJBg0m82s59UUnp9TsYnNwK8Il1ellBOdgWe37WTydojm3z/zi7flj6XEwOeCVTtP+CRYiAKGfBQYCxBeNIQDUWWyoWM0b84fNr2myzfJswdA/pr1YUV64VzbIh/U/sUHtZVRyeT/asa31QkHK8EKplVAaEm59vpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DH5HNF3SYI/mo7vTYwjLBKWqRKJFhjR9igkOvw3DC7w=; b=UzdRCZRNAy5i+E8AAnNDsF/ZbLEYrT0a/pmoqZ1tXlTpf/WUa03rKWCJI5Xgy42ewshceoCDTQafr6R6m0/ToaHvfVJ4s7cQBZyijpgpJKl6K8jjtBmbyjX/9yBZO/SId+0a9KePu3ZUMfm35NSR7PpZxON4bq0gN6sDab9Aw2MtawYnsZ5ooNVtTFmjg6yFKWWl+Y9aGAaN9SElQA/HhwPr9dOvEXvwkElq9ZPhvINQ1sC3lJGTwr+FToDccX/P4laeMqqje5QLlLLaYJzqMNEbaICVU0qN+RP4HDmK0RdZzU6E2D7n6N3qhM7FNu1HPsR7hL5KFTMY6wZOyxtUWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DH5HNF3SYI/mo7vTYwjLBKWqRKJFhjR9igkOvw3DC7w=; b=hZy0Pgxprpiveow40xiDdRTX688/aBinjuCPweYfs9rSbUUzq609agf2o5wlKeQjn06AkK+aoJF+7qX0ALpOlg3/zcAxMyKhOL1o/Y+RDCUlia+rr8RoK0uc2Ho+h4ztm77or3SEdGRcVklo85JZ86ZA3YOIfmDf5C2DFC+w7QQ= Received: from SA1PR03CA0018.namprd03.prod.outlook.com (2603:10b6:806:2d3::29) by MW6PR12MB8760.namprd12.prod.outlook.com (2603:10b6:303:23a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.20; Mon, 7 Aug 2023 05:54:06 +0000 Received: from SN1PEPF0002529F.namprd05.prod.outlook.com (2603:10b6:806:2d3:cafe::48) by SA1PR03CA0018.outlook.office365.com (2603:10b6:806:2d3::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27 via Frontend Transport; Mon, 7 Aug 2023 05:54:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF0002529F.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Mon, 7 Aug 2023 05:54:05 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 00:53:05 -0500 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 7 Aug 2023 00:53:01 -0500 From: Radhey Shyam Pandey To: , , , , , , , , , CC: , , , , , , Radhey Shyam Pandey Subject: [PATCH net-next v5 08/10] dt-bindings: net: xlnx,axi-ethernet: Introduce DMA support Date: Mon, 7 Aug 2023 11:21:47 +0530 Message-ID: <1691387509-2113129-9-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529F:EE_|MW6PR12MB8760:EE_ X-MS-Office365-Filtering-Correlation-Id: 11b521e2-6287-4683-71cb-08db970ab5cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JpQ6tFx0hgmQvmbwyNjxYG+I8lJT4Sw22l7a6ULPVphM3VN6Rqjm0fUrO3PuRRCVNymYGKOFbDli3V5hEqg6qoA0MJtvf/YF1/Qz15rAkTpJe2QNwXj2xjBlNv+5MRYn0Nxyz3/1ozmfOYhFSf7fA6P4MtoKmzAQ4Anfjs6lDiLVqLtQQX8GfTySLRyCw+8Mz6mHiyhn3VGeZB8HR6DcPtcIrPa4h0luDdodyANvLQRVYDtEPctlRbQXIAEPc3HjHhMGptjEo5hHw1r43nRrv238eWPpeMJITzS43AjHYInS7JLlo1Je0tZbV8l/Tf9t6eOMWmTXJd4e587gDae09VjGW43aDfO9NESduvrEvjMFnq/dyd7tkDVWS36lqYIcup+KhgE45V2JyIlg9MfQLbs3pmsDEuv8400DnHK5uR8rJd1rmRpbkdYWHHYxlNDx2kNK3fOLZJULo+caoBl7IoZnNigZ9/JLg6wFkp+IpT9Gd8CnnDQUJ0Tz/Jwh39LYx2o+XfXwLx1rI0B273HVMWNeENrh9XpW7Xi6Khg1joEQ768gF3yrTTsos1+pwNG1uA8d3/zsHSeO48jDPKheij61Bdzpqw2p8bXsw5uNRUvBu3ECLBvego7QtaeuXopnCGzF6gC1zv3P3is5OOSRJmt7LsDZkpY5/FJRRHLI3CcqXAT/RjRDz8z0O2m4LxDOQugzIZ+KFfsjHZy6Blzloh1QutwqtTOvZKS013NX7p/95L2h1fcel63by0JY5u0PX+okfv3DQyLOLkUVtRoTnNS5yARygZSWtEmVjfexo2E= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(376002)(136003)(39860400002)(186006)(1800799003)(451199021)(82310400008)(46966006)(36840700001)(40470700004)(70586007)(70206006)(2616005)(426003)(316002)(4326008)(5660300002)(40480700001)(40460700003)(336012)(41300700001)(7416002)(26005)(8676002)(8936002)(81166007)(86362001)(921005)(6666004)(110136005)(478600001)(82740400003)(2906002)(36756003)(47076005)(54906003)(36860700001)(356005)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:54:05.7908 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11b521e2-6287-4683-71cb-08db970ab5cb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002529F.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8760 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Xilinx 1G/2.5G Ethernet Subsystem provides 32-bit AXI4-Stream buses to move transmit and receive Ethernet data to and from the subsystem. These buses are designed to be used with an AXI Direct Memory Access(DMA) IP or AXI Multichannel Direct Memory Access (MCDMA) IP core, AXI4-Stream Data FIFO, or any other custom logic in any supported device. Primary high-speed DMA data movement between system memory and stream target is through the AXI4 Read Master to AXI4 memory-mapped to stream (MM2S) Master, and AXI stream to memory-mapped (S2MM) Slave to AXI4 Write Master. AXI DMA/MCDMA enables channel of data movement on both MM2S and S2MM paths in scatter/gather mode. AXI DMA has two channels where as MCDMA has 16 Tx and 16 Rx channels. To uniquely identify each channel use 'chan' suffix. Depending on the usecase AXI ethernet driver can request any combination of multichannel DMA channels using generic dmas, dma-names properties. Example: dma-names = tx_chan0, rx_chan0, tx_chan1, rx_chan1; Signed-off-by: Radhey Shyam Pandey Reviewed-by: Krzysztof Kozlowski --- Changes for v5: - Modified commit description to remove dmaengine framework references and instead describe how axiethernet IP uses DMA channels. - Fix "^[tr]x_chan[0-9]|1[0-5]$" -> "^[tr]x_chan([0-9]|1[0-5])$" - Drop generic dmas description. - Use amd.com email address. Changes for v4: - Updated commit description about tx/rx channels name. - Removed "dt-bindings" and "dmaengine" strings in subject. - Extended dmas and dma-names to support MCDMA channel names. - Remove "driver" from commit message. - Use pattern/regex for dma-names property. Changes for v3: - Reverted reg and interrupts property to support backward compatibility. - Moved dmas and dma-names properties from Required properties. Changes for v2: - None. --- .../bindings/net/xlnx,axi-ethernet.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/net/xlnx,axi-ethernet.yaml b/Documentation/devicetree/bindings/net/xlnx,axi-ethernet.yaml index 1d33d80af11c..bbe89ea9590c 100644 --- a/Documentation/devicetree/bindings/net/xlnx,axi-ethernet.yaml +++ b/Documentation/devicetree/bindings/net/xlnx,axi-ethernet.yaml @@ -122,6 +122,20 @@ properties: and "phy-handle" should point to an external PHY if exists. maxItems: 1 + dmas: + minItems: 2 + maxItems: 32 + description: TX and RX DMA channel phandle + + dma-names: + items: + pattern: "^[tr]x_chan([0-9]|1[0-5])$" + description: + Should be "tx_chan0", "tx_chan1" ... "tx_chan15" for DMA Tx channel + Should be "rx_chan0", "rx_chan1" ... "rx_chan15" for DMA Rx channel + minItems: 2 + maxItems: 32 + required: - compatible - interrupts @@ -143,6 +157,8 @@ examples: clocks = <&axi_clk>, <&axi_clk>, <&pl_enet_ref_clk>, <&mgt_clk>; phy-mode = "mii"; reg = <0x40c00000 0x40000>,<0x50c00000 0x40000>; + dmas = <&xilinx_dma 0>, <&xilinx_dma 1>; + dma-names = "tx_chan0", "rx_chan0"; xlnx,rxcsum = <0x2>; xlnx,rxmem = <0x800>; xlnx,txcsum = <0x2>; From patchwork Mon Aug 7 05:51:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13343043 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 927671845 for ; Mon, 7 Aug 2023 05:55:50 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2079.outbound.protection.outlook.com [40.107.94.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C9691989; Sun, 6 Aug 2023 22:55:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LpKmaxjXVd5oWiYZoI11INMjDulGzT77La/6fEovf4nlfM9xYVnFFa+SzCU5ns2RLWgAJzEDzPXBrsZ/Jc/S8bmVA5chXdXbALm/ptkhrTvvHOtuHJ/E+n+QUf9GaRrv5X3eU6GzaKvdWLEl0NNQx/oTxl5jb/smTEEO38dM7eTALjnSUoir3DpRAA+jTs5HNthOF2GqdGkJ6XXGm58intWPNfU+p/TOLS43qIY6OjCTMMciPSZGIU8TWppw91wGUNPIEmj2gByqdMO+0BAJ5CEKDQRlHEwm/Ekgp1AT5tjWXzl3whkrS44UcGoRzTNSx1GxR/hhJ0tkXdk4+okJKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p5lz0i39971gVN1YorGg6V56PQdFkzyeERx2LnSVCH4=; b=k9AjKe7rI0dHRARcl65hI8obiuokpTErN8JVRdD2ZuUGdNi+XRRVkGac+uYmwI1VtfFB2Axo/2nAAx5u4BSUWPGhDocjlHyeXU3rEVFVx2mzJwbs+U4sf+mkDneQY/gvntym+Jdl1jT/Bq1qkbnR2dyTBcueqtqUAEKfGvVrQS5n9kESsuCCSMD9d8tu/xJYC3pZRSYWd6hTQWH77lX4irGhOzv4J+XBqFut3OCxhuQQYOmsMrYlz1ZjneMDIFCmRBRlD6hGc08C/BLxRBtk/dPG3/SvaUnJigHdJ+tAki6EB0y6df+T9T/f3Gs9fZH0gSAV7jCdYngdzOA7R61ggA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p5lz0i39971gVN1YorGg6V56PQdFkzyeERx2LnSVCH4=; b=lOOViVwFMScD3JX9enf/P2j7TGArWvw/22tK+dJZRLnxW8oSBd7TJ2hAqHglTwTkmDgqmUvd6lbXo8qE7kMuTWx79DjOOm5ankJlbNFwkSO5muRH9V23gj6oqALjsrzqCM+gz2D1okPZbz5B5wy1SQZpUiY7FG6BRt5NTbN639Q= Received: from SN7PR04CA0047.namprd04.prod.outlook.com (2603:10b6:806:120::22) by SA1PR12MB6993.namprd12.prod.outlook.com (2603:10b6:806:24c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26; Mon, 7 Aug 2023 05:54:05 +0000 Received: from SN1PEPF0002529E.namprd05.prod.outlook.com (2603:10b6:806:120:cafe::ca) by SN7PR04CA0047.outlook.office365.com (2603:10b6:806:120::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27 via Frontend Transport; Mon, 7 Aug 2023 05:54:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF0002529E.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.20 via Frontend Transport; Mon, 7 Aug 2023 05:54:08 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 00:53:59 -0500 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 7 Aug 2023 00:53:39 -0500 From: Radhey Shyam Pandey To: , , , , , , , , , CC: , , , , , , Sarath Babu Naidu Gaddam , Radhey Shyam Pandey Subject: [PATCH net-next v5 09/10] net: axienet: Preparatory changes for dmaengine support Date: Mon, 7 Aug 2023 11:21:48 +0530 Message-ID: <1691387509-2113129-10-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529E:EE_|SA1PR12MB6993:EE_ X-MS-Office365-Filtering-Correlation-Id: 43845fcf-756c-4a3e-de1e-08db970ab737 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nsuv0rdP86pRvFIqXiZob5EsOq6isF2zskIPHErARc/HrRE0K05bKPdRCVIVDyPKB5Qs/A8fdjR/1g1nzE/XYhMsjn8bwvWvwot4s+zsszAI420MNf/2BdWmr4sg9zuPDs2b9biL1Mt2A+5dGx7BTktbDBwGKJj1ikGKO0kDToNCi+KCSgTQO9/1iLpeFcpMvIxPlUqnM+2oviHvIqIriEclySMmy1qDfHhz2Ei3m9zyTJeVPjBdQ/YrVXfvAV8okcDMdZlwXxzMlG74hEoV9Mc/hntPxSbMjwnQ0TZI+Ym7R41hIKQS5PYbgNuMX1rxF30GF9wUOaW/Cn9MgOJ6iKPSgUjOSnPGx3mif4c1axEfVu7VYAKF4S5IpXiC8rlNUaqQql6iy4gQjaOp3pRSL/lIQi0Nq1slDiFcYZXFU/2VFxea8Hsn6AlaAaHLvPmDkH9m1rGs3qFW/9+oHF3T++j5vQh1FL0MKm7oa2xkdMX9926yBEEL5mo2kzejyXCwf9KCNxMDe1yja4ZxZCWkbweTjPQoZpUyd+KpLyAoesogTpH+QgfJia6vz8gxbl8/H9oGtrLXD1P030csmVdak2u/GwMLNQwLiqz0ig0/DkHBlGcvRqJ5XPAUd/hLxOdRdwNmnWgG4X8cehnt16Isf9g49dwgLBF//WyJ+LHBOLlKrBiHiVy5Ks6X6Z7hm21kcR4Ag2qOHHcSYOvis7q46WsqznfbMlVUJUiPfprwvZi8g6Qa8F6GBzDmGR4IG6bP4A5Hshi8VfSj230YbwadYbMZzXTBzpWjd/wadFnHqRE= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(39860400002)(346002)(396003)(186006)(1800799003)(451199021)(82310400008)(40470700004)(46966006)(36840700001)(47076005)(4326008)(2906002)(70206006)(70586007)(336012)(6666004)(83380400001)(5660300002)(36860700001)(7416002)(41300700001)(8936002)(316002)(8676002)(30864003)(40480700001)(81166007)(921005)(356005)(2616005)(54906003)(110136005)(426003)(478600001)(82740400003)(36756003)(26005)(86362001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:54:08.1791 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43845fcf-756c-4a3e-de1e-08db970ab737 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002529E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6993 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org From: Sarath Babu Naidu Gaddam The axiethernet driver has inbuilt dma programming. In order to add dmaengine support and make it's integration seamless the current axidma inbuilt programming code is put under use_dmaengine check. It also performs minor code reordering to minimize conditional use_dmaengine checks and there is no functional change. It uses "dmas" property to identify whether it should use a dmaengine framework or inbuilt axidma programming. Signed-off-by: Sarath Babu Naidu Gaddam Signed-off-by: Radhey Shyam Pandey --- Changes for v5: - Fix git apply failure due to commit f1bc9fc4a06de0108e0dca2a9a7e99ba1fc632f9 Changes for v4: - Renamed has_dmas to use_dmaegine. - Removed the AXIENET_USE_DMA. - Changed the start_xmit_** functions description. Changes for v3: - New patch --- drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 + .../net/ethernet/xilinx/xilinx_axienet_main.c | 313 +++++++++++------- 2 files changed, 188 insertions(+), 127 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index 575ff9de8985..3ead0bac597b 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h @@ -435,6 +435,7 @@ struct axidma_bd { * @coalesce_usec_rx: IRQ coalesce delay for RX * @coalesce_count_tx: Store the irq coalesce on TX side. * @coalesce_usec_tx: IRQ coalesce delay for TX + * @use_dmaengine: flag to check dmaengine framework usage. */ struct axienet_local { struct net_device *ndev; @@ -499,6 +500,7 @@ struct axienet_local { u32 coalesce_usec_rx; u32 coalesce_count_tx; u32 coalesce_usec_tx; + u8 use_dmaengine; }; /** diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 8e32dc50a408..36c77248a55e 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -588,10 +588,6 @@ static int axienet_device_reset(struct net_device *ndev) struct axienet_local *lp = netdev_priv(ndev); int ret; - ret = __axienet_device_reset(lp); - if (ret) - return ret; - lp->max_frm_size = XAE_MAX_VLAN_FRAME_SIZE; lp->options |= XAE_OPTION_VLAN; lp->options &= (~XAE_OPTION_JUMBO); @@ -605,11 +601,17 @@ static int axienet_device_reset(struct net_device *ndev) lp->options |= XAE_OPTION_JUMBO; } - ret = axienet_dma_bd_init(ndev); - if (ret) { - netdev_err(ndev, "%s: descriptor allocation failed\n", - __func__); - return ret; + if (!lp->use_dmaengine) { + ret = __axienet_device_reset(lp); + if (ret) + return ret; + + ret = axienet_dma_bd_init(ndev); + if (ret) { + netdev_err(ndev, "%s: descriptor allocation failed\n", + __func__); + return ret; + } } axienet_status = axienet_ior(lp, XAE_RCW1_OFFSET); @@ -775,20 +777,20 @@ static int axienet_tx_poll(struct napi_struct *napi, int budget) } /** - * axienet_start_xmit - Starts the transmission. + * axienet_start_xmit_legacy - Starts the transmission. * @skb: sk_buff pointer that contains data to be Txed. * @ndev: Pointer to net_device structure. * * Return: NETDEV_TX_OK, on success * NETDEV_TX_BUSY, if any of the descriptors are not free * - * This function is invoked from upper layers to initiate transmission. The + * This function is invoked from axienet_start_xmit to initiate transmission. The * function uses the next available free BDs and populates their fields to * start the transmission. Additionally if checksum offloading is supported, * it populates AXI Stream Control fields with appropriate values. */ static netdev_tx_t -axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) +axienet_start_xmit_legacy(struct sk_buff *skb, struct net_device *ndev) { u32 ii; u32 num_frag; @@ -890,6 +892,27 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) return NETDEV_TX_OK; } +/** + * axienet_start_xmit - Invoke the transmission function + * @skb: sk_buff pointer that contains data to be Txed. + * @ndev: Pointer to net_device structure. + * + * Return: NETDEV_TX_OK, on success + * NETDEV_TX_BUSY, if any of the descriptors are not free + * + * This function is invoked from upper layers to initiate transmission + */ +static netdev_tx_t +axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) +{ + struct axienet_local *lp = netdev_priv(ndev); + + if (!lp->use_dmaengine) + return axienet_start_xmit_legacy(skb, ndev); + else + return NETDEV_TX_BUSY; +} + /** * axienet_rx_poll - Triggered by RX ISR to complete the BD processing. * @napi: Pointer to NAPI structure. @@ -1124,41 +1147,22 @@ static irqreturn_t axienet_eth_irq(int irq, void *_ndev) static void axienet_dma_err_handler(struct work_struct *work); /** - * axienet_open - Driver open routine. - * @ndev: Pointer to net_device structure + * axienet_init_legacy_dma - init the dma legacy code. + * @ndev: Pointer to net_device structure * * Return: 0, on success. - * non-zero error value on failure + * non-zero error value on failure + * + * This is the dma initialization code. It also allocates interrupt + * service routines, enables the interrupt lines and ISR handling. * - * This is the driver open routine. It calls phylink_start to start the - * PHY device. - * It also allocates interrupt service routines, enables the interrupt lines - * and ISR handling. Axi Ethernet core is reset through Axi DMA core. Buffer - * descriptors are initialized. */ -static int axienet_open(struct net_device *ndev) + +static inline int axienet_init_legacy_dma(struct net_device *ndev) { int ret; struct axienet_local *lp = netdev_priv(ndev); - dev_dbg(&ndev->dev, "axienet_open()\n"); - - /* When we do an Axi Ethernet reset, it resets the complete core - * including the MDIO. MDIO must be disabled before resetting. - * Hold MDIO bus lock to avoid MDIO accesses during the reset. - */ - axienet_lock_mii(lp); - ret = axienet_device_reset(ndev); - axienet_unlock_mii(lp); - - ret = phylink_of_phy_connect(lp->phylink, lp->dev->of_node, 0); - if (ret) { - dev_err(lp->dev, "phylink_of_phy_connect() failed: %d\n", ret); - return ret; - } - - phylink_start(lp->phylink); - /* Enable worker thread for Axi DMA error handling */ INIT_WORK(&lp->dma_err_task, axienet_dma_err_handler); @@ -1192,13 +1196,62 @@ static int axienet_open(struct net_device *ndev) err_tx_irq: napi_disable(&lp->napi_tx); napi_disable(&lp->napi_rx); - phylink_stop(lp->phylink); - phylink_disconnect_phy(lp->phylink); cancel_work_sync(&lp->dma_err_task); dev_err(lp->dev, "request_irq() failed\n"); return ret; } +/** + * axienet_open - Driver open routine. + * @ndev: Pointer to net_device structure + * + * Return: 0, on success. + * non-zero error value on failure + * + * This is the driver open routine. It calls phylink_start to start the + * PHY device. + * It also allocates interrupt service routines, enables the interrupt lines + * and ISR handling. Axi Ethernet core is reset through Axi DMA core. Buffer + * descriptors are initialized. + */ +static int axienet_open(struct net_device *ndev) +{ + int ret; + struct axienet_local *lp = netdev_priv(ndev); + + dev_dbg(&ndev->dev, "%s\n", __func__); + + /* When we do an Axi Ethernet reset, it resets the complete core + * including the MDIO. MDIO must be disabled before resetting. + * Hold MDIO bus lock to avoid MDIO accesses during the reset. + */ + axienet_lock_mii(lp); + ret = axienet_device_reset(ndev); + axienet_unlock_mii(lp); + + ret = phylink_of_phy_connect(lp->phylink, lp->dev->of_node, 0); + if (ret) { + dev_err(lp->dev, "phylink_of_phy_connect() failed: %d\n", ret); + return ret; + } + + phylink_start(lp->phylink); + + if (!lp->use_dmaengine) { + ret = axienet_init_legacy_dma(ndev); + if (ret) + goto error_code; + } + + return 0; + +error_code: + phylink_stop(lp->phylink); + phylink_disconnect_phy(lp->phylink); + + return ret; +} + /** * axienet_stop - Driver stop routine. * @ndev: Pointer to net_device structure @@ -1215,8 +1268,10 @@ static int axienet_stop(struct net_device *ndev) dev_dbg(&ndev->dev, "axienet_close()\n"); - napi_disable(&lp->napi_tx); - napi_disable(&lp->napi_rx); + if (!lp->use_dmaengine) { + napi_disable(&lp->napi_tx); + napi_disable(&lp->napi_rx); + } phylink_stop(lp->phylink); phylink_disconnect_phy(lp->phylink); @@ -1224,18 +1279,18 @@ static int axienet_stop(struct net_device *ndev) axienet_setoptions(ndev, lp->options & ~(XAE_OPTION_TXEN | XAE_OPTION_RXEN)); - axienet_dma_stop(lp); + if (!lp->use_dmaengine) { + axienet_dma_stop(lp); + cancel_work_sync(&lp->dma_err_task); + free_irq(lp->tx_irq, ndev); + free_irq(lp->rx_irq, ndev); + axienet_dma_bd_release(ndev); + } axienet_iow(lp, XAE_IE_OFFSET, 0); - cancel_work_sync(&lp->dma_err_task); - if (lp->eth_irq > 0) free_irq(lp->eth_irq, ndev); - free_irq(lp->tx_irq, ndev); - free_irq(lp->rx_irq, ndev); - - axienet_dma_bd_release(ndev); return 0; } @@ -1411,14 +1466,16 @@ static void axienet_ethtools_get_regs(struct net_device *ndev, data[29] = axienet_ior(lp, XAE_FMI_OFFSET); data[30] = axienet_ior(lp, XAE_AF0_OFFSET); data[31] = axienet_ior(lp, XAE_AF1_OFFSET); - data[32] = axienet_dma_in32(lp, XAXIDMA_TX_CR_OFFSET); - data[33] = axienet_dma_in32(lp, XAXIDMA_TX_SR_OFFSET); - data[34] = axienet_dma_in32(lp, XAXIDMA_TX_CDESC_OFFSET); - data[35] = axienet_dma_in32(lp, XAXIDMA_TX_TDESC_OFFSET); - data[36] = axienet_dma_in32(lp, XAXIDMA_RX_CR_OFFSET); - data[37] = axienet_dma_in32(lp, XAXIDMA_RX_SR_OFFSET); - data[38] = axienet_dma_in32(lp, XAXIDMA_RX_CDESC_OFFSET); - data[39] = axienet_dma_in32(lp, XAXIDMA_RX_TDESC_OFFSET); + if (!lp->use_dmaengine) { + data[32] = axienet_dma_in32(lp, XAXIDMA_TX_CR_OFFSET); + data[33] = axienet_dma_in32(lp, XAXIDMA_TX_SR_OFFSET); + data[34] = axienet_dma_in32(lp, XAXIDMA_TX_CDESC_OFFSET); + data[35] = axienet_dma_in32(lp, XAXIDMA_TX_TDESC_OFFSET); + data[36] = axienet_dma_in32(lp, XAXIDMA_RX_CR_OFFSET); + data[37] = axienet_dma_in32(lp, XAXIDMA_RX_SR_OFFSET); + data[38] = axienet_dma_in32(lp, XAXIDMA_RX_CDESC_OFFSET); + data[39] = axienet_dma_in32(lp, XAXIDMA_RX_TDESC_OFFSET); + } } static void @@ -1879,9 +1936,6 @@ static int axienet_probe(struct platform_device *pdev) u64_stats_init(&lp->rx_stat_sync); u64_stats_init(&lp->tx_stat_sync); - netif_napi_add(ndev, &lp->napi_rx, axienet_rx_poll); - netif_napi_add(ndev, &lp->napi_tx, axienet_tx_poll); - lp->axi_clk = devm_clk_get_optional(&pdev->dev, "s_axi_lite_clk"); if (!lp->axi_clk) { /* For backward compatibility, if named AXI clock is not present, @@ -2007,80 +2061,85 @@ static int axienet_probe(struct platform_device *pdev) goto cleanup_clk; } - /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */ - np = of_parse_phandle(pdev->dev.of_node, "axistream-connected", 0); - if (np) { - struct resource dmares; + if (!of_find_property(pdev->dev.of_node, "dmas", NULL)) { + /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */ + np = of_parse_phandle(pdev->dev.of_node, "axistream-connected", 0); - ret = of_address_to_resource(np, 0, &dmares); - if (ret) { - dev_err(&pdev->dev, - "unable to get DMA resource\n"); + if (np) { + struct resource dmares; + + ret = of_address_to_resource(np, 0, &dmares); + if (ret) { + dev_err(&pdev->dev, + "unable to get DMA resource\n"); + of_node_put(np); + goto cleanup_clk; + } + lp->dma_regs = devm_ioremap_resource(&pdev->dev, + &dmares); + lp->rx_irq = irq_of_parse_and_map(np, 1); + lp->tx_irq = irq_of_parse_and_map(np, 0); of_node_put(np); + lp->eth_irq = platform_get_irq_optional(pdev, 0); + } else { + /* Check for these resources directly on the Ethernet node. */ + lp->dma_regs = devm_platform_get_and_ioremap_resource(pdev, 1, NULL); + lp->rx_irq = platform_get_irq(pdev, 1); + lp->tx_irq = platform_get_irq(pdev, 0); + lp->eth_irq = platform_get_irq_optional(pdev, 2); + } + if (IS_ERR(lp->dma_regs)) { + dev_err(&pdev->dev, "could not map DMA regs\n"); + ret = PTR_ERR(lp->dma_regs); + goto cleanup_clk; + } + if (lp->rx_irq <= 0 || lp->tx_irq <= 0) { + dev_err(&pdev->dev, "could not determine irqs\n"); + ret = -ENOMEM; goto cleanup_clk; } - lp->dma_regs = devm_ioremap_resource(&pdev->dev, - &dmares); - lp->rx_irq = irq_of_parse_and_map(np, 1); - lp->tx_irq = irq_of_parse_and_map(np, 0); - of_node_put(np); - lp->eth_irq = platform_get_irq_optional(pdev, 0); - } else { - /* Check for these resources directly on the Ethernet node. */ - lp->dma_regs = devm_platform_get_and_ioremap_resource(pdev, 1, NULL); - lp->rx_irq = platform_get_irq(pdev, 1); - lp->tx_irq = platform_get_irq(pdev, 0); - lp->eth_irq = platform_get_irq_optional(pdev, 2); - } - if (IS_ERR(lp->dma_regs)) { - dev_err(&pdev->dev, "could not map DMA regs\n"); - ret = PTR_ERR(lp->dma_regs); - goto cleanup_clk; - } - if ((lp->rx_irq <= 0) || (lp->tx_irq <= 0)) { - dev_err(&pdev->dev, "could not determine irqs\n"); - ret = -ENOMEM; - goto cleanup_clk; - } - /* Reset core now that clocks are enabled, prior to accessing MDIO */ - ret = __axienet_device_reset(lp); - if (ret) - goto cleanup_clk; + /* Reset core now that clocks are enabled, prior to accessing MDIO */ + ret = __axienet_device_reset(lp); + if (ret) + goto cleanup_clk; + + /* Autodetect the need for 64-bit DMA pointers. + * When the IP is configured for a bus width bigger than 32 bits, + * writing the MSB registers is mandatory, even if they are all 0. + * We can detect this case by writing all 1's to one such register + * and see if that sticks: when the IP is configured for 32 bits + * only, those registers are RES0. + * Those MSB registers were introduced in IP v7.1, which we check first. + */ + if ((axienet_ior(lp, XAE_ID_OFFSET) >> 24) >= 0x9) { + void __iomem *desc = lp->dma_regs + XAXIDMA_TX_CDESC_OFFSET + 4; - /* Autodetect the need for 64-bit DMA pointers. - * When the IP is configured for a bus width bigger than 32 bits, - * writing the MSB registers is mandatory, even if they are all 0. - * We can detect this case by writing all 1's to one such register - * and see if that sticks: when the IP is configured for 32 bits - * only, those registers are RES0. - * Those MSB registers were introduced in IP v7.1, which we check first. - */ - if ((axienet_ior(lp, XAE_ID_OFFSET) >> 24) >= 0x9) { - void __iomem *desc = lp->dma_regs + XAXIDMA_TX_CDESC_OFFSET + 4; - - iowrite32(0x0, desc); - if (ioread32(desc) == 0) { /* sanity check */ - iowrite32(0xffffffff, desc); - if (ioread32(desc) > 0) { - lp->features |= XAE_FEATURE_DMA_64BIT; - addr_width = 64; - dev_info(&pdev->dev, - "autodetected 64-bit DMA range\n"); - } iowrite32(0x0, desc); + if (ioread32(desc) == 0) { /* sanity check */ + iowrite32(0xffffffff, desc); + if (ioread32(desc) > 0) { + lp->features |= XAE_FEATURE_DMA_64BIT; + addr_width = 64; + dev_info(&pdev->dev, + "autodetected 64-bit DMA range\n"); + } + iowrite32(0x0, desc); + } + } + if (!IS_ENABLED(CONFIG_64BIT) && lp->features & XAE_FEATURE_DMA_64BIT) { + dev_err(&pdev->dev, "64-bit addressable DMA is not compatible with 32-bit archecture\n"); + ret = -EINVAL; + goto cleanup_clk; } - } - if (!IS_ENABLED(CONFIG_64BIT) && lp->features & XAE_FEATURE_DMA_64BIT) { - dev_err(&pdev->dev, "64-bit addressable DMA is not compatible with 32-bit archecture\n"); - ret = -EINVAL; - goto cleanup_clk; - } - ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(addr_width)); - if (ret) { - dev_err(&pdev->dev, "No suitable DMA available\n"); - goto cleanup_clk; + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(addr_width)); + if (ret) { + dev_err(&pdev->dev, "No suitable DMA available\n"); + goto cleanup_clk; + } + netif_napi_add(ndev, &lp->napi_rx, axienet_rx_poll); + netif_napi_add(ndev, &lp->napi_tx, axienet_tx_poll); } /* Check for Ethernet core IRQ (optional) */ @@ -2098,8 +2157,8 @@ static int axienet_probe(struct platform_device *pdev) } lp->coalesce_count_rx = XAXIDMA_DFT_RX_THRESHOLD; - lp->coalesce_usec_rx = XAXIDMA_DFT_RX_USEC; lp->coalesce_count_tx = XAXIDMA_DFT_TX_THRESHOLD; + lp->coalesce_usec_rx = XAXIDMA_DFT_RX_USEC; lp->coalesce_usec_tx = XAXIDMA_DFT_TX_USEC; ret = axienet_mdio_setup(lp); From patchwork Mon Aug 7 05:51:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 13343044 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 CB94B1FC6 for ; Mon, 7 Aug 2023 05:55:59 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2048.outbound.protection.outlook.com [40.107.94.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBB091BF2; Sun, 6 Aug 2023 22:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YQfCehiL8aG9QNigAXu3rTDSd5xZ4A32ZwsJRTO9wsAO2FDLydcHumZljPaof61UleJK3EHQojKli3ywclTOOvCmNGgccv+rOPhHOVrosKGFNhM05HTkgqpHAIBReJtYXUAwq5sxF49ryq5h4acAAjiPFxr5e6V+9cXoZ4+/T0lgmZQohV8Oe/BfZ284avvDFzZIhxussR4of51+Pf1NXythNvTqLh/2aKnISW/4TtqdOZEBImKghQDJ8CvOZz5n7WChvYlXTjry+7fMBlNhyEVdT/94N/UQ3iIeGxmbQohpWGg/KokXTKHGnFoR02/Xg+48au+ycf3+Hj6XJqSRcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=D8NsdYxs4qSRxk/X29PUVeQbqGy5c9nrf6+pHBR/fe0=; b=PzLeMujmvHm/jo11MQy9EKtNlOIN9geTrrpN17DV5VLhLYv1j079cUbMEWn647x4wHcZWbkks/7Q5WPUtSvXuxegDaMy4L9fDvzo7KjjgdlFDPovT0pxfEJi97l9Lqfd5Uo8UEAvbWQ0Katmpuph1CVtHwTOugK20BxmGAPFtNgXw52NShn3a1YZio7WDKY09sHGHl1MlQ4Ae8WJWikl6OQnKOeuclpB8tk+CmeH/nZ0fkS7jubHUsf5tmkXrxq0rkiqqFmrHmrKzN88ZZTfKTirnoM51MYGA2wVDDt1mgBqa110SYCHPlLkjt1Zpk/aUsy8Y/QPQFUyE4P8iTFsNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D8NsdYxs4qSRxk/X29PUVeQbqGy5c9nrf6+pHBR/fe0=; b=a4MJqCLEDXUrJdlmy5AkNlO8Xv0LS7RRBTVc0Y9LvUfiaLzsJqHewoqk9RR30MdutFcBzFkLFM0ncrMNUrjPCNu6wHA0QOg9ErlimFlnruncXoDpUlN2O5IPrUJvcZNcoktQ2gkcH1JPaAgB/bTLJLK1W/iV+bdvAfg7iLOlTC0= Received: from SA9PR03CA0011.namprd03.prod.outlook.com (2603:10b6:806:20::16) by PH7PR12MB6833.namprd12.prod.outlook.com (2603:10b6:510:1af::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26; Mon, 7 Aug 2023 05:54:35 +0000 Received: from SN1PEPF000252A0.namprd05.prod.outlook.com (2603:10b6:806:20:cafe::1b) by SA9PR03CA0011.outlook.office365.com (2603:10b6:806:20::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26 via Frontend Transport; Mon, 7 Aug 2023 05:54:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF000252A0.mail.protection.outlook.com (10.167.242.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Mon, 7 Aug 2023 05:54:35 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 7 Aug 2023 00:54:04 -0500 Received: from xhdradheys41.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Mon, 7 Aug 2023 00:53:59 -0500 From: Radhey Shyam Pandey To: , , , , , , , , , CC: , , , , , , Radhey Shyam Pandey Subject: [PATCH net-next v5 10/10] net: axienet: Introduce dmaengine support Date: Mon, 7 Aug 2023 11:21:49 +0530 Message-ID: <1691387509-2113129-11-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1691387509-2113129-1-git-send-email-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A0:EE_|PH7PR12MB6833:EE_ X-MS-Office365-Filtering-Correlation-Id: 78c01516-c522-4d2a-5331-08db970ac78f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: liIYpu7+vQl27hKSexAbp7QzCPYAsyqUTIWgAdfwwmCYbzEiJDwKfFZVahjvaWGbF2kn35DGfqGip07gGcY6u3LLc/LGxfW1VtnBN3Vrr0fOkOqaluSSxoyROwjgVT+dK6I/rOnMAD9NQz4GYfOeEHSga6I82qKCD6svaSEX12OxXlYZu2UQhiEbZkToa9QpGXpwX8NCPN6P8q/DgvAlHzeRy4v/XZc3IStbTaeFS2exnqzdeCS278pVjoHzmfxk9CJa+xMJeit6A123Yp9oJtP5f29AFixOBHlgNU752BYqYeP9LwBiBHyjZpkDlZRrdyj5K9YL/L76EmAu3D+dTNoeaX1XBzY9GeGQx+A7KgGYozM6icFwZAIQ3UYlCZkg8nMmBXF5Mhug5s+zKtJN63SHLJIc/eaM5KhzlE//CJyiArtYSa27Jd3atPQAF5VEjOuseAADjtG9JQ/dwPeAkOiYUFUkWY47dnD7wDAucRKkgeIC71QssF/INMv6RABo61GQ0cqgajNlggJPOzGx1+iYh/WNeImaujkFDfm/zXptkqxjN6w3CVfMTmpJ0WzaCV4leYJfG0640DBC/mvHQazKUINlQ5o+0giJA9Bb9b5Mgwvfgi6UPoJ86FxE4Jn7iG+IpJBBr8ThifYr2Gxjl9/Zs4Oe1QmxCRahFdwZYOo4+dAUQFgtrLNiipS2fnx4D2Ecez6ZY0SqSRmFfPapez7THp2qoIl+MLW/mVkbAIak8gBT0drwQnSsVgK2/TPR75i9t2z/qPxBe1ZWQxZUo5QgD3kMOb5dyPH+QvMAEo4= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(136003)(39860400002)(396003)(346002)(451199021)(82310400008)(186006)(1800799003)(36840700001)(40470700004)(46966006)(6666004)(30864003)(54906003)(478600001)(110136005)(40460700003)(316002)(4326008)(40480700001)(86362001)(81166007)(921005)(41300700001)(356005)(82740400003)(70206006)(70586007)(47076005)(83380400001)(426003)(26005)(2616005)(7416002)(36860700001)(36756003)(2906002)(336012)(5660300002)(8936002)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 05:54:35.5958 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78c01516-c522-4d2a-5331-08db970ac78f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000252A0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6833 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Add dmaengine framework to communicate with the xilinx DMAengine driver(AXIDMA). Axi ethernet driver uses separate channels for transmit and receive. Add support for these channels to handle TX and RX with skb and appropriate callbacks. Also add axi ethernet core interrupt for dmaengine framework support. The dmaengine framework was extended for metadata API support. However it still needs further enhancements to make it well suited for ethernet usecases. The ethernet features i.e ethtool set/get of DMA IP properties, ndo_poll_controller,(mentioned in TODO) are not supported and it requires follow-up discussions. dmaengine support has a dependency on xilinx_dma as it uses xilinx_vdma_channel_set_config() API to reset the DMA IP which internally reset MAC prior to accessing MDIO. Benchmark with netperf: xilinx-zcu102-20232:~$ netperf -H 192.168.10.20 -t TCP_STREAM MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.10.20 () port 0 AF_INET Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 131072 16384 16384 10.03 915.55 xilinx-zcu102-20232:~$ netperf -H 192.168.10.20 -t UDP_STREAM MIGRATED UDP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.10.20 () port 0 AF_INET Socket Message Elapsed Messages Size Size Time Okay Errors Throughput bytes bytes secs # # 10^6bits/sec 212992 65507 10.00 18192 0 953.35 212992 10.00 18192 953.35 Signed-off-by: Radhey Shyam Pandey --- Changes for v5: - Switch to amd.com email - Modified commit description. Remove lore link, mention reset API, add performance numbers. - Fix kmem_cache resource leak on stop. - Use dmaengine_terminate_sync instead of deprecated dmaengine_terminate_all API. Changes for v4: - Remove the AXIENET_USE_DMA. - Add dev_err_probe for dma_request_chan error handling. - Add kmem_cache_destroy for create in axienet_setup_dma_chan. - Add XILINX_DMA dependency in ethernet drier Kconfig file. - move setup_dma_channel to init_dmaengine func - Remove unlikely if (unlikely(ret < 0)) - if (ret == 0) to if (!ret) - Rename DMA_MEM_TO_DEV to DMA_TO_DEVICE - Remove else check for lp->use_dmaengine = 1; in the probe. Changes in V3: - New patch for dmaengine framework support. --- drivers/net/ethernet/xilinx/Kconfig | 1 + drivers/net/ethernet/xilinx/xilinx_axienet.h | 8 + .../net/ethernet/xilinx/xilinx_axienet_main.c | 321 +++++++++++++++++- 3 files changed, 328 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/xilinx/Kconfig b/drivers/net/ethernet/xilinx/Kconfig index 0014729b8865..35d96c633a33 100644 --- a/drivers/net/ethernet/xilinx/Kconfig +++ b/drivers/net/ethernet/xilinx/Kconfig @@ -26,6 +26,7 @@ config XILINX_EMACLITE config XILINX_AXI_EMAC tristate "Xilinx 10/100/1000 AXI Ethernet support" depends on HAS_IOMEM + depends on XILINX_DMA select PHYLINK help This driver supports the 10/100/1000 Ethernet from Xilinx for the diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index 3ead0bac597b..d8c6d0afa8a3 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h @@ -436,6 +436,10 @@ struct axidma_bd { * @coalesce_count_tx: Store the irq coalesce on TX side. * @coalesce_usec_tx: IRQ coalesce delay for TX * @use_dmaengine: flag to check dmaengine framework usage. + * @tx_chan: TX DMA channel. + * @rx_chan: RX DMA channel. + * @skb_cache: Custom skb slab allocator + * @rx_chan_skb: List to store RX descriptors custom SKB pointer */ struct axienet_local { struct net_device *ndev; @@ -501,6 +505,10 @@ struct axienet_local { u32 coalesce_count_tx; u32 coalesce_usec_tx; u8 use_dmaengine; + struct dma_chan *tx_chan; + struct dma_chan *rx_chan; + struct kmem_cache *skb_cache; + struct list_head rx_chan_skb; }; /** diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 36c77248a55e..1de5c4992ecf 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -37,6 +37,9 @@ #include #include #include +#include +#include +#include #include "xilinx_axienet.h" @@ -46,6 +49,9 @@ #define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1) #define TX_BD_NUM_MAX 4096 #define RX_BD_NUM_MAX 4096 +#define DMA_NUM_APP_WORDS 5 +#define LEN_APP 4 +#define RX_BUF_NUM_DEFAULT 128 /* Must be shorter than length of ethtool_drvinfo.driver field to fit */ #define DRIVER_NAME "xaxienet" @@ -54,6 +60,17 @@ #define AXIENET_REGS_N 40 +struct axi_skbuff { + struct scatterlist sgl[MAX_SKB_FRAGS + 1]; + struct dma_async_tx_descriptor *desc; + dma_addr_t dma_address; + struct sk_buff *skb; + struct list_head lh; + int sg_len; +} __packed; + +static int axienet_rx_submit_desc(struct net_device *ndev); + /* Match table for of_platform binding */ static const struct of_device_id axienet_of_match[] = { { .compatible = "xlnx,axi-ethernet-1.00.a", }, @@ -726,6 +743,108 @@ static inline int axienet_check_tx_bd_space(struct axienet_local *lp, return 0; } +/** + * axienet_dma_tx_cb - DMA engine callback for TX channel. + * @data: Pointer to the axi_skbuff structure + * @result: error reporting through dmaengine_result. + * This function is called by dmaengine driver for TX channel to notify + * that the transmit is done. + */ +static void axienet_dma_tx_cb(void *data, const struct dmaengine_result *result) +{ + struct axi_skbuff *axi_skb = data; + + struct net_device *netdev = axi_skb->skb->dev; + struct axienet_local *lp = netdev_priv(netdev); + + u64_stats_update_begin(&lp->tx_stat_sync); + u64_stats_add(&lp->tx_bytes, axi_skb->skb->len); + u64_stats_add(&lp->tx_packets, 1); + u64_stats_update_end(&lp->tx_stat_sync); + + dma_unmap_sg(lp->dev, axi_skb->sgl, axi_skb->sg_len, DMA_TO_DEVICE); + dev_kfree_skb_any(axi_skb->skb); + kmem_cache_free(lp->skb_cache, axi_skb); +} + +/** + * axienet_start_xmit_dmaengine - Starts the transmission. + * @skb: sk_buff pointer that contains data to be Txed. + * @ndev: Pointer to net_device structure. + * + * Return: NETDEV_TX_OK, on success + * NETDEV_TX_BUSY, if any memory failure or SG error. + * + * This function is invoked from xmit to initiate transmission. The + * function sets the skbs , call back API, SG etc. + * Additionally if checksum offloading is supported, + * it populates AXI Stream Control fields with appropriate values. + */ +static netdev_tx_t +axienet_start_xmit_dmaengine(struct sk_buff *skb, struct net_device *ndev) +{ + struct dma_async_tx_descriptor *dma_tx_desc = NULL; + struct axienet_local *lp = netdev_priv(ndev); + u32 app[DMA_NUM_APP_WORDS] = {0}; + struct axi_skbuff *axi_skb; + u32 csum_start_off; + u32 csum_index_off; + int sg_len; + int ret; + + sg_len = skb_shinfo(skb)->nr_frags + 1; + axi_skb = kmem_cache_zalloc(lp->skb_cache, GFP_KERNEL); + if (!axi_skb) + return NETDEV_TX_BUSY; + + sg_init_table(axi_skb->sgl, sg_len); + ret = skb_to_sgvec(skb, axi_skb->sgl, 0, skb->len); + if (ret < 0) + goto xmit_error_skb_sgvec; + + ret = dma_map_sg(lp->dev, axi_skb->sgl, sg_len, DMA_TO_DEVICE); + if (!ret) + goto xmit_error_skb_sgvec; + + /*Fill up app fields for checksum */ + if (skb->ip_summed == CHECKSUM_PARTIAL) { + if (lp->features & XAE_FEATURE_FULL_TX_CSUM) { + /* Tx Full Checksum Offload Enabled */ + app[0] |= 2; + } else if (lp->features & XAE_FEATURE_PARTIAL_RX_CSUM) { + csum_start_off = skb_transport_offset(skb); + csum_index_off = csum_start_off + skb->csum_offset; + /* Tx Partial Checksum Offload Enabled */ + app[0] |= 1; + app[1] = (csum_start_off << 16) | csum_index_off; + } + } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { + app[0] |= 2; /* Tx Full Checksum Offload Enabled */ + } + + dma_tx_desc = lp->tx_chan->device->device_prep_slave_sg(lp->tx_chan, axi_skb->sgl, + sg_len, DMA_MEM_TO_DEV, + DMA_PREP_INTERRUPT, (void *)app); + + if (!dma_tx_desc) + goto xmit_error_prep; + + axi_skb->skb = skb; + axi_skb->sg_len = sg_len; + dma_tx_desc->callback_param = axi_skb; + dma_tx_desc->callback_result = axienet_dma_tx_cb; + dmaengine_submit(dma_tx_desc); + dma_async_issue_pending(lp->tx_chan); + + return NETDEV_TX_OK; + +xmit_error_prep: + dma_unmap_sg(lp->dev, axi_skb->sgl, sg_len, DMA_TO_DEVICE); +xmit_error_skb_sgvec: + kmem_cache_free(lp->skb_cache, axi_skb); + return NETDEV_TX_BUSY; +} + /** * axienet_tx_poll - Invoked once a transmit is completed by the * Axi DMA Tx channel. @@ -910,7 +1029,43 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) if (!lp->use_dmaengine) return axienet_start_xmit_legacy(skb, ndev); else - return NETDEV_TX_BUSY; + return axienet_start_xmit_dmaengine(skb, ndev); +} + +/** + * axienet_dma_rx_cb - DMA engine callback for RX channel. + * @data: Pointer to the axi_skbuff structure + * @result: error reporting through dmaengine_result. + * This function is called by dmaengine driver for RX channel to notify + * that the packet is received. + */ +static void axienet_dma_rx_cb(void *data, const struct dmaengine_result *result) +{ + struct axi_skbuff *axi_skb = data; + struct sk_buff *skb = axi_skb->skb; + struct net_device *netdev = skb->dev; + struct axienet_local *lp = netdev_priv(netdev); + size_t meta_len, meta_max_len, rx_len; + u32 *app; + + app = dmaengine_desc_get_metadata_ptr(axi_skb->desc, &meta_len, &meta_max_len); + dma_unmap_single(lp->dev, axi_skb->dma_address, lp->max_frm_size, + DMA_FROM_DEVICE); + /* TODO: Derive app word index programmatically */ + rx_len = (app[LEN_APP] & 0xFFFF); + skb_put(skb, rx_len); + skb->protocol = eth_type_trans(skb, netdev); + skb->ip_summed = CHECKSUM_NONE; + + netif_rx(skb); + list_del(&axi_skb->lh); + kmem_cache_free(lp->skb_cache, axi_skb); + u64_stats_update_begin(&lp->rx_stat_sync); + u64_stats_add(&lp->rx_packets, 1); + u64_stats_add(&lp->rx_bytes, rx_len); + u64_stats_update_end(&lp->rx_stat_sync); + axienet_rx_submit_desc(netdev); + dma_async_issue_pending(lp->rx_chan); } /** @@ -1146,6 +1301,112 @@ static irqreturn_t axienet_eth_irq(int irq, void *_ndev) static void axienet_dma_err_handler(struct work_struct *work); +/** + * axienet_rx_submit_desc - Submit the descriptors with required data + * like call backup API, skb buffer.. etc to dmaengine. + * + * @ndev: net_device pointer + * + *Return: 0, on success. + * non-zero error value on failure + */ +static int axienet_rx_submit_desc(struct net_device *ndev) +{ + struct dma_async_tx_descriptor *dma_rx_desc = NULL; + struct axienet_local *lp = netdev_priv(ndev); + struct axi_skbuff *axi_skb; + struct sk_buff *skb; + dma_addr_t addr; + int ret; + + axi_skb = kmem_cache_alloc(lp->skb_cache, GFP_KERNEL); + + if (!axi_skb) + return -ENOMEM; + skb = netdev_alloc_skb(ndev, lp->max_frm_size); + if (!skb) { + ret = -ENOMEM; + goto rx_bd_init_skb; + } + + sg_init_table(axi_skb->sgl, 1); + addr = dma_map_single(lp->dev, skb->data, lp->max_frm_size, DMA_FROM_DEVICE); + sg_dma_address(axi_skb->sgl) = addr; + sg_dma_len(axi_skb->sgl) = lp->max_frm_size; + dma_rx_desc = dmaengine_prep_slave_sg(lp->rx_chan, axi_skb->sgl, + 1, DMA_DEV_TO_MEM, + DMA_PREP_INTERRUPT); + if (!dma_rx_desc) { + ret = -EINVAL; + goto rx_bd_init_prep_sg; + } + + axi_skb->skb = skb; + axi_skb->dma_address = sg_dma_address(axi_skb->sgl); + axi_skb->desc = dma_rx_desc; + dma_rx_desc->callback_param = axi_skb; + dma_rx_desc->callback_result = axienet_dma_rx_cb; + list_add_tail(&axi_skb->lh, &lp->rx_chan_skb); + dmaengine_submit(dma_rx_desc); + + return 0; + +rx_bd_init_prep_sg: + dma_unmap_single(lp->dev, addr, lp->max_frm_size, DMA_FROM_DEVICE); + dev_kfree_skb(skb); +rx_bd_init_skb: + kmem_cache_free(lp->skb_cache, axi_skb); + return ret; +} + +/** + * axienet_init_dmaengine - init the dmaengine code. + * @ndev: Pointer to net_device structure + * + * Return: 0, on success. + * non-zero error value on failure + * + * This is the dmaengine initialization code. + */ +static inline int axienet_init_dmaengine(struct net_device *ndev) +{ + struct axienet_local *lp = netdev_priv(ndev); + int i, ret; + + lp->tx_chan = dma_request_chan(lp->dev, "tx_chan0"); + if (IS_ERR(lp->tx_chan)) { + ret = PTR_ERR(lp->tx_chan); + return dev_err_probe(lp->dev, ret, "No Ethernet DMA (TX) channel found\n"); + } + + lp->rx_chan = dma_request_chan(lp->dev, "rx_chan0"); + if (IS_ERR(lp->rx_chan)) { + ret = PTR_ERR(lp->rx_chan); + dev_err_probe(lp->dev, ret, "No Ethernet DMA (RX) channel found\n"); + goto err_dma_request_rx; + } + + lp->skb_cache = kmem_cache_create("ethernet", sizeof(struct axi_skbuff), + 0, 0, NULL); + if (!lp->skb_cache) { + ret = -ENOMEM; + goto err_kmem; + } + + INIT_LIST_HEAD(&lp->rx_chan_skb); + /* TODO: Instead of BD_NUM_DEFAULT use runtime support*/ + for (i = 0; i < RX_BUF_NUM_DEFAULT; i++) + axienet_rx_submit_desc(ndev); + dma_async_issue_pending(lp->rx_chan); + + return 0; +err_kmem: + dma_release_channel(lp->rx_chan); +err_dma_request_rx: + dma_release_channel(lp->tx_chan); + return ret; +} + /** * axienet_init_legacy_dma - init the dma legacy code. * @ndev: Pointer to net_device structure @@ -1237,7 +1498,24 @@ static int axienet_open(struct net_device *ndev) phylink_start(lp->phylink); - if (!lp->use_dmaengine) { + if (lp->use_dmaengine) { + /* Enable interrupts for Axi Ethernet core (if defined) */ + if (lp->eth_irq > 0) { + ret = request_irq(lp->eth_irq, axienet_eth_irq, IRQF_SHARED, + ndev->name, ndev); + if (ret) + goto error_code; + } + + ret = axienet_init_dmaengine(ndev); + + if (ret < 0) { + if (lp->eth_irq > 0) + free_irq(lp->eth_irq, ndev); + goto error_code; + } + + } else { ret = axienet_init_legacy_dma(ndev); if (ret) goto error_code; @@ -1265,6 +1543,7 @@ static int axienet_open(struct net_device *ndev) static int axienet_stop(struct net_device *ndev) { struct axienet_local *lp = netdev_priv(ndev); + struct axi_skbuff *askb, *skb; dev_dbg(&ndev->dev, "axienet_close()\n"); @@ -1285,6 +1564,19 @@ static int axienet_stop(struct net_device *ndev) free_irq(lp->tx_irq, ndev); free_irq(lp->rx_irq, ndev); axienet_dma_bd_release(ndev); + } else { + dmaengine_terminate_sync(lp->tx_chan); + dmaengine_synchronize(lp->tx_chan); + dmaengine_terminate_sync(lp->rx_chan); + dmaengine_synchronize(lp->rx_chan); + + list_for_each_entry_safe(askb, skb, &lp->rx_chan_skb, lh) { + list_del(&askb->lh); + kmem_cache_free(lp->skb_cache, askb); + } + dma_release_channel(lp->rx_chan); + dma_release_channel(lp->tx_chan); + kmem_cache_destroy(lp->skb_cache); } axienet_iow(lp, XAE_IE_OFFSET, 0); @@ -2140,6 +2432,31 @@ static int axienet_probe(struct platform_device *pdev) } netif_napi_add(ndev, &lp->napi_rx, axienet_rx_poll); netif_napi_add(ndev, &lp->napi_tx, axienet_tx_poll); + } else { + struct xilinx_vdma_config cfg; + struct dma_chan *tx_chan; + + lp->eth_irq = platform_get_irq_optional(pdev, 0); + tx_chan = dma_request_chan(lp->dev, "tx_chan0"); + + if (IS_ERR(tx_chan)) { + ret = PTR_ERR(tx_chan); + dev_err_probe(lp->dev, ret, "No Ethernet DMA (TX) channel found\n"); + goto cleanup_clk; + } + + cfg.reset = 1; + /* As name says VDMA but it has support for DMA channel reset*/ + ret = xilinx_vdma_channel_set_config(tx_chan, &cfg); + + if (ret < 0) { + dev_err(&pdev->dev, "Reset channel failed\n"); + dma_release_channel(tx_chan); + goto cleanup_clk; + } + + dma_release_channel(tx_chan); + lp->use_dmaengine = 1; } /* Check for Ethernet core IRQ (optional) */