From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0044.outbound.protection.outlook.com [104.47.34.44]) by dpdk.org (Postfix) with ESMTP id A246C5F1A for ; Fri, 30 Mar 2018 17:48:49 +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=MqEZ20zvmzzvSEFEMh21DVgV6ySfvYiv0o2mK1kUQjo=; b=F/tVkPcaFm3iFc0wHRA+8ZdNta2gCGaJwJTGxkrE6gr46C3yAoVbfR44VAF3WZH9I3mFXHnCgqXBvdMCVeCbusVnlvnvO4mwluzpKhDT5SOawuV7E/ddTKTOLwRc2+a8BolR9JQhBttlFd9knliLov5zPL9Z61eeo5KQKMp6Bdc= Received: from DM5PR07MB3466.namprd07.prod.outlook.com (10.164.153.21) by DM5PR07MB4102.namprd07.prod.outlook.com (52.132.140.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Fri, 30 Mar 2018 15:48:46 +0000 Received: from DM5PR07MB3466.namprd07.prod.outlook.com ([fe80::a8a7:83c2:a980:7915]) by DM5PR07MB3466.namprd07.prod.outlook.com ([fe80::a8a7:83c2:a980:7915%13]) with mapi id 15.20.0609.012; Fri, 30 Mar 2018 15:48:46 +0000 From: "Bhagavatula, Pavan" To: Erik Gabriel Carrillo , "Jacob, Jerin" , "nipun.gupta@nxp.com" , "hemant.agrawal@nxp.com" CC: "dev@dpdk.org" Thread-Topic: [PATCH v8 7/9] test: add event timer adapter auto-test Thread-Index: AQHTx6TeiGz2AagIIU+J3dN8vmL4rKPpSgMA Date: Fri, 30 Mar 2018 15:48:46 +0000 Message-ID: <20180330154755.GA23814@ltp-pvn> References: <1520546046-6973-1-git-send-email-erik.g.carrillo@intel.com> <1522358852-3630-1-git-send-email-erik.g.carrillo@intel.com> <1522358852-3630-8-git-send-email-erik.g.carrillo@intel.com> In-Reply-To: <1522358852-3630-8-git-send-email-erik.g.carrillo@intel.com> Accept-Language: en-IN, en-US Content-Language: en-IN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-imapappendstamp: DM5PR07MB3466.namprd07.prod.outlook.com (15.20.0609.010) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; x-originating-ip: [111.93.218.67] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR07MB4102; 7:vjUapqdN0WyG/AOxc4Hggu2xDhtWgYEZIJ1XEYcP39oY2xr341Pu0LIvllO3iL8hIEsPjkuLGoJd+/N10IJZQ+0IWHaLNYudzE8LQVcLhwdaznWfPLC+ImANK3IAV6gZal2auddclAaeqw7b4Ucrxb37uNzkDIDqn9CgeMok7PqLgzEdcwq0RrBffmWcmmnJCZLyFCwidekWWYYQ6JutlWtvSzUtxM/9rNvU69/Ll3sEDvGLd9ZRJqfHty7ISm8s x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(7916004)(366004)(39860400002)(39380400002)(346002)(396003)(376002)(199004)(189003)(9686003)(6436002)(6512007)(8656006)(3846002)(6116002)(3280700002)(97736004)(1076002)(7736002)(66066001)(110136005)(305945005)(33656002)(99286004)(33716001)(316002)(68736007)(72206003)(6506007)(76176011)(59450400001)(106356001)(33896004)(478600001)(2906002)(6486002)(3660700001)(53936002)(14454004)(6246003)(2900100001)(8936002)(81166006)(81156014)(5660300001)(11346002)(186003)(25786009)(102836004)(4326008)(5250100002)(26005)(229853002)(486005)(8676002)(105586002)(446003)(99946001)(2201001)(476003)(486005)(86362001)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB4102; H:DM5PR07MB3466.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-office365-filtering-correlation-id: e4caa33f-9913-40d1-29f9-08d59655b8f8 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM5PR07MB4102; x-ms-traffictypediagnostic: DM5PR07MB4102: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(10201501046)(93006095)(93001095)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR07MB4102; BCL:0; PCL:0; RULEID:; SRVR:DM5PR07MB4102; x-forefront-prvs: 06274D1C43 received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 84SQzO1/Tvf4iS3b8jlCluw2p1bOlELjPpNphgtVwJP2Viqdhh/M2eYFSXgIdDIu7ev5nNmj/bKcudrzDEvnFth/tZAW5U2ksqs5xths0T76lYK23NssbG3RrNOjZQj7pWdhXh+Q0jvfRfSN6EuUGgVdJmBIuaknCqfTw5zf9LUYq0rW8sc4XWxazZhYdRvg8lBpxW2NBtr6AjF+U+JafvJ3PUaBbz6TIP2FoQ7gCktTMrEPBvLSoygt+fN5DcFKfq/gFyU0Uz/2LBUn7pg4EqACnLQ2cIbX9YaLnmJ0hPaN+n7P8FcT1/q1YrhWEHLORiQjB9rLmf5eqt616G7T0jvdo7LZ7usw/EOas0p0+LxHDsjGNPsDZA0FTJjXgNKOlMDbElgZcIEODDnf9+KNinZW1KiRn3KMY8wyIrxB1E0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: e4caa33f-9913-40d1-29f9-08d59655b8f8 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Mar 2018 15:48:46.1826 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB4102 Subject: Re: [dpdk-dev] [PATCH v8 7/9] test: add event timer adapter auto-test 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: Fri, 30 Mar 2018 15:48:50 -0000 Hi Erik, Few comments below, On Thu, Mar 29, 2018 at 04:27:30PM -0500, Erik Gabriel Carrillo wrote: > Signed-off-by: Erik Gabriel Carrillo > --- > test/test/Makefile | 1 + > test/test/test_event_timer_adapter.c | 1837 ++++++++++++++++++++++++++++= ++++++ > 2 files changed, 1838 insertions(+) > create mode 100644 test/test/test_event_timer_adapter.c > > +/* Test that adapter stops correctly. */ > +static int > +adapter_stop(void) > +{ > + uint32_t evdev_service_id, adapter_service_id; > + struct rte_event_timer_adapter *l_adapter =3D NULL; > + Please use INTERNAL_PORT capability to determine if service core is require= d. > + /* retrieve service ids */ > + TEST_ASSERT_SUCCESS(rte_event_dev_service_id_get(evdev, > + &evdev_service_id), "Failed to get event device " > + "service id"); > + TEST_ASSERT_SUCCESS(rte_event_timer_adapter_service_id_get(timdev, > + &adapter_service_id), "Failed to get event timer " > + "adapter service id"); > + > + /* Test adapter stop */ > + TEST_ASSERT_SUCCESS(rte_event_timer_adapter_stop(timdev), > + "Failed to stop event adapter"); > + > + TEST_ASSERT_FAIL(rte_event_timer_adapter_stop(l_adapter), > + "Erroneously stopped null event adapter"); > + > + TEST_ASSERT_SUCCESS(rte_event_timer_adapter_free(timdev), > + "Failed to free adapter"); > + > + rte_mempool_free(eventdev_test_mempool); > + > + return TEST_SUCCESS; > +} > + > +stat_inc_reset_ev_enq(void) > +{ > + int ret, i, n; > + int num_evtims =3D MAX_TIMERS; > + struct rte_event_timer *evtims[num_evtims]; > + struct rte_event evs[BATCH_SIZE]; > + struct rte_event_timer_adapter_stats stats; > + const struct rte_event_timer init_tim =3D { > + .ev.op =3D RTE_EVENT_OP_NEW, > + .ev.queue_id =3D TEST_QUEUE_ID, > + .ev.sched_type =3D RTE_SCHED_TYPE_ATOMIC, > + .ev.priority =3D RTE_EVENT_DEV_PRIORITY_NORMAL, > + .ev.event_type =3D RTE_EVENT_TYPE_TIMER, > + .state =3D RTE_EVENT_TIMER_NOT_ARMED, > + .timeout_ticks =3D 5, // expire in .5 sec > + }; > + > + ret =3D rte_mempool_get_bulk(eventdev_test_mempool, (void **)evtims, > + num_evtims); > + TEST_ASSERT_EQUAL(ret, 0, "Failed to get array of timer objs: ret =3D %= d", > + ret); > + > + for (i =3D 0; i < num_evtims; i++) { > + *evtims[i] =3D init_tim; > + evtims[i]->ev.event_ptr =3D evtims[i]; > + } > + > + ret =3D rte_event_timer_adapter_stats_get(timdev, &stats); > + TEST_ASSERT_EQUAL(ret, 0, "Failed to get stats"); > + TEST_ASSERT_EQUAL((int)stats.ev_enq_count, 0, "Stats not clear at " > + "startup"); > + > + /* Test with the max value for the adapter */ > + ret =3D rte_event_timer_arm_burst(timdev, evtims, num_evtims); > + TEST_ASSERT_EQUAL(ret, num_evtims, > + "Failed to arm all event timers: attempted =3D %d, " > + "succeeded =3D %d, rte_errno =3D %s", > + num_evtims, ret, rte_strerror(rte_errno)); > + > + rte_delay_ms(1000); > + > +#define MAX_TRIES 1000 Please make MAX_TRIES equivalent to num_evtims, here we are trying to deq 1= 0 events in burst and assume it to succeed but in case event dev doesn't supp= ort burst mode event will be stuck as it will have only 1000 tries instead of 4= 096. > + int sum =3D 0; > + int tries =3D 0; > + bool done =3D false; > + while (!done) { > + sum +=3D rte_event_dequeue_burst(evdev, TEST_PORT_ID, evs, > + RTE_DIM(evs), 10); > + if (sum >=3D num_evtims || ++tries >=3D MAX_TRIES) > + done =3D true; > + > + rte_delay_ms(10); > + } > + > + TEST_ASSERT_EQUAL(sum, num_evtims, "Expected %d timer expiry events, " > + "got %d", num_evtims, sum); > + > +event_timer_arm_max(void) > +{ > + int ret, i, n; > + int num_evtims =3D MAX_TIMERS; > + struct rte_event_timer *evtims[num_evtims]; > + struct rte_event evs[BATCH_SIZE]; > + const struct rte_event_timer init_tim =3D { > + .ev.op =3D RTE_EVENT_OP_NEW, > + .ev.queue_id =3D TEST_QUEUE_ID, > + .ev.sched_type =3D RTE_SCHED_TYPE_ATOMIC, > + .ev.priority =3D RTE_EVENT_DEV_PRIORITY_NORMAL, > + .ev.event_type =3D RTE_EVENT_TYPE_TIMER, > + .state =3D RTE_EVENT_TIMER_NOT_ARMED, > + .timeout_ticks =3D 5, // expire in .5 sec > + }; > + > + ret =3D rte_mempool_get_bulk(eventdev_test_mempool, (void **)evtims, > + num_evtims); > + TEST_ASSERT_EQUAL(ret, 0, "Failed to get array of timer objs: ret =3D %= d", > + ret); > + > + for (i =3D 0; i < num_evtims; i++) { > + *evtims[i] =3D init_tim; > + evtims[i]->ev.event_ptr =3D evtims[i]; > + } > + > + /* Test with the max value for the adapter */ > + ret =3D rte_event_timer_arm_burst(timdev, evtims, num_evtims); > + TEST_ASSERT_EQUAL(ret, num_evtims, > + "Failed to arm all event timers: attempted =3D %d, " > + "succeeded =3D %d, rte_errno =3D %s", > + num_evtims, ret, rte_strerror(rte_errno)); > + > + rte_delay_ms(1000); > + > +#define MAX_TRIES 1000 Same as above. > + int sum =3D 0; > + int tries =3D 0; > + bool done =3D false; > +static int > +adapter_create_max(void) > +{ > + int i; > + uint32_t svc_start_count, svc_end_count; > + struct rte_event_timer_adapter *adapters[ > + RTE_EVENT_TIMER_ADAPTER_NUM_MAX + 1]; > + > + struct rte_event_timer_adapter_conf conf =3D { > + .event_dev_id =3D evdev, > + // timer_adapter_id set in loop > + .clk_src =3D RTE_EVENT_TIMER_ADAPTER_CPU_CLK, > + .timer_tick_ns =3D NSECPERSEC / 10, > + .max_tmo_ns =3D 180 * NSECPERSEC, > + .nb_timers =3D MAX_TIMERS, > + .flags =3D 0, > + }; > + > + svc_start_count =3D rte_service_get_count(); > + > + /* This test expects that there are sufficient service IDs available > + * to be allocated. I.e., RTE_EVENT_TIMER_ADAPTER_NUM_MAX may need to > + * be less than RTE_SERVICE_NUM_MAX if anything else uses a service > + * (the SW event device, for example). > + */ Same as above service use need to be dependent on INTERNAL_PORT capability. Also, in software event dev case this can be a valid test but in case of a = hw event dev RTE_EVENT_TIMER_ADAPTER_NUM_MAX number of event devicesmight not = be binded to dpdk. Either we need to provide a API to check how many event dev= ices are supported or use eventdev_timer_adapter_caps_get_t to get the number. Thoughts? > + for (i =3D 0; i < RTE_EVENT_TIMER_ADAPTER_NUM_MAX; i++) { > + conf.timer_adapter_id =3D i; > + adapters[i] =3D rte_event_timer_adapter_create_ext(&conf, > + test_port_conf_cb, NULL); > + TEST_ASSERT_NOT_NULL(adapters[i], "Failed to create adapter " > + "%d", i); > + } > + Thanks, Pavan.