From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH 6/6] service cores: enable event/sw with service Date: Mon, 26 Jun 2017 19:16:55 +0530 Message-ID: <20170626134654.GA14871@jerin> References: <1498208779-166205-1-git-send-email-harry.van.haaren@intel.com> <1498208779-166205-6-git-send-email-harry.van.haaren@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, thomas@monjalon.net, keith.wiles@intel.com, bruce.richardson@intel.com To: Harry van Haaren Return-path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0046.outbound.protection.outlook.com [104.47.32.46]) by dpdk.org (Postfix) with ESMTP id 5D5079E3 for ; Mon, 26 Jun 2017 15:47:13 +0200 (CEST) Content-Disposition: inline In-Reply-To: <1498208779-166205-6-git-send-email-harry.van.haaren@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" -----Original Message----- > Date: Fri, 23 Jun 2017 10:06:19 +0100 > From: Harry van Haaren > To: dev@dpdk.org > CC: thomas@monjalon.net, jerin.jacob@caviumnetworks.com, > keith.wiles@intel.com, bruce.richardson@intel.com, Harry van Haaren > > Subject: [PATCH 6/6] service cores: enable event/sw with service > X-Mailer: git-send-email 2.7.4 > > This commit shows how easy it is to enable a specific > DPDK component with a service callback, in order to get > CPU cycles for it. > > The beauty of this method is that the service is unaware > of how much CPU time it is getting - the application can > decide how to split and slice cores and map them to the > registered services. > > Signed-off-by: Harry van Haaren > --- > drivers/event/sw/sw_evdev.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c > index a31aaa6..f55cad9 100644 > --- a/drivers/event/sw/sw_evdev.c > +++ b/drivers/event/sw/sw_evdev.c > @@ -38,6 +38,9 @@ > #include > #include > > +#include > +#include If rte_service_private.h needs the rte_cycles.h then I think it can be included in rte_service_private.h. > + > #include "sw_evdev.h" > #include "iq_ring.h" > #include "event_ring.h" > @@ -695,6 +698,14 @@ set_credit_quanta(const char *key __rte_unused, const char *value, void *opaque) > return 0; > } > > + > +static int32_t sw_sched_service_func(void *args) > +{ > + struct rte_eventdev *dev = args; > + sw_event_schedule(dev); > + return 0; > +} > + > static int > sw_probe(struct rte_vdev_device *vdev) > { > @@ -806,6 +817,17 @@ sw_probe(struct rte_vdev_device *vdev) > sw->credit_update_quanta = credit_quanta; > sw->sched_quanta = sched_quanta; > > + /* register service with EAL */ > + struct rte_service_spec service; > + memset(&service, 0, sizeof(struct rte_service_spec)); > + snprintf(service.name, sizeof(service.name), "%s_service", name); Should we add socket_id as well in the service name? > + service.socket_id = socket_id; > + service.callback = sw_sched_service_func; > + service.callback_userdata = (void *)dev; > + > + int32_t ret = rte_service_register(&service); > + printf("serivce register = %d, cb ud %p\n", ret, dev); sw_pmd_log? > + > return 0; Should we also check rte_service_is_running() in sw pmd start function to verify application did everything to setup the service function on service lcore? or means for feedback? > } > > -- > 2.7.4 >