From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Van Haaren, Harry" Subject: Re: [PATCH v5 02/20] event/sw: add new software-only eventdev driver Date: Mon, 27 Mar 2017 15:30:38 +0000 Message-ID: References: <489175012-101439-1-git-send-email-harry.van.haaren@intel.com> <1490374395-149320-1-git-send-email-harry.van.haaren@intel.com> <1490374395-149320-3-git-send-email-harry.van.haaren@intel.com> <20170325062423.g44dcf46eweeypwx@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "Richardson, Bruce" To: Jerin Jacob Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id B1FBDFB1E for ; Mon, 27 Mar 2017 17:30:42 +0200 (CEST) In-Reply-To: <20170325062423.g44dcf46eweeypwx@localhost.localdomain> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Saturday, March 25, 2017 6:24 AM > To: Van Haaren, Harry > Cc: dev@dpdk.org; Richardson, Bruce > Subject: Re: [PATCH v5 02/20] event/sw: add new software-only eventdev dr= iver >=20 > On Fri, Mar 24, 2017 at 04:52:57PM +0000, Harry van Haaren wrote: > > From: Bruce Richardson > > > > 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=3Devent_sw0 > > ... > > PMD: Creating eventdev sw device event_sw0, numa_node=3D0, sched_quan= ta=3D128 > > RTE>> > > > > Signed-off-by: Bruce Richardson > > Signed-off-by: Harry van Haaren > > --- > > 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 ++++++++++++++++++= ++++++++ >=20 > [snip] > > + > > +static int > > +assign_numa_node(const char *key __rte_unused, const char *value, void= *opaque) > > +{ > > + int *socket_id =3D opaque; > > + *socket_id =3D atoi(value); > > + if (*socket_id > RTE_MAX_NUMA_NODES) >=20 > Shouldn't be ">=3D RTE_MAX_NUMA_NODES" check, as numa_id is from 0 to > RTE_MAX_NUMA_NODES - 1 Yes - thanks fixed, also fixed for quanta and credits below. > > + return -1; > > + return 0; > > +} > > + > > +static int > > +set_sched_quanta(const char *key __rte_unused, const char *value, void= *opaque) > > +{ > > + int *quanta =3D opaque; > > + *quanta =3D atoi(value); > > + if (*quanta < 0 || *quanta > 4096) >=20 > Is quanta =3D=3D 4096 valid? or It is only from 0 to 4095? >=20 > I think, it is nice to set max value as #define value in sw_evdev.h >=20 > > + return -1; > > + return 0; > > +} > > + > > +static int > > +set_credit_quanta(const char *key __rte_unused, const char *value, voi= d *opaque) > > +{ > > + int *credit =3D opaque; > > + *credit =3D atoi(value); > > + if (*credit < 0 || *credit > 128) >=20 > Same as above comment. >=20 > > + return -1; > > + return 0; > > +} > > + > > +static int > > +sw_probe(const char *name, const char *params) > > +{ > > + static const struct rte_eventdev_ops evdev_sw_ops =3D { > > + }; > > + > > + static const char *const args[] =3D { > > + NUMA_NODE_ARG, > > + SCHED_QUANTA_ARG, > > + CREDIT_QUANTA_ARG, > > + NULL > > + }; > > + struct rte_eventdev *dev; > > + struct sw_evdev *sw; > > + int socket_id =3D rte_socket_id(); > > + int sched_quanta =3D SW_DEFAULT_SCHED_QUANTA; > > + int credit_quanta =3D SW_DEFAULT_CREDIT_QUANTA; > > + > > + if (params !=3D NULL && params[0] !=3D '\0') { > > + struct rte_kvargs *kvlist =3D rte_kvargs_parse(params, args); > > + > > + if (!kvlist) { > > + SW_LOG_INFO( > > + "Ignoring unsupported parameters when creating device '%s'\n", > > + name); > > + } else { > > + int ret =3D rte_kvargs_process(kvlist, NUMA_NODE_ARG, > > + assign_numa_node, &socket_id); > > + if (ret !=3D 0) { > > + SW_LOG_ERR( > > + "%s: Error parsing numa node parameter", > > + name); > > + rte_kvargs_free(kvlist); > > + return ret; > > + } > > + > > + ret =3D rte_kvargs_process(kvlist, SCHED_QUANTA_ARG, > > + set_sched_quanta, &sched_quanta); > > + if (ret !=3D 0) { > > + SW_LOG_ERR( > > + "%s: Error parsing sched quanta parameter", > > + name); > > + rte_kvargs_free(kvlist); > > + return ret; > > + } > > + > > + ret =3D rte_kvargs_process(kvlist, CREDIT_QUANTA_ARG, > > + set_credit_quanta, &credit_quanta); > > + if (ret !=3D 0) { > > + SW_LOG_ERR( > > + "%s: Error parsing credit quanta parameter", > > + name); > > + rte_kvargs_free(kvlist); > > + return ret; > > + } > > + > > + rte_kvargs_free(kvlist); > > + } > > + } > > + > > + SW_LOG_INFO( >=20 > An extra line here may be not required here. Checkpatch warns on "long line" if this extra whitespace is not present. > > + "Creating eventdev sw device %s, numa_node=3D%d, sched_quanta=3D%d, > credit_quanta=3D%d\n", > > + name, socket_id, sched_quanta, credit_quanta); > > + > > + dev =3D rte_event_pmd_vdev_init(name, > > + sizeof(struct sw_evdev), socket_id); > > + if (dev =3D=3D NULL) { > > + SW_LOG_ERR("eventdev vdev init() failed"); > > + return -EFAULT; > > + } > > + dev->dev_ops =3D &evdev_sw_ops; > > + > > + sw =3D dev->data->dev_private; > > + sw->data =3D dev->data; > > + > > + /* copy values passed from vdev command line to instance */ > > + sw->credit_update_quanta =3D credit_quanta; > > + sw->sched_quanta =3D sched_quanta; > > + > > + return 0; > > +} > > + > > +static int > > +sw_remove(const char *name) > > +{ > > + if (name =3D=3D 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 =3D { > > + .probe =3D sw_probe, > > + .remove =3D sw_remove > > +}; > > + > > +RTE_PMD_REGISTER_VDEV(EVENTDEV_NAME_SW_PMD, evdev_sw_pmd_drv); > > +RTE_PMD_REGISTER_PARAM_STRING(event_sw, NUMA_NODE_ARG "=3D " > > + SCHED_QUANTA_ARG "=3D" CREDIT_QUANTA_ARG "=3D"); >=20 > With suggested changes, >=20 > Acked-by: Jerin Jacob Thanks for review!