From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0073.outbound.protection.outlook.com [104.47.32.73]) by dpdk.org (Postfix) with ESMTP id DA10A10BAB for ; Thu, 30 Mar 2017 10:27:03 +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=+062F0mtSQ7SxSnc8vMqPIyWIBOo4dKnddlsdDMjmcc=; b=KZ9FIeQXQoICTQIb3381UAnFUDOp99y+2c6YUR+tUVUe/N3v34Cw/ucgHqfX7QWio80U01N1qSJoDgNgnk6qw0HtpXjOiEuApobPcgReURvKSgzHEF5JeJwIqOOxYYUfruUjk6/eke9AnpgzB6ma2E1sV/jidixVcQn4ZD0YkmU= 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 (111.93.218.67) 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; Thu, 30 Mar 2017 08:27:00 +0000 Date: Thu, 30 Mar 2017 13:54:27 +0530 From: Jerin Jacob To: Harry van Haaren Cc: dev@dpdk.org, Bruce Richardson Message-ID: <20170330082426.p7vvghxkyfct5gis@localhost.localdomain> References: <1490374395-149320-1-git-send-email-harry.van.haaren@intel.com> <1490829963-106807-1-git-send-email-harry.van.haaren@intel.com> <1490829963-106807-13-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: <1490829963-106807-13-git-send-email-harry.van.haaren@intel.com> User-Agent: NeoMutt/20170306 (1.8.0) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0091.INDPRD01.PROD.OUTLOOK.COM (10.174.208.159) To BN3PR0701MB1717.namprd07.prod.outlook.com (10.163.39.16) X-MS-Office365-Filtering-Correlation-Id: 355ece4b-c4cf-45f2-fd46-08d477468a30 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BN3PR0701MB1717; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 3:CKVruzozONYxISvADq9U/sY7dHl5EbkbxX/EBwh8NmMHzzAHbMLGsT6BjbBkPy30Niz4HpSZVv7d3Zzq5ibfsLjYMtE5m2M7agmNnwMSUONB9FarBtiIecZwQmTY+gSOZqaVTLQqa/BavP3eoKhpPssdcVtdkSBgJaYK5MN53yoe36Z/MhOFzltLSGt3roLXB1DCbnsD8+tp417W+4rbMkCvaoD7vlakaNWSrAi+bb8McttEOgIJfk4gj8/Siakyt/4/Y0kY3hrp2IxqymX3ZSoOcqpooUHbh8kzyUrRhjPDyPXEXUyuMRiPicnk4kurf0wiI6pHLvhR+ok45Gt1Cw==; 25:OaabSRfq7AYK9f+xiDWZZTtTPyOvYuhcg0TzoH2PZ9r25PA6xyFq6BfNYC/Taw1dQR7dJ6BuJ8Si/RUn569Q6htVt0dly32i2AF50bjuCh/L1MZ0hTuxfbDboMUsTVQVrvieA8nlnz0fSLsQ64h2RJJMvAAqFMUuDS1FQfIxPaDPsolHfQCBcvnnz7riTtsatxtqPPV6eIFlviruq40q1yIzhAx8TQOQ79ccDek/F6WvzrMWNOMH2aNAYUeANptCXZgeXwS8KJv3DjjE+/zw29EG7IL9Za0SQo/Uxb+2diuGGQEdo9jQI37h31bviX9a91Ce3vzWfbYAuZXu+R2wFUlvGeVim4Zf452ti5g6wEjDY6HQahFHqmiE59I+W4kBrPlDNlejihNN0+VGO89Kg3VVsa3/pkHWmjJPXLoHBvRe/5qpcyTXwtVahDvkInEBAN2k6YnNiAt6rOV9ACaUiQ== X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 31:JibZ3WoFUimGyQlXD/fYuvQp8eBBSjcU9Hr9CR3IKamoI5/LcKaTvABTS61LxXb6AYOC6OCr0241nG7RKE7SIYG91rn+x/1eH+xMmg/FJdqWV3cX6VfSliOtVsKXdwJb53wImkyTQFHozFFCBFNqVXYN0i9uu4lzSU7PuDiibIbFtERRO7bBCMfCQs3O9V37KyJPQ2F69/kTFPz0A4PiuwN+BnjvIs4NmhGk1aJn07AVs4zcfj8rpgX+uv3gnkeZ2mxoVSZnGauW4qT5f+Q5bQ==; 20:ZciIzCJz0+VKmrQmZmQFYcgmBLYz2Gdo7/MFw/v2dBMOrAcPTX7hxV1n/BOBdZBhOfWGG+Qzmd6O7wi5KbRd79iT2i9nMzYZsHPh3r781EJ6I9l8PD6P/dFvYWl9NzZzyXyCCV6cLRnZD2nzaPJtHKjD8zD0Zj3XiaMYtANGSbgTZnqfwL2ISOfoNhHO0FfQbBC85UgzH2l82QNRlL4XcKV+Nao8Ek/mP1a7MVHQJc+hs2Qs3fO1Zynmf2G6w3Tcp21aneaXPzSR6Ygc67gzhtxW/Q5Ck3Q5rft2J9vwsaDm0LkZBRQc2tZnEDVShQXHrV7JC2J92MF1hhinfonopiR6Aigg4VGUoADRnryYzvPnMrGuj3V0YwZLWc4rAUzgnbUNrR3GNmChSgPpjUNXCN5gmDaSPutZTnHGjWS9G4S6aoek1z298BFTmW/W/24Z0XF2igJZig/mpIbrFg341WqWrJk53GZyicThcQk8il/CoS99r5hT49rTYbIc6LZ2QhO8h9x43FDDYtpZGAlu3qr60c/b7UvNt2/0HAluqaOUEZpzxmZNTK2uaWaMzGLz9nm01WtM3L9u6B9kfTtgRyA0l4iqGgo80PP+TBSzvyg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(6072148); SRVR:BN3PR0701MB1717; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1717; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 4:987r536rc9CLVWlhSGeZWTU+qCf5bBvRMlIhV7iLoS88N/jrryjOC96IvyopshkyhdGBsPutRWN1x/pPw7vkqwDkK8IeqZvl9TqGvEIs8j2A2buhXzdPsLGVkaf3oj/vRF1QXxit0gLdzLyhrMoMO3XNqPAPiLDtVZksLNme8X7ivRybb9tbY4pgCO5ySwjJWw0N/ymlqn7ZVrERnU3SQ73vJXqY/FGttvensDJ5f5ROG44BcEN4slJlfwxxC/RofIA5ZSMHTRX7l8+iFBp9Z5hIh21OEiLqDbTnZrg5l5mp1ZFIK8S7Z4p75tZdyYOvd6bo5ij6uXxJmkk76PJcC6AV0JyhftI1zJsfjafARVwjePGhcbIkZcayOdDvwTcs6/Ery1+DbB1cxDd318Lqtixt4VAbInwS1KRcH8YSH2dsNFQvrsTnQJ6AVpXJn/rh3FBnRQTLLF97PPfNQUv0N0vo4yOr38KKrcLcgs18ILXhb3lTmfZBao/6fZWE0gT3Dqlk9Ae+Z2zd6ECjGGybjz/fvjAcr3KZj31mpQvwfUE5VjXfZr4aaL6k3pHDZLRkegl+gBN5H/J76LZ3xmfXTjW78GWjsuGPqQb6Hvm2GC90ciaUJ0dqZOLP/UmZLYZXBbnGZZ/wwXUrdpyo3S2viHLvh9obEUYo4uBmbK+3Th1DwpBNrVHxfUkJm7G+XBA/HK3JDXvwaF866cRgCvttb6J8mKFA8u0cXAdKxdbIYBs= X-Forefront-PRVS: 02622CEF0A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(39410400002)(39840400002)(39400400002)(39450400003)(39850400002)(24454002)(38730400002)(229853002)(5660300001)(6246003)(110136004)(2906002)(76176999)(50986999)(54356999)(6666003)(42882006)(6916009)(2950100002)(305945005)(7736002)(61506002)(1076002)(6116002)(23726003)(189998001)(3846002)(83506001)(9686003)(53936002)(55016002)(6506006)(50466002)(4001350100001)(42186005)(5009440100003)(33646002)(4326008)(25786009)(8676002)(81166006)(47776003)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1717; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0701MB1717; 23:/wWiNPQWt9olxZV0GvSxjUNbuLafKprUrENG9Ip?= =?us-ascii?Q?FsyBL8ua5g2WSAgFbkJhmZUOvSPmHUE+yUtJZvOrz1LvzzTQCvIGY1KTkLg4?= =?us-ascii?Q?hMXpHBMXYrmtgSczMDHukEv9Axks3AWJXOz5EhP1trlaNeBl/BshffO4kCaj?= =?us-ascii?Q?6PrIId5nq0Usu9X8OYJIoUMSrxLuu3Y8ncNAPbtVKK0UloqsdzMDCxoRes7W?= =?us-ascii?Q?5ywqB8Z4I+aIJ0m66V5SJvj44JDC0EQqtrx8e+9jkqEwv0MlIDF5rApgRVXd?= =?us-ascii?Q?Xr0heZVF6Nd2zMH9GaVH3wMUIVy9d+5t06VV8ifqC5sHBnYLXLLc3dgM42Ve?= =?us-ascii?Q?sE88i7KFgC+367YKb1HDKoVeUzKA8NWY5/Es8TUfGS2i7TnpE5FI5q4JByNa?= =?us-ascii?Q?pGB//EPyQc7q3wiP39ttYPB62dtlHAokj11awZ66b792qB4B3xmw+Ui7nK5e?= =?us-ascii?Q?18Bxtc1QaEMX8JY/h/iyQc4h58Cq2HCYCvw2KGa5bIenOFNYsfd1Afxg+d14?= =?us-ascii?Q?u24UekMH9xEmfiPdkROFkZ9CNOlVI9xM/kiXxyGFkw8pOLsLlOpxUq1FJl4+?= =?us-ascii?Q?OYpW7vVd78TK5MoB/8zX1lvkK1ACMurxgUCKoW50BV0UmFBdEcrnIdXlldqx?= =?us-ascii?Q?cYHj2kXaV6tjQ2G8E5Ogkeum1lycFFaVnptayM7Wh49899s5Pe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cst3lJVuJWZ4jvKPaVRp+LUBnvydp2zLdaXjecOrRo/t72It1vliKj9s7L4D3NF8mu13pEqPpVOs8NA8DFA0+RN9Vh5mbS71img2lNk/Go3W5SR+nai2TrNa4KGpIQXf9u4kStelonQ==; 24:5aY+8gyflI/UyMKkx0SOvug12YxGKWhkLMyqOY4euNxxWjg7WX5k16tzDJaiLbzfmctMZocbEjYmMM3Y0p7FfSnRKymjyHware9I8tq58ng= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 7:28KfV5D9Bke3sJxBdgX7q9LA/Bcr65+HTuDQ5IhnweBEILky2EPbT06sMFefJ8jF9c1uX6966tUwJHhBaz+GxjO4Tiu887aeh5pWUj7nSf7Ip9Q0ltfuGOVFXBv4XxFvfvGWHyiaaAsF10ITwhb4C6p8Clz9bJnzUa98ahgkZ/caY6b5Ucjf/UZKZFKsXLBaO64PyidBK6VfbuFXzo8VMCzOWhTfEQKcsCZYz9PfYmINs/bQKH7Xu4goyNp9kpIaAKga43JiGZQ2wkaquFtH4sjkIbuM7bp2AacKUmkKWQZFQPteWAl6Rg7r3CTQqDA9yhdg85EFVDW50vk9acKmvA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2017 08:27:00.3975 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1717 Subject: Re: [dpdk-dev] [PATCH v6 12/21] 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: Thu, 30 Mar 2017 08:27:04 -0000 On Thu, Mar 30, 2017 at 12:25:54AM +0100, Harry van Haaren wrote: > From: Bruce Richardson > > Signed-off-by: Bruce Richardson > Signed-off-by: Harry van Haaren > > Acked-by: Jerin Jacob > > --- > > v6: > - Removed printf() using SW_LOG_ERR instead (Jerin) > - Added rte_smp_wmb() to start() and stop() (Jerin) > - Improved error return values from start() (Jerin) > --- > drivers/event/sw/sw_evdev.c | 78 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 78 insertions(+) > > diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c > index f91a04b..04ab7ad 100644 > --- a/drivers/event/sw/sw_evdev.c > +++ b/drivers/event/sw/sw_evdev.c > @@ -442,6 +442,81 @@ 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) { > + SW_LOG_ERR("%s %d: port %d not configured\n", > + __func__, __LINE__, i); Remove __func__ and __LINE_ as SW_LOG_ERR macro has it already. Check the same issue in other places. > + return -EINVAL; > + } > + > + /* 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) { > + SW_LOG_ERR("%s %d: queue %d not configured\n", > + __func__, __LINE__, i); > + return -EDEADLK; > + } > + > + /* 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++; > + } > + } > + } > + > + rte_smp_wmb(); > + sw->started = 1; > + > + return 0; > +} > + > +static void > +sw_stop(struct rte_eventdev *dev) > +{ > + struct sw_evdev *sw = sw_pmd_priv(dev); > + sw->started = 0; > + rte_smp_wmb(); > +} > + > +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; > @@ -477,6 +552,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 >