From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sessmg22.ericsson.net (sessmg22.ericsson.net [193.180.251.58]) by dpdk.org (Postfix) with ESMTP id 4FEAA4F91 for ; Tue, 18 Sep 2018 14:45:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1537274729; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hKlObLwZBaFcFvweKVHhgolE2j13LJvkp7EukNJ1PD8=; b=CrctfDwJjjZM+38C8lt8y3DCtGfKO0LhlcBXwd4UcJYSh7cG8N4NNWuZlJXP8rHd 7olOazY1yTdJcVq8c6n60RUkcIvKZPyUT7hNO0UMvoshmCiQ0OHkdJTRB8JQgPdq DvgBAFfob5FvwDsI15dOIRR6MhL7Lm9KXmzi698NJdg=; X-AuditID: c1b4fb3a-75d969c000003197-8d-5ba0f3697854 Received: from ESESSMB501.ericsson.se (Unknown_Domain [153.88.183.119]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id B1.EF.12695.963F0AB5; Tue, 18 Sep 2018 14:45:29 +0200 (CEST) Received: from ESESBMB501.ericsson.se (153.88.183.168) by ESESSMB501.ericsson.se (153.88.183.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 18 Sep 2018 14:45:26 +0200 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.184) with Microsoft SMTP Server id 15.1.1466.3 via Frontend Transport; Tue, 18 Sep 2018 14:45:26 +0200 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 w8ICjQ1W011575; Tue, 18 Sep 2018 14:45:27 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: Jerin Jacob CC: Bruce Richardson , , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Date: Tue, 18 Sep 2018 14:45:07 +0200 Message-ID: <20180918124514.10615-4-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180918124514.10615-1-mattias.ronnblom@ericsson.com> References: <20180918124514.10615-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsUyM2J7uW7m5wXRBg96rCxurLK3ePdpO5PF xEkmDsweG070s3r8WrCU1WPxnpdMAcxRXDYpqTmZZalF+nYJXBnHP9xgLTilULHk+Fn2BsYv Ul2MnBwSAiYSz6bNZO9i5OIQEjjKKLFq021WCOcbo8SXs4tYIJyLjBLzrj9kg3AuM0r8P32M BaSfTcBTYvK7bjBbRMBAYtGZ+8wgRcwCHYwSzVP/gCWEBewl9vZ+YQSxWQRUJfpOPmQHsXkF nCSafh9kgThEXmL1hgPMIDangLPE56nrmLoYOYC2OUlc3KAMUS4ocXLmE7ByZgFNidbtv9kh bHmJ5q2zwVqFBLQk7i/5wjyBUWgWkpZZSFpmIWlZwMi8ilG0OLW4ODfdyEgvtSgzubg4P08v L7VkEyMwuA9u+W21g/Hgc8dDjAIcjEo8vMmvFkQLsSaWFVfmHmKU4GBWEuHlzAEK8aYkVlal FuXHF5XmpBYfYpTmYFES53VKs4gSEkhPLEnNTk0tSC2CyTJxcEo1MGoFTvo5IU5wb9NEJTe9 3+2nhDtZ5K/9cD/RZ3rtwOoJsUd9VM8oz/wfP6Wo5LvKg7PJ8pem6r9ZtjjAZFJKTH/u5bqT Oo7GZis2bLKZ8maTbPzHOOPTdkW1990mtYULXZTKcLxVlO3MsmKZls33dSsze1bz8lv/K0xe /uzCqs9TDsa+uZ14cLkSS3FGoqEWc1FxIgDK5WAeagIAAA== Subject: [dpdk-dev] [PATCH v4 03/10] event/dsw: add DSW port configuration 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: , X-List-Received-Date: Tue, 18 Sep 2018 12:45:30 -0000 Allow port setup and release in the DSW event device. Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_evdev.c | 60 +++++++++++++++++++++++++++++++++++ drivers/event/dsw/dsw_evdev.h | 28 ++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/drivers/event/dsw/dsw_evdev.c b/drivers/event/dsw/dsw_evdev.c index 1500d2426..91b1a2449 100644 --- a/drivers/event/dsw/dsw_evdev.c +++ b/drivers/event/dsw/dsw_evdev.c @@ -9,6 +9,62 @@ #define EVENTDEV_NAME_DSW_PMD event_dsw +static int +dsw_port_setup(struct rte_eventdev *dev, uint8_t port_id, + const struct rte_event_port_conf *conf) +{ + struct dsw_evdev *dsw = dsw_pmd_priv(dev); + struct dsw_port *port; + struct rte_event_ring *in_ring; + char ring_name[RTE_RING_NAMESIZE]; + + port = &dsw->ports[port_id]; + + *port = (struct dsw_port) { + .id = port_id, + .dsw = dsw, + .dequeue_depth = conf->dequeue_depth, + .enqueue_depth = conf->enqueue_depth, + .new_event_threshold = conf->new_event_threshold + }; + + snprintf(ring_name, sizeof(ring_name), "dsw%d_p%u", dev->data->dev_id, + port_id); + + in_ring = rte_event_ring_create(ring_name, DSW_IN_RING_SIZE, + dev->data->socket_id, + RING_F_SC_DEQ|RING_F_EXACT_SZ); + + if (in_ring == NULL) + return -ENOMEM; + + port->in_ring = in_ring; + + dev->data->ports[port_id] = port; + + return 0; +} + +static void +dsw_port_def_conf(struct rte_eventdev *dev __rte_unused, + uint8_t port_id __rte_unused, + struct rte_event_port_conf *port_conf) +{ + *port_conf = (struct rte_event_port_conf) { + .new_event_threshold = 1024, + .dequeue_depth = DSW_MAX_PORT_DEQUEUE_DEPTH / 4, + .enqueue_depth = DSW_MAX_PORT_ENQUEUE_DEPTH / 4 + }; +} + +static void +dsw_port_release(void *p) +{ + struct dsw_port *port = p; + + rte_event_ring_free(port->in_ring); +} + static int dsw_queue_setup(struct rte_eventdev *dev, uint8_t queue_id, const struct rte_event_queue_conf *conf) @@ -81,12 +137,16 @@ dsw_configure(const struct rte_eventdev *dev) struct dsw_evdev *dsw = dsw_pmd_priv(dev); const struct rte_event_dev_config *conf = &dev->data->dev_conf; + dsw->num_ports = conf->nb_event_ports; dsw->num_queues = conf->nb_event_queues; return 0; } static struct rte_eventdev_ops dsw_evdev_ops = { + .port_setup = dsw_port_setup, + .port_def_conf = dsw_port_def_conf, + .port_release = dsw_port_release, .queue_setup = dsw_queue_setup, .queue_def_conf = dsw_queue_def_conf, .queue_release = dsw_queue_release, diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h index 5eda8d114..2a4f10421 100644 --- a/drivers/event/dsw/dsw_evdev.h +++ b/drivers/event/dsw/dsw_evdev.h @@ -5,6 +5,7 @@ #ifndef _DSW_EVDEV_H_ #define _DSW_EVDEV_H_ +#include #include #define DSW_PMD_NAME RTE_STR(event_dsw) @@ -23,6 +24,31 @@ #define DSW_MAX_FLOWS (1<<(DSW_MAX_FLOWS_BITS)) #define DSW_MAX_FLOWS_MASK (DSW_MAX_FLOWS-1) +/* The rings are dimensioned so that all in-flight events can reside + * on any one of the port rings, to avoid the trouble of having to + * care about the case where there's no room on the destination port's + * input ring. + */ +#define DSW_IN_RING_SIZE (DSW_MAX_EVENTS) + +struct dsw_port { + uint16_t id; + + /* Keeping a pointer here to avoid container_of() calls, which + * are expensive since they are very frequent and will result + * in an integer multiplication (since the port id is an index + * into the dsw_evdev port array). + */ + struct dsw_evdev *dsw; + + uint16_t dequeue_depth; + uint16_t enqueue_depth; + + int32_t new_event_threshold; + + struct rte_event_ring *in_ring __rte_cache_aligned; +} __rte_cache_aligned; + struct dsw_queue { uint8_t schedule_type; uint16_t num_serving_ports; @@ -31,6 +57,8 @@ struct dsw_queue { struct dsw_evdev { struct rte_eventdev_data *data; + struct dsw_port ports[DSW_MAX_PORTS]; + uint16_t num_ports; struct dsw_queue queues[DSW_MAX_QUEUES]; uint8_t num_queues; }; -- 2.17.1