From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0051.outbound.protection.outlook.com [104.47.42.51]) by dpdk.org (Postfix) with ESMTP id 5271B152A for ; Mon, 27 Mar 2017 18:02:39 +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=bpvPUVxgPP7hisCnuHXDjfiBZHVKPHKGcdZlRl6TOz8=; b=cGjrcIq4q/milXxSDsYiYpuOgAtW5eYkg7Wc+XBlGPUUfC3TJ9Hz8p3/YxmZrtuf/n/r/MxD2TLF9Ahm9Ypx7Jry5eBHPW8EMMpr+I/VGH114rlYrVfpBqGM+nBkQPOmQ93BQeYajQuOFUgnaL3le67s2hcc+o3H/HV5eQLFgVI= 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 (106.200.242.46) by BN3PR0701MB1717.namprd07.prod.outlook.com (10.163.39.16) 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 16:02:34 +0000 Date: Mon, 27 Mar 2017 21:32:18 +0530 From: Jerin Jacob To: Harry van Haaren Cc: dev@dpdk.org, Bruce Richardson Message-ID: <20170327160217.o7bqgoxvx4ii2pb5@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-12-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-12-git-send-email-harry.van.haaren@intel.com> User-Agent: NeoMutt/20170306 (1.8.0) X-Originating-IP: [106.200.242.46] X-ClientProxiedBy: BM1PR01CA0019.INDPRD01.PROD.OUTLOOK.COM (10.163.198.154) To BN3PR0701MB1717.namprd07.prod.outlook.com (10.163.39.16) X-MS-Office365-Filtering-Correlation-Id: df6ee293-f4a7-4e63-9a47-08d4752aafe0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN3PR0701MB1717; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 3:WSUn3Zrmn9LXH4gb/AOeXEyfs0yhn1oeZneEdb3mWYbAj40D1/Byhymx1VIq8AD45zYjZNIy8Jvm35IX8X0dElefTFiQ+EoMhriVVNMHg/wVPHvRKIPaog5dEnK+ByU6+WLYERKPicne39Ul01dKa/+k9QoRPlE/NK1lMZ0+tXtd33eVKvyqHMVyL2RGRzqzdN14CA9BkTHstvKtKqK84q/9W8GOAf5krwgJiS7aIv60ZW2siw4RXI2Dx7gxuaKVm+JKivzkWckfDQeebmATfw==; 25:ejwcpQQBcA4YuUaBQkrnVjhKNSO8kUzSVvG6e9M1Z+9JFct6RXy1/IBt+04o/y9tf9si5W3cCnViMfNdZa8l0n69/ADV93fYd7xYXoVaGYVWFqDR2BIyMzX1WDslToo5c9uDiZwYYRYYNYSmC5khm+ipa7t3YowkofvRpBc65V83WGI88PPheaJziflwtOMKjPX8SJOJ1tmRuweaQd8sAJx1a4Gc6FX6M/rUwphvWBzftRMaXikXpL1b0Qg9utZJTqpsaIxx9az7V2eDd2UaV6qCN6zfxXYS/G1a2Ujv4yI6HnWw+jJXXgSxxK/hP9vjNhLr17ZAJi+2EXhcHZRlcFu7EE52RXmGchbKDuRnVEaCBdFCCwakZFr/wADKJlGhiVMBCWZNus90tztKiacf8IlHMuspLd3qicDSi/7r9AqQJDfuvw0I1qfNgciQpg8x3gBhmsZry/t6GjoGrezaOA== X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 31:oqKEgnD0V7JPDuPNZ5HCo/wusXOHiO4Z4zlL8AkZyC8v4+MDGTDhsZNgGU+iNR7BT4A5lDRFoHOaK6eKU4qGRa8UH9CYlkUcmuWl2C7oHULcM2v0/CrYh0VXBv53QKWaV/Vhv552tKbjwJr3EloQZGwofxb/W5QxwGviJtvjKnscbcnHysOBU2ghCVTrZXczlRFTdbjBI962w5OwYs/SlONLA3iFxCO6RfyT+vpIcH0BEQ4Tcix9yOCh7//Dw1zIMX0RSee1GiA5KWo+HXnr/clE6URGwNa/Gw1dkm1Bsbw=; 20:mfBpyjzwvCd5ozgILOArfJqsuOt2cB0uhDUN+owa7suf9Z9gfXxv8fqKWsSWeLuKxuMpFJqJ2dNbO3UWu6AYWKGcc7/rMbzM3VkeEUBGhntUAK7i5WXLyuaqfVqdwGJBoGhaKk0Fw1fKSb/4GgGrgJ/0ujsuZuR/KFkx3UFd6++ICGgnaL5f06QdzeINCSH0ciAoAqZO/CeODT4T5sbMkTSOKmYvK1qwNJenrBVU07HB3hFvRKjNYjWZr2uWTxFHBrcA9zMifAknoEIC/W8sRupHnbfQPYnVRn2jtConYMb/DhB787FXIBnTBzA1cDIjt54oWx6hAeAI/r58iWxksKcNCmCcrjFxNtLvArwIEDTefKEQOr6L71H0aPhVqIFsv38qW/9olhxoOfZ7OsSY3kKXs7EOM2AojP/kWX5sZXoCmC+7aTLe3jrHFRydUTQ8LnIWMjR4dtFaWtta0Os83eSN76jfg2oUNolfwBKtzosy4GtJgzcczu7JeR9kEp8BRo8buMx5YrLNm2r1/FzpkFYNlgrmrq2JOD1nKeBNExIWvYuWCTvM6NcYagFJuWCuqfFRn9tgh4cJf/BBzvOHgJ3aYnPLSS2tdsuBsQzcKZE= 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)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(6072148); SRVR:BN3PR0701MB1717; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1717; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 4:jqov3IZRrL45LQDyLgH5oBQ2VjKaAN3HV1iCxYrVQGpD4gQm3+ch1jWbBnqQZB051TQcv3fAGTNC9SDLdykfvKRPOTn1Bi8EkxL8NSdhtLmjdAJexvg1EzzPG6rWntbfW7C99tJmNbAdjdAqYUlY+88VhspAJYQiF2oqemO4oasqBkzkfcQAt6RHxHGMGKyGoOQUsA9Blk9sB3ta+vaTcd4Z5XDN5hDlJcvlEOLLLFFSAwU2xBwPjbHd0fuRc1X8JLSQWXp1N8Qiyw26bbNn2FXV3ZUowXo16KUzghooNddBjrkI/jBYuOOdyn7uVtsIuHltTqCNPDbmEUDBMv20386iLpic0GddN7GwslAC6H8NI9xzNE3voFp2a19xquh4ubeXZz9ten9ie0Pc81ZemD52eGvFGuMa5PIq9Jho27CXDjJhwvFLctepXxXLCRxBj9s62kY624+H2QZXNsHEWzW+M9wmLRqQoQSy29z4KOBGPKhztqgDXqAwMM7dHU79X1xa8txYm9N0kqSZT3ftWbPWIRkgJVfjnj8vzT688kmIias+UOAviHYkipVt+9uAkca5aBorrpC6RoSwZweufy5xoUwhvUS1r1lZdO946YWpcO8PldLnqC0aWOAEfba9qQTwCyN0tef3GshP8yzqTQ== X-Forefront-PRVS: 02596AB7DA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(39450400003)(39840400002)(39410400002)(57704003)(24454002)(47776003)(66066001)(76176999)(81166006)(8676002)(33646002)(42186005)(50986999)(54356999)(6916009)(55016002)(38730400002)(9686003)(61506002)(2950100002)(305945005)(53936002)(6666003)(5660300001)(42882006)(5009440100003)(110136004)(4326008)(6246003)(6116002)(1076002)(25786009)(3846002)(6506006)(229853002)(7736002)(2906002)(23726003)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1717; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-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YRMTfiC12LImqaxKuQbkU7YWA12HKHCVpS?= =?us-ascii?Q?NdF/5tSePX/lcj5VwcfqgT6/mTY8jf1vVAT8tZQar14YtEOApqmnRMI/xLqC?= =?us-ascii?Q?snJAp/c0PolKryFIrD3itmVGvodtfme9OeWEoQNCA4dwY3upKU6pPDC6Ecdl?= =?us-ascii?Q?90gmDzsRacNzREXkJm3j9fQ4nNQdNxwyTZAiP2lPM2f+JfQL+mHXAs6T2044?= =?us-ascii?Q?g26U4ebU=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 6:Z7BDL9piUOuNrZBORFcAvtfzxiL0EA04XcL3oWg/lw0wXUfRPC1R1+OZH8SeDDhS3yyupTAb62Rj9q1P+WOnEJtxs3JxbwuQPUjPRRUBiWldwl2IpZXpjROcNJaZJwpeSwZxQ+5b8DdO0dYG7bkVy+HNJmZrlr8gocfsoD8RV6FfngUsE0zzN2D/1jxZYCzTlb4rQ6pilK5fywj1RnEUbVksMMS+BsmFTdfkkZx3AX6yP72QyusJyDuz4z4VELcRy0N0IukoQ05xwJy46TfnJytAxiG4PqvTHT8ypDKur33rZrY7I2htddhirVizi/qJYyYetg4YqAq5vjQEl57Xa5aSoyyyVEBMgjbL4vTi/rb/DjUrp9Xn09UhVEA9vSv0ClIl4yIIQRwS2ngknGYCrg==; 5:PHEy2/pxAwemWoKnE25i+vzproAhhFU8pOaw3M4jaRd+7kDTIJyXOclDjLT78XpaPeMcTaXUU1ppje/nWrKP6P6rO8vGqFoQ09rHW9BIvri8/pSjIZEssBPDq5/PLvUZYGQ/0ALAs0PdjmaIM6DC39vilUDEydzIGzt9vxL6oNM=; 24:8sDyPdtMwLe1nNowus9MmP5BLkLBeoxuLYDh+YHE/0h0n0xZngmvXX0zxDIBIiWFyBPYF/R6PFAs4Sgoqj2SqFX9fW2Rit5DcP2At7IS8Fg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 7:1C7ebAJuvVWc82lmla4ZArKUzLicl3yHDUlwGAotNK7zJefuYLNz1/ObHd55LomSX2b/xqjhe1xoMYmCLXVci7zKMNLvHb/LMhV9wWjwXHDm+6bOZmKPw+D9/42CYRJrRVogpO9LqN0aRsy+romU8jf0U7pciFj9O2pbN2mAOWNmk17D0Zxyxub9P7zB+xgqZnRhZ+eTyQO8ThQa7AOtRpVT8+uOwT2O9jMzgj4mvJXjUbFOIWZV0W4VtLF7ZrbReK3ABEQ4ouVfty9LXudZ48SMMBBnsPgM6aJC2TF6Zha8KtvnixeOWBIkphg9k1kdmAkJtxaMhabFspgg1b1FPw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2017 16:02:34.3613 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1717 Subject: Re: [dpdk-dev] [PATCH v5 11/20] event/sw: add start stop and close functions 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 16:02:40 -0000 On Fri, Mar 24, 2017 at 04:53:06PM +0000, Harry van Haaren wrote: > From: Bruce Richardson > > Signed-off-by: Bruce Richardson > Signed-off-by: Harry van Haaren > --- > drivers/event/sw/sw_evdev.c | 74 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 74 insertions(+) > > diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c > index b1ae2b6..d4d6d7f 100644 > --- a/drivers/event/sw/sw_evdev.c > +++ b/drivers/event/sw/sw_evdev.c > @@ -440,6 +440,77 @@ sw_info_get(struct rte_eventdev *dev, struct rte_event_dev_info *info) > } > > static int > +sw_start(struct rte_eventdev *dev) > +{ > + unsigned int i, j; > + struct sw_evdev *sw = sw_pmd_priv(dev); > + /* check all ports are set up */ > + for (i = 0; i < sw->port_count; i++) > + if (sw->ports[i].rx_worker_ring == NULL) { > + printf("%s %d: port %d not configured\n", > + __func__, __LINE__, i); s/printf/SW_LOG_ERR > + return -1; Is it possible to have better error code than -1? > + } > + > + /* check all queues are configured and mapped to ports*/ > + for (i = 0; i < sw->qid_count; i++) > + if (sw->qids[i].iq[0] == NULL || > + sw->qids[i].cq_num_mapped_cqs == 0) { > + printf("%s %d: queue %d not configured\n", > + __func__, __LINE__, i); > + return -1; ditto > + } > + > + /* build up our prioritized array of qids */ > + /* We don't use qsort here, as if all/multiple entries have the same > + * priority, the result is non-deterministic. From "man 3 qsort": > + * "If two members compare as equal, their order in the sorted > + * array is undefined." > + */ > + uint32_t qidx = 0; > + for (j = 0; j <= RTE_EVENT_DEV_PRIORITY_LOWEST; j++) { > + for (i = 0; i < sw->qid_count; i++) { > + if (sw->qids[i].priority == j) { > + sw->qids_prioritized[qidx] = &sw->qids[i]; > + qidx++; > + } > + } > + } > + sw->started = 1; Do we need rte_smp_wmb() here to update correct sw->started status on other core, as sw_event_schedule() uses sw->started? > + return 0; > +} > + > +static void > +sw_stop(struct rte_eventdev *dev) > +{ > + struct sw_evdev *sw = sw_pmd_priv(dev); > + sw->started = 0; Same as above? > +} > + > +static int > +sw_close(struct rte_eventdev *dev) > +{ > + struct sw_evdev *sw = sw_pmd_priv(dev); > + uint32_t i; > + > + for (i = 0; i < sw->qid_count; i++) > + sw_queue_release(dev, i); > + sw->qid_count = 0; > + > + for (i = 0; i < sw->port_count; i++) > + sw_port_release(&sw->ports[i]); > + sw->port_count = 0; > + > + memset(&sw->stats, 0, sizeof(sw->stats)); > + sw->sched_called = 0; > + sw->sched_no_iq_enqueues = 0; > + sw->sched_no_cq_enqueues = 0; > + sw->sched_cq_qid_called = 0; > + > + return 0; > +} > + > +static int > assign_numa_node(const char *key __rte_unused, const char *value, void *opaque) > { > int *socket_id = opaque; > @@ -475,6 +546,9 @@ sw_probe(const char *name, const char *params) > static const struct rte_eventdev_ops evdev_sw_ops = { > .dev_configure = sw_dev_configure, > .dev_infos_get = sw_info_get, > + .dev_close = sw_close, > + .dev_start = sw_start, > + .dev_stop = sw_stop, > > .queue_def_conf = sw_queue_def_conf, > .queue_setup = sw_queue_setup, > -- > 2.7.4 > With suggested changes, Acked-by: Jerin Jacob