From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id CF7ED532D for ; Fri, 1 Dec 2017 21:01:31 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Dec 2017 12:01:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,346,1508828400"; d="scan'208";a="155155493" Received: from txasoft-yocto.an.intel.com (HELO txasoft-yocto.an.intel.com.) ([10.123.72.111]) by orsmga004.jf.intel.com with ESMTP; 01 Dec 2017 12:01:30 -0800 From: Erik Gabriel Carrillo To: pbhagavatula@caviumnetworks.com Cc: dev@dpdk.org, jerin.jacob@caviumnetworks.com, nipun.gupta@nxp.com, hemant.agrawal@nxp.com Date: Fri, 1 Dec 2017 14:00:57 -0600 Message-Id: <1512158458-22661-5-git-send-email-erik.g.carrillo@intel.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1512158458-22661-1-git-send-email-erik.g.carrillo@intel.com> References: <1511890148-22295-1-git-send-email-erik.g.carrillo@intel.com> <1512158458-22661-1-git-send-email-erik.g.carrillo@intel.com> Subject: [dpdk-dev] [RFC PATCH v5 4/5] eventtimer: add default software implementation stub 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, 01 Dec 2017 20:01:32 -0000 If an eventdev PMD does not wish to provide event timer adapter ops definitions, the library will fall back to a default software implementation whose entry points are added by this commit. Signed-off-by: Erik Gabriel Carrillo --- lib/librte_eventdev/rte_event_timer_adapter.c | 107 ++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c b/lib/librte_eventdev/rte_event_timer_adapter.c index 5315058..d5a58ff 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter.c +++ b/lib/librte_eventdev/rte_event_timer_adapter.c @@ -48,6 +48,8 @@ static struct rte_event_timer_adapter adapters[MAX_EVENT_TIMER_ADAPTERS]; +const struct rte_event_timer_adapter_ops sw_event_adapter_timer_ops; + static inline int adapter_valid(const struct rte_event_timer_adapter *adapter) { @@ -211,6 +213,12 @@ rte_event_timer_adapter_create_ext( } } + /* If eventdev PMD did not provide ops, use default software + * implementation. + */ + if (adapter->ops == NULL) + adapter->ops = &sw_event_adapter_timer_ops; + /* Allow driver to do some setup */ FUNC_PTR_OR_NULL_RET_WITH_ERRNO(adapter->ops->init, -ENOTSUP); ret = adapter->ops->init(adapter); @@ -318,6 +326,12 @@ rte_event_timer_adapter_lookup(uint16_t adapter_id) return NULL; } + /* If eventdev PMD did not provide ops, use default software + * implementation. + */ + if (adapter->ops == NULL) + adapter->ops = &sw_event_adapter_timer_ops; + /* Set fast-path function pointers */ adapter->arm_burst = adapter->ops->arm_burst; adapter->arm_tmo_tick_burst = adapter->ops->arm_tmo_tick_burst; @@ -405,3 +419,96 @@ rte_event_timer_cancel_burst(const struct rte_event_timer_adapter *adapter, return adapter->cancel_burst(adapter, event_timers, nb_event_timers); } + +/* + * Software event timer adapter ops definitions + */ + +static int +sw_event_timer_adapter_init(struct rte_event_timer_adapter *adapter) +{ + RTE_SET_USED(adapter); + + return 0; +} + +static int +sw_event_timer_adapter_uninit(struct rte_event_timer_adapter *adapter) +{ + RTE_SET_USED(adapter); + + return 0; +} + +static int +sw_event_timer_adapter_start(const struct rte_event_timer_adapter *adapter) +{ + RTE_SET_USED(adapter); + + return 0; +} + +static int +sw_event_timer_adapter_stop(const struct rte_event_timer_adapter *adapter) +{ + RTE_SET_USED(adapter); + + return 0; +} + +static void +sw_event_timer_adapter_get_info(const struct rte_event_timer_adapter *adapter, + struct rte_event_timer_adapter_info *adapter_info) +{ + RTE_SET_USED(adapter); + RTE_SET_USED(adapter_info); +} + +static int +sw_event_timer_arm_burst(const struct rte_event_timer_adapter *adapter, + struct rte_event_timer **evtims, + uint16_t nb_evtims) +{ + RTE_SET_USED(adapter); + RTE_SET_USED(evtims); + RTE_SET_USED(nb_evtims); + + return 0; +} + +static int +sw_event_timer_cancel_burst(const struct rte_event_timer_adapter *adapter, + struct rte_event_timer **evtims, + uint16_t nb_evtims) +{ + RTE_SET_USED(adapter); + RTE_SET_USED(evtims); + RTE_SET_USED(nb_evtims); + + return 0; +} + +static int +sw_event_timer_arm_tmo_tick_burst(const struct rte_event_timer_adapter *adapter, + struct rte_event_timer **tims, + uint64_t timeout_tick, + uint16_t nb_tims) +{ + RTE_SET_USED(adapter); + RTE_SET_USED(tims); + RTE_SET_USED(timeout_tick); + RTE_SET_USED(nb_tims); + + return 0; +} + +const struct rte_event_timer_adapter_ops sw_event_adapter_timer_ops = { + .init = sw_event_timer_adapter_init, + .uninit = sw_event_timer_adapter_uninit, + .start = sw_event_timer_adapter_start, + .stop = sw_event_timer_adapter_stop, + .get_info = sw_event_timer_adapter_get_info, + .arm_burst = sw_event_timer_arm_burst, + .arm_tmo_tick_burst = sw_event_timer_arm_tmo_tick_burst, + .cancel_burst = sw_event_timer_cancel_burst, +}; -- 2.6.4