From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id CE0894F93 for ; Thu, 22 Mar 2018 19:31:14 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2018 11:31:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,345,1517904000"; d="scan'208";a="213772857" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga006.fm.intel.com with ESMTP; 22 Mar 2018 11:31:13 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 22 Mar 2018 11:31:09 -0700 Received: from fmsmsx108.amr.corp.intel.com ([169.254.9.102]) by fmsmsx118.amr.corp.intel.com ([169.254.1.209]) with mapi id 14.03.0319.002; Thu, 22 Mar 2018 11:31:08 -0700 From: "Eads, Gage" To: Jerin Jacob , "dev@dpdk.org" CC: "Van Haaren, Harry" , "hemant.agrawal@nxp.com" , "pbhagavatula@caviumnetworks.com" , "nipun.gupta@nxp.com" , "santosh.shukla@caviumnetworks.com" Thread-Topic: [dpdk-dev] [PATCH] event/octeontx: support device stop flush callback Thread-Index: AQHTwEMTIoM+jQFgfk6/c3RkGcwciKPcluXg Date: Thu, 22 Mar 2018 18:31:08 +0000 Message-ID: <9184057F7FC11744A2107296B6B8EB1E3FA849B0@FMSMSX108.amr.corp.intel.com> References: <20180320115955.19805-1-jerin.jacob@caviumnetworks.com> In-Reply-To: <20180320115955.19805-1-jerin.jacob@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzdhOTlmYjctODdkNC00YjU0LWFmMTgtYTk4NWZlYjUzN2UyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Im1NdUNiZHJnM2s1dmRyOHNaTk1lSzdURnhGNVpsQnNGejdmVjBVUjF1Zms9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.1.200.107] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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: Thu, 22 Mar 2018 18:31:15 -0000 Looks good. Acked-by: Gage Eads > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Tuesday, March 20, 2018 7:00 AM > To: dev@dpdk.org > Cc: Eads, Gage ; Van Haaren, Harry > ; hemant.agrawal@nxp.com; > pbhagavatula@caviumnetworks.com; nipun.gupta@nxp.com; > santosh.shukla@caviumnetworks.com; Jerin Jacob > > Subject: [dpdk-dev] [PATCH] event/octeontx: support device stop flush cal= lback >=20 > Add support for stop flush callback along with unit test. >=20 > Signed-off-by: Jerin Jacob > --- > This patch has dependecy on "eventdev: add device stop flush callback" pa= tch. > 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(-) >=20 > 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) >=20 > for (i =3D 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); >=20 > base =3D octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, i, 0); > base +=3D SSO_VHGRP_QCTL; > @@ -540,6 +540,16 @@ ssovf_start(struct rte_eventdev *dev) > return 0; > } >=20 > +static void > +ssows_handle_event(void *arg, struct rte_event event) { > + struct rte_eventdev *dev =3D arg; > + > + if (dev->dev_ops->dev_stop_flush !=3D 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) >=20 > for (i =3D 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); >=20 > base =3D octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, i, 0); > base +=3D 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); >=20 > 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 */); > } >=20 > +static > +void flush(uint8_t dev_id, struct rte_event event, void *arg) { > + unsigned int *count =3D arg; > + > + RTE_SET_USED(dev_id); > + if (event.event_type =3D=3D RTE_EVENT_TYPE_CPU) > + *count =3D *count + 1; > + > +} > + > +static int > +test_dev_stop_flush(void) > +{ > + unsigned int total_events =3D MAX_EVENTS, count =3D 0; > + int ret; > + > + ret =3D generate_random_events(total_events); > + if (ret) > + return -1; > + > + ret =3D rte_event_dev_stop_flush_callback_register(evdev, flush, &count= ); > + if (ret) > + return -2; > + rte_event_dev_stop(evdev); > + ret =3D 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=3D%d count=3D%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) } >=20 > 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 =3D 1; > uint64_t cq_ds_cnt =3D 1; > - uint64_t enable, get_work0, get_work1; > + uint64_t enable; > + struct rte_event ev; > uint8_t *base =3D octeontx_ssovf_bar(OCTEONTX_SSO_GROUP, > queue_id, 0); >=20 > enable =3D ssovf_read64(base + SSO_VHGRP_QCTL); @@ -219,11 +221,10 > @@ ssows_flush_events(struct ssows *ws, uint8_t queue_id) > cq_ds_cnt =3D ssovf_read64(base + SSO_VHGRP_INT_CNT); > /* Extract cq and ds count */ > cq_ds_cnt &=3D 0x1FFF1FFF0000; > - ssovf_load_pair(get_work0, get_work1, ws->base + reg_off); > + ssows_get_work(ws, &ev); > + if (fn !=3D NULL && ev.u64 !=3D 0) > + fn(arg, ev); > } > - > - RTE_SET_USED(get_work0); > - RTE_SET_USED(get_work1); > } >=20 > void > -- > 2.16.2