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 5B38143FAC; Sun, 5 May 2024 09:44:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E186F4064C; Sun, 5 May 2024 09:43:43 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2053.outbound.protection.outlook.com [40.107.21.53]) by mails.dpdk.org (Postfix) with ESMTP id B981C4025D for ; Sun, 5 May 2024 09:43:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g8YJRG2mxjp3hmazc7Qp+B4O0XRZZqFAKMFKKioZJF0JR8zRO7xnvil2CcCbFrTyCkLITEHZ6H8xeBGTAw2PwvMu4DidfXuK4ZsOOCUU4tEdbArrMQ+rNk4Mp06BRnsGr99QwB2DAp3F/dQDxID1IGYHWVYzFR5USSIU7N1rCXB0tU7U3hkqKaLsLS8/szKna7ZqaDAJwmiSRo9UM5fW+e/F5Fyo9/8REfDr79ONmvjCAG2NUqNZey6jG+W+QNmq08wXZSKSPl1vpoTPW92DfxSnIrXXFRDk4KdRPlz1OmY8762x4ovnPLTKNrayoHu79ER/BMLKkEzDOa9ljq20Kw== 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=yg9JyEy7mLkxh3uPP7MtbRx4iQ/spseeByLLkTdz4d0=; b=aYcqtmE9e/qiglTYihtXS6SUJTzeFKhuQK1sGN7MX+nPRNCUvDIGc4ZdIBxujyf+u2tgqWmb4HpJFK/QdV1i8HM1zNQp97ucTKrKq4pYeS+YwUEAmZ8wbv6ZnOp4ReUHNf6UNakb+qiPzUq17SPU5CILBMRUFHdluKkAw32lH0X0eZ7/Nxf5Iu7bBJbYyg/vb9oautzXjrHtSuFqCzE/wBg7kFmJwn+OYuKRIdPF7pU7byG66hleFA18M/rX9IZ20ypMiludaggpUZcHIFmrBUaFJ3cd0MnrvxrCiDnSviXHYLOIJ3LdN/W5X7v9X0b2inSYJQ9CeTGR8ISMmqztHg== 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=yg9JyEy7mLkxh3uPP7MtbRx4iQ/spseeByLLkTdz4d0=; b=qrD13SVzZMIwZcAl2zesOO9xH0dCecWjuCZeb8vQVfChNMQ3O2wbW48xfl6XVPDkLr7OcdU+YMIHHwjfLkuPwiGTbwabb2yzvWvv2xUFdwMPcC14P2Oqkw01P0t08WJuQnYSdj/uAV5zGRbfaxoqkyVlhJ9fX8adGvRzzKjAKiNRZfZtOJV5WppG7wZtRGnIOaTvxUX+0UCCen8OknIe4nD9ByJC3o2eJw/GEuGumPFxUYMQDImmDEv7LY3ATIFIdyohKIsA5HcpOGvUB6xWYsEGgpzKosDvzokvee7C7u25GS+Nes9Z9mU9Rf436r3iQmUKaGw2HQlLF+Riu8nvZg== Received: from DUZPR01CA0332.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b8::18) by AS8PR07MB7765.eurprd07.prod.outlook.com (2603:10a6:20b:396::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Sun, 5 May 2024 07:43:36 +0000 Received: from DB1PEPF000509E7.eurprd03.prod.outlook.com (2603:10a6:10:4b8:cafe::fb) by DUZPR01CA0332.outlook.office365.com (2603:10a6:10:4b8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39 via Frontend Transport; Sun, 5 May 2024 07:43:36 +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 DB1PEPF000509E7.mail.protection.outlook.com (10.167.242.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.19 via Frontend Transport; Sun, 5 May 2024 07:43:36 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.69) with Microsoft SMTP Server id 15.2.1544.9; Sun, 5 May 2024 09:43:35 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 258FA38007A; Sun, 5 May 2024 09:43:35 +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: [RFC v5 6/6] event/dsw: optimize serving port logic Date: Sun, 5 May 2024 09:33:13 +0200 Message-ID: <20240505073313.118515-6-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240505073313.118515-1-mattias.ronnblom@ericsson.com> References: <20240216102348.480407-1-mattias.ronnblom@ericsson.com> <20240505073313.118515-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: DB1PEPF000509E7:EE_|AS8PR07MB7765:EE_ X-MS-Office365-Filtering-Correlation-Id: b95395f7-336b-4b66-6d5e-08dc6cd7127b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|36860700004|1800799015|376005; X-Microsoft-Antispam-Message-Info: =?utf-8?B?blAwcGQzOTkza1JBM2FqOUNtLzNTQS9JQVhtSHNkZmdtT2oyUEM2aHp6MHhq?= =?utf-8?B?VHpHczlmbXNFYUFub252NUhxOEk0SWM3ckkyV1lkVjIxOVFjVzJQUXVMQUFt?= =?utf-8?B?ZmlzV0cvWUNaMVArOCtoNGd5ZXNzdzk1dThma01Mc0dYN0EwUmZUN1Z3SnFu?= =?utf-8?B?L0J6K0xORGh2QnREVVp3ZHlIemhsTWJZNko0NUlZWVg4bzdQK0YvQlE3NlBH?= =?utf-8?B?L2lIQWRHaVNNSGNQOEI4elA5cHhwdUNXZEx5QkhVQXBFRGRERVluWHhuMjJV?= =?utf-8?B?SFNxRFVoL1ZsWVRnOThycVIzbE9EODlzSkFCaW5Cd0J2ZFJCcHprVTlnY2dt?= =?utf-8?B?TUpBdjRmdVFDblpxaDBEY09LSVBqYVlCTmtQNHJkZ2xBcDJQcDBRNG16cEY1?= =?utf-8?B?UEFCSEpOR21oYkFZbzNXaExnV0l5TG9oWWpLUnRESmhaT1FZbjIrTUxudVBp?= =?utf-8?B?eFN4LzlYQjJJMm5sZU4ya2RFTms3NWJsQlhJdkxhS1Vpc0hFQWtHMm1ZUHN1?= =?utf-8?B?cHlOaDd6MnVSS2lJUHVlMk9aSENuSlpCNDFNeWIrbWxHUHpXTGpoTDZVUHpU?= =?utf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=?utf-8?B?UzZjRXpmYlV3WVRGNGhhRHI3anlHQnc4LzZMN3h2d1FMT3JYL0Z6Y2RodkhJ?= =?utf-8?B?NlFpTWphQTE0OVFrc05yTWhDV2ZFaFovd2VXZUtQRU5rTDR2RUZzTG1wdXZr?= =?utf-8?B?Y1cxV0g1WXBIMzJNK3VKdWpDTzRmMjR6ZXdQNHN1cmgvZThQS2piNXIrMzJF?= =?utf-8?B?ZW1qdmYyc0NSNFY5L2syVVhSelpyejkwaXYwKzY5cnBVUzFVb0paUnd0VkpK?= =?utf-8?B?Z1Nnb2VjcFQzaUVhOEp4OE9QWXRKM3c2ZlNrK0p1eDBVdHplQU8yWHQ4VXBB?= =?utf-8?B?N1VoWVRMNC9XMWNhS0wxekUyekxxUGRRcEp6ZzRKSnZzZ3ZpNUZYVzNCSjAx?= =?utf-8?Q?zMitynCiuYzmj?= 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:(13230031)(82310400017)(36860700004)(1800799015)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2024 07:43:36.2833 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b95395f7-336b-4b66-6d5e-08dc6cd7127b 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: DB1PEPF000509E7.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7765 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 To reduce flow migration overhead, replace the array-based representation of which set of ports are bound to a particular queue by a multi-word bitset. 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 ab0420b549..f3ca99e935 100644 --- a/drivers/event/dsw/dsw_evdev.c +++ b/drivers/event/dsw/dsw_evdev.c @@ -118,6 +118,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; @@ -144,20 +145,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; } @@ -257,14 +254,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 3a5989f148..0c40c45e46 100644 --- a/drivers/event/dsw/dsw_evdev.h +++ b/drivers/event/dsw/dsw_evdev.h @@ -7,6 +7,7 @@ #include +#include #include #include @@ -234,7 +235,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 23488d9030..b855f9ecf1 100644 --- a/drivers/event/dsw/dsw_event.c +++ b/drivers/event/dsw/dsw_event.c @@ -447,9 +447,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 @@ -571,7 +570,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