From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EACC8A0566; Mon, 8 Mar 2021 21:46:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7536922A4AF; Mon, 8 Mar 2021 21:45:57 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 91F3222A4AD for ; Mon, 8 Mar 2021 21:45:55 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 128Kjcbk008467; Mon, 8 Mar 2021 12:45:54 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=ICzpzJ0MWCpi/S/C9/aIEzoFASp80XSC50juiW3rfck=; b=k0YFccM2w9pySNEjLE2Y0bahG0lhlcQdaVtw2ba2WhqiHeitHqf06liaj466JG6nkd/9 m/a3wJkQTYrhjzUORbnmWjifW1ggRTNZdCz6WoJpXF99wLVwG8SQllutUvHkdHeJqM6S 5qPa8DPMQf9rnBVwfEjikzQYxt36arInYLB/69Rfh9gO+Zsm5hYg4w3NcHq/fnGiIUHs iz8O9VtkQgszFrZC6FWmC42ns9IyVOrBZOYxFOeErqniVxhoyRd9HI9fNbQv6JgqDxTM RPzgjL82FOP0QrA85hsQ5Ja+nkvSLCfORP0Agv+uPftGNNOobUzmVGj8NGwOI5AJc02r ig== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3747yuwsm8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 08 Mar 2021 12:45:54 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 8 Mar 2021 12:45:52 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 8 Mar 2021 12:45:52 -0800 Received: from localhost.localdomain (unknown [10.28.34.29]) by maili.marvell.com (Postfix) with ESMTP id 5D0FA3F7041; Mon, 8 Mar 2021 12:45:51 -0800 (PST) From: Shijith Thotton To: Erik Gabriel Carrillo CC: Shijith Thotton , Pavan Nikhilesh , Jerin Jacob , Date: Tue, 9 Mar 2021 02:15:41 +0530 Message-ID: <20210308204543.2903723-2-sthotton@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210308204543.2903723-1-sthotton@marvell.com> References: <20210308204543.2903723-1-sthotton@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-08_17:2021-03-08, 2021-03-08 signatures=0 Subject: [dpdk-dev] [PATCH 1/3] eventdev: introduce adapter flags for periodic mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" A timer adapter in periodic mode can be used to arm periodic timers. This patch adds flags used to advertise capability and configure timer adapter in periodic mode. Capability flag should be set for adapters which support periodic mode. Below is a programming sequence on the usage: /* check for periodic mode support by reading capability. */ rte_event_timer_adapter_caps_get(...); /* create adapter in periodic mode by setting periodic flag (RTE_EVENT_TIMER_ADAPTER_F_PERIODIC) and resolution. */ rte_event_timer_adapter_create_ext(...); /* arm periodic timer of configured resolution */ rte_event_timer_arm_burst(...); /* timer event will be periodically generated at configured resolution till cancel is called. */ while (running) { rte_event_dequeue_burst(...); } /* cancel periodic timer which stops generating events */ rte_event_timer_cancel_burst(...); Signed-off-by: Shijith Thotton --- doc/guides/prog_guide/event_timer_adapter.rst | 33 +++++++++++++++++++ lib/librte_eventdev/rte_event_timer_adapter.h | 6 ++++ lib/librte_eventdev/rte_eventdev.h | 3 ++ 3 files changed, 42 insertions(+) diff --git a/doc/guides/prog_guide/event_timer_adapter.rst b/doc/guides/prog_guide/event_timer_adapter.rst index a95efbe0d..fcdecdb3b 100644 --- a/doc/guides/prog_guide/event_timer_adapter.rst +++ b/doc/guides/prog_guide/event_timer_adapter.rst @@ -252,6 +252,39 @@ be canceled by calling ``rte_event_timer_cancel_burst()``: */ rte_event_timer_cancel_burst(adapter, &conn->timer, 1); +Timer adapter in periodic mode +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A periodic timer is a timer, which expires at fixed time intervals continuously +till it is cancelled. A timer adapter can be configured to arm such timers by +configuring it in periodic mode. Capability flag +``RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC`` can be used to check if an adapter +supports periodic mode. An adapter in periodic mode can only be used to arm +periodic timers. + +Example config to create an adapter in periodic mode with 100ms resolution: + +.. code-block:: c + + #define NSECPERSEC 1E9 // No of ns in 1 sec + const struct rte_event_timer_adapter_conf adapter_config = { + .event_dev_id = event_dev_id, + .timer_adapter_id = 0, + .clk_src = RTE_EVENT_TIMER_ADAPTER_CPU_CLK, + .timer_tick_ns = NSECPERSEC / 10, // 100 milliseconds + .nb_timers = 100, + .timer_adapter_flags = RTE_EVENT_TIMER_ADAPTER_F_PERIODIC, + }; + +``timer_adapter_flags`` is set to include periodic flag +``RTE_EVENT_TIMER_ADAPTER_F_PERIODIC`` and ``timer_tick_ns`` to resolution. +Maximum timeout (``max_tmo_nsec``) does not apply for periodic mode. + +After starting the adapter, event timer arm APIs can be used to arm periodic +timers. Timer events will be generated at configured ``timer_tick_ns`` +intervals. Event generation can be stopped using cancel API +``rte_event_timer_cancel_burst``. + Processing Timer Expiry Events ------------------------------ diff --git a/lib/librte_eventdev/rte_event_timer_adapter.h b/lib/librte_eventdev/rte_event_timer_adapter.h index d2ebcb090..f9fc95711 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter.h +++ b/lib/librte_eventdev/rte_event_timer_adapter.h @@ -151,6 +151,12 @@ enum rte_event_timer_adapter_clk_src { * @see struct rte_event_timer_adapter_conf::flags */ +#define RTE_EVENT_TIMER_ADAPTER_F_PERIODIC (1ULL << 2) +/**< Flag to configure event timer adapter in periodic mode. + * + * @see struct rte_event_timer_adapter_conf::flags + */ + /** * Timer adapter configuration structure */ diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index ce1fc2ce0..9fc39e9ca 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -1154,6 +1154,9 @@ rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id, #define RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT (1ULL << 0) /**< This flag is set when the timer mechanism is in HW. */ +#define RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC (1ULL << 1) +/**< This flag is set if periodic mode is supported. */ + /** * Retrieve the event device's timer adapter capabilities. * -- 2.25.1