From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0042.outbound.protection.outlook.com [104.47.38.42]) by dpdk.org (Postfix) with ESMTP id CF619D267 for ; Sat, 25 Mar 2017 07:24:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=rkBWpUo4eJ7OlAgJ4VyGftm0FWgwkCFFJMqNRLP91dQ=; b=olmNvrR7wzUAimBfHjvegLgGbnslsdQHKkXh35sc3K7C5cES7X+jLFb+jZEbbmj1nBvdMrBwkJRPrLvSJomQQlFsdK2IL1ciH/FDgPihNpOGi7HcuOb1YoP4j6ddDO6C3OlB2pHBzGBiJH6saUY0DKzO/tDYT6QD22vWLbZuzFU= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (171.76.89.237) by BY1PR0701MB1724.namprd07.prod.outlook.com (10.162.111.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Sat, 25 Mar 2017 06:24:40 +0000 Date: Sat, 25 Mar 2017 11:54:24 +0530 From: Jerin Jacob To: Harry van Haaren Cc: dev@dpdk.org, Bruce Richardson Message-ID: <20170325062423.g44dcf46eweeypwx@localhost.localdomain> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1490374395-149320-3-git-send-email-harry.van.haaren@intel.com> User-Agent: NeoMutt/20170306 (1.8.0) X-Originating-IP: [171.76.89.237] X-ClientProxiedBy: BMXPR01CA0006.INDPRD01.PROD.OUTLOOK.COM (10.174.214.144) To BY1PR0701MB1724.namprd07.prod.outlook.com (10.162.111.143) X-MS-Office365-Filtering-Correlation-Id: 818b3285-4e7d-4517-fa46-08d473479f45 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 3:zxYypeFq/tyz70uhiT2OGDsoZ4yqTlUyrDfW/KpP3Z+1ZE+kC85kQ/T04gMArl60YgjfjUYoTJv9wGVT/ddltNspWZ5cf5z9IzIKuUCHjQow95STnI5ia2txC+rM5xp5hl/GNuH7+Pf8bDpBNKIb+DyodVGB6JMpMMghspXHe/hGTg3BK9qwKUFV4XieXqLVX7g0lAcL9LdFUMetV6Hhr6ePrFWjOtEefbPkeo2Px8uCoKn6qoJD1bKobaYgXu8WUd0OawLIWfniMrd6Rdpo+A==; 25:XDPVv4MdrwaS/ZtJAdj06J6mXb8GtzFR7Og61upnKi+hjHeVestytgOFZkcbE01xR0ykqjGCfaAajd1hBouqQys8ZHnHMnUC+dDYolWwxKc91J/hzBLK573l9cJ/DskhUgOfA9Hy4d+Y687HWW43uMWUsXxl+7fL+11n5z0z4wPyQawkDMan542blxJHwKSG24HelFkiVYeopJvhCtsJmW6zNeR6/7qPMV4Z0y2ut2uRDPTNvRHCymceRRgSRhcFxT78H9XyFCf1o3I4u7ExuuP5Ut28uyfTke6kyIyZeWrHnLWmKKfFOFPws5jWiMDEyQpk1bKS+leh7oErW04y0nr53eEC7XfDe7jLVd4wl1ruZnmSrIdglNepAEDeUXAGNKa/5/G284MeYmDWUACMjHacS+JcdligK0VmaSrWSuYjHpzeBD4JkXFKlv0f1RvPOKc+buiHWMJwblhnfgx5UA== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 31:xG1MRP8Qr2ylB52xufjZe2UqD1JcJKhl2Qo03WfTAFpSIoG+RGLoUzwxhPSBnyEcgpOsv3v5Pa32lTBokyuGaFIwjpq1zgxn4VAWEnnT3hu30gypRYTWPW1+FApMCheKM+TSOYzIyw/spB0NwqB4Z7e3f1zLpl+OaCkt0/tvN8XgJSjL1rh2fSmAyTB6xX/imDNFAVQxY0i+VZVlHofKYlM544knq/ZtMcEsHqIN8gqLW29unZkhOHxQs2DYk203DcI5KnW+9tyyPZRCEs3ofQ==; 20:bP8CQVV58qIZB42FdYVsItNNfUEv1gGaNjl/g/d8FpQ8+nQ1fJIcpQ6gNntp9DvKz3Onz6CiqcsCqWSH9lYsSF+0pTBC6PAnvZt9tlWPNqe1lV53Q8lcvkSfhw7CAt3WlumyJINKA4QdlTKaxSssrSeKIXOd+dIq31LjCrhR56Ez5nMwpCrlMKfqT8JVoL1vsdBp5ZwR8jqzbrDYA6Ejd7q1U//8dSVIKcFaQdGgZXd/zncvtBjuUWuFnhiQPMAuZKVSsQlrL8gQ2GtRu619vR6jdSPCjkbCLk4G2ZeVBA5fKGvELaf+V9xFHha6wPOUmlAGd6XrAXRbYsPmSkZv7Sh1qlodvxKdGJPvbMUTNqRE1l1EXHmZMjjAj4zTzmrfnTyZpfdWPWnVNCfvvw146zERixvigN8XIDGmyXt8Ps5HAvkysXLIxdrblUt2cExQJGEvO6sKsyomHAjvI9paWXktYVT62GoU3wbBHDP9OXMZqQLeLrmP/ydEr4ZSS2XY5LrShCRcv54guFNZq424ug2g5bZhFAPt4n+6WyxOW3XGcOjTSjuqQGnlz0DhbAmCiUezlHCcNlVOXF1+IE9h1wee8CQuD0ssx/5stUSWuuQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123564025)(20161123560025)(20161123558025)(20161123562025)(20161123555025)(6072148); SRVR:BY1PR0701MB1724; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1724; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 4:UsPaMYuScbNqfp7cXWxbf1c0nY08r91Rdk1CTjF05VA+BRlChMTgny3B3oH2kS8AnD76K9mC2YVAoWnvmFsSc70oxM7j+QfqbJHdacpOtqPm9AD80ugW05cQs0Y4S0ikwKVeuYs5bfyFMC++ksvt1sgbmf+KF2PermF5V5NHMHZB4OhOPKNvUTJKv/MJ2Af2ujer1S32UySpRwYiKOHX/0ln24CNEWCOmLmVgFq4PCn7PdF0bxD44WtbeY6LE6q1HZaUN51xOo+UOEjrBqKRpaM4ix3GgBTVWKVXwWYCxylJUem6Ytj9x6ahqxF0WrXJFxeNS03cuNETapv4+HAx9tnuqBwvequA76LQwVxyDabAX88NTHlxhEXi9ptreUEmFbFlwvxPqXwtpi/aS6LH2o14jcZfDpnrLgJVzJ8wUW1tgJhA0Savzxqk7VnrZqcUnQK16Pn10LyHzb0hh4sZP1YboeFzFIyuoS2izCFNixEMUFZ8fHFMY2EauizbLgWdlIA2moHoeEk7eHdaMVd0U6Xi5WwY2Yz9lehGttLtmp8/rJ6oyTRJpeSQJiQPj0uROd47Re0L4dVq8j3n6myRrlWpnBHZc6XTokBZ2CjuezZEENjTjOPTGJEUj/jto75E/oePhSlFUBLm4A1opdLlig== X-Forefront-PRVS: 025796F161 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(39450400003)(39830400002)(39410400002)(24454002)(5660300001)(2906002)(47776003)(33646002)(42186005)(4326008)(66066001)(61506002)(229853002)(23726003)(6116002)(4001350100001)(3846002)(6666003)(76176999)(54356999)(2950100002)(50986999)(42882006)(6916009)(25786009)(55016002)(189998001)(50466002)(6506006)(81166006)(7736002)(305945005)(8676002)(110136004)(38730400002)(6246003)(53936002)(9686003)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1724; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB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7?= =?us-ascii?Q?k9IQL6+9R99azPpnweFZHWptBpcGVzru4zpgQ4VpqyqsYJ49rnb4kbh2hcv/?= =?us-ascii?Q?GVz1VN/dkhvdXCxxEc4Pt1dXxAvYsaSSQNT+gwQ2u7QRRUwz9ml3NN/e022T?= =?us-ascii?Q?y+Yj0xsjs5wHWtcSjIc8w7/jNjPVoNk6iq1vOBIA6lzNQvnJqOGPM+qWCkFj?= =?us-ascii?Q?GhaFEADI=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 6:2JrCnYqAjnIHeTAIRzhyHqqTJQ3ACvtIpY844RIHES90JXUWbUjBA58+swMSIU0KgvqUD8b8MMZQ+LBIRP9FPagKVvmjmh4pOVPy30KYfYaozPY7JmcyAa1IWMzOFMbpyHr4TAb0Ph3eUpwd6onvU5OaVXZP8gcdXa4CM+pVIRp2/Z9NH+lIXEvzPJ9UGTrh6LYQ6hdT+uS4nVem07oJPdNrTO+zULOXeGyy0bD9GX6J+Y4UAAlQ2gOp1vo/PFi4HlA2YQf/+Ng78PAgNQ4D3dyTDjbKyxCrkan7IKPChNZGXh/sZSB9nFs55mPA9UlvL/2RPpSu5eOfkljeAwxc5jjpRtSstgkgHJj5n/I2T9keU0nZq9oV40JgMQ76xO0/PVZyiv4PMtDcIwVGEZtbWQ==; 5:eWxN6kv7sldl5t74pEtJHwp3KuewTfNk0C7tEq995JYcohYsY7ebs7vyORlFIkJ4C5H1qiTWLs7HWppGP4YeBfBAf7p8e6Hxw+qyCNZmrVucJJknhGmC1WCvd1DgsbO4eeu76Q0JyyFer4FMAc7orw==; 24:m18/JFrwBeMcmaEW1YUpC9N3Q2o0l4KDjdVWtTd8HquMDiafxq/lFUmuKnUHTmtlgCzWI1PHChjSkK3+m+G0mxT59KH73dLSXnzT5QGT77Q= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1724; 7:H0dzbSDeC1br6HKSklAD0iQatKvGdDYEewP3lyoDraGXVAQZdoG9vMcDJlAp7pL7jLJ6y+vkYu7lTCX+zGI/q+P2/Z3wynU1OFiDgAlPAnRPtEI3W6DBsC+LCV8NobsKsvX+tKLifxjxSr78pg3em9ZJLuGi2zefpGl9njSNsxCjSBZM+lCu2IKDBza+Tta6Pb6C0PuP31qRDE4mZUwCc05nUVeYD7Y43QxY2WqGuxXieG9I0wIVQT2bUDFcZdNEWnAPZx4bViTGqv+/7nVK8kCOH6sVFXpEISwy1GokSoEOH4CjqmLOqcdq+fnP34pV/O3XwSlNyb6UD40HmS7L2g== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2017 06:24:40.2915 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1724 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: Sat, 25 Mar 2017 06:24:45 -0000 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=event_sw0 > ... > PMD: Creating eventdev sw device event_sw0, numa_node=0, sched_quanta=128 > 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 ++++++++++++++++++++++++++ [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 > + > +#include > +#include > +#include > +#include > + > +#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 "= " > + SCHED_QUANTA_ARG "=" CREDIT_QUANTA_ARG "="); With suggested changes, Acked-by: Jerin Jacob