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 302A2A00C2; Wed, 17 Mar 2021 09:05:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 13310242B4A; Wed, 17 Mar 2021 09:05:19 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 2EC8F4014D for ; Wed, 17 Mar 2021 09:05:18 +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 12H80Rhu017561; Wed, 17 Mar 2021 01:05:17 -0700 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=F+854lag1mrQR+M/igLzCZ8y2sZLHqUTgmZoOtX0NLg=; b=Mo3SRZAmJZUBCuGL57SeixGDuMWIihS7WyEgo1LqRJu9YNVkWAHAA5a2OTsJXGR5gX7B OSKTETnZPQmpGQc9l5IUTg7Ruxx0DM44EhhjlKEdXSUraQBkd71Vu7/pL+HvPsRMEOWp 7jFApExH/gu2Nm+dSwvJX9hjncNZF+NOtxsiCsxz+QvkWpqJYX9lYkCQl2bZ6OGysDDk DGJgEfhPnndXz0+wAEPggt5eF66tqIeV3D85mIGdP9avV97YkH7C2r0I00RBTnWLOpib cSBL373bMVQtCoC7IKbcpMLODMQ1FlhH6t85tpHfpne4hOa+sWCPApuhENEDzJbJ2L8A Xw== Received: from dc6wp-exch01.marvell.com ([4.21.29.232]) by mx0a-0016f401.pphosted.com with ESMTP id 37b5vdhbjg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Mar 2021 01:05:17 -0700 Received: from DC6WP-EXCH01.marvell.com (10.76.176.21) by DC6WP-EXCH01.marvell.com (10.76.176.21) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 17 Mar 2021 04:05:15 -0400 Received: from maili.marvell.com (10.76.176.51) by DC6WP-EXCH01.marvell.com (10.76.176.21) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 17 Mar 2021 04:05:15 -0400 Received: from localhost.localdomain (unknown [10.28.34.29]) by maili.marvell.com (Postfix) with ESMTP id 94BAA3F703F; Wed, 17 Mar 2021 01:05:12 -0700 (PDT) From: Shijith Thotton To: Erik Gabriel Carrillo CC: Shijith Thotton , Pavan Nikhilesh , Jerin Jacob , Date: Wed, 17 Mar 2021 13:34:19 +0530 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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-17_02:2021-03-17, 2021-03-17 signatures=0 Subject: [dpdk-dev] [PATCH v3 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 | 16 +++++++++++++++- lib/librte_eventdev/rte_event_timer_adapter.h | 13 +++++++++++++ lib/librte_eventdev/rte_eventdev.h | 3 +++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/doc/guides/prog_guide/event_timer_adapter.rst b/doc/guides/prog_guide/event_timer_adapter.rst index a95efbe0d..8b18cd169 100644 --- a/doc/guides/prog_guide/event_timer_adapter.rst +++ b/doc/guides/prog_guide/event_timer_adapter.rst @@ -138,6 +138,18 @@ This function is passed a callback function that will be invoked if the adapter needs to create an event port, giving the application the opportunity to control how it is done. +Adapter modes +^^^^^^^^^^^^^ +An event timer adapter can be configured in either periodic or non-periodic mode +to support timers of the respective type. A periodic timer expires at a fixed +time interval repeatedly till it is cancelled. A non-periodic timer expires only +once. The periodic capability flag, ``RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC``, +can be set for implementations that support periodic mode if desired. To +configure an adapter in periodic mode, ``timer_adapter_flags`` of +``rte_event_timer_adapter_conf`` is set to include the periodic flag +``RTE_EVENT_TIMER_ADAPTER_F_PERIODIC``. Maximum timeout (``max_tmo_nsec``) does +not apply to periodic mode. + Retrieve Event Timer Adapter Contextual Information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The event timer adapter implementation may have constraints on tick resolution @@ -229,7 +241,9 @@ Now we can arm the event timer with ``rte_event_timer_arm_burst()``: Once an event timer expires, the application may free it or rearm it as necessary. If the application will rearm the timer, the state should be reset -to RTE_EVENT_TIMER_NOT_ARMED by the application before rearming it. +to RTE_EVENT_TIMER_NOT_ARMED by the application before rearming it. Timer expiry +events will be generated once or periodically until the timer is cancelled based +on adapter mode. Multiple Event Timers with Same Expiry Value ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/lib/librte_eventdev/rte_event_timer_adapter.h b/lib/librte_eventdev/rte_event_timer_adapter.h index d2ebcb090..4e0d2a819 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter.h +++ b/lib/librte_eventdev/rte_event_timer_adapter.h @@ -151,6 +151,14 @@ 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 an event timer adapter in periodic mode; non-periodic + * mode is the default. A timer will fire once or periodically until the timer + * is cancelled based on the adapter mode. + * + * @see struct rte_event_timer_adapter_conf::flags + */ + /** * Timer adapter configuration structure */ @@ -551,6 +559,8 @@ struct rte_event_timer_adapter { * expiry event attributes, timeout ticks from now. * This function submits the event timer arm requests to the event timer adapter * and on expiry, the events will be injected to designated event queue. + * Timer expiry events will be generated once or periodically until cancellation + * based on the adapter mode. * * @param adapter * A pointer to an event timer adapter structure. @@ -570,6 +580,9 @@ struct rte_event_timer_adapter { * destination event queue. * - EAGAIN Specified timer adapter is not running * - EALREADY A timer was encountered that was already armed + * + * @see RTE_EVENT_TIMER_ADAPTER_F_PERIODIC + * */ static inline uint16_t rte_event_timer_arm_burst(const struct rte_event_timer_adapter *adapter, 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