DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
To: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>,
	jerin.jacob@caviumnetworks.com, nipun.gupta@nxp.com,
	hemant.agrawal@nxp.com
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v6 05/23] eventtimer: add adapter allocation definitions
Date: Thu, 11 Jan 2018 16:48:31 +0530	[thread overview]
Message-ID: <20180111111830.dkedtc7uqwxt64y7@Pavan-LT> (raw)
In-Reply-To: <1515630074-29020-6-git-send-email-erik.g.carrillo@intel.com>

On Wed, Jan 10, 2018 at 06:20:56PM -0600, Erik Gabriel Carrillo wrote:
> Add definitions for the functions that allocate and deallocate adapter
> instances in the default software implementation.
>
> Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
> ---
>  lib/Makefile                                  |   2 +-
>  lib/librte_eventdev/Makefile                  |   2 +-
>  lib/librte_eventdev/rte_event_timer_adapter.c | 138 +++++++++++++++++++++++++-
>  lib/librte_eventdev/rte_event_timer_adapter.h |   2 +-
>  4 files changed, 139 insertions(+), 5 deletions(-)
>
> diff --git a/lib/Makefile b/lib/Makefile
> index 4202702..4c53f8c 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -29,7 +29,7 @@ DEPDIRS-librte_security := librte_eal librte_mempool librte_ring librte_mbuf
>  DEPDIRS-librte_security += librte_ether
>  DEPDIRS-librte_security += librte_cryptodev
>  DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += librte_eventdev
> -DEPDIRS-librte_eventdev := librte_eal librte_ring librte_ether librte_hash
> +DEPDIRS-librte_eventdev := librte_eal librte_ring librte_ether librte_hash librte_mempool
>  DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost
>  DEPDIRS-librte_vhost := librte_eal librte_mempool librte_mbuf librte_ether
>  DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash
> diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile
> index 8f11a79..e68f888 100644
> --- a/lib/librte_eventdev/Makefile
> +++ b/lib/librte_eventdev/Makefile
> @@ -13,7 +13,7 @@ LIBABIVER := 3
>  # build flags
>  CFLAGS += -O3
>  CFLAGS += $(WERROR_FLAGS)
> -LDLIBS += -lrte_eal -lrte_ring -lrte_ethdev -lrte_hash
> +LDLIBS += -lrte_eal -lrte_ring -lrte_ethdev -lrte_hash -lrte_mempool
>
>  # library source files
>  SRCS-y += rte_eventdev.c
> diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c b/lib/librte_eventdev/rte_event_timer_adapter.c
> index 540be95..9c4ba1c 100644
> --- a/lib/librte_eventdev/rte_event_timer_adapter.c
> +++ b/lib/librte_eventdev/rte_event_timer_adapter.c
> @@ -31,11 +31,17 @@
>   */
>
>  #include <string.h>
> +#include <stdbool.h>
>
>  #include <rte_memzone.h>
>  #include <rte_memory.h>
>  #include <rte_dev.h>
>  #include <rte_errno.h>
> +#include <rte_malloc.h>
> +#include <rte_ring.h>
> +#include <rte_mempool.h>
> +#include <rte_timer.h>
> +#include <rte_service_component.h>
>
>  #include "rte_eventdev.h"
>  #include "rte_eventdev_pmd.h"
> @@ -163,6 +169,11 @@ rte_event_timer_adapter_create_ext(
>
>  	adapter_id = conf->timer_adapter_id;
>
> +	if (adapter_id >= RTE_EVENT_TIMER_ADAPTER_NUM_MAX) {
> +		rte_errno = -EINVAL;
> +		return NULL;
> +	}
> +
>  	/* Check adapter ID not already allocated */
>  	adapter = &adapters[adapter_id];
>  	if (adapter->allocated) {
> @@ -412,18 +423,141 @@ rte_event_timer_cancel_burst(const struct rte_event_timer_adapter *adapter,
>   * Software event timer adapter ops definitions
>   */
>
> +struct rte_event_timer_adapter_sw_data {
> +	/* Number of outstanding timers managed by event adapter. */
> +	int nb_armed_evtims;
> +	/* Identifier of service executing timer management logic. */
> +	uint32_t service_id;
> +	/* Ring containing messages to arm or cancel event timers */
> +	struct rte_ring *msg_ring;
> +	/* Mempool containing msg objects */
> +	struct rte_mempool *msg_pool;
> +	/* Mempool containing timer objects */
> +	struct rte_mempool *tim_pool;
> +};

Don't use rte_ prefix for internal data.

> +
> +enum msg_type {MSG_TYPE_ARM, MSG_TYPE_CANCEL};
> +
> +struct msg {
> +	enum msg_type type;
> +	struct rte_event_timer *evtim;
> +};
> +
> +static int
> +sw_event_timer_adapter_service_func(void *arg)
> +{
> +	RTE_SET_USED(arg);
> +	return 0;
> +}
> +
>  static int
>  sw_event_timer_adapter_init(struct rte_event_timer_adapter *adapter)
>  {
> -	RTE_SET_USED(adapter);
> +	int ret;
> +	struct rte_event_timer_adapter_sw_data *sw_data;
> +	uint64_t nb_timers;
<snip>
> +
> +	char pool_name[RTE_RING_NAMESIZE];
> +	snprintf(pool_name, RTE_RING_NAMESIZE, "sw_evtim_adap_msg_pool_%"PRIu8,
> +		 adapter->data->id);
> +	sw_data->msg_pool = rte_mempool_create(pool_name, nb_timers,
> +					       sizeof(struct msg), 32, 0, NULL,
> +					       NULL, NULL, NULL,
> +					       adapter->data->socket_id, 0);
> +	if (sw_data->msg_pool == NULL) {
> +		rte_errno = ENOMEM;
> +		return -1;
> +	}
> +
> +	snprintf(pool_name, RTE_RING_NAMESIZE, "sw_evtim_adap_tim_pool_%"PRIu8,
> +		 adapter->data->id);
> +	sw_data->tim_pool = rte_mempool_create(pool_name, nb_timers,
> +					       sizeof(struct rte_timer), 32, 0,
> +					       NULL, NULL, NULL, NULL,
> +					       adapter->data->socket_id, 0);
> +	if (sw_data->tim_pool == NULL) {
> +		printf("Could not allocate tim mempool\n");
> +		return -1;
> +	}

Any specific reason for having seperate mempool for msg and timers?
You could have a internal structure as a wrapper for both.

> +
> +	/* Register a service component */
> +	memset(&service, 0, sizeof(service));
> +	snprintf(service.name, RTE_SERVICE_NAME_MAX,
> +		 "sw_evimer_adap_svc_%"PRIu8, adapter->data->id);
> +	service.socket_id = adapter->data->socket_id;
> +	service.callback = sw_event_timer_adapter_service_func;
> +	service.callback_userdata = adapter;
> +	ret = rte_service_component_register(&service, &sw_data->service_id);
> +	if (ret < 0)
> +		return ret;
>
>  	return 0;
>  }
>
> -#define RTE_EVENT_TIMER_ADAPTER_NUM_MAX 64
> +#define RTE_EVENT_TIMER_ADAPTER_NUM_MAX 32

Any specific reason for this change?
maybe make it compile-time configurable

>
>  /**
>   * @warning
> --
> 2.6.4
>

  reply	other threads:[~2018-01-11 11:18 UTC|newest]

Thread overview: 133+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1511890148-22295-1-git-send-email-erik.g.carrillo@intel.com>
2017-12-01 20:00 ` [dpdk-dev] [RFC PATCH v5 0/5] eventtimer: introduce event timer adapter Erik Gabriel Carrillo
2017-12-01 20:00   ` [dpdk-dev] [RFC PATCH v5 1/5] " Erik Gabriel Carrillo
2017-12-06 15:17     ` Jerin Jacob
2017-12-06 16:23       ` Carrillo, Erik G
2017-12-01 20:00   ` [dpdk-dev] [RFC PATCH v5 2/5] eventtimer: add common code Erik Gabriel Carrillo
2017-12-06 15:35     ` Jerin Jacob
2017-12-01 20:00   ` [dpdk-dev] [RFC PATCH v5 3/5] eventtimer: add config variable for adapter Erik Gabriel Carrillo
2017-12-06 15:41     ` Jerin Jacob
2017-12-06 20:01       ` Carrillo, Erik G
2017-12-01 20:00   ` [dpdk-dev] [RFC PATCH v5 4/5] eventtimer: add default software implementation stub Erik Gabriel Carrillo
2017-12-01 20:00   ` [dpdk-dev] [RFC PATCH v5 5/5] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-01-11  0:20   ` [dpdk-dev] [PATCH v6 00/23] eventtimer: introduce event timer adapter Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 01/23] eventtimer: add event timer adapter API Erik Gabriel Carrillo
2018-01-11 11:10       ` Pavan Nikhilesh
2018-01-11 16:56         ` Carrillo, Erik G
2018-01-11 17:31           ` Pavan Nikhilesh
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 02/23] eventtimer: add common code Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 03/23] eventtimer: add default software driver stub Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 04/23] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 05/23] eventtimer: add adapter allocation definitions Erik Gabriel Carrillo
2018-01-11 11:18       ` Pavan Nikhilesh [this message]
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 06/23] test: exercise event timer adapter allocation functions Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 07/23] eventtimer: add adapter get info function definition Erik Gabriel Carrillo
2018-01-11  0:20     ` [dpdk-dev] [PATCH v6 08/23] eventtimer: add adapter start/stop definitions Erik Gabriel Carrillo
2018-01-11 17:28       ` Pavan Nikhilesh
2018-01-18 23:57         ` Carrillo, Erik G
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 09/23] eventtimer: add API to get service id Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 10/23] eventtimer: remove service id entry from info structure Erik Gabriel Carrillo
2018-01-11 11:34       ` Pavan Nikhilesh
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 11/23] test: exercise event timer adapter start/stop functions Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 12/23] eventtimer: add event timer arm/cancel function definitions Erik Gabriel Carrillo
2018-01-11 11:38       ` Pavan Nikhilesh
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 13/23] eventtimer: add adapter service definition Erik Gabriel Carrillo
2018-01-11 12:03       ` Pavan Nikhilesh
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 14/23] eventtimer: add event timer initializer function Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 15/23] eventtimer: add buffering of timer expiry events Erik Gabriel Carrillo
2018-01-11 12:18       ` Pavan Nikhilesh
2018-01-18 23:07         ` Carrillo, Erik G
2018-01-20  8:55           ` Pavan Nikhilesh
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 16/23] eventtimer: add stats to API Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 17/23] eventtimer: add support for single-producer put mode Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 18/23] eventtimer: add non-blocking mode for event timer operations Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 19/23] test: exercise event timer arm and expiry Erik Gabriel Carrillo
2018-01-11 12:26       ` Pavan Nikhilesh
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 20/23] maintainers: add event timer adapter section Erik Gabriel Carrillo
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 21/23] doc: add event timer adapter to API index Erik Gabriel Carrillo
2018-01-12 11:12       ` Kovacevic, Marko
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 22/23] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-01-11 15:26       ` Kovacevic, Marko
2018-01-11  0:21     ` [dpdk-dev] [PATCH v6 23/23] doc: add event timer adapter to release notes Erik Gabriel Carrillo
2018-01-12 10:48       ` Kovacevic, Marko
2018-03-08 21:53     ` [dpdk-dev] [PATCH v7 0/7] eventtimer: introduce event timer adapter Erik Gabriel Carrillo
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 1/7] eventtimer: add event timer adapter API Erik Gabriel Carrillo
2018-03-12  7:53         ` Jerin Jacob
2018-03-12 16:22           ` Carrillo, Erik G
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 2/7] eventtimer: add common code Erik Gabriel Carrillo
2018-03-12  8:11         ` Jerin Jacob
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 3/7] eventtimer: add default software driver Erik Gabriel Carrillo
2018-03-12  8:45         ` Jerin Jacob
2018-03-12 21:20           ` Carrillo, Erik G
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 4/7] eventtimer: add support for meson build system Erik Gabriel Carrillo
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 5/7] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-03-14 12:52         ` Pavan Nikhilesh
2018-03-14 21:42           ` Carrillo, Erik G
2018-03-14 13:31         ` Pavan Nikhilesh
2018-03-14 21:40           ` Carrillo, Erik G
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 6/7] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-03-12 11:21         ` Jerin Jacob
2018-03-12 22:02           ` Carrillo, Erik G
2018-03-08 21:54       ` [dpdk-dev] [PATCH v7 7/7] doc: add event timer adapter documentation Erik Gabriel Carrillo
2018-03-12 11:28         ` Jerin Jacob
2018-03-29 21:27       ` [dpdk-dev] [PATCH v8 0/9] eventtimer: introduce event timer adapter Erik Gabriel Carrillo
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 1/9] " Erik Gabriel Carrillo
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 2/9] eventdev: convert to SPDX license tag in header Erik Gabriel Carrillo
2018-04-02  8:12           ` Jerin Jacob
2018-04-02  9:16             ` Hemant Agrawal
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 3/9] eventtimer: add common code Erik Gabriel Carrillo
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 4/9] mk: update library order in static build Erik Gabriel Carrillo
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 5/9] eventtimer: add default software driver Erik Gabriel Carrillo
2018-04-02  8:42           ` Jerin Jacob
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 6/9] eventtimer: add support for meson build system Erik Gabriel Carrillo
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 7/9] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-03-30 15:48           ` Bhagavatula, Pavan
2018-03-30 18:47             ` Carrillo, Erik G
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 8/9] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-03-29 21:27         ` [dpdk-dev] [PATCH v8 9/9] doc: add event timer adapter documentation Erik Gabriel Carrillo
2018-04-02 19:39         ` [dpdk-dev] [PATCH v9 0/9] eventtimer: introduce event timer adapter Erik Gabriel Carrillo
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 1/9] " Erik Gabriel Carrillo
2018-04-02 23:25             ` Jerin Jacob
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 2/9] eventdev: convert to SPDX license tag in header Erik Gabriel Carrillo
2018-04-02 23:27             ` Jerin Jacob
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 3/9] eventtimer: add common code Erik Gabriel Carrillo
2018-04-02 23:35             ` Jerin Jacob
2018-04-03 18:38               ` Carrillo, Erik G
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 4/9] mk: update library order in static build Erik Gabriel Carrillo
2018-04-02 23:36             ` Jerin Jacob
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 5/9] eventtimer: add default software driver Erik Gabriel Carrillo
2018-04-03  9:59             ` Pavan Nikhilesh
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 6/9] eventtimer: add support for meson build system Erik Gabriel Carrillo
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 7/9] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-04-03  9:52             ` Pavan Nikhilesh
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 8/9] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-04-03  0:00             ` Jerin Jacob
2018-04-02 19:39           ` [dpdk-dev] [PATCH v9 9/9] doc: add event timer adapter documentation Erik Gabriel Carrillo
2018-04-02 23:42             ` Jerin Jacob
2018-04-02 23:19           ` [dpdk-dev] [PATCH v9 0/9] eventtimer: introduce event timer adapter Jerin Jacob
2018-04-03 14:09             ` Carrillo, Erik G
2018-04-03 14:15               ` Jerin Jacob
2018-04-03 18:32                 ` Carrillo, Erik G
2018-04-03 21:44           ` [dpdk-dev] [PATCH v10 " Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 1/9] " Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 2/9] eventdev: convert to SPDX license tag in header Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 3/9] eventtimer: add common code Erik Gabriel Carrillo
2018-04-04 16:50               ` Pavan Nikhilesh
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 4/9] mk: update library order in static build Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 5/9] eventtimer: add default software driver Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 6/9] eventtimer: add support for meson build system Erik Gabriel Carrillo
2018-04-04 16:51               ` Pavan Nikhilesh
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 7/9] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 8/9] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-04-03 21:44             ` [dpdk-dev] [PATCH v10 9/9] doc: add event timer adapter documentation Erik Gabriel Carrillo
2018-04-04  2:31             ` [dpdk-dev] [PATCH v10 0/9] eventtimer: introduce event timer adapter Jerin Jacob
2018-04-04 21:51             ` [dpdk-dev] [PATCH v11 " Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 1/9] " Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 2/9] eventdev: convert to SPDX license tag in header Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 3/9] eventtimer: add common code Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 4/9] mk: update library order in static build Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 5/9] eventtimer: add default software driver Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 6/9] eventtimer: add support for meson build system Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 7/9] test: add event timer adapter auto-test Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 8/9] doc: add event timer adapter section to programmer's guide Erik Gabriel Carrillo
2018-04-04 21:51               ` [dpdk-dev] [PATCH v11 9/9] doc: add event timer adapter documentation Erik Gabriel Carrillo
2018-04-05  3:31               ` [dpdk-dev] [PATCH v11 0/9] eventtimer: introduce event timer adapter Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180111111830.dkedtc7uqwxt64y7@Pavan-LT \
    --to=pbhagavatula@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=erik.g.carrillo@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=nipun.gupta@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).