> From: Jerin Jacob [mailto:jerin.ja...@caviumnetworks.com] > Sent: Monday, March 27, 2017 2:51 PM > To: Van Haaren, Harry <harry.van.haa...@intel.com> > Cc: dev@dpdk.org; Richardson, Bruce <bruce.richard...@intel.com>; Eads, Gage > <gage.e...@intel.com> > Subject: Re: [PATCH v5 09/20] event/sw: add worker core functions > > On Fri, Mar 24, 2017 at 04:53:04PM +0000, Harry van Haaren wrote: > > From: Bruce Richardson <bruce.richard...@intel.com> > > > > add the event enqueue, dequeue and release functions to the eventdev. > > These also include tracking of stats for observability in the load of > > the scheduler. > > Internally in the enqueue function, the various types of enqueue > > operations, to forward an existing event, to send a new event, to > > drop a previous event, are converted to a series of flags which will > > be used by the scheduler code to perform the needed actions for that > > event. > > > > Signed-off-by: Bruce Richardson <bruce.richard...@intel.com> > > Signed-off-by: Gage Eads <gage.e...@intel.com> > > Signed-off-by: Harry van Haaren <harry.van.haa...@intel.com> > > --- > > drivers/event/sw/Makefile | 1 + > > drivers/event/sw/sw_evdev.c | 5 + > > drivers/event/sw/sw_evdev.h | 32 +++++++ > > drivers/event/sw/sw_evdev_worker.c | 188 > > +++++++++++++++++++++++++++++++++++++ > > 4 files changed, 226 insertions(+) > > create mode 100644 drivers/event/sw/sw_evdev_worker.c > >
<snip> > > @@ -550,6 +551,10 @@ sw_probe(const char *name, const char *params) > > return -EFAULT; > > } > > dev->dev_ops = &evdev_sw_ops; > > + dev->enqueue = sw_event_enqueue; > > + dev->enqueue_burst = sw_event_enqueue_burst; > > + dev->dequeue = sw_event_dequeue; > > + dev->dequeue_burst = sw_event_dequeue_burst; > > Is all the code in the sw_probe() valid for multi process? If not, after > function pointer assignment it can return[1] from sw_probe. Just like > another PMD's, we will support configuration API and fastpath API in primary > process and secondary process will be limited to fast path functions. > > [1] > if (rte_eal_process_type() != RTE_PROC_PRIMARY) > return 0; Yes, will be fixed in v6. > > sw = dev->data->dev_private; > > sw->data = dev->data; > > diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h > > index f5515e1..ab372fd 100644 > > --- a/drivers/event/sw/sw_evdev.h > > +++ b/drivers/event/sw/sw_evdev.h > > @@ -55,12 +55,36 @@ > > #define SCHED_DEQUEUE_BURST_SIZE 32 > > > > + > > +static inline void > > +sw_event_release(struct sw_port *p, uint8_t index) > > +{ > > + /* > > + * Drops the next outstanding event in our history. Used on dequeue > > + * to clear any history before dequeuing more events. > > + */ > > + RTE_SET_USED(index); > > + > > + /* create drop message */ > > + struct rte_event ev = { > > + .op = sw_qe_flag_map[RTE_EVENT_OP_RELEASE], > > + }; > > + > > + uint16_t free_count; > > + qe_ring_enqueue_burst(p->rx_worker_ring, &ev, 1, &free_count); > > + > > + /* each release returns one credit */ > > + p->outstanding_releases--; > > + p->inflight_credits++; > > +} > > + > > +uint16_t > > +sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t > > num) > > +{ > > + int32_t i; > > + uint8_t new_ops[PORT_ENQUEUE_MAX_BURST_SIZE]; > > + struct sw_port *p = port; > > + struct sw_evdev *sw = (void *)p->sw; > > + uint32_t sw_inflights = rte_atomic32_read(&sw->inflights); > > + > > + if (p->inflight_max < sw_inflights) > > + return 0; > > likely and unlikely attributes are missing in fastpath functions. > Worth to consider in using those in worker file. Initial (obvious ones) done in v6. Perhaps a candidate for future patches after initial merge, as these are only performance improvements, not functional. > > +uint16_t > > +sw_event_dequeue_burst(void *port, struct rte_event *ev, uint16_t num, > > + uint64_t wait) > > +{ > > + RTE_SET_USED(wait); > > + struct sw_port *p = (void *)port; > > + struct sw_evdev *sw = (void *)p->sw; > > + struct qe_ring *ring = p->cq_worker_ring; > > + uint32_t credit_update_quanta = sw->credit_update_quanta; > > + > > + /* check that all previous dequeues have been released */ > > + if (!p->is_directed) { > > + uint16_t out_rels = p->outstanding_releases; > > + uint16_t i; > > + for (i = 0; i < out_rels; i++) > > + sw_event_release(p, i); > > + } > > + > > + /* Intel modification: may not be in final API */ > > + if (ev == 0) > > + return 0; > > May be we can remove this one in fastpath. Maybe under DEBUG in common code > we can add this. Done, removed in v6. <snip to end>