From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 00118A051F; Mon, 20 Jan 2020 16:22:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D07AA1BE3D; Mon, 20 Jan 2020 16:22:17 +0100 (CET) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00057.outbound.protection.outlook.com [40.107.0.57]) by dpdk.org (Postfix) with ESMTP id A360D1BC25 for ; Mon, 20 Jan 2020 16:22:16 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E6l/KalewPFYv4PEEiOePVd5OIIrl5HjA0tW50siNMTjaNTrkTLmjprp8C2nrJlBFaannO1p7WkQPwpPU+Ruxp1rDdu5ENr3V5E5Vmo5FWgSRqKElMyJJN69AEuiJVK1kcg94alXZo8mjgjxFTN9YHyEUWOP2T5udQE4f06XSDOdW2Cg5FyET8lV3zAZgjc8efdaoXJE41PUyrGOtTvnhKJSEjuTAlUsmVfEo4LWO+oxcg28j1l6Xo0pKlpuJIpGr/Zi13yfuMQHUXqljWn+fhV93jMOITyz0uVm+A+nM9mJ2w5vL/bundagTG/gZKV8DzeEUBMIxxT61UdeB7jUWw== 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-SenderADCheck; bh=X2vIga/W74Ei8Nb+AriaKa+8JjyB+7/s84IOEymcHDY=; b=Mp16KOFpRDvOL+C4F/7NaN2TxOjAozXY1rcCwnBPxrrgbr20AkjqH4r2/BAl4gu5Ba32Xn2i5z3SXnPcwIdbdzWbG0vOLZiu4zozmGQryScrUa4W/yzVx8e+TZz9xWRKohXpiPZsvdF2GTSuzSOkBfUVj/Z3zSsDkR65fCaDb4hWZ+/PZ1xV8TCx7rZsXKSgZHNRjewiGIpG9eUFzXSPHZgVBdfVkEBpnqWusOi8dRsMRXiI1O85iQlnkceRJwtXDtY5kfKBABXbTT/o60sHAZQFE0kJ8SPBuQKqyjDJG7GWHeeJ//rielSZO0NWH9+p4ivBVelAxWDDoj8iTPA57A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=arm.com smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none 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=X2vIga/W74Ei8Nb+AriaKa+8JjyB+7/s84IOEymcHDY=; b=AJKhGZGcdOrs+uWrIRzAEm2yW4nJYGm5s2Sg1utTemNEujSl72F/9UzaZmJI+xaoqPRXo3uSZsLqtVfYcse15nHsPuHTXHCu8ds0eN3VGSnhrnhI13x15Hp9DlYLRKxQygWQ2Xqp08R8RSuHrm4VBpHPIXdnsX0fC5Qsa3psz+U= Received: from VI1PR07CA0220.eurprd07.prod.outlook.com (2603:10a6:802:58::23) by VI1PR0701MB2526.eurprd07.prod.outlook.com (2603:10a6:800:71::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.14; Mon, 20 Jan 2020 15:22:15 +0000 Received: from VE1EUR02FT018.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e06::201) by VI1PR07CA0220.outlook.office365.com (2603:10a6:802:58::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.13 via Frontend Transport; Mon, 20 Jan 2020 15:22:15 +0000 Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; 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; Received: from oa.msg.ericsson.com (192.176.1.74) by VE1EUR02FT018.mail.protection.outlook.com (10.152.12.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2644.19 via Frontend Transport; Mon, 20 Jan 2020 15:22:15 +0000 Received: from ESESSMB502.ericsson.se (153.88.183.163) by ESESBMR505.ericsson.se (153.88.183.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 20 Jan 2020 16:03:05 +0100 Received: from ESESBMB504.ericsson.se (153.88.183.171) by ESESSMB502.ericsson.se (153.88.183.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 20 Jan 2020 16:03:05 +0100 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.187) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 20 Jan 2020 16:03:04 +0100 Received: from breslau.lmera.ericsson.se (breslau.lmera.ericsson.se [150.132.109.241]) by selio1a020.lmera.ericsson.se (8.15.1+Sun/8.15.1) with ESMTP id 00KF355q006592; Mon, 20 Jan 2020 16:03:05 +0100 (CET) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: CC: , , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Date: Mon, 20 Jan 2020 16:03:00 +0100 Message-ID: <20200120150300.15407-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.176.1.74; IPV:; CTRY:SE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(346002)(376002)(396003)(136003)(189003)(199004)(2906002)(6916009)(107886003)(66574012)(1076003)(4326008)(6666004)(356004)(478600001)(36756003)(70206006)(70586007)(8676002)(316002)(336012)(2616005)(956004)(26005)(186003)(54906003)(86362001)(5660300002)(8936002)(246002)(7636002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0701MB2526; H:oa.msg.ericsson.com; FPR:; SPF:Pass; LANG:en; PTR:office365.se.ericsson.net; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d79b6aef-bdf9-4aad-c1d1-08d79dbc87d6 X-MS-TrafficTypeDiagnostic: VI1PR0701MB2526: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-Forefront-PRVS: 0288CD37D9 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x9bEfyP3zlvb3c6dYp13w7ZsL05S2tA23Zqzo6/Xq6iyFEX13M5xMJbT3x7JLkaWmqxKW6NPoSaZy70GbmOuBcb801pBrsLcNfFukCU4+omC2VmfplOwYLfaSbiBYycx5sIBOgtJjzrBxgHTkiSuuUggsizaIM+e9Wyy2E2B7WAPaPhcxJNHomrRs18S27B93fVLofnsdiNrVknoGM1BAdbUx45T3Y0zVkfJbzs5fb4hmht66gL9gEIs24eHIxaU8CebbD+rf7vqkg7vWlxTzfghrMl1NpQ7Q3XdgTSQrfIIs/w2BVqL9mqJPzxtFaZanN62YSs44psUUUbbB2kVDntReRMWXPuHD25NQb3C4pJvbHmpo7UmBqoj8uGSqe/JgxO1yunxxzfC6LfK2gXkKMqQNVJLO3w53wgcBLh3UgljkW2oT709/YO5GQfqDVcZ X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2020 15:22:15.3694 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d79b6aef-bdf9-4aad-c1d1-08d79dbc87d6 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0701MB2526 Subject: [dpdk-dev] [PATCH] event/dsw: use custom element size ring for control X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replace DSW's use of regular DPDK rings (and code for packing/unpacking control messages into void pointers) with custom size rings. In addition to cleaner code, this change allows DSW to support up to the eventdev API's maximum of 255 ports by tweaking DSW_MAX_PORTS. Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/Makefile | 3 +++ drivers/event/dsw/dsw_evdev.c | 9 ++++++--- drivers/event/dsw/dsw_evdev.h | 10 +++------- drivers/event/dsw/dsw_event.c | 16 ++-------------- drivers/event/dsw/meson.build | 3 +++ 5 files changed, 17 insertions(+), 24 deletions(-) diff --git a/drivers/event/dsw/Makefile b/drivers/event/dsw/Makefile index f6e7dda1f..68d681fab 100644 --- a/drivers/event/dsw/Makefile +++ b/drivers/event/dsw/Makefile @@ -11,6 +11,9 @@ ifneq ($(CONFIG_RTE_TOOLCHAIN_ICC),y) CFLAGS += -Wno-format-nonliteral endif +# Depends on rte_ring_elem_*() +CFLAGS += -DALLOW_EXPERIMENTAL_API + LDLIBS += -lrte_eal LDLIBS += -lrte_mbuf LDLIBS += -lrte_mempool diff --git a/drivers/event/dsw/dsw_evdev.c b/drivers/event/dsw/dsw_evdev.c index 9387d4149..7798a38ad 100644 --- a/drivers/event/dsw/dsw_evdev.c +++ b/drivers/event/dsw/dsw_evdev.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "dsw_evdev.h" @@ -46,9 +47,11 @@ dsw_port_setup(struct rte_eventdev *dev, uint8_t port_id, snprintf(ring_name, sizeof(ring_name), "dswctl%d_p%u", dev->data->dev_id, port_id); - ctl_in_ring = rte_ring_create(ring_name, DSW_CTL_IN_RING_SIZE, - dev->data->socket_id, - RING_F_SC_DEQ|RING_F_EXACT_SZ); + ctl_in_ring = rte_ring_create_elem(ring_name, + sizeof(struct dsw_ctl_msg), + DSW_CTL_IN_RING_SIZE, + dev->data->socket_id, + RING_F_SC_DEQ|RING_F_EXACT_SZ); if (ctl_in_ring == NULL) { rte_event_ring_free(in_ring); diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h index dc28ab125..5c7b6108d 100644 --- a/drivers/event/dsw/dsw_evdev.h +++ b/drivers/event/dsw/dsw_evdev.h @@ -10,7 +10,6 @@ #define DSW_PMD_NAME RTE_STR(event_dsw) -/* Code changes are required to allow more ports. */ #define DSW_MAX_PORTS (64) #define DSW_MAX_PORT_DEQUEUE_DEPTH (128) #define DSW_MAX_PORT_ENQUEUE_DEPTH (128) @@ -226,15 +225,12 @@ struct dsw_evdev { #define DSW_CTL_UNPAUS_REQ (1) #define DSW_CTL_CFM (2) -/* sizeof(struct dsw_ctl_msg) must be equal or less than - * sizeof(void *), to fit on the control ring. - */ struct dsw_ctl_msg { - uint8_t type:2; - uint8_t originating_port_id:6; + uint8_t type; + uint8_t originating_port_id; uint8_t queue_id; uint16_t flow_hash; -} __rte_packed; +} __rte_aligned(4); uint16_t dsw_event_enqueue(void *port, const struct rte_event *event); uint16_t dsw_event_enqueue_burst(void *port, diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c index eae53b240..d68b71b98 100644 --- a/drivers/event/dsw/dsw_event.c +++ b/drivers/event/dsw/dsw_event.c @@ -176,27 +176,15 @@ dsw_port_consider_load_update(struct dsw_port *port, uint64_t now) static void dsw_port_ctl_enqueue(struct dsw_port *port, struct dsw_ctl_msg *msg) { - void *raw_msg; - - memcpy(&raw_msg, msg, sizeof(*msg)); - /* there's always room on the ring */ - while (rte_ring_enqueue(port->ctl_in_ring, raw_msg) != 0) + while (rte_ring_enqueue_elem(port->ctl_in_ring, msg, sizeof(*msg)) != 0) rte_pause(); } static int dsw_port_ctl_dequeue(struct dsw_port *port, struct dsw_ctl_msg *msg) { - void *raw_msg; - int rc; - - rc = rte_ring_dequeue(port->ctl_in_ring, &raw_msg); - - if (rc == 0) - memcpy(msg, &raw_msg, sizeof(*msg)); - - return rc; + return rte_ring_dequeue_elem(port->ctl_in_ring, msg, sizeof(*msg)); } static void diff --git a/drivers/event/dsw/meson.build b/drivers/event/dsw/meson.build index 60ab13d90..3b39cb653 100644 --- a/drivers/event/dsw/meson.build +++ b/drivers/event/dsw/meson.build @@ -6,3 +6,6 @@ if cc.has_argument('-Wno-format-nonliteral') cflags += '-Wno-format-nonliteral' endif sources = files('dsw_evdev.c', 'dsw_event.c', 'dsw_xstats.c') + +# Depends on rte_ring_elem_*() +allow_experimental_apis = true -- 2.17.1