From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0072.outbound.protection.outlook.com [104.47.32.72]) by dpdk.org (Postfix) with ESMTP id A4FA9FA5D for ; Mon, 27 Mar 2017 10:55:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DTvn45lEhPQolccQt3Jz4T0iWrfGUvkLSRscHGCImrw=; b=n0c8LmV2pT1CDvF7aLgbO+aQEuC5AwhnGWoZwIjqMxV02MNSmPOQBKxvNaFZH4uOmP4pbZJsxSUx0quV3aTEoJQXLLe+Kj4/AuOQeANgU2DV/Z8sJ7KiQ+31LP0f3mfVSaFCdk8ij0W2h0z5v0QOhmi+2hlnpgYJId2XXSNekKY= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (171.76.86.30) by BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14; Mon, 27 Mar 2017 08:55:29 +0000 Date: Mon, 27 Mar 2017 14:25:13 +0530 From: Jerin Jacob To: Harry van Haaren Cc: dev@dpdk.org, Bruce Richardson Message-ID: <20170327085512.vqx5d5w5wkwxt2bs@localhost.localdomain> References: <489175012-101439-1-git-send-email-harry.van.haaren@intel.com> <1490374395-149320-1-git-send-email-harry.van.haaren@intel.com> <1490374395-149320-8-git-send-email-harry.van.haaren@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1490374395-149320-8-git-send-email-harry.van.haaren@intel.com> User-Agent: NeoMutt/20170306 (1.8.0) X-Originating-IP: [171.76.86.30] X-ClientProxiedBy: BM1PR01CA0075.INDPRD01.PROD.OUTLOOK.COM (10.174.208.143) To BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) X-MS-Office365-Filtering-Correlation-Id: 10609b8e-692c-4e79-d5ec-08d474ef0609 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 3:CLSCadMCxF/XqDRUkVrV3qcNtnkPnVPLZLoydMgoeQmYjn4V5Izfk4JZ0TCzlpMxZvN7Ou2HihQxgKvj8lIl2I2q/xB/upEotARu0vozk2SEkoQpJpVp2WQtWGqPjF2aDwFGu+TWml65sbVaMLpRV/x5/RNtzIHQ65iyeO7PYRZ1SHWHHCTq0Zhsl5TuKFHHb5EhxwlxikJEhuSeexlH6ukY2ePZbymVsqXrDkTVyfMrq02siA6kchgOQn4U7wnIK5tmKt563DKn9DwjDW4LgA==; 25:08GUraJzmNgPvIw114/2ZYH5jIzLB0GQFBB9Kefm6zUn7V0Vj1IOva8a06x+Z2oSNUldGf8p2KRC/nOSxnuq2J6KNYTOITrM8A1Qi0wUHxdNrGfrR0wurxWnWzl4blSrwY0A/7+BDBCJcfnOnpYDV6sZAlka//mix+7wBHS22fHIVc9fCS0oKZNy18zGCmiySFTOouHjxWE9+Q0P4CemUFAdmb+rm2CIF//kFivH8lpAWR9SKtY6uOQ/8AeA39Ck8lJ3Nnk/BOJP9uuaASQ/z40UBeJPJDo1Qxcwz8nuykNKOfuegk65ZFwnLoYb4ijStZ6xTcVMwGPVF9f0zW4stxZLOkEbsL8Mc4DIYO70QOs59lXpREtPS8kPMWRuf8y3M0Ji8jZf1jbU9XxVc/s/dRsgvTAFSkF3k7owYdgu2X6r4rErNpOQpQzS1Lw+/C/pJNHDCrULgpgoa3ViOcPL1w== X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 31:yKd6S4tDh/PnRRgeQ8RsGyLYx3N5F+ILHyPkcGTEJoB31P/Ig7VZXHuvfuoyD0WV+oSXmy0l3TkxOTEBgffjyUQjj+6HdsWJrEp3HCd1pT0cjOzKCpLv3V/GT6EMYtZ4fnFL+XL+am807nTIGwfiw1XtyRJdRctFdCpCAMhjMmMahpqX5Ib7Zmv/tUCJOyplYBgX4NcO+EwohJFJ9ZYtAJMFEVMfPt4o1ilWdmInLS7Fda98PKBMHKuqXI9oSDNo; 20:w0YVyc83LcC4El5OYGtQt9UCJPCsjWMBP8CtmxiS5mZF7AHhQaGrMmuy/S2StqtVBW97sVEU4R2YyJ/5xCPd0KvGj1nMT5ooT8tXgOVKKok59KKiMBbWvMuKpnnfekFn1cy6kiXs5jstw0xNn5J3AK5713jVySp14IEX76sqPz6lC53qGf/aH6IcC1qkmFLPkdIPXv1esZAsqMlE2jWUGnt/SfcauAy2a2ZrbgZRfgqOpflz79BYgMdSwrWrZdD1dSojr1r3asM7J4vOOuYuYI3uMCkFzMVjvBQwT1aIzhglyBXXP9SYFY+AX4ixNufjx3LH/wR9de0+Ojeior4r9z4lfTI884u7rME/EP2guBfgvh2sjj5eQTWeLB179SwfxMOtEsHAg/abfL3481sXzONrfq3T+kGfYSkAid9gQbGxA1+8t11x8+RnUG6FigvL+GqRt3LFO8c/M5Rjfwk4CS0c/IOKqFgltmv5sZVx4DyHrzph8dCF2VEprg2/kRCHPbcvxSBEuNFgH7Q44DjrabXoan85gBaJZtl4hhBkILP1ba3rSVOrnsX6+GbLqvnF04bMytpw7/pl2hJjvMSsdXrNRzONH92bGwC3oTkPdKo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123558025)(20161123564025)(20161123555025)(20161123562025)(20161123560025)(6072148); SRVR:BN3PR0701MB1719; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 4:r+l3ifhre1ePyeTMikAnme6dptDC2Mvp8x17GfHqL0HqwyKJrZV2nDgE7cafhJ//0UVcboSkSVsdy42M5GYTMcR3cnDrJ3x0Bai+VcPQ2quqWieXncR2WcX+SC6VdSE+nKws5MrC43Zf8tzw7k2R3tVoJFuNbUR7IQolDz+l/TBROsH56gQNaIr58/N8WocL4qeAwAxKar9ZfW6tfFAD2cohkBfICyWo+Pvtnz7RZRNpChhdIj/Ig63OuL0tvaZIXPp6LzKjcDll6vkjhlq4VrJrBDgYGYJQiyBQ9/NJ/ImYh6maIgQu5Zzs8IQ4zxrdp+049XGzzaBm1Drn5PQut19WaIgQ/wGbZbjO3LXDViyk735K+Y9JT13LORAptotk6Fx+221QpvQGlNBiiV7HZaz/ZxtVK8ic2RHqgY4rwGDpCg7U1AjN7dBPpKf3Yobt8QIZmxWoBMbGaklbV0YxGXpRsrT41wKGvNuckJRteXfMFYhtACPS1WC9JaJrr6O5BhtF2uepsMPIUTR4cWUpJJjkMo6kw1ii2iaKWtb+372VobjJ0oH2P6kkuH7WKQy3gOCkPemtjM9glc32vWWLgKNnYMXI+AQ4aAN0JaWG2ZYpALVPyw4DBRjcuT7mcv0WNmmZjln8SDzfe6nIaWPppw== X-Forefront-PRVS: 02596AB7DA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(39410400002)(39840400002)(39450400003)(24454002)(66066001)(47776003)(2950100002)(25786009)(6246003)(6666003)(61506002)(1076002)(81166006)(6916009)(4001350100001)(305945005)(7736002)(54356999)(33646002)(76176999)(8676002)(50986999)(6116002)(50466002)(23726003)(42882006)(3846002)(110136004)(42186005)(189998001)(53936002)(6506006)(2906002)(4326008)(9686003)(83506001)(5660300001)(55016002)(38730400002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1719; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0701MB1719; 23:/w/mqU95e6/Vmfix/AF52RCMaBiQirzcj0qIE+n?= =?us-ascii?Q?CFFs4gdDPIjKo5JFHfMkG26cFHSKVs+CqEW3nbH4Nn6DajjyrSpEe9OR4IzX?= =?us-ascii?Q?V7+Vb0cl1lnSzPTf3GF/Bwf4eP09WkVzBhKEHPF9HCwxaBS/6RkAH4yl2/DM?= =?us-ascii?Q?wnKxqAHyJDEzn23U6+ftC3R0nStA92EBe3BvisDZ8j5ZRsmWrYDSTzF4yEK5?= =?us-ascii?Q?xm1uoDbyWxEILaS0NuJIlGIwbxePdIqhztCBithYWiNJLq4E6LAKfWyDeosh?= =?us-ascii?Q?xBp22otetoDlo0ycURRHikhICbk3tjQzv5c8rLGPqbpsrBmMXnbj0UPmlZ57?= =?us-ascii?Q?m1viGTAcsFeNRMgKUWtN2C/T3E1smc0sVxm7MM//nmibA0w3LboT3EXyqKSG?= =?us-ascii?Q?I62WXoJSRleICdiFO5xNZzNykcXoinzJP2T1LdqzU2dmx6ALJe67NVClrT9W?= =?us-ascii?Q?kFEvtzjm5QS7w+XqutquNMDO314P3tE3vTZt4o997agTf82GAGHvb9SPoC4B?= =?us-ascii?Q?uPDvCOeElWpAatAXFj6zJVDuvHgvjJ3kd7CWOuk8W2bugv/I5kAk0XGW0+K6?= =?us-ascii?Q?v4QI6x8/9wNoXV73+YlRgD4GlJ6JnvKCEypaJ+HVpeyqPxVTkgkh/rcHpevJ?= =?us-ascii?Q?GgpmHoO9hxuywVLX7ooCLbLt3JDTsU0q7QHuuqrT0ExV8B9mPAU+lFXOBJG0?= =?us-ascii?Q?XE2Ka2egNjHsXW9STQhB9YslsemQV9MfDseej98vX/0IFaieSV33JoXBpWSw?= =?us-ascii?Q?XRICUXQZn3mz7IUNI3wKdib8bTrM7NrtUFcUkSajX5BlShDHQyrvukEHlvJP?= =?us-ascii?Q?A3jG4gDQnqxGrnjs+bucNZjScMrq2cRuuDK6x44zA484l216kRreMX3/MT7x?= =?us-ascii?Q?8wQJ/i3GtKTqWME0w/G1R6FxtO5fiOcowxw/iZEiXfR5Jio/2/OpaQ9i6eP3?= =?us-ascii?Q?8W98VrKRyN404lRu6IzqJ1IYL2Lck26KHkrNwq0waTcBZ+efQ3nvSIWFTMcw?= =?us-ascii?Q?2El+j0Xtwx8Q0VWVmkCJwo30pNsSKJQuNJTuMGOLcFkHbxS5U56wPidusIY5?= =?us-ascii?Q?FZ5O1Few=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 6:CRAyYdcPn7y2GARCSKh9v8aBD89VgLVBwwnDq062OrccBt5s/QOPhPTyrUDhdakPjF8ayq23/nVO3HmUfdeang2ZTvIdoVjNRwLjT03eVygfyLH78Z/qsKg31aC1Diz3Dfn8FoQsJoLE3+cY80R5wQo5tnUVnSutkZM+GLjqvvRgVmRaXrzz9D0pp3286Mwwdh5KrjbEeOEflw/uTMcvy+1mJeLyPmRPTUzrjclQvGuf2brVwJ4SreasN4LjdwAlKK82k/YQX97VwK3aiCwIrsvjSWJsOGw848K2yjU5uH+o3QxNoJ1HPgbht+5riWLwRPCLlq6SjV2sa2tKf8qScI/mU75RXmu6vp4C9Ynrt+tBXxT/qPac0Dzj9hYq2gtbVm6l3gEEnFY5M8R1ApyidQ==; 5:7hPAR8vlFPkc7fEZR6JXvInIkzBKb5syY6F5mpS5FIkcvWXUJ6DBr50JCECb5613VHcb3LgxFemuw0PFqDrp8hLn9DZA+hGsGGDXpfYPF8irYPzOy/B9LMCNw2FU8Hflv1S1pRol+Z+WIgKUDazH+Q==; 24:jxHwL1ywOyNTw6RqNnACiueUXdYaxr+N1Z6Vc2JgCoZmCyIQeW6wBDlGaQ8jgWFEnEncpD0QZQ4pxCw+hyXuMmUqnVyN6BRTMbZkuxcTuEc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 7:QJTIRiW+AoGKfJBVMvD/Fyl7J3/0GVSH7CuBEZPjzDPAh6ZtFeSaMwvZiWLi/PDyZ20X1TyRG+xlv+mIuXQxoMIyn7ETdMm3nzX8P6njzlTD0eFFeQju5GcwLFYeupUcIz385HEHo9bzXqSj+Hb/P7IXY5k6EnTkfv2+BgOMOSHcbYDsPYTF89bPbeVrfO/TWaSEwxlvc6adeGM/imiXN4FyVhAEZtIqvtfNrjO9OBh+UPibynfUbDaF90Z+08hgNoFQc+SpBhOJ00FOCfHYEus8vA2onJGgIGnaa7sbUM+ZLnKRt3mJS9dfeIN8tBccw0kiGgkBoWlK6KcxKTAalA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2017 08:55:29.6972 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1719 Subject: Re: [dpdk-dev] [PATCH v5 07/20] event/sw: add support for event 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: Mon, 27 Mar 2017 08:55:34 -0000 On Fri, Mar 24, 2017 at 04:53:02PM +0000, Harry van Haaren wrote: > From: Bruce Richardson > > Add in the data-structures for the ports used by workers to send > packets to/from the scheduler. Also add in the functions to > create/destroy those ports. > > Signed-off-by: Bruce Richardson > Signed-off-by: Harry van Haaren > > --- > > v5: > - Add inflights in this patch to resolve compilation issue > --- > drivers/event/sw/event_ring.h | 185 ++++++++++++++++++++++++++++++++++++++++++ > drivers/event/sw/sw_evdev.c | 88 ++++++++++++++++++++ > drivers/event/sw/sw_evdev.h | 80 ++++++++++++++++++ > 3 files changed, 353 insertions(+) > create mode 100644 drivers/event/sw/event_ring.h > > > #define EVENTDEV_NAME_SW_PMD event_sw > #define NUMA_NODE_ARG "numa_node" > #define SCHED_QUANTA_ARG "sched_quanta" > #define CREDIT_QUANTA_ARG "credit_quanta" > > +static void > +sw_info_get(struct rte_eventdev *dev, struct rte_event_dev_info *info); > + > +static int > +sw_port_setup(struct rte_eventdev *dev, uint8_t port_id, > + const struct rte_event_port_conf *conf) > +{ > + struct sw_evdev *sw = sw_pmd_priv(dev); > + struct sw_port *p = &sw->ports[port_id]; > + char buf[QE_RING_NAMESIZE]; > + unsigned int i; > + > + struct rte_event_dev_info info; > + sw_info_get(dev, &info); > + > + uint8_t enq_oversize = > + conf->enqueue_depth > info.max_event_port_enqueue_depth; > + uint8_t deq_oversize = > + conf->dequeue_depth > info.max_event_port_dequeue_depth; > + if (enq_oversize || deq_oversize) > + return -EINVAL; I think, implicitly this check is addressed in rte_event_dev_configure() and rte_event_port_setup() parameters check in common code. If so, you can remove it. > + > + > + /* detect re-configuring and return credits to instance if needed */ > + if (p->initialized) { > + /* taking credits from pool is done one quanta at a time, and > + * credits may be spend (counted in p->inflights) or still > + * available in the port (p->inflight_credits). We must return > + * the sum to no leak credits > + */ > + int possible_inflights = p->inflight_credits + p->inflights; > + rte_atomic32_sub(&sw->inflights, possible_inflights); > + } > + > + *p = (struct sw_port){0}; /* zero entire structure */ > + p->id = port_id; > + p->sw = sw; > + > + snprintf(buf, sizeof(buf), "sw%d_%s", dev->data->dev_id, > + "rx_worker_ring"); > + p->rx_worker_ring = qe_ring_create(buf, MAX_SW_PROD_Q_DEPTH, > + dev->data->socket_id); > + if (p->rx_worker_ring == NULL) { > + printf("%s %d: error creating RX worker ring\n", > + __func__, __LINE__); s/printf/SW_LOG_ERR > + return -1; > + } > + > + p->inflight_max = conf->new_event_threshold; > + > + snprintf(buf, sizeof(buf), "sw%d_%s", dev->data->dev_id, > + "cq_worker_ring"); > + p->cq_worker_ring = qe_ring_create(buf, conf->dequeue_depth, > + dev->data->socket_id); > + if (p->cq_worker_ring == NULL) { > + qe_ring_destroy(p->rx_worker_ring); > + printf("%s %d: error creating CQ worker ring\n", > + __func__, __LINE__); s/printf/SW_LOG_ERR > + return -1; > + } > + sw->cq_ring_space[port_id] = conf->dequeue_depth; > + > + /* set hist list contents to empty */ > + for (i = 0; i < SW_PORT_HIST_LIST; i++) { > + p->hist_list[i].fid = -1; > + p->hist_list[i].qid = -1; > + } > + dev->data->ports[port_id] = p; > + p->initialized = 1; I think, we can add rte_smb_wmb() here to be in _very_ safer side as port will be used by other cores after the setup(). > + > + return 0; > +} > + > +static void > +sw_port_release(void *port) > +{ > + struct sw_port *p = (void *)port; > + if (p == NULL) > + return; > + > + qe_ring_destroy(p->rx_worker_ring); > + qe_ring_destroy(p->cq_worker_ring); > + memset(p, 0, sizeof(*p)); > +} > + > static int32_t > qid_init(struct sw_evdev *sw, unsigned int idx, int type, > const struct rte_event_queue_conf *queue_conf) > @@ -314,6 +400,8 @@ sw_probe(const char *name, const char *params) > .queue_setup = sw_queue_setup, > .queue_release = sw_queue_release, > .port_def_conf = sw_port_def_conf, > + .port_setup = sw_port_setup, > + .port_release = sw_port_release, > }; > With suggested changes, Acked-by: Jerin Jacob