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 A5F2DA00C2; Mon, 28 Mar 2022 14:57:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9294241104; Mon, 28 Mar 2022 14:57:04 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2046.outbound.protection.outlook.com [40.107.94.46]) by mails.dpdk.org (Postfix) with ESMTP id 2243540041 for ; Mon, 28 Mar 2022 14:57:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EMbf1oN3SgH2x0l/nXXzV5ApiR14tyqvBKYIn6c9DsmtbojZ812On+55FQkV5iLzQw7CyFjkFf7YNxc0q+MQEcLzIykOle6vBNMDPHF6dscdEn76qvqw5VcYVZLOvwkf8qfhnb38sTYir8lUChNUrRBxdXrhLXiYXFQ/yR+l7rvgKo2Jo1M4sdKcu8/anxvdg3SJnEAyFv0+pbGNePlUDrByNA2UO38hxc/aak6yJGThPHYUS3F8S6yxsZONtYGPaQMYBMj4WHDfjZYjo+yMD2yW2W81v9pjOYtr9nHIfndYnHJfHPyTV0TwY8PP+WeqdP2YV0x88tUc2cxJ7cksqg== 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=i7DeQmghUUgTtKKB74bZ4+H/BWpCz+SD+I1Y+cCI9Vo=; b=guvzs/MVqc0NWE9RyIrbY8SJAMjga2IWNT4T54MiatkAtlmqwaXU1VJqQTt0CkCwZBYoynw2OsS8xbWj+MM31qkGQfTDuPoFSY0ay9COEv8x5UBxxGCbFR1uQVh9S5r+rOpLws3Z2uecUHOe1LwMzTLrAD/e2CCbpLPoiQQ7woHkCs0HbuihsjSVRl/Ag482wyMlthAgHT8eDln6IQSLwqRjMrPjgHoSEUjh+7NB3rbGhtBGRyavQlIFk124Yvs+FOo1DYU3swkKMale4FdUcLSU4S3LnTRGwNYkUMcLyKp7buVEzKl7UYrLQUOH9gl2a2t6PO+gBTKncVeNz1PqhA== 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=i7DeQmghUUgTtKKB74bZ4+H/BWpCz+SD+I1Y+cCI9Vo=; b=A6MxQnreY3LoRAVo7S8fLGJSpxHfOhY9FDlCSHoZXuMiqKH58X0JbMb4YKJRFwJi2EfSOs+EPw0txZto/NgVFZM60hJpDCOASqOiAonuBc4XhFziHfYMqNkAzx1ab6LUFWiBXGkC2+7h72zZDl2ZesDKp+k2HNn3Wig45RzaXRE= Received: from MW4PR03CA0200.namprd03.prod.outlook.com (2603:10b6:303:b8::25) by CH2PR12MB5002.namprd12.prod.outlook.com (2603:10b6:610:6d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.16; Mon, 28 Mar 2022 12:57:00 +0000 Received: from CO1NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b8:cafe::18) by MW4PR03CA0200.outlook.office365.com (2603:10b6:303:b8::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.18 via Frontend Transport; Mon, 28 Mar 2022 12:57:00 +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 CO1NAM11FT044.mail.protection.outlook.com (10.13.175.188) 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 12:57:00 +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 07:56:58 -0500 From: Sivaprasad Tummala To: CC: , Sivaprasad Tummala Subject: [PATCH] dma/skeleton: support multiple instances Date: Mon, 28 Mar 2022 05:53:57 -0700 Message-ID: <20220328125357.24747-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: f4c64f9d-bd64-412d-6915-08da10ba72e8 X-MS-TrafficTypeDiagnostic: CH2PR12MB5002: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: +2cpZRNiBpSJLMyBAdUOzF92VMyTejyxU38tOD18YkicBJ6JNDoP1x83Qhmagm31cuVvCslkZm2Ui/yne6pIIvB5zJUkd7JEMl7jP11vqqKD02vpF7BbVAZUm4bUU2N95w8qCWrbpAQJz7v9dN6bUlg2xkNKUCt04IzP1A7pInOaB2My6td8MW8fBBzTfrb+tSO9Rp+maKzlHW3BOq4P6A5HvpejPUEKzTRjnKMJMX8JqJQIgVYi/G+W71p59EQi+MiUZipWcyWMIrH14p3zRutAzQBMDVgxwB5Z2yGxiqiLTGXKisAtLR7gEPEPgeJVi0oMwJwcdXRRjGeJGQ3CnZwrPWe67ui6OYEGPtrnsXaA8g8IvO7FHESjCgINaZTZf078d0U5+LLWIH52qu/uW6B/vau5o4dSXysfg6ohQO6oPf13cm09HI++SOZ0Fe7QOqN+Y3sLJdDY0UiQXuDwGEumlJmswPpbrvyL9zc6oBjaNKtylDnN1TbY1PM7m4MKOs1urdtofihhyncWyxicL6A0ZBUHAa3ed23zR2HGUtdMV2v8NaAzTwvfpbOKDS4SAVfhnBNb5oWMWz8WV+cFKv7hlfO4rFneBLEI2lyg7sYoZmEKMJAAPsTjnlIo5gSpokzXcgb/BGds8z9Bl3nKJJhQgxaMeWNnkR9G4hgUuXNz10YXLa4DkNEvHkisY1KSyDLovCcj0RZgySmFZ5ctCA== 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)(46966006)(36840700001)(40470700004)(83380400001)(336012)(1076003)(426003)(186003)(47076005)(81166007)(26005)(36860700001)(356005)(4326008)(8936002)(5660300002)(8676002)(16526019)(36756003)(86362001)(2906002)(7696005)(508600001)(70206006)(2616005)(6916009)(70586007)(40460700003)(54906003)(82310400004)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2022 12:57:00.2266 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f4c64f9d-bd64-412d-6915-08da10ba72e8 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: CO1NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB5002 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 | 41 +++++++++++++++----------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c index d9e4f731d7..a1847571c1 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_skelteon_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, - hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ); - running = rte_ring_create("dma_skeleton_desc_running", 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_pend_%d", + dev_id); + pending = rte_ring_create(ring_name, nb_desc, + hw->socket_id, RING_F_SP_ENQ | RING_F_SC_DEQ); + 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); + 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