From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1F528A00C2; Mon, 28 Mar 2022 16:26:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C34DF427F9; Mon, 28 Mar 2022 16:26:49 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2054.outbound.protection.outlook.com [40.107.243.54]) by mails.dpdk.org (Postfix) with ESMTP id C83D441104 for ; Mon, 28 Mar 2022 16:26:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RBi7jhPQ3aTwNNNu7CGnFqA7fEpylfw5nJLJtPo444kD4uvWyicSuYPFbvNOpP2zcbZOt3wQSxSg0FVltgBWEfA9wi+WMmw+QSe+eeUo0LhIMsMt8Wo4KgB5KMuz/5pEp4hR97Y2dj7PQ4IEbzt3HM4NpIkPrbMy589CPNJqICjGGMCa+TvzjObcSPX9Pu2rfVB6h4i0MPs/yHeB5MaqpF2fTdY8iCJ7va1vOFaOkiiQ7CcOUx00XPvLsrDeaxIXh9mt+nDD2Iwnu8Lu/QomGG/rnsPRWPSaX/ATpyekqIH4uWaYJ8CwidXz+qsDc+4j4X6VTjLHSD5ep2E9F0dQhw== 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=mEcYVaH8OoiqlEsIlYBQbukhSwJbgSriiqiWZqi0Qb4=; b=W0xr+XBIXeCsxoipS/L7P/2ykujJ7O4luRuKSklHSOUPpLhNVQhYwJ30qtTx5Cbpe5/CwcgoqJ8BIICJ4jMPXfPySiI6P4aSkypNCbwEGLcWctBRHCJmYoSHcDrzKYXviI6SdOXL+IomF39PPTbz83+3Gcbq7XeCxxGV5HQ+JO0s4/4j0xBtri2inX/WmqB/FfiNX45G9TUue31ylVX8cSYGVYR6U6tc7oLbqa9P+yBJ4SfTR3x0n4penFlpg/btRPXzIxvKQ1Hr3u5lXgrvAYkG9DRuBou/IR+nXgtBu1fzjM+Xv1W3yNo5Ob3L7wzOfRqwEYtFP2KFOcNGYO1PMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=huawei.com 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=mEcYVaH8OoiqlEsIlYBQbukhSwJbgSriiqiWZqi0Qb4=; b=DRpkJl8XSkTD32OpRxjrV7O4JCwmsRDyhhac4eFIGzDRcAhhGDuLNXu/a+Z5gzzsRZiIpbHC6azSC71NkBJFoSJqpfR5FcIG7xJBLqnLCVYePoGUBYn8rdHxGSeogzQ3xrtkxb34bUcqrCi1l7inMXcwVgr+Wbks+Y1z9s5WjII= Received: from BN0PR02CA0058.namprd02.prod.outlook.com (2603:10b6:408:e5::33) by MWHPR12MB1711.namprd12.prod.outlook.com (2603:10b6:300:10a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17; Mon, 28 Mar 2022 14:26:46 +0000 Received: from BN8NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e5:cafe::b7) by BN0PR02CA0058.outlook.office365.com (2603:10b6:408:e5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17 via Frontend Transport; Mon, 28 Mar 2022 14:26:46 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT053.mail.protection.outlook.com (10.13.177.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5102.17 via Frontend Transport; Mon, 28 Mar 2022 14:26:45 +0000 Received: from telco4.amd.com (10.180.168.240) 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.2375.24; Mon, 28 Mar 2022 09:26:44 -0500 From: Sivaprasad Tummala To: CC: , Sivaprasad Tummala Subject: [PATCH] dma/skeleton: support multiple instances Date: Mon, 28 Mar 2022 07:23:14 -0700 Message-ID: <20220328142314.46322-1-Sivaprasad.Tummala@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 420e0507-fc38-4e57-fdd4-08da10c6fcc3 X-MS-TrafficTypeDiagnostic: MWHPR12MB1711:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eeiMrtpVHSC/dK8/zdiKupIIZINf7aJQbFoWqAprploqcyeY3RLTZtz7P0OgNrxrpQAXeGg4dgPI27Q3VN6rNYuTUuYdIcj9418CfU9WY2fuiV9i43We8iHVhA4L8hSrS8Vfc3/roF+fOjxx9HayQrsk8NQjPNQy0U+XmxoRfPJHunuMzGQqLaOgmOIjR3jhqNoayaAZyuyHgye9mN3JP6I5nFmoA9Olb0Gr6REjuD45lNU9n8dvugll+rHceax5WnDfIrfTL8GGSp9nCeK3nK0EaejjAZ7AXz3rKlMXnzYOWBsGjUEq4lLEpTpd1owAmysE3WDp+U0Sb4PZw8Nn7cRAUYWzY+y/cxGk82EKUtt/LJQuq7t07pWVMN2l28e7VAdb0gi64IM5669UHMF7kUP8mza3eFER3DL3qRKivE+xvOA4RIsuuUyxMY4OSzeQs6GYGx20Ct80KIaA+ZwW2icpVKD0uB9hYNVPwADePntNzPe7M5N2a0uN790ZwZmHVCNCmKNZXX3SZ6MSsI1ROBZiKEC2LCEBThkc7ut69KkA1t+qc1PyuKoKf8MSDkl2WiSuk7pkicBpUwXQ4tVCCJ8mXWmS3MRWudy4rHILjT1QF19R8tOmGWuvEVqOi1W51Kj2cdPv2akq57g6Su+YyRtMQf5+nSk5YGCN8FbDORDhqLWSCChsDAXb1w9+oN3QMgDKAzhQiVvyF5OKtjivSg== 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:(13230001)(4636009)(40470700004)(46966006)(36840700001)(82310400004)(36756003)(5660300002)(2906002)(83380400001)(40460700003)(16526019)(6666004)(8936002)(7696005)(47076005)(336012)(186003)(26005)(426003)(1076003)(2616005)(316002)(36860700001)(81166007)(4326008)(8676002)(6916009)(54906003)(70586007)(70206006)(356005)(508600001)(86362001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2022 14:26:45.5056 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 420e0507-fc38-4e57-fdd4-08da10c6fcc3 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: BN8NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1711 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org dpdk app can support multiple hardware dma instances. with dma skeleton, only a single instance can be configured. This patch supports multiple driver instances per device. Signed-off-by: Sivaprasad Tummala --- drivers/dma/skeleton/skeleton_dmadev.c | 37 +++++++++++++++----------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c index 81cbdd286e..6b1c01d89c 100644 --- a/drivers/dma/skeleton/skeleton_dmadev.c +++ b/drivers/dma/skeleton/skeleton_dmadev.c @@ -100,6 +100,7 @@ static int skeldma_start(struct rte_dma_dev *dev) { struct skeldma_hw *hw = dev->data->dev_private; + char name[RTE_MAX_THREAD_NAME_LEN]; rte_cpuset_t cpuset; int ret; @@ -125,7 +126,8 @@ skeldma_start(struct rte_dma_dev *dev) rte_mb(); - ret = rte_ctrl_thread_create(&hw->thread, "dma_skeleton", NULL, + snprintf(name, sizeof(name), "dma_skel_%d", dev->data->dev_id); + ret = rte_ctrl_thread_create(&hw->thread, name, NULL, cpucopy_thread, dev); if (ret) { SKELDMA_LOG(ERR, "Start cpucopy thread fail!"); @@ -160,7 +162,7 @@ skeldma_stop(struct rte_dma_dev *dev) } static int -vchan_setup(struct skeldma_hw *hw, uint16_t nb_desc) +vchan_setup(struct skeldma_hw *hw, int16_t dev_id, uint16_t nb_desc) { struct skeldma_desc *desc; struct rte_ring *empty; @@ -168,8 +170,12 @@ vchan_setup(struct skeldma_hw *hw, uint16_t nb_desc) struct rte_ring *running; struct rte_ring *completed; uint16_t i; + char pool_name[RTE_RING_NAMESIZE]; + char ring_name[RTE_RING_NAMESIZE]; - desc = rte_zmalloc_socket("dma_skeleton_desc", + snprintf(pool_name, RTE_RING_NAMESIZE, "dma_skel_desc_pool_%d", + dev_id); + desc = rte_zmalloc_socket(pool_name, nb_desc * sizeof(struct skeldma_desc), RTE_CACHE_LINE_SIZE, hw->socket_id); if (desc == NULL) { @@ -177,13 +183,21 @@ vchan_setup(struct skeldma_hw *hw, uint16_t nb_desc) return -ENOMEM; } - empty = rte_ring_create("dma_skeleton_desc_empty", nb_desc, + snprintf(ring_name, RTE_RING_NAMESIZE, "dma_skel_desc_empty_%d", + dev_id); + empty = rte_ring_create(ring_name, nb_desc, hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ); - pending = rte_ring_create("dma_skeleton_desc_pending", nb_desc, + snprintf(ring_name, RTE_RING_NAMESIZE, "dma_skel_desc_pend_%d", + dev_id); + pending = rte_ring_create(ring_name, nb_desc, hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ); - running = rte_ring_create("dma_skeleton_desc_running", nb_desc, + snprintf(ring_name, RTE_RING_NAMESIZE, "dma_skel_desc_run_%d", + dev_id); + running = rte_ring_create(ring_name, nb_desc, hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ); - completed = rte_ring_create("dma_skeleton_desc_completed", nb_desc, + snprintf(ring_name, RTE_RING_NAMESIZE, "dma_skel_desc_comp_%d", + dev_id); + completed = rte_ring_create(ring_name, nb_desc, hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ); if (empty == NULL || pending == NULL || running == NULL || completed == NULL) { @@ -254,7 +268,7 @@ skeldma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan, } vchan_release(hw); - return vchan_setup(hw, conf->nb_desc); + return vchan_setup(hw, dev->data->dev_id, conf->nb_desc); } static int @@ -548,13 +562,6 @@ skeldma_probe(struct rte_vdev_device *vdev) return -EINVAL; } - /* More than one instance is not supported */ - if (skeldma_count > 0) { - SKELDMA_LOG(ERR, "Multiple instance not supported for %s", - name); - return -EINVAL; - } - skeldma_parse_vdev_args(vdev, &lcore_id); ret = skeldma_create(name, vdev, lcore_id); -- 2.17.1