From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0078.outbound.protection.outlook.com [104.47.33.78]) by dpdk.org (Postfix) with ESMTP id B44D51C73A for ; Fri, 6 Apr 2018 16:56:23 +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=RS0CAIxv0QHFNW4XsYaIhvSOvKCOquErxoLcNs4y9XA=; b=kP7eVVHErO63UizEAwkyMO1g7oEnAL27wsLKhpvPYyJk5w9wvFWSzIZfAQWkPG5iQzoEmY4RgykwYk7qmHJ3dHmOYB2jkSzIUTxj7V9qY5THSYSrjJa9+PAtv7FS1wkSSGUhc+pHvkvDujxQKH5xCX+w04mhESg0c3cmZZZjGyY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from ltp-pvn.caveonetworks.com (111.93.218.67) by MWHPR07MB3471.namprd07.prod.outlook.com (2603:10b6:301:63::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Fri, 6 Apr 2018 14:56:15 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com, erik.g.carrillo@intel.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Fri, 6 Apr 2018 20:25:19 +0530 Message-Id: <20180406145522.7775-1-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180318131216.11699-1-pbhagavatula@caviumnetworks.com> References: <20180318131216.11699-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BMXPR01CA0031.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::17) To MWHPR07MB3471.namprd07.prod.outlook.com (2603:10b6:301:63::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6e2f3242-be68-44c3-73f6-08d59bce8cac X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603328)(7153060)(7193020); SRVR:MWHPR07MB3471; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3471; 3:cTOgRLEUkMlDjsy2MnOAQpiEd0Gc6aalBWprKdiXzesiyrtYLui4q8mvhH+cxvbWWzukuWf9HlhmtTM9YEOj+Eb8NIbycmfnzFW9n160vMsw2+dSQ3YaNB9j5V2w6sS9TqBcImRtgZzj8MTUKx1rMMclRaF1fQiHPAyWf1jmOLdGaGVm4mRIG1kQakzWvxjt7mhRkVG45RunQWgcbJiic1+1xZQ177naAFTxNxblY0OaHobM+Io1Cku+YTbA4pVI; 25:1ETxeDCYZLC6VLrogMJ47cdlHnRvjHVGv7Og3NXE1z7XarmdUCm7885CEhxqoqJOYS2oXlNIA5+O/sItZ4cigNmp+z71AZCbI+1VoJXDNq2H3T+DMgL+7li12KuyGjkgOSkaGlO4a9GvY9suU9uzQ9V8rUZyh9E9RrZLPqlLC5KfYCHbxoF5MO8i1SeVRMzLSht2l367qw+WAY9YMO1mAz3MhXYB99liNPHc6zo8E1KGfHA5GV6YBu7Elubaffqk/XNcy/E4nGlD622eW9Sl3jnwBp+KPcwTY8RdNZ7Z8YRF6AK6/O50mwpOCM0T9eKx0Pn0FPf1uPT44A0sLMuk5w==; 31:eooVxInDuTVMNSF9qBiIO9Bah/EdqtlFFpSjMXICxRKk9qvy+NlU7hIrl0mx6LbJVAfF2Qo9W7CPwvYao1LcyKJmc70svZ6P5XwjDH/DHgLOUrRWaAEuk+MJZHkpeuvGcJsZx0SuxpzuZMugUrhwksoqGCJbABOZ6g4YMh71D/U9ejmKvknqC08HHMmEUp88vG0HKcGCywKOpNvr24E8p9szlCRUKWv+b5oH1Lovln0= X-MS-TrafficTypeDiagnostic: MWHPR07MB3471: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3471; 20:mWTerfQtwL63zp+R1CRVPP6pHcW4+P0CH1MzMEFE392L9CdHhJtGXvL6/k47eFHt6FuK/Ha+l7VDF1VQCOEvoXTvCFNBjp/7E8kempbZUGWtGSggknYXYNB9m2MAwPryoIeRZLRATkBBFjPG+z1mbldj94uU82n82bQww7uYLLrVMq7C5gr3fWC+hKsghi4qOg+U9HlR4hWmAf+0nevaJ6OXQFc9dKo55Phr0HLa1kOmjA+clR9HGPATjd/cbYYd18UVv728suyqhw1HtP+MnJbzHHekZtEwoVFoLL0mLdM5WEFcWkX8LTih6zCmsrJK7IEslmSHuSwOvMWjmAhEnYsFncDzuCs6thwtUAYVNCMO2DSVrwAFbiP6JGdthdmTjmNKYc52J89855Bp67SOXXeaehuNupOWU8LC6ixEZAwmHFhHTNjxe8Etpio/UkXwo5FeP8hQYwtD1L/qNbBYpTQcZybrk56Cyeo7mvtrkgqBje/BMNRU6cTDWGl5+eD3v9o1LDnQ1QSdQxxcE9tQhVvnWH1ab8QXkqSoXwGncN0y8+oOMcN6KHmtHbYRHUWvYeDH8gHLBZwRVp2pv5Z8TRnxyMR33sKNrtXSjMNsLaU=; 4:1qa+7k/+MYwLfZTOAr/9u/eKcGPlHQ04N8m+I1fGKj1E/nWYvGy3VSMybel9GVHRl/Qq02qpGLBbjjreNJKCcEF5Y7bBgeMj4kquD4//4NfPEyCXFJN8FjkA1FPIMXV+x9qtiU3YldXpK8ApWeycYo72mkzCmFkPpfyAIl7mdX3kOmHZpD/xggcedG4drXcbfz5cYY1nL0bX0FTNRtHSywySPXVSZo0wXas/JI8x7v0a1WJlXqxim6uxavce1krga6l1bU6VzEH+LGpFoTK82iWIS2AttZoiNBYrUrAFK+kgLUIn0uoUIX2eCNUEA6za X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(131327999870524); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:MWHPR07MB3471; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3471; X-Forefront-PRVS: 0634F37BFF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(39380400002)(346002)(396003)(366004)(189003)(199004)(53416004)(106356001)(8676002)(25786009)(68736007)(81166006)(305945005)(48376002)(3846002)(7736002)(6116002)(66066001)(47776003)(478600001)(4326008)(2906002)(8936002)(52116002)(50466002)(105586002)(50226002)(69596002)(1076002)(81156014)(5660300001)(1857600001)(51416003)(16586007)(36756003)(6512007)(575784001)(76176011)(16526019)(97736004)(107886003)(5009440100003)(42882007)(316002)(6486002)(53936002)(72206003)(59450400001)(6506007)(26005)(476003)(486006)(11346002)(956004)(2616005)(446003)(386003)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3471; H:ltp-pvn.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR07MB3471; 23:3N4PnHHTfgxOtj0sfCR0cBX3VuIH9Oc8VHB/4GhX7?= =?us-ascii?Q?6wQrc0DbgF2qcmCU0+uJeYAF0/rjsmakx5MENgeED8x2bOv+WthCTwZu/zRy?= =?us-ascii?Q?EzV1ALBP30imR7TsQPcqYE4ykUf5fklE4XNO7aeXUfBJg4u34mGklGTC6tXN?= =?us-ascii?Q?/NtHoQ2T0oErMIiPqgmcptGXoC2ZtcYZS/XubmGRJ4D4N61hxLjjftmhMtWK?= =?us-ascii?Q?WPTdpXypzMUlHgIkjtslF9ZCaby9RQVkU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nL4mh2iHJfnBfgqC17cBvOKhalI6qs8mX4+LAqHwyM3ejYN3BJbiauU9C1UwOCuoFNK6PYuYFMpokvNxhKW9o+EpoFFC7acvVvB8rNKGQkl+s42bQ7cdBgqE=; 24:8fKYspi7+y+yAGGhvyDNS2RdLLyao6XIiIy5nKuVE/JRjWX/+wT41DrBj+YIUTJyJQ9KanowiYhvZ5clAd8iAuG+iHrN12Wik1nZOF2O3/A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3471; 7:knSaH3S8xg3OebQVvlWSywM7dclW++ZWq1xXLSJnmw2PzHjUHxU1LICMMi6QzNsEs5jMsxex15Ut8ZV1TZvu+UtRCkIpHqo3hKZDynwouCp/5l7B1cacnUXN0EXCA+xF7GwfkLToLB7TVQJV6ymvo+RuxRB1E68sWb7T8Q+qImK0jE/WZ3U0/JXVF0Vkyyt/2VKFtOGHjMYIPoHm8AVFb2K2BbNrED6rTmrO1An3JnZA12ujP4jSRxqj/WTxjua7 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2018 14:56:15.0504 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e2f3242-be68-44c3-73f6-08d59bce8cac X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3471 Subject: [dpdk-dev] [PATCH v4 1/4] app/eventdev: add event timer adapter as a producer 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, 06 Apr 2018 14:56:24 -0000 Add event timer adapter as producer option that can be selected by passing --prod_type_timerdev. Signed-off-by: Pavan Nikhilesh --- v4 Changes: - reuse struct rte_event_timer's unused data portion to store timestamp instead of spilling timestamp into a new cacheline. - change bkt_tck_nsec to timer_tick_nsec - change nb_bkt_tcks to expiry_nsec v3 Changes: - Add detailed options dump. - Fix few typos. v2 Changes: - set timer to NOT_ARMED before trying to arm it. - prevent edge cases for timeout_ticks being set to 0. app/test-eventdev/evt_options.c | 54 ++++++--- app/test-eventdev/evt_options.h | 24 ++++ app/test-eventdev/test_perf_atq.c | 10 +- app/test-eventdev/test_perf_common.c | 171 +++++++++++++++++++++++++-- app/test-eventdev/test_perf_common.h | 14 ++- app/test-eventdev/test_perf_queue.c | 7 +- 6 files changed, 243 insertions(+), 37 deletions(-) diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c index 9683b2224..47e37bc9b 100644 --- a/app/test-eventdev/evt_options.c +++ b/app/test-eventdev/evt_options.c @@ -27,6 +27,11 @@ evt_options_default(struct evt_options *opt) opt->pool_sz = 16 * 1024; opt->wkr_deq_dep = 16; opt->nb_pkts = (1ULL << 26); /* do ~64M packets */ + opt->nb_timers = 1E8; + opt->nb_timer_adptrs = 1; + opt->timer_tick_nsec = 1E3; /* 1000ns ~ 1us */ + opt->max_tmo_nsec = 1E5; /* 100000ns ~100us */ + opt->expiry_nsec = 1E4; /* 10000ns ~10us */ opt->prod_type = EVT_PROD_TYPE_SYNT; } @@ -86,6 +91,13 @@ evt_parse_eth_prod_type(struct evt_options *opt, const char *arg __rte_unused) return 0; } +static int +evt_parse_timer_prod_type(struct evt_options *opt, const char *arg __rte_unused) +{ + opt->prod_type = EVT_PROD_TYPE_EVENT_TIMER_ADPTR; + return 0; +} + static int evt_parse_test_name(struct evt_options *opt, const char *arg) { @@ -169,7 +181,10 @@ usage(char *program) "\t--worker_deq_depth : dequeue depth of the worker\n" "\t--fwd_latency : perform fwd_latency measurement\n" "\t--queue_priority : enable queue priority\n" - "\t--prod_type_ethdev : use ethernet device as producer\n." + "\t--prod_type_ethdev : use ethernet device as producer.\n" + "\t--prod_type_timerdev : use event timer device as producer.\n" + "\t expity_nsec would be the timeout\n" + "\t in ns.\n" ); printf("available tests:\n"); evt_test_dump_names(); @@ -217,22 +232,23 @@ evt_parse_sched_type_list(struct evt_options *opt, const char *arg) } static struct option lgopts[] = { - { EVT_NB_FLOWS, 1, 0, 0 }, - { EVT_DEVICE, 1, 0, 0 }, - { EVT_VERBOSE, 1, 0, 0 }, - { EVT_TEST, 1, 0, 0 }, - { EVT_PROD_LCORES, 1, 0, 0 }, - { EVT_WORK_LCORES, 1, 0, 0 }, - { EVT_SOCKET_ID, 1, 0, 0 }, - { EVT_POOL_SZ, 1, 0, 0 }, - { EVT_NB_PKTS, 1, 0, 0 }, - { EVT_WKR_DEQ_DEP, 1, 0, 0 }, - { EVT_SCHED_TYPE_LIST, 1, 0, 0 }, - { EVT_FWD_LATENCY, 0, 0, 0 }, - { EVT_QUEUE_PRIORITY, 0, 0, 0 }, - { EVT_PROD_ETHDEV, 0, 0, 0 }, - { EVT_HELP, 0, 0, 0 }, - { NULL, 0, 0, 0 } + { EVT_NB_FLOWS, 1, 0, 0 }, + { EVT_DEVICE, 1, 0, 0 }, + { EVT_VERBOSE, 1, 0, 0 }, + { EVT_TEST, 1, 0, 0 }, + { EVT_PROD_LCORES, 1, 0, 0 }, + { EVT_WORK_LCORES, 1, 0, 0 }, + { EVT_SOCKET_ID, 1, 0, 0 }, + { EVT_POOL_SZ, 1, 0, 0 }, + { EVT_NB_PKTS, 1, 0, 0 }, + { EVT_WKR_DEQ_DEP, 1, 0, 0 }, + { EVT_SCHED_TYPE_LIST, 1, 0, 0 }, + { EVT_FWD_LATENCY, 0, 0, 0 }, + { EVT_QUEUE_PRIORITY, 0, 0, 0 }, + { EVT_PROD_ETHDEV, 0, 0, 0 }, + { EVT_PROD_TIMERDEV, 0, 0, 0 }, + { EVT_HELP, 0, 0, 0 }, + { NULL, 0, 0, 0 } }; static int @@ -255,11 +271,12 @@ evt_opts_parse_long(int opt_idx, struct evt_options *opt) { EVT_FWD_LATENCY, evt_parse_fwd_latency}, { EVT_QUEUE_PRIORITY, evt_parse_queue_priority}, { EVT_PROD_ETHDEV, evt_parse_eth_prod_type}, + { EVT_PROD_TIMERDEV, evt_parse_timer_prod_type}, }; for (i = 0; i < RTE_DIM(parsermap); i++) { if (strncmp(lgopts[opt_idx].name, parsermap[i].lgopt_name, - strlen(parsermap[i].lgopt_name)) == 0) + strlen(lgopts[opt_idx].name)) == 0) return parsermap[i].parser_fn(opt, optarg); } @@ -305,6 +322,7 @@ evt_options_dump(struct evt_options *opt) evt_dump("pool_sz", "%d", opt->pool_sz); evt_dump("master lcore", "%d", rte_get_master_lcore()); evt_dump("nb_pkts", "%"PRIu64, opt->nb_pkts); + evt_dump("nb_timers", "%"PRIu64, opt->nb_timers); evt_dump_begin("available lcores"); RTE_LCORE_FOREACH(lcore_id) printf("%d ", lcore_id); diff --git a/app/test-eventdev/evt_options.h b/app/test-eventdev/evt_options.h index 46d122229..b51d8d5b3 100644 --- a/app/test-eventdev/evt_options.h +++ b/app/test-eventdev/evt_options.h @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -31,12 +32,14 @@ #define EVT_FWD_LATENCY ("fwd_latency") #define EVT_QUEUE_PRIORITY ("queue_priority") #define EVT_PROD_ETHDEV ("prod_type_ethdev") +#define EVT_PROD_TIMERDEV ("prod_type_timerdev") #define EVT_HELP ("help") enum evt_prod_type { EVT_PROD_TYPE_NONE, EVT_PROD_TYPE_SYNT, /* Producer type Synthetic i.e. CPU. */ EVT_PROD_TYPE_ETH_RX_ADPTR, /* Producer type Eth Rx Adapter. */ + EVT_PROD_TYPE_EVENT_TIMER_ADPTR, /* Producer type Timer Adapter. */ EVT_PROD_TYPE_MAX, }; @@ -52,11 +55,18 @@ struct evt_options { int nb_stages; int verbose_level; uint64_t nb_pkts; + uint8_t nb_timer_adptrs; + uint64_t nb_timers; + uint64_t timer_tick_nsec; + uint64_t optm_timer_tick_nsec; + uint64_t max_tmo_nsec; + uint64_t expiry_nsec; uint16_t wkr_deq_dep; uint8_t dev_id; uint32_t fwd_latency:1; uint32_t q_priority:1; enum evt_prod_type prod_type; + uint8_t timdev_cnt; }; void evt_options_default(struct evt_options *opt); @@ -262,6 +272,20 @@ evt_dump_producer_type(struct evt_options *opt) case EVT_PROD_TYPE_ETH_RX_ADPTR: snprintf(name, EVT_PROD_MAX_NAME_LEN, "Ethdev Rx Adapter producers"); + evt_dump("nb_ethdev", "%d", rte_eth_dev_count()); + break; + case EVT_PROD_TYPE_EVENT_TIMER_ADPTR: + snprintf(name, EVT_PROD_MAX_NAME_LEN, + "Event timer adapter producer"); + evt_dump("nb_timer_adapters", "%d", opt->nb_timer_adptrs); + evt_dump("max_tmo_nsec", "%"PRIu64"", opt->max_tmo_nsec); + evt_dump("expiry_nsec", "%"PRIu64"", opt->expiry_nsec); + if (opt->optm_timer_tick_nsec) + evt_dump("optm_timer_tick_ns", "%"PRIu64"", + opt->optm_timer_tick_nsec); + else + evt_dump("timer_tick_ns", "%"PRIu64"", + opt->timer_tick_nsec); break; } evt_dump("prod_type", "%s", name); diff --git a/app/test-eventdev/test_perf_atq.c b/app/test-eventdev/test_perf_atq.c index b36b22a77..b3a312722 100644 --- a/app/test-eventdev/test_perf_atq.c +++ b/app/test-eventdev/test_perf_atq.c @@ -43,15 +43,12 @@ perf_atq_worker(void *arg, const int enable_fwd_latency) while (t->done == false) { uint16_t event = rte_event_dequeue_burst(dev, port, &ev, 1, 0); - if (enable_fwd_latency) - rte_prefetch0(ev.event_ptr); - if (!event) { rte_pause(); continue; } - if (enable_fwd_latency) + if (enable_fwd_latency && !prod_timer_type) /* first stage in pipeline, mark ts to compute fwd latency */ atq_mark_fwd_latency(&ev); @@ -90,7 +87,7 @@ perf_atq_worker_burst(void *arg, const int enable_fwd_latency) } for (i = 0; i < nb_rx; i++) { - if (enable_fwd_latency) { + if (enable_fwd_latency && !prod_timer_type) { rte_prefetch0(ev[i+1].event_ptr); /* first stage in pipeline. * mark time stamp to compute fwd latency @@ -163,7 +160,8 @@ perf_atq_eventdev_setup(struct evt_test *test, struct evt_options *opt) struct rte_event_dev_info dev_info; nb_ports = evt_nr_active_lcores(opt->wlcores); - nb_ports += opt->prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR ? 0 : + nb_ports += (opt->prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR || + opt->prod_type == EVT_PROD_TYPE_EVENT_TIMER_ADPTR) ? 0 : evt_nr_active_lcores(opt->plcores); nb_queues = atq_nb_event_queues(opt); diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index 59fa0a49e..b6cc00e60 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -72,6 +72,67 @@ perf_producer(void *arg) return 0; } +static inline int +perf_event_timer_producer(void *arg) +{ + struct prod_data *p = arg; + struct test_perf *t = p->t; + struct evt_options *opt = t->opt; + uint32_t flow_counter = 0; + uint64_t count = 0; + uint64_t arm_latency = 0; + const uint8_t nb_timer_adptrs = opt->nb_timer_adptrs; + const uint32_t nb_flows = t->nb_flows; + const uint64_t nb_timers = opt->nb_timers; + struct rte_mempool *pool = t->pool; + struct perf_elt *m; + struct rte_event_timer_adapter **adptr = t->timer_adptr; + uint64_t timeout_ticks = opt->expiry_nsec / opt->timer_tick_nsec; + + timeout_ticks = opt->optm_timer_tick_nsec ? + (timeout_ticks * opt->timer_tick_nsec) + / opt->optm_timer_tick_nsec : timeout_ticks; + timeout_ticks += timeout_ticks ? 0 : 1; + const struct rte_event_timer tim = { + .ev.op = RTE_EVENT_OP_NEW, + .ev.queue_id = p->queue_id, + .ev.sched_type = t->opt->sched_type_list[0], + .ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL, + .ev.event_type = RTE_EVENT_TYPE_TIMER, + .state = RTE_EVENT_TIMER_NOT_ARMED, + .timeout_ticks = timeout_ticks, + }; + + if (opt->verbose_level > 1) + printf("%s(): lcore %d\n", __func__, rte_lcore_id()); + + while (count < nb_timers && t->done == false) { + if (rte_mempool_get(pool, (void **)&m) < 0) + continue; + + m->tim = tim; + m->tim.ev.flow_id = flow_counter++ % nb_flows; + m->tim.ev.event_ptr = m; + m->timestamp = rte_get_timer_cycles(); + while (rte_event_timer_arm_burst( + adptr[flow_counter % nb_timer_adptrs], + (struct rte_event_timer **)&m, 1) != 1) { + if (t->done) + break; + rte_pause(); + m->timestamp = rte_get_timer_cycles(); + } + arm_latency += rte_get_timer_cycles() - m->timestamp; + count++; + } + fflush(stdout); + rte_delay_ms(1000); + printf("%s(): lcore %d Average event timer arm latency = %.3f us\n", + __func__, rte_lcore_id(), (float)(arm_latency / count) / + (rte_get_timer_hz() / 1000000)); + return 0; +} + static int perf_producer_wrapper(void *arg) { @@ -80,6 +141,8 @@ perf_producer_wrapper(void *arg) /* Launch the producer function only in case of synthetic producer. */ if (t->opt->prod_type == EVT_PROD_TYPE_SYNT) return perf_producer(arg); + else if (t->opt->prod_type == EVT_PROD_TYPE_EVENT_TIMER_ADPTR) + return perf_event_timer_producer(arg); return 0; } @@ -146,8 +209,7 @@ perf_launch_lcores(struct evt_test *test, struct evt_options *opt, port_idx++; } - const uint64_t total_pkts = opt->nb_pkts * - evt_nr_active_lcores(opt->plcores); + const uint64_t total_pkts = t->outstand_pkts; uint64_t dead_lock_cycles = rte_get_timer_cycles(); int64_t dead_lock_remaining = total_pkts; @@ -189,7 +251,9 @@ perf_launch_lcores(struct evt_test *test, struct evt_options *opt, if (remaining <= 0) { t->result = EVT_TEST_SUCCESS; - if (opt->prod_type == EVT_PROD_TYPE_SYNT) { + if (opt->prod_type == EVT_PROD_TYPE_SYNT || + opt->prod_type == + EVT_PROD_TYPE_EVENT_TIMER_ADPTR) { t->done = true; rte_smp_wmb(); break; @@ -283,6 +347,65 @@ perf_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride, return ret; } +static int +perf_event_timer_adapter_setup(struct test_perf *t) +{ + int i; + int ret; + struct rte_event_timer_adapter_info adapter_info; + struct rte_event_timer_adapter *wl; + uint8_t nb_producers = evt_nr_active_lcores(t->opt->plcores); + uint8_t flags = RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES; + + if (nb_producers == 1) + flags |= RTE_EVENT_TIMER_ADAPTER_F_SP_PUT; + + for (i = 0; i < t->opt->nb_timer_adptrs; i++) { + struct rte_event_timer_adapter_conf config = { + .event_dev_id = t->opt->dev_id, + .timer_adapter_id = i, + .timer_tick_ns = t->opt->timer_tick_nsec, + .max_tmo_ns = t->opt->max_tmo_nsec, + .nb_timers = 2 * 1024 * 1024, + .flags = flags, + }; + + wl = rte_event_timer_adapter_create(&config); + if (wl == NULL) { + evt_err("failed to create event timer ring %d", i); + return rte_errno; + } + + memset(&adapter_info, 0, + sizeof(struct rte_event_timer_adapter_info)); + rte_event_timer_adapter_get_info(wl, &adapter_info); + t->opt->optm_timer_tick_nsec = adapter_info.min_resolution_ns; + + if (!(adapter_info.caps & + RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT)) { + uint32_t service_id; + + rte_event_timer_adapter_service_id_get(wl, + &service_id); + ret = evt_service_setup(service_id); + if (ret) { + evt_err("Failed to setup service core" + " for timer adapter\n"); + return ret; + } + rte_service_runstate_set(service_id, 1); + } + + ret = rte_event_timer_adapter_start(wl); + if (ret) { + evt_err("failed to Start event timer adapter %d", i); + return ret; + } + t->timer_adptr[i] = wl; + } + return 0; +} + int perf_event_dev_port_setup(struct evt_test *test, struct evt_options *opt, uint8_t stride, uint8_t nb_queues, @@ -326,6 +449,18 @@ perf_event_dev_port_setup(struct evt_test *test, struct evt_options *opt, ret = perf_event_rx_adapter_setup(opt, stride, *port_conf); if (ret) return ret; + } else if (opt->prod_type == EVT_PROD_TYPE_EVENT_TIMER_ADPTR) { + prod = 0; + for ( ; port < perf_nb_event_ports(opt); port++) { + struct prod_data *p = &t->prod[port]; + p->queue_id = prod * stride; + p->t = t; + prod++; + } + + ret = perf_event_timer_adapter_setup(t); + if (ret) + return ret; } else { prod = 0; for ( ; port < perf_nb_event_ports(opt); port++) { @@ -415,10 +550,13 @@ perf_opt_check(struct evt_options *opt, uint64_t nb_queues) } /* Fixups */ - if (opt->nb_stages == 1 && opt->fwd_latency) { + if ((opt->nb_stages == 1 && + opt->prod_type != EVT_PROD_TYPE_EVENT_TIMER_ADPTR) && + opt->fwd_latency) { evt_info("fwd_latency is valid when nb_stages > 1, disabling"); opt->fwd_latency = 0; } + if (opt->fwd_latency && !opt->q_priority) { evt_info("enabled queue priority for latency measurement"); opt->q_priority = 1; @@ -447,8 +585,13 @@ perf_opt_dump(struct evt_options *opt, uint8_t nb_queues) void perf_eventdev_destroy(struct evt_test *test, struct evt_options *opt) { - RTE_SET_USED(test); + int i; + struct test_perf *t = evt_test_priv(test); + if (opt->prod_type == EVT_PROD_TYPE_EVENT_TIMER_ADPTR) { + for (i = 0; i < opt->nb_timer_adptrs; i++) + rte_event_timer_adapter_stop(t->timer_adptr[i]); + } rte_event_dev_stop(opt->dev_id); rte_event_dev_close(opt->dev_id); } @@ -488,7 +631,8 @@ perf_ethdev_setup(struct evt_test *test, struct evt_options *opt) }, }; - if (opt->prod_type == EVT_PROD_TYPE_SYNT) + if (opt->prod_type == EVT_PROD_TYPE_SYNT || + opt->prod_type == EVT_PROD_TYPE_EVENT_TIMER_ADPTR) return 0; if (!rte_eth_dev_count()) { @@ -544,7 +688,8 @@ perf_mempool_setup(struct evt_test *test, struct evt_options *opt) { struct test_perf *t = evt_test_priv(test); - if (opt->prod_type == EVT_PROD_TYPE_SYNT) { + if (opt->prod_type == EVT_PROD_TYPE_SYNT || + opt->prod_type == EVT_PROD_TYPE_EVENT_TIMER_ADPTR) { t->pool = rte_mempool_create(test->name, /* mempool name */ opt->pool_sz, /* number of elements*/ sizeof(struct perf_elt), /* element size*/ @@ -594,10 +739,18 @@ perf_test_setup(struct evt_test *test, struct evt_options *opt) struct test_perf *t = evt_test_priv(test); - t->outstand_pkts = opt->nb_pkts * evt_nr_active_lcores(opt->plcores); + if (opt->prod_type == EVT_PROD_TYPE_EVENT_TIMER_ADPTR) { + t->outstand_pkts = opt->nb_timers * + evt_nr_active_lcores(opt->plcores); + t->nb_pkts = opt->nb_timers; + } else { + t->outstand_pkts = opt->nb_pkts * + evt_nr_active_lcores(opt->plcores); + t->nb_pkts = opt->nb_pkts; + } + t->nb_workers = evt_nr_active_lcores(opt->wlcores); t->done = false; - t->nb_pkts = opt->nb_pkts; t->nb_flows = opt->nb_flows; t->result = EVT_TEST_FAILED; t->opt = opt; diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h index 9ad99733b..d8fbee6d8 100644 --- a/app/test-eventdev/test_perf_common.h +++ b/app/test-eventdev/test_perf_common.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,7 @@ struct prod_data { struct test_perf *t; } __rte_cache_aligned; + struct test_perf { /* Don't change the offset of "done". Signal handler use this memory * to terminate all lcores work. @@ -54,10 +56,18 @@ struct test_perf { struct worker_data worker[EVT_MAX_PORTS]; struct evt_options *opt; uint8_t sched_type_list[EVT_MAX_STAGES] __rte_cache_aligned; + struct rte_event_timer_adapter *timer_adptr[ + RTE_EVENT_TIMER_ADAPTER_NUM_MAX] __rte_cache_aligned; } __rte_cache_aligned; struct perf_elt { - uint64_t timestamp; + union { + struct rte_event_timer tim; + struct { + char pad[offsetof(struct rte_event_timer, user_meta)]; + uint64_t timestamp; + }; + }; } __rte_cache_aligned; #define BURST_SIZE 16 @@ -68,6 +78,8 @@ struct perf_elt { struct evt_options *opt = t->opt;\ const uint8_t dev = w->dev_id;\ const uint8_t port = w->port_id;\ + const uint8_t prod_timer_type = \ + opt->prod_type == EVT_PROD_TYPE_EVENT_TIMER_ADPTR;\ uint8_t *const sched_type_list = &t->sched_type_list[0];\ struct rte_mempool *const pool = t->pool;\ const uint8_t nb_stages = t->opt->nb_stages;\ diff --git a/app/test-eventdev/test_perf_queue.c b/app/test-eventdev/test_perf_queue.c index db8f2f3e5..74469a5ee 100644 --- a/app/test-eventdev/test_perf_queue.c +++ b/app/test-eventdev/test_perf_queue.c @@ -49,7 +49,7 @@ perf_queue_worker(void *arg, const int enable_fwd_latency) rte_pause(); continue; } - if (enable_fwd_latency) + if (enable_fwd_latency && !prod_timer_type) /* first q in pipeline, mark timestamp to compute fwd latency */ mark_fwd_latency(&ev, nb_stages); @@ -88,7 +88,7 @@ perf_queue_worker_burst(void *arg, const int enable_fwd_latency) } for (i = 0; i < nb_rx; i++) { - if (enable_fwd_latency) { + if (enable_fwd_latency && !prod_timer_type) { rte_prefetch0(ev[i+1].event_ptr); /* first queue in pipeline. * mark time stamp to compute fwd latency @@ -161,7 +161,8 @@ perf_queue_eventdev_setup(struct evt_test *test, struct evt_options *opt) struct rte_event_dev_info dev_info; nb_ports = evt_nr_active_lcores(opt->wlcores); - nb_ports += opt->prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR ? 0 : + nb_ports += opt->prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR || + opt->prod_type == EVT_PROD_TYPE_EVENT_TIMER_ADPTR ? 0 : evt_nr_active_lcores(opt->plcores); nb_queues = perf_queue_nb_event_queues(opt); -- 2.17.0