DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Harry van Haaren <harry.van.haaren@intel.com>
Cc: dev@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>
Subject: Re: [dpdk-dev] [PATCH v5 02/20] event/sw: add new software-only eventdev driver
Date: Sat, 25 Mar 2017 11:54:24 +0530	[thread overview]
Message-ID: <20170325062423.g44dcf46eweeypwx@localhost.localdomain> (raw)
In-Reply-To: <1490374395-149320-3-git-send-email-harry.van.haaren@intel.com>

On Fri, Mar 24, 2017 at 04:52:57PM +0000, Harry van Haaren wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> This adds the minimal changes to allow a SW eventdev implementation to
> be compiled, linked and created at run time. The eventdev does nothing,
> but can be created via vdev on commandline, e.g.
> 
>   sudo ./x86_64-native-linuxapp-gcc/app/test --vdev=event_sw0
>   ...
>   PMD: Creating eventdev sw device event_sw0, numa_node=0, sched_quanta=128
>   RTE>>
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> ---
>  config/common_base                            |   6 +
>  drivers/event/Makefile                        |   1 +
>  drivers/event/sw/Makefile                     |  66 ++++++++++
>  drivers/event/sw/rte_pmd_evdev_sw_version.map |   3 +
>  drivers/event/sw/sw_evdev.c                   | 177 ++++++++++++++++++++++++++

[snip]

> + *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> + *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#include <string.h>
> +
> +#include <rte_vdev.h>
> +#include <rte_memzone.h>
> +#include <rte_kvargs.h>
> +#include <rte_ring.h>
> +
> +#include "sw_evdev.h"
> +
> +#define EVENTDEV_NAME_SW_PMD event_sw
> +#define NUMA_NODE_ARG "numa_node"
> +#define SCHED_QUANTA_ARG "sched_quanta"
> +#define CREDIT_QUANTA_ARG "credit_quanta"
> +
> +static int
> +assign_numa_node(const char *key __rte_unused, const char *value, void *opaque)
> +{
> +	int *socket_id = opaque;
> +	*socket_id = atoi(value);
> +	if (*socket_id > RTE_MAX_NUMA_NODES)

Shouldn't be ">= RTE_MAX_NUMA_NODES" check, as numa_id is from 0 to
RTE_MAX_NUMA_NODES - 1

> +		return -1;
> +	return 0;
> +}
> +
> +static int
> +set_sched_quanta(const char *key __rte_unused, const char *value, void *opaque)
> +{
> +	int *quanta = opaque;
> +	*quanta = atoi(value);
> +	if (*quanta < 0 || *quanta > 4096)

Is quanta == 4096 valid? or It is only from 0 to 4095?

I think, it is nice to set max value as #define value in sw_evdev.h

> +		return -1;
> +	return 0;
> +}
> +
> +static int
> +set_credit_quanta(const char *key __rte_unused, const char *value, void *opaque)
> +{
> +	int *credit = opaque;
> +	*credit = atoi(value);
> +	if (*credit < 0 || *credit > 128)

Same as above comment.

> +		return -1;
> +	return 0;
> +}
> +
> +static int
> +sw_probe(const char *name, const char *params)
> +{
> +	static const struct rte_eventdev_ops evdev_sw_ops = {
> +	};
> +
> +	static const char *const args[] = {
> +		NUMA_NODE_ARG,
> +		SCHED_QUANTA_ARG,
> +		CREDIT_QUANTA_ARG,
> +		NULL
> +	};
> +	struct rte_eventdev *dev;
> +	struct sw_evdev *sw;
> +	int socket_id = rte_socket_id();
> +	int sched_quanta  = SW_DEFAULT_SCHED_QUANTA;
> +	int credit_quanta = SW_DEFAULT_CREDIT_QUANTA;
> +
> +	if (params != NULL && params[0] != '\0') {
> +		struct rte_kvargs *kvlist = rte_kvargs_parse(params, args);
> +
> +		if (!kvlist) {
> +			SW_LOG_INFO(
> +				"Ignoring unsupported parameters when creating device '%s'\n",
> +				name);
> +		} else {
> +			int ret = rte_kvargs_process(kvlist, NUMA_NODE_ARG,
> +					assign_numa_node, &socket_id);
> +			if (ret != 0) {
> +				SW_LOG_ERR(
> +					"%s: Error parsing numa node parameter",
> +					name);
> +				rte_kvargs_free(kvlist);
> +				return ret;
> +			}
> +
> +			ret = rte_kvargs_process(kvlist, SCHED_QUANTA_ARG,
> +					set_sched_quanta, &sched_quanta);
> +			if (ret != 0) {
> +				SW_LOG_ERR(
> +					"%s: Error parsing sched quanta parameter",
> +					name);
> +				rte_kvargs_free(kvlist);
> +				return ret;
> +			}
> +
> +			ret = rte_kvargs_process(kvlist, CREDIT_QUANTA_ARG,
> +					set_credit_quanta, &credit_quanta);
> +			if (ret != 0) {
> +				SW_LOG_ERR(
> +					"%s: Error parsing credit quanta parameter",
> +					name);
> +				rte_kvargs_free(kvlist);
> +				return ret;
> +			}
> +
> +			rte_kvargs_free(kvlist);
> +		}
> +	}
> +
> +	SW_LOG_INFO(

An extra line here may be not required here.

> +			"Creating eventdev sw device %s, numa_node=%d, sched_quanta=%d, credit_quanta=%d\n",
> +			name, socket_id, sched_quanta, credit_quanta);
> +
> +	dev = rte_event_pmd_vdev_init(name,
> +			sizeof(struct sw_evdev), socket_id);
> +	if (dev == NULL) {
> +		SW_LOG_ERR("eventdev vdev init() failed");
> +		return -EFAULT;
> +	}
> +	dev->dev_ops = &evdev_sw_ops;
> +
> +	sw = dev->data->dev_private;
> +	sw->data = dev->data;
> +
> +	/* copy values passed from vdev command line to instance */
> +	sw->credit_update_quanta = credit_quanta;
> +	sw->sched_quanta = sched_quanta;
> +
> +	return 0;
> +}
> +
> +static int
> +sw_remove(const char *name)
> +{
> +	if (name == NULL)
> +		return -EINVAL;
> +
> +	SW_LOG_INFO("Closing eventdev sw device %s\n", name);
> +
> +	return rte_event_pmd_vdev_uninit(name);
> +}
> +
> +static struct rte_vdev_driver evdev_sw_pmd_drv = {
> +	.probe = sw_probe,
> +	.remove = sw_remove
> +};
> +
> +RTE_PMD_REGISTER_VDEV(EVENTDEV_NAME_SW_PMD, evdev_sw_pmd_drv);
> +RTE_PMD_REGISTER_PARAM_STRING(event_sw, NUMA_NODE_ARG "=<int> "
> +		SCHED_QUANTA_ARG "=<int>" CREDIT_QUANTA_ARG "=<int>");

With suggested changes,

Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

  reply	other threads:[~2017-03-25  6:24 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <489175012-101439-1-git-send-email-harry.van.haaren@intel.com>
2017-03-24 16:52 ` [dpdk-dev] [PATCH v5 00/20] next-eventdev: event/sw software eventdev Harry van Haaren
2017-03-24 16:52   ` [dpdk-dev] [PATCH v5 01/20] test/eventdev: pass timeout ticks unsupported Harry van Haaren
2017-03-25  5:38     ` Jerin Jacob
2017-03-24 16:52   ` [dpdk-dev] [PATCH v5 02/20] event/sw: add new software-only eventdev driver Harry van Haaren
2017-03-25  6:24     ` Jerin Jacob [this message]
2017-03-27 15:30       ` Van Haaren, Harry
2017-03-24 16:52   ` [dpdk-dev] [PATCH v5 03/20] event/sw: add device capabilities function Harry van Haaren
2017-03-25 10:50     ` Jerin Jacob
2017-03-24 16:52   ` [dpdk-dev] [PATCH v5 04/20] event/sw: add configure function Harry van Haaren
2017-03-25 13:17     ` Jerin Jacob
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 05/20] event/sw: add fns to return default port/queue config Harry van Haaren
2017-03-25 13:21     ` Jerin Jacob
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 06/20] event/sw: add support for event queues Harry van Haaren
2017-03-27  7:45     ` Jerin Jacob
2017-03-27  8:47       ` Bruce Richardson
2017-03-27 15:17       ` Van Haaren, Harry
2017-03-28 10:43         ` Jerin Jacob
2017-03-28 12:42           ` Van Haaren, Harry
2017-03-28 17:36             ` Jerin Jacob
2017-03-29  8:28               ` Van Haaren, Harry
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 07/20] event/sw: add support for event ports Harry van Haaren
2017-03-27  8:55     ` Jerin Jacob
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 08/20] event/sw: add support for linking queues to ports Harry van Haaren
2017-03-27 11:20     ` Jerin Jacob
2017-03-29 10:58       ` Van Haaren, Harry
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 09/20] event/sw: add worker core functions Harry van Haaren
2017-03-27 13:50     ` Jerin Jacob
2017-03-28 16:17       ` Van Haaren, Harry
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 10/20] event/sw: add scheduling logic Harry van Haaren
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 11/20] event/sw: add start stop and close functions Harry van Haaren
2017-03-27 16:02     ` Jerin Jacob
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 12/20] event/sw: add dump function for easier debugging Harry van Haaren
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 13/20] event/sw: add xstats support Harry van Haaren
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 14/20] test/eventdev: add SW test infrastructure Harry van Haaren
2017-03-28 15:20     ` Burakov, Anatoly
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 15/20] test/eventdev: add basic SW tests Harry van Haaren
2017-03-28 15:21     ` Burakov, Anatoly
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 16/20] test/eventdev: add SW tests for load balancing Harry van Haaren
2017-03-28 15:21     ` Burakov, Anatoly
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 17/20] test/eventdev: add SW xstats tests Harry van Haaren
2017-03-28 15:22     ` Burakov, Anatoly
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 18/20] test/eventdev: add SW deadlock tests Harry van Haaren
2017-03-28 15:22     ` Burakov, Anatoly
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 19/20] doc: add event device and software eventdev Harry van Haaren
2017-03-29 13:47     ` Jerin Jacob
2017-03-24 16:53   ` [dpdk-dev] [PATCH v5 20/20] maintainers: add eventdev section and claim SW PMD Harry van Haaren
2017-03-29 13:05     ` Jerin Jacob
2017-03-29 23:25   ` [dpdk-dev] [PATCH v6 00/21] next-eventdev: event/sw software eventdev Harry van Haaren
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 01/21] eventdev: improve API docs for start function Harry van Haaren
2017-03-30 10:56       ` Burakov, Anatoly
2017-03-30 17:11       ` Jerin Jacob
2017-03-30 17:24         ` Van Haaren, Harry
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 02/21] test/eventdev: pass timeout ticks unsupported Harry van Haaren
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 03/21] event/sw: add new software-only eventdev driver Harry van Haaren
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 04/21] event/sw: add device capabilities function Harry van Haaren
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 05/21] event/sw: add configure function Harry van Haaren
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 06/21] event/sw: add fns to return default port/queue config Harry van Haaren
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 07/21] event/sw: add support for event queues Harry van Haaren
2017-03-30 18:06       ` Jerin Jacob
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 08/21] event/sw: add support for event ports Harry van Haaren
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 09/21] event/sw: add support for linking queues to ports Harry van Haaren
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 10/21] event/sw: add worker core functions Harry van Haaren
2017-03-30 18:07       ` Jerin Jacob
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 11/21] event/sw: add scheduling logic Harry van Haaren
2017-03-30 10:07       ` Hunt, David
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 12/21] event/sw: add start stop and close functions Harry van Haaren
2017-03-30  8:24       ` Jerin Jacob
2017-03-30  8:49         ` Van Haaren, Harry
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 13/21] event/sw: add dump function for easier debugging Harry van Haaren
2017-03-30 10:32       ` Hunt, David
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 14/21] event/sw: add xstats support Harry van Haaren
2017-03-30 11:12       ` Hunt, David
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 15/21] test/eventdev: add SW test infrastructure Harry van Haaren
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 16/21] test/eventdev: add basic SW tests Harry van Haaren
2017-03-29 23:25     ` [dpdk-dev] [PATCH v6 17/21] test/eventdev: add SW tests for load balancing Harry van Haaren
2017-03-29 23:26     ` [dpdk-dev] [PATCH v6 18/21] test/eventdev: add SW xstats tests Harry van Haaren
2017-03-29 23:26     ` [dpdk-dev] [PATCH v6 19/21] test/eventdev: add SW deadlock tests Harry van Haaren
2017-03-29 23:26     ` [dpdk-dev] [PATCH v6 20/21] doc: add event device and software eventdev Harry van Haaren
2017-03-30  8:27       ` Burakov, Anatoly
2017-03-29 23:26     ` [dpdk-dev] [PATCH v6 21/21] maintainers: add eventdev section and claim SW PMD Harry van Haaren
2017-03-30 19:30     ` [dpdk-dev] [PATCH v7 00/22] next-eventdev: event/sw software eventdev Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 01/22] eventdev: improve API docs for start function Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 02/22] test/eventdev: pass timeout ticks unsupported Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 03/22] event/sw: add new software-only eventdev driver Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 04/22] event/sw: add device capabilities function Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 05/22] event/sw: add configure function Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 06/22] event/sw: add fns to return default port/queue config Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 07/22] event/sw: add support for event queues Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 08/22] event/sw: add support for event ports Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 09/22] event/sw: add support for linking queues to ports Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 10/22] event/sw: add worker core functions Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 11/22] event/sw: add scheduling logic Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 12/22] event/sw: add start stop and close functions Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 13/22] event/sw: add dump function for easier debugging Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 14/22] event/sw: add xstats support Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 15/22] test/eventdev: add SW test infrastructure Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 16/22] test/eventdev: add basic SW tests Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 17/22] test/eventdev: add SW tests for load balancing Harry van Haaren
2017-04-02 14:56         ` Jerin Jacob
2017-04-03  9:08           ` Van Haaren, Harry
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 18/22] test/eventdev: add SW xstats tests Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 19/22] test/eventdev: add SW deadlock tests Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 20/22] doc: add event device and software eventdev Harry van Haaren
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 21/22] doc: add SW eventdev PMD to 17.05 release notes Harry van Haaren
2017-03-31 12:23         ` Hunt, David
2017-03-31 14:45         ` Jerin Jacob
2017-03-30 19:30       ` [dpdk-dev] [PATCH v7 22/22] maintainers: add eventdev section and claim SW PMD Harry van Haaren
2017-03-31 13:56         ` Jerin Jacob
2017-04-01 11:38       ` [dpdk-dev] [PATCH v7 00/22] next-eventdev: event/sw software eventdev 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=20170325062423.g44dcf46eweeypwx@localhost.localdomain \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.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).