From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sessmg23.ericsson.net (sessmg23.ericsson.net [193.180.251.45]) by dpdk.org (Postfix) with ESMTP id 31BC74F90 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=Enm/vbm3s0eGKed716027WE7k6cKgP3cuX6a6GqS9dY=; b=DLqaD/ncpXgZyJduYXmIlDXPT/f5BQx3ZxcJAyPudkbKwYHyoWbr5bmQfgZLrWrT bHou1/bTL69AONQKyEH3QRo3gANF0+mYSYoPkVfxNGzI2Uw/7ERDAfWW22h+SLU4 +uamy9WY3tWK1lqVegBrzh228DmlF0PWt2aqOwmPkqw=; X-AuditID: c1b4fb2d-5ecb19c0000055ff-96-5ba0f36923fd Received: from ESESSMB502.ericsson.se (Unknown_Domain [153.88.183.120]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 86.EF.22015.963F0AB5; Tue, 18 Sep 2018 14:45:29 +0200 (CEST) Received: from ESESBMR502.ericsson.se (153.88.183.134) by ESESSMB502.ericsson.se (153.88.183.190) 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 ESESBMB501.ericsson.se (153.88.183.168) by ESESBMR502.ericsson.se (153.88.183.134) 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 w8ICjQ1X011575; 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:08 +0200 Message-ID: <20180918124514.10615-5-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+NgFnrMLMWRmVeSWpSXmKPExsUyM2J7hW7m5wXRBpcuGFvcWGVv8e7TdiaL iZNMHJg9NpzoZ/X4tWApq8fiPS+ZApijuGxSUnMyy1KL9O0SuDIOLPnGXDBXomLb6WmsDYyP hLsYOTkkBEwkJlxexdrFyMUhJHCUUWLb+wVMEM43Ron+6VtY4JyTG++zQTgXGSXmXX8I5Vxm lDj/fB8zyDA2AU+Jye+6WUBsEQEDiUVn7jODFDELdDBKNE/9A5YQFgiWOPdvC2MXIwcHi4Cq xNcJtiBhXgEniXmvF7NDHCUvsXrDAbCZnALOEp+nrmMCKRcCqrm4QRmiXFDi5MwnYBOZBTQl Wrf/Zoew5SWat84GaxUS0JK4v+QL8wRG4VlIWmYhaZmFpGUBI/MqRtHi1OLi3HQjY73Uoszk 4uL8PL281JJNjMCgP7jlt+4OxtWvHQ8xCnAwKvHwTny1IFqINbGsuDL3EKMEB7OSCC9nDlCI NyWxsiq1KD++qDQntfgQozQHi5I4r96qPVFCAumJJanZqakFqUUwWSYOTqkGRo9DhwykRDLl 3say5JQ+vGV8JPAxZ55g1KKnv6QftB7552+3vifLq6I68MXa2l9Sng/K11/M3LBHfeXPxKgA +YIKZs9o36UsOnw3+XfEStQbnFv74HqHtMGeLDF/Ac9X+vuY/Y6+YZ0pk5DvZPzGZv7iB4YM XOFupw+f2qxhonJ2ruU9Uy8TJZbijERDLeai4kQAPMDbWXYCAAA= Subject: [dpdk-dev] [PATCH v4 04/10] event/dsw: add support in DSW for linking/unlinking ports 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 Added support for linking and unlinking ports to queues in a DSW event device. Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_evdev.c | 67 +++++++++++++++++++++++++++++++++++ drivers/event/dsw/dsw_evdev.h | 1 + 2 files changed, 68 insertions(+) diff --git a/drivers/event/dsw/dsw_evdev.c b/drivers/event/dsw/dsw_evdev.c index 91b1a2449..5dccc232a 100644 --- a/drivers/event/dsw/dsw_evdev.c +++ b/drivers/event/dsw/dsw_evdev.c @@ -2,6 +2,8 @@ * Copyright(c) 2018 Ericsson AB */ +#include + #include #include @@ -112,6 +114,69 @@ dsw_queue_release(struct rte_eventdev *dev __rte_unused, { } +static void +queue_add_port(struct dsw_queue *queue, uint16_t port_id) +{ + queue->serving_ports[queue->num_serving_ports] = port_id; + queue->num_serving_ports++; +} + +static bool +queue_remove_port(struct dsw_queue *queue, uint16_t port_id) +{ + uint16_t i; + + for (i = 0; i < queue->num_serving_ports; i++) + if (queue->serving_ports[i] == port_id) { + uint16_t last_idx = queue->num_serving_ports - 1; + if (i != last_idx) + queue->serving_ports[i] = + queue->serving_ports[last_idx]; + queue->num_serving_ports--; + return true; + } + return false; +} + +static int +dsw_port_link_unlink(struct rte_eventdev *dev, void *port, + const uint8_t queues[], uint16_t num, bool link) +{ + struct dsw_evdev *dsw = dsw_pmd_priv(dev); + struct dsw_port *p = port; + uint16_t i; + uint16_t count = 0; + + for (i = 0; i < num; i++) { + uint8_t qid = queues[i]; + struct dsw_queue *q = &dsw->queues[qid]; + if (link) { + queue_add_port(q, p->id); + count++; + } else { + bool removed = queue_remove_port(q, p->id); + if (removed) + count++; + } + } + + return count; +} + +static int +dsw_port_link(struct rte_eventdev *dev, void *port, const uint8_t queues[], + const uint8_t priorities[] __rte_unused, uint16_t num) +{ + return dsw_port_link_unlink(dev, port, queues, num, true); +} + +static int +dsw_port_unlink(struct rte_eventdev *dev, void *port, uint8_t queues[], + uint16_t num) +{ + return dsw_port_link_unlink(dev, port, queues, num, false); +} + static void dsw_info_get(struct rte_eventdev *dev __rte_unused, struct rte_event_dev_info *info) @@ -150,6 +215,8 @@ static struct rte_eventdev_ops dsw_evdev_ops = { .queue_setup = dsw_queue_setup, .queue_def_conf = dsw_queue_def_conf, .queue_release = dsw_queue_release, + .port_link = dsw_port_link, + .port_unlink = dsw_port_unlink, .dev_infos_get = dsw_info_get, .dev_configure = dsw_configure, }; diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h index 2a4f10421..ad0f857cc 100644 --- a/drivers/event/dsw/dsw_evdev.h +++ b/drivers/event/dsw/dsw_evdev.h @@ -51,6 +51,7 @@ struct dsw_port { struct dsw_queue { uint8_t schedule_type; + uint8_t serving_ports[DSW_MAX_PORTS]; uint16_t num_serving_ports; }; -- 2.17.1