From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490628643; x=1522164643; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=FpGc0bVms3bJnkanIOco6bQuojfPqF8cd0VPgKSHjME=; b=S4kLx5SPR7qSDyR7ezi8DyV45DXISEQvD2V5+HB9/3o78mpem5107622 dRPReBH1Cj9piuZHEXMZwE3CpSUTDA==; Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2017 08:30:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,232,1486454400"; d="scan'208";a="81082232" Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23]) by fmsmga005.fm.intel.com with ESMTP; 27 Mar 2017 08:30:39 -0700 Received: from irsmsx155.ger.corp.intel.com (163.33.192.3) by IRSMSX109.ger.corp.intel.com (163.33.3.23) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 27 Mar 2017 16:30:38 +0100 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.153]) by irsmsx155.ger.corp.intel.com ([169.254.14.202]) with mapi id 14.03.0319.002; Mon, 27 Mar 2017 16:30:38 +0100 From: "Van Haaren, Harry" To: Jerin Jacob CC: "dev@dpdk.org" , "Richardson, Bruce" Thread-Topic: [PATCH v5 02/20] event/sw: add new software-only eventdev driver Thread-Index: AQHSpL8jUAcjFKDa/ku+lRZIzYQ5VaGlF2YAgAOputA= 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> In-Reply-To: <20170325062423.g44dcf46eweeypwx@localhost.localdomain> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmUyZWEwYzgtMDdkNy00YTI4LTlhMmQtMzIwZGYwMGFiNDYyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX1BVQkxJQyJ9XX1dfSwiU3ViamVjdExhYmVscyI6W10sIlRNQ1ZlcnNpb24iOiIxNS45LjYuNiIsIlRydXN0ZWRMYWJlbEhhc2giOiJ0aFZETDlXWmxOOGFcL29JZmFWN2xKNjZpanRyTzR5aGJrTjNxUUg0RThvYz0ifQ== x-ctpclassification: CTP_PUBLIC x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v5 02/20] event/sw: add new software-only eventdev driver 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: Mon, 27 Mar 2017 15:30:43 -0000 > 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!