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 B36784577D; Fri, 9 Aug 2024 22:24:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8627A42DC9; Fri, 9 Aug 2024 22:24:19 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2042.outbound.protection.outlook.com [40.107.105.42]) by mails.dpdk.org (Postfix) with ESMTP id A439E42DB1 for ; Fri, 9 Aug 2024 22:24:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eQU8LQ+uDlaaej2taZ7Ux/Kst/PyNyvC79F2awjNGcs2d5f/t0YJgifvUBlHcbYTSG/7Npg4xuZzPsWAhxva/2rytz7w2uWv9AlZ+AuGoeUIQl0P6wNCr1y8fLQNgFhU8ArMEw/sT6dOyxXJilDKrGwQq1+JjCgonxMbOB5mXRIvQFGIP2MgRN8uOrdzZxscWFEbQXQM2escf9r0MsyF/Mj2jjLAcssDmDHlGyOY2OCoSDqBYIQyQ/vGZg95I9Gv18zfRHXNJA+Q6sH97rd6/v9OF2fBdCT93Z/CNg/2eNmpBZ/KayzN+0FRMDXym+YXuNBi0yIdMOSUE8QTU6VOzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Y3A2b1xSKMtegzca54Pq1cB/gX7b5Bwyh3sR2D3R9fk=; b=oJ+FU8PJpDOLBsL/i+FYice1Pd0sCGCl/lgnvbwJqgxQwGkZmSkwWWtwuVlzDiG+sgaYOdvVNb03/ZoEusK3qYu5+xTWIqdR3KtnSY+43zePM5lgvQZFsGXfDdnRME1naBnteFb8rMve+55JDnu/RIPfnu71L/8y87JY/oUxYueJLhj0rtAaQG3pKONxW+gHBC6dYVpr8ioVdGUtUL9Zn+R8x+tBnC3iSoIqK35w25a6Jc0UwnT0CyU7irp/zYgU1nlWXc40c3sFDhSXNUCnka8JcfUSenf4izvRcdwbJ+M5Lq/UBL4Hc7Kzt7t0j9shCXZoDvhgXPhREbAaIEn+JQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=dpdk.org smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y3A2b1xSKMtegzca54Pq1cB/gX7b5Bwyh3sR2D3R9fk=; b=WJj/LE22jnIp2cSYn6RJ1YOh0GhOSH3xA3AQc7HaHwztvXF25TPM0P0MuDgyrzsCmYT4kexoyfY2JnShQlm8Mphynt2pZAJJcjmhERR3NsvCvO4uzC+2LE9iomWqXE+yaEUk9F/uKPrKCvvSS5ia/RmmkslgfQBFyyV+VRN5FbHlI1ALJt4ilu3JmJx4AlvRG58I5cTGp23mJXJnAX44lMRmpqVN7OcUNc+m2/mjhptIhvxXyGYi1rcxbwvoQXPSurrdsPzDC/cruDaa8m9G8VYlZwXPU5L2eBtMyvSmbXWki6MZLRGUNfv8S9CEBYe30ErzMvIOE/g+mDMLz95VCQ== Received: from DUZP191CA0070.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:4fa::20) by PAXPR07MB8891.eurprd07.prod.outlook.com (2603:10a6:102:24a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.14; Fri, 9 Aug 2024 20:24:16 +0000 Received: from DB5PEPF00014B94.eurprd02.prod.outlook.com (2603:10a6:10:4fa:cafe::24) by DUZP191CA0070.outlook.office365.com (2603:10a6:10:4fa::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.15 via Frontend Transport; Fri, 9 Aug 2024 20:24:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by DB5PEPF00014B94.mail.protection.outlook.com (10.167.8.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.8 via Frontend Transport; Fri, 9 Aug 2024 20:24:16 +0000 Received: from seliicinfr00050.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.60) with Microsoft SMTP Server id 15.2.1544.11; Fri, 9 Aug 2024 22:24:15 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id C31181C0070; Fri, 9 Aug 2024 22:24:15 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: CC: , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Tyler Retzlaff , Stephen Hemminger , Harry van Haaren , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Subject: [PATCH 6/6] event/dsw: add support for larger port count Date: Fri, 9 Aug 2024 22:14:40 +0200 Message-ID: <20240809201440.590464-6-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809201440.590464-1-mattias.ronnblom@ericsson.com> References: <20240505073313.118515-1-mattias.ronnblom@ericsson.com> <20240809201440.590464-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B94:EE_|PAXPR07MB8891:EE_ X-MS-Office365-Filtering-Correlation-Id: 47d335c4-23bc-4006-8c5a-08dcb8b13dcf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?eTBDallSOTFsQ0NVTVFZb0tZUWFmNVF4aFF2Z3huVzE5Y3ZMSEFKRTZLMDVv?= =?utf-8?B?QW9JaGtIekhQN1VzYkZueUFJbElHWWU1REZBb3R4U3EvYTdQVUFzVWY4dkpY?= =?utf-8?B?c0tRakpPK0tXZ3ZaR29FL0x3OTZZKy9YTkhMYXpCejFoeWk0ZzI4S1lCQzFz?= =?utf-8?B?a2lqUzVmUGg4ZEo1c3BQQ0pVQTlRcnNXTjJlWVIzOUIvVS9MS3Nadjk2Mm9w?= =?utf-8?B?ZFhwQkp6cndhU1N1emVQQlB2U0RwZFNBUFdEYnVhOFF2eVEyMzVDNTQyWmoz?= =?utf-8?B?T2t1UjgvN3ZxY2c3N200S011eFh5a05jL01vM0U4azZ2MVhpbmNsSUZWdWNs?= =?utf-8?B?VWhtaTA2TFo0UmhaekpmWkMwcWhsa1BWZ0thbnNLQTd4RXQ5SEVRZU9rV3Ez?= =?utf-8?B?MHpKK3Z2NzVyZnFURDNULzNOdGhoNmdJT21ucUpoNnRmWGhvOXVVWERwd0xk?= =?utf-8?B?NjNFdzc4MWY1QitGakloSTU3STB5STQvMUxqeEF5dkxaZjMzdTgybG9uWFdx?= =?utf-8?B?djFNdFl0R3lvV2ZVZEFucWhPMEJnUDZ1NzByRl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aNHdZT2ZhcHFmeXZ5THUxeFBPeEdleWZiRXZOVXdZeFRPT2hpYWx4?= =?utf-8?B?VWNBcWJTckYwTVVWbitmclZNQVR0TmxxUitCelFiQU41UGt5T01zZXdxbWtN?= =?utf-8?B?Z3h1bmpzbWtyZXJRTXpKQnB4WkF5SDlvb2F0cWxaNDI2R3Z6a09RTkk2M0dY?= =?utf-8?B?QTg1dFUwWTJVWGJEZWdiL20vc05CS3JHbkZKYjVTYzZSbkRBdzVQZmFFeDBo?= =?utf-8?B?eU5lOU5BYW9KRDZyZlk5WnpIUU5OT3ZVWHVVOVhtV3U4a0ViUDJhbjhHRThQ?= =?utf-8?B?UUdoWVpqTWFtaktCUExwMm1SRzRDUkFaQVBTYk9LR0ZuOUkrblpXb3Z4NUpK?= =?utf-8?B?VjRLNVQ3TTI1QUtZQzQ5L2dmSGQvK0YwMk5nTDhiSnFZOEVKaSs2Q3p4eE1B?= =?utf-8?B?cFNRb3V6dWs0eVB4Y1dVVWllN3h4TVV3OFgvRXFzdGZLY3c9PQ==?= X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(1800799024)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2024 20:24:16.4720 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 47d335c4-23bc-4006-8c5a-08dcb8b13dcf X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: DB5PEPF00014B94.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR07MB8891 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 Switch from using an open-coded, single-word bitset to using to represent which event ports are linked to a particular event queue. Besides the cleaner code, this also allow the user to extend the maximum port count beyond 64, by means of changing an "event_dev.h" Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_evdev.c | 19 +++++++------------ drivers/event/dsw/dsw_evdev.h | 3 ++- drivers/event/dsw/dsw_event.c | 7 ++++--- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/event/dsw/dsw_evdev.c b/drivers/event/dsw/dsw_evdev.c index 0dea1091e3..961217334e 100644 --- a/drivers/event/dsw/dsw_evdev.c +++ b/drivers/event/dsw/dsw_evdev.c @@ -123,6 +123,7 @@ dsw_queue_setup(struct rte_eventdev *dev, uint8_t queue_id, queue->schedule_type = conf->schedule_type; } + rte_bitset_init(queue->serving_ports, DSW_MAX_PORTS); queue->num_serving_ports = 0; return 0; @@ -149,20 +150,16 @@ dsw_queue_release(struct rte_eventdev *dev __rte_unused, static void queue_add_port(struct dsw_queue *queue, uint16_t port_id) { - uint64_t port_mask = UINT64_C(1) << port_id; - - queue->serving_ports |= port_mask; + rte_bitset_set(queue->serving_ports, port_id); queue->num_serving_ports++; } static bool queue_remove_port(struct dsw_queue *queue, uint16_t port_id) { - uint64_t port_mask = UINT64_C(1) << port_id; - - if (queue->serving_ports & port_mask) { + if (rte_bitset_test(queue->serving_ports, port_id)) { queue->num_serving_ports--; - queue->serving_ports ^= port_mask; + rte_bitset_clear(queue->serving_ports, port_id); return true; } @@ -263,14 +260,12 @@ initial_flow_to_port_assignment(struct dsw_evdev *dsw) struct dsw_queue *queue = &dsw->queues[queue_id]; uint16_t flow_hash; for (flow_hash = 0; flow_hash < DSW_MAX_FLOWS; flow_hash++) { - uint8_t skip = - rte_rand_max(queue->num_serving_ports); + uint8_t skip = rte_rand_max(queue->num_serving_ports); uint8_t port_id; for (port_id = 0;; port_id++) { - uint64_t port_mask = UINT64_C(1) << port_id; - - if (queue->serving_ports & port_mask) { + if (rte_bitset_test(queue->serving_ports, + port_id)) { if (skip == 0) break; skip--; diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h index c9bf4f8b6b..606c1e9f8a 100644 --- a/drivers/event/dsw/dsw_evdev.h +++ b/drivers/event/dsw/dsw_evdev.h @@ -7,6 +7,7 @@ #include +#include #include #include @@ -237,7 +238,7 @@ struct __rte_cache_aligned dsw_port { struct dsw_queue { uint8_t schedule_type; - uint64_t serving_ports; + RTE_BITSET_DECLARE(serving_ports, DSW_MAX_PORTS); uint16_t num_serving_ports; alignas(RTE_CACHE_LINE_SIZE) uint8_t flow_to_port_map[DSW_MAX_FLOWS]; diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c index 33f741990f..f18c7e8fbc 100644 --- a/drivers/event/dsw/dsw_event.c +++ b/drivers/event/dsw/dsw_event.c @@ -457,9 +457,8 @@ static bool dsw_is_serving_port(struct dsw_evdev *dsw, uint8_t port_id, uint8_t queue_id) { struct dsw_queue *queue = &dsw->queues[queue_id]; - uint64_t port_mask = UINT64_C(1) << port_id; - return queue->serving_ports & port_mask; + return rte_bitset_test(queue->serving_ports, port_id); } static bool @@ -583,7 +582,9 @@ dsw_schedule(struct dsw_evdev *dsw, uint8_t queue_id, uint16_t flow_hash) /* A single-link queue, or atomic/ordered/parallel but * with just a single serving port. */ - port_id = rte_bsf64(queue->serving_ports); + port_id = (uint8_t)rte_bitset_find_first_set( + queue->serving_ports, DSW_MAX_PORTS + ); DSW_LOG_DP(DEBUG, "Event with queue_id %d flow_hash %d is scheduled " "to port %d.\n", queue_id, flow_hash, port_id); -- 2.34.1