From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0056.outbound.protection.outlook.com [104.47.37.56]) by dpdk.org (Postfix) with ESMTP id BCD862BDF for ; Tue, 20 Mar 2018 13:00:26 +0100 (CET) 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=Tj+DdGE1xCxRGlLleuKLKWtfvhWI4lWPbN/E3NrQmyo=; b=ksBjlBortzKJbuVVHqAZ3CDB9q26lGbj/s8MLg+/sCyAzWF3vMiT+aert/PLHBevRJsbl2khBXYMx6Mh0MfJ00yxAEx3IdoVW2w6c9+Nek0BYdmC+DuOTNDm/iimV+++PoQDFI9IE61HlYmvn7j6Y1bCSta03L/HaZwppLllxBk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin.4.4.4.4 (122.167.116.50) by CO2PR07MB2519.namprd07.prod.outlook.com (10.166.201.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Tue, 20 Mar 2018 12:00:21 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: gage.eads@intel.com, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, pbhagavatula@caviumnetworks.com, nipun.gupta@nxp.com, santosh.shukla@caviumnetworks.com, Jerin Jacob Date: Tue, 20 Mar 2018 17:29:55 +0530 Message-Id: <20180320115955.19805-1-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [122.167.116.50] X-ClientProxiedBy: MA1PR01CA0113.INDPRD01.PROD.OUTLOOK.COM (10.174.56.157) To CO2PR07MB2519.namprd07.prod.outlook.com (10.166.201.6) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 13007fd3-b8d3-4952-e109-08d58e5a2a2e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:CO2PR07MB2519; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2519; 3:BmkkxexUP+XXbDcSWQLBT2ruqpsdIyUJBhsFK4cJ7tMT8znT0teLIZOpqkW47rqWfJwnOxlzk6fJeTJ5MrLC23+UqZ81tk+kC7J9a8rGMDNVXoCGwylwVmFh75uPytEzEzoVZqNvprWkZDqup/6Gr5B0qlJ3+HLnSCBTaqexLeKK4NX8Hn5dc9IbFqOWYH8uxvXUsuVuQ3b9KVj8F+UklE+XcERDkKfpGMSg8Va9hibETOQke6rUYdmAjQYfB/en; 25:6sumS8tD6DIkvqefV7h/cSQWLC2/zyUyuuYumsSK1qT3Xss0J5f7G6fLk5y0r1/Xl4qhKW2F83Pa11vEIo5oRbfpGpyUsXr8OKJceIMT7X5l+ScDwNOSMKKaATuTQ/0Y53j5QLlJOnqsF1fW0RGdzi3MJBE5wbhbwA7DMI21tMUO9dY0nG2y6CNfXDHWoYSLt7qPOdbZm6I7n5gtryEtVrPq7bTZeBtBsEl/Zqb7TL4tHkqa1KxQpieXlzB1SE1RkKqoiW8Ml30q+MhAcJY7r26QIYTVgaAoSeGY8nAEZ5bl1XJq+GS79wEZlXEf6vdfG3A/EgWX8WtziO8zEgo/bA==; 31:/UIO5wzblMlw/ZYODRI+lYhhl9dImgRMebDZH4OyX9KsedWY55xz3wSE/4i9LGFn8AIJTJvg8ajfFhsxwkZK/yDXjbguxr+ti/RhgDAWju4fDMmQbDPEa5MXsRXlpIahnNE0RjCO2uBPmZMalbhIrn4Ajv5cNjLhmSq71k5otQ+ILp8XlU2KPKp440cFbV1CjPYYz8ti+Ax8+j1/XJVNj8Ua8inPFj5J4IZvIo3x4uA= X-MS-TrafficTypeDiagnostic: CO2PR07MB2519: X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2519; 20:l00olNxmFKUPMHkxv5RCx5J+wfaPSwt17weoZDmandWj6LTfooYIbzC8tT7OEcvQ8fa+aZ8wh9i55g8GpHFtOn9TIPSpg/689kBgq1CK2gv2wWEvNj8QL0DOd896Axbf4ONeOvfn/BHY3KHvD5HFtWjkid7eF1gwcz99w5Skn+MLnhlmCqK0vzBBuaY5S1QmeUNxizcYJzqSUuiL0l5BYAeWcfKlYbuCYwZo7FFh57NJ8Rxk30LSAhAWRs/mq/M1uiI/h7PxBuPg4gZ77qjMrqJUj9iiRvnB9OfOolxebKC9d6qyStp02IhoCvkRxcvFmSytknYZkuM3CemNvQLyTQcDzArMY48OguLoQUXldbBjTzD+Jx6fNmEtdeaFx7Pw/W90uadKhfWYZc/DaVpokqlQcCaNY9F6O2tminRwGuTQQ3BtqKk67qFx++KNeFheNZAwGhSFAYQVDLKoB1cSxuIU5WAtBBQvf09OC/2KX4MZAQIGI/giwM5mc2kMf6+ivCC8YvYLs56lw3/xHScsglVt9Xc6I8cKrca4rgUHyx16EOO8ayOSUeOj63FWycf5ECe1GRZFnpjrAlwoR/LJdA5wuaxaPPNGJwMaH2bXmvs=; 4:zndcrFTJoe76P8lGt2rCCusjP7E/9uzG3u3Z7iPtLiGd7uUmXWH1gWZ676mTu6ROWTDLdaEslJM0vtgW4yFCayqAbalQV/rwMdSD+HB5cmMq7V4539T2Fg8ffyKN0XVsKVFgvq8tb8jqTDCB5fjLtxcRUrKrXoZ+ol7hu9QqKkr0qPthc69mtGzZF3Vk6iJ6CYya9HRX1El7408oBQvmaym2ormA02+XGBOYjax11HUEptwd6vlimXIFV1/qTSa6G1q+GoqYgSGsEoBvAo+Z8w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231221)(944501244)(52105095)(93006095)(3002001)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:CO2PR07MB2519; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2519; X-Forefront-PRVS: 061725F016 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(376002)(346002)(39860400002)(396003)(366004)(39380400002)(199004)(189003)(4326008)(106356001)(2361001)(59450400001)(305945005)(2351001)(7736002)(107886003)(16526019)(105586002)(50226002)(6916009)(81156014)(81166006)(8676002)(5660300001)(97736004)(966005)(478600001)(51416003)(8656006)(72206003)(68736007)(52116002)(36756003)(2906002)(26005)(316002)(16586007)(42882007)(53936002)(386003)(66066001)(186003)(48376002)(53376002)(47776003)(50466002)(6666003)(25786009)(6306002)(1857600001)(8936002)(6486002)(3846002)(6116002)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR07MB2519; H:jerin.4.4.4.4; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR07MB2519; 23:DjsU/mWtYD8mR4LeZa7G+OuzLPG/88Le1slt1AHX8?= =?us-ascii?Q?txgCNhLR1S7Ih4JYDif9XqKgb2WkWmzVUBbbU7mvQgfhTSG2TCrKRl4Au89a?= =?us-ascii?Q?ZKSqBgtD3faFrYgD9DlM/ATtFbZC/74xaONBQSn15RorL8uvjzLBqHJ6m7EU?= =?us-ascii?Q?JY1m4HmGZqsusD83dRlVDx/VBznWjcJ0JkmcBBNPwnURxSM4VEsS3oiPD8zb?= =?us-ascii?Q?iEX1+qRZ9RpRyC1wcMDEvxR1yl6b16MngNeS3TXwN8a5RXJFeE9Wqe/PE+av?= =?us-ascii?Q?XwSr32en4sW1HkfXStWR0jP6MdIHOcHTTeZgGPO+w9ALD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Xpj6lohV2yLhPVMrQcdFvOluVt2Qr91CDr0H9AUJ1Jn6T4IViUDXm0BnW6g9ewro3i4u6t3li9NK35plMsGa9YjlQw5JhwpwLliS5sJr9lx7TPnlFesXkhCR+Nst2r5V4i0ngWTxjEU1/EdWgc4ctEj8JI+jTaq2fMII8ZuUXKZh2wc/XbpbxtJ7qwfsFsNOnV+qy0zf926ZQ3WuWxe5w SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2018 12:00:21.8824 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13007fd3-b8d3-4952-e109-08d58e5a2a2e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2519 Subject: [dpdk-dev] [PATCH] event/octeontx: support device stop flush callback 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, 20 Mar 2018 12:00:27 -0000 Add support for stop flush callback along with unit test. Signed-off-by: Jerin Jacob --- This patch has dependecy on "eventdev: add device stop flush callback" patch. http://dpdk.org/dev/patchwork/patch/36106/ --- drivers/event/octeontx/ssovf_evdev.c | 15 +++++++++-- drivers/event/octeontx/ssovf_evdev.h | 5 +++- drivers/event/octeontx/ssovf_evdev_selftest.c | 36 +++++++++++++++++++++++++++ drivers/event/octeontx/ssovf_worker.c | 13 +++++----- 4 files changed, 60 insertions(+), 9 deletions(-) diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index 713983b51..27adf00e3 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -529,7 +529,7 @@ ssovf_start(struct rte_eventdev *dev) for (i = 0; i < edev->nb_event_queues; i++) { /* Consume all the events through HWS0 */ - ssows_flush_events(dev->data->ports[0], i); + ssows_flush_events(dev->data->ports[0], i, NULL, NULL); base = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, i, 0); base += SSO_VHGRP_QCTL; @@ -540,6 +540,16 @@ ssovf_start(struct rte_eventdev *dev) return 0; } +static void +ssows_handle_event(void *arg, struct rte_event event) +{ + struct rte_eventdev *dev = arg; + + if (dev->dev_ops->dev_stop_flush != NULL) + dev->dev_ops->dev_stop_flush(dev->data->dev_id, event, + dev->data->dev_stop_flush_arg); +} + static void ssovf_stop(struct rte_eventdev *dev) { @@ -557,7 +567,8 @@ ssovf_stop(struct rte_eventdev *dev) for (i = 0; i < edev->nb_event_queues; i++) { /* Consume all the events through HWS0 */ - ssows_flush_events(dev->data->ports[0], i); + ssows_flush_events(dev->data->ports[0], i, + ssows_handle_event, dev); base = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, i, 0); base += SSO_VHGRP_QCTL; diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index d1825b4f3..643bc87f2 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -164,7 +164,10 @@ uint16_t ssows_deq_timeout(void *port, struct rte_event *ev, uint64_t timeout_ticks); uint16_t ssows_deq_timeout_burst(void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks); -void ssows_flush_events(struct ssows *ws, uint8_t queue_id); + +typedef void (*ssows_handle_event_t)(void *arg, struct rte_event ev); +void ssows_flush_events(struct ssows *ws, uint8_t queue_id, + ssows_handle_event_t fn, void *arg); void ssows_reset(struct ssows *ws); int test_eventdev_octeontx(void); diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c index 5e012a95a..239362fcf 100644 --- a/drivers/event/octeontx/ssovf_evdev_selftest.c +++ b/drivers/event/octeontx/ssovf_evdev_selftest.c @@ -688,6 +688,40 @@ test_multi_queue_enq_multi_port_deq(void) nr_ports, 0xff /* invalid */); } +static +void flush(uint8_t dev_id, struct rte_event event, void *arg) +{ + unsigned int *count = arg; + + RTE_SET_USED(dev_id); + if (event.event_type == RTE_EVENT_TYPE_CPU) + *count = *count + 1; + +} + +static int +test_dev_stop_flush(void) +{ + unsigned int total_events = MAX_EVENTS, count = 0; + int ret; + + ret = generate_random_events(total_events); + if (ret) + return -1; + + ret = rte_event_dev_stop_flush_callback_register(evdev, flush, &count); + if (ret) + return -2; + rte_event_dev_stop(evdev); + ret = rte_event_dev_stop_flush_callback_register(evdev, NULL, NULL); + if (ret) + return -3; + RTE_TEST_ASSERT_EQUAL(total_events, count, + "count mismatch total_events=%d count=%d", + total_events, count); + return 0; +} + static int validate_queue_to_port_single_link(uint32_t index, uint8_t port, struct rte_event *ev) @@ -1414,6 +1448,8 @@ test_eventdev_octeontx(void) test_simple_enqdeq_parallel); OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, test_multi_queue_enq_single_port_deq); + OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, + test_dev_stop_flush); OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, test_multi_queue_enq_multi_port_deq); OCTEONTX_TEST_RUN(eventdev_setup, eventdev_teardown, diff --git a/drivers/event/octeontx/ssovf_worker.c b/drivers/event/octeontx/ssovf_worker.c index 753c1e9f5..046eaf80f 100644 --- a/drivers/event/octeontx/ssovf_worker.c +++ b/drivers/event/octeontx/ssovf_worker.c @@ -198,12 +198,14 @@ ssows_enq_fwd_burst(void *port, const struct rte_event ev[], uint16_t nb_events) } void -ssows_flush_events(struct ssows *ws, uint8_t queue_id) +ssows_flush_events(struct ssows *ws, uint8_t queue_id, + ssows_handle_event_t fn, void *arg) { uint32_t reg_off; uint64_t aq_cnt = 1; uint64_t cq_ds_cnt = 1; - uint64_t enable, get_work0, get_work1; + uint64_t enable; + struct rte_event ev; uint8_t *base = octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, queue_id, 0); enable = ssovf_read64(base + SSO_VHGRP_QCTL); @@ -219,11 +221,10 @@ ssows_flush_events(struct ssows *ws, uint8_t queue_id) cq_ds_cnt = ssovf_read64(base + SSO_VHGRP_INT_CNT); /* Extract cq and ds count */ cq_ds_cnt &= 0x1FFF1FFF0000; - ssovf_load_pair(get_work0, get_work1, ws->base + reg_off); + ssows_get_work(ws, &ev); + if (fn != NULL && ev.u64 != 0) + fn(arg, ev); } - - RTE_SET_USED(get_work0); - RTE_SET_USED(get_work1); } void -- 2.16.2