Hi Kevin This came from your ARM address, does it need to be via your Linaro address for legal reasons ?
Mike On 18 December 2016 at 20:58, Kevin Wang <kevin.w...@linaro.org> wrote: > From: "kevin.wang" <kevin.w...@arm.com> > > To make the queue component to be modulized, the other > components aren't allowed to access the detailed data > structure of queue. The only way to access queue is > from the internal queue interface by using odp_queue_t > as a handler > > Signed-off-by: kevin.wang <kevin.w...@arm.com> > --- > .../include/odp_classification_datamodel.h | 2 +- > .../linux-generic/include/odp_packet_io_queue.h | 16 ++--- > .../linux-generic/include/odp_queue_internal.h | 71 > ++++++++++++++++---- > .../include/odp_traffic_mngr_internal.h | 2 +- > platform/linux-generic/odp_classification.c | 18 ++--- > platform/linux-generic/odp_packet_io.c | 77 > ++++++++++------------ > platform/linux-generic/odp_queue.c | 24 +++---- > platform/linux-generic/odp_schedule_ordered.c | 22 ++++--- > platform/linux-generic/odp_traffic_mngr.c | 15 +++-- > platform/linux-generic/pktio/loop.c | 8 +-- > 10 files changed, 143 insertions(+), 112 deletions(-) > > diff --git a/platform/linux-generic/include/odp_classification_datamodel.h > b/platform/linux-generic/include/odp_classification_datamodel.h > index dc2190d..fa437d0 100644 > --- a/platform/linux-generic/include/odp_classification_datamodel.h > +++ b/platform/linux-generic/include/odp_classification_datamodel.h > @@ -76,7 +76,7 @@ typedef struct pmr_term_value { > Class Of Service > */ > struct cos_s { > - queue_entry_t *queue; /* Associated Queue */ > + odp_queue_t queue; /* Associated Queue */ > pool_entry_t *pool; /* Associated Buffer pool */ > union pmr_u *pmr[ODP_PMR_PER_COS_MAX]; /* Chained PMR */ > union cos_u *linked_cos[ODP_PMR_PER_COS_MAX]; /* Chained CoS with > PMR*/ > diff --git a/platform/linux-generic/include/odp_packet_io_queue.h > b/platform/linux-generic/include/odp_packet_io_queue.h > index 13b79f3..a14cf00 100644 > --- a/platform/linux-generic/include/odp_packet_io_queue.h > +++ b/platform/linux-generic/include/odp_packet_io_queue.h > @@ -28,20 +28,20 @@ extern "C" { > ODP_STATIC_ASSERT(ODP_PKTIN_QUEUE_MAX_BURST >= QUEUE_MULTI_MAX, > "ODP_PKTIN_DEQ_MULTI_MAX_ERROR"); > > -int pktin_enqueue(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr, int > sustain); > -odp_buffer_hdr_t *pktin_dequeue(queue_entry_t *queue); > +int pktin_enqueue(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr, int > sustain); > +odp_buffer_hdr_t *pktin_dequeue(odp_queue_t queue); > > -int pktin_enq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], > int num, > +int pktin_enq_multi(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr[], int > num, > int sustain); > -int pktin_deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], > int num); > +int pktin_deq_multi(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr[], int > num); > > > -int pktout_enqueue(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr); > -odp_buffer_hdr_t *pktout_dequeue(queue_entry_t *queue); > +int pktout_enqueue(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr); > +odp_buffer_hdr_t *pktout_dequeue(odp_queue_t queue); > > -int pktout_enq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], > +int pktout_enq_multi(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr[], > int num); > -int pktout_deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], > +int pktout_deq_multi(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr[], > int num); > > #ifdef __cplusplus > diff --git a/platform/linux-generic/include/odp_queue_internal.h > b/platform/linux-generic/include/odp_queue_internal.h > index e223d9f..ccd4e15 100644 > --- a/platform/linux-generic/include/odp_queue_internal.h > +++ b/platform/linux-generic/include/odp_queue_internal.h > @@ -41,12 +41,12 @@ extern "C" { > /* forward declaration */ > union queue_entry_u; > > -typedef int (*enq_func_t)(union queue_entry_u *, odp_buffer_hdr_t *, int); > -typedef odp_buffer_hdr_t *(*deq_func_t)(union queue_entry_u *); > +typedef int (*enq_func_t)(odp_queue_t queue, odp_buffer_hdr_t *, int); > +typedef odp_buffer_hdr_t *(*deq_func_t)(odp_queue_t queue); > > -typedef int (*enq_multi_func_t)(union queue_entry_u *, > +typedef int (*enq_multi_func_t)(odp_queue_t queue, > odp_buffer_hdr_t **, int, int); > -typedef int (*deq_multi_func_t)(union queue_entry_u *, > +typedef int (*deq_multi_func_t)(odp_queue_t queue, > odp_buffer_hdr_t **, int); > > struct queue_entry_s { > @@ -84,23 +84,23 @@ union queue_entry_u { > > queue_entry_t *get_qentry(uint32_t queue_id); > > -int queue_enq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr, int > sustain); > -odp_buffer_hdr_t *queue_deq(queue_entry_t *queue); > +int queue_enq(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr, int sustain); > +odp_buffer_hdr_t *queue_deq(odp_queue_t queue); > > -int queue_enq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], > int num, > +int queue_enq_multi(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr[], int > num, > int sustain); > -int queue_deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], > int num); > +int queue_deq_multi(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr[], int > num); > > -int queue_pktout_enq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr, > +int queue_pktout_enq(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr, > int sustain); > -int queue_pktout_enq_multi(queue_entry_t *queue, > +int queue_pktout_enq_multi(odp_queue_t queue, > odp_buffer_hdr_t *buf_hdr[], int num, int > sustain); > > -int queue_tm_reenq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr, > +int queue_tm_reenq(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr, > int sustain); > -int queue_tm_reenq_multi(queue_entry_t *queue, odp_buffer_hdr_t > *buf_hdr[], > +int queue_tm_reenq_multi(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr[], > int num, int sustain); > -int queue_tm_reorder(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr); > +int queue_tm_reorder(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr); > > void queue_lock(queue_entry_t *queue); > void queue_unlock(queue_entry_t *queue); > @@ -118,6 +118,51 @@ static inline queue_entry_t > *queue_to_qentry(odp_queue_t handle) > return get_qentry(queue_id); > } > > +static inline odp_pktout_queue_t queue_get_pktout(odp_queue_t queue) > +{ > + return queue_to_qentry(queue)->s.pktout; > +} > + > +static inline void queue_set_pktout(odp_queue_t queue, odp_pktout_queue_t > *pktout) > +{ > + queue_to_qentry(queue)->s.pktout = *pktout; > +} > + > +static inline odp_pktin_queue_t queue_get_pktin(odp_queue_t queue) > +{ > + return queue_to_qentry(queue)->s.pktin; > +} > + > +static inline void queue_set_pktin(odp_queue_t queue, odp_pktin_queue_t > *pktin) > +{ > + queue_to_qentry(queue)->s.pktin = *pktin; > +} > + > +static inline void queue_set_enq_func(odp_queue_t queue, enq_func_t func) > +{ > + queue_to_qentry(queue)->s.enqueue = func; > +} > + > +static inline void queue_set_enq_multi_func(odp_queue_t queue, > enq_multi_func_t func) > +{ > + queue_to_qentry(queue)->s.enqueue_multi = func; > +} > + > +static inline void queue_set_deq_func(odp_queue_t queue, deq_func_t func) > +{ > + queue_to_qentry(queue)->s.dequeue = func; > +} > + > +static inline void queue_set_deq_multi_func(odp_queue_t queue, > deq_multi_func_t func) > +{ > + queue_to_qentry(queue)->s.dequeue_multi = func; > +} > + > +static inline void queue_set_type(odp_queue_t queue, odp_queue_type_t > type) > +{ > + queue_to_qentry(queue)->s.type = type; > +} > + > #ifdef __cplusplus > } > #endif > diff --git a/platform/linux-generic/include/odp_traffic_mngr_internal.h > b/platform/linux-generic/include/odp_traffic_mngr_internal.h > index 9f821fe..4e9cd9e 100644 > --- a/platform/linux-generic/include/odp_traffic_mngr_internal.h > +++ b/platform/linux-generic/include/odp_traffic_mngr_internal.h > @@ -286,7 +286,7 @@ struct tm_queue_obj_s { > uint8_t tm_idx; > uint8_t delayed_cnt; > uint8_t blocked_cnt; > - queue_entry_t tm_qentry; > + odp_queue_t queue; > }; > > struct tm_node_obj_s { > diff --git a/platform/linux-generic/odp_classification.c > b/platform/linux-generic/odp_classification.c > index 82760e8..3ce7517 100644 > --- a/platform/linux-generic/odp_classification.c > +++ b/platform/linux-generic/odp_classification.c > @@ -158,15 +158,10 @@ int odp_cls_capability(odp_cls_capability_t > *capability) > odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param) > { > int i, j; > - queue_entry_t *queue; > pool_entry_t *pool; > odp_cls_drop_t drop_policy; > > /* Packets are dropped if Queue or Pool is invalid*/ > - if (param->queue == ODP_QUEUE_INVALID) > - queue = NULL; > - else > - queue = queue_to_qentry(param->queue); > > if (param->pool == ODP_POOL_INVALID) > pool = NULL; > @@ -185,7 +180,7 @@ odp_cos_t odp_cls_cos_create(const char *name, > odp_cls_cos_param_t *param) > cos_tbl->cos_entry[i].s.pmr[j] = NULL; > cos_tbl->cos_entry[i].s.linked_cos[j] = > NULL; > } > - cos_tbl->cos_entry[i].s.queue = queue; > + cos_tbl->cos_entry[i].s.queue = param->queue; > cos_tbl->cos_entry[i].s.pool = pool; > cos_tbl->cos_entry[i].s.flow_set = 0; > cos_tbl->cos_entry[i].s.headroom = 0; > @@ -256,7 +251,7 @@ int odp_cos_destroy(odp_cos_t cos_id) > return 0; > } > > -int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id) > +int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue) > { > cos_t *cos = get_cos_entry(cos_id); > > @@ -266,10 +261,7 @@ int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t > queue_id) > } > /* Locking is not required as intermittent stale > data during CoS modification is acceptable*/ > - if (queue_id == ODP_QUEUE_INVALID) > - cos->s.queue = NULL; > - else > - cos->s.queue = queue_to_qentry(queue_id); > + cos->s.queue = queue; > return 0; > } > > @@ -285,7 +277,7 @@ odp_queue_t odp_cos_queue(odp_cos_t cos_id) > if (!cos->s.queue) > return ODP_QUEUE_INVALID; > > - return cos->s.queue->s.handle; > + return cos->s.queue; > } > > int odp_cos_drop_set(odp_cos_t cos_id, odp_cls_drop_t drop_policy) > @@ -832,7 +824,7 @@ int cls_classify_packet(pktio_entry_t *entry, const > uint8_t *base, > > *pool = cos->s.pool->s.pool_hdl; > pkt_hdr->p.input_flags.dst_queue = 1; > - pkt_hdr->dst_queue = cos->s.queue->s.handle; > + pkt_hdr->dst_queue = cos->s.queue; > > return 0; > } > diff --git a/platform/linux-generic/odp_packet_io.c > b/platform/linux-generic/odp_packet_io.c > index 3524ff8..e494831 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -566,11 +566,8 @@ static inline int pktin_recv_buf(odp_pktin_queue_t > queue, > buf_hdr = odp_buf_to_hdr(buf); > > if (pkt_hdr->p.input_flags.dst_queue) { > - queue_entry_t *dst_queue; > int ret; > - > - dst_queue = queue_to_qentry(pkt_hdr->dst_queue); > - ret = queue_enq(dst_queue, buf_hdr, 0); > + ret = queue_enq(pkt_hdr->dst_queue, buf_hdr, 0); > if (ret < 0) > odp_packet_free(pkt); > continue; > @@ -580,23 +577,23 @@ static inline int pktin_recv_buf(odp_pktin_queue_t > queue, > return num_rx; > } > > -int pktout_enqueue(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr) > +int pktout_enqueue(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr) > { > odp_packet_t pkt = _odp_packet_from_buffer(buf_ > hdr->handle.handle); > int len = 1; > int nbr; > > - nbr = odp_pktout_send(qentry->s.pktout, &pkt, len); > + nbr = odp_pktout_send(queue_get_pktout(queue), &pkt, len); > return (nbr == len ? 0 : -1); > } > > -odp_buffer_hdr_t *pktout_dequeue(queue_entry_t *qentry ODP_UNUSED) > +odp_buffer_hdr_t *pktout_dequeue(odp_queue_t queue ODP_UNUSED) > { > ODP_ABORT("attempted dequeue from a pktout queue"); > return NULL; > } > > -int pktout_enq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[], > +int pktout_enq_multi(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr[], > int num) > { > odp_packet_t pkt_tbl[QUEUE_MULTI_MAX]; > @@ -606,11 +603,11 @@ int pktout_enq_multi(queue_entry_t *qentry, > odp_buffer_hdr_t *buf_hdr[], > for (i = 0; i < num; ++i) > pkt_tbl[i] = _odp_packet_from_buffer(buf_ > hdr[i]->handle.handle); > > - nbr = odp_pktout_send(qentry->s.pktout, pkt_tbl, num); > + nbr = odp_pktout_send(queue_get_pktout(queue), pkt_tbl, num); > return nbr; > } > > -int pktout_deq_multi(queue_entry_t *qentry ODP_UNUSED, > +int pktout_deq_multi(odp_queue_t queue ODP_UNUSED, > odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, > int num ODP_UNUSED) > { > @@ -618,35 +615,35 @@ int pktout_deq_multi(queue_entry_t *qentry > ODP_UNUSED, > return 0; > } > > -int pktin_enqueue(queue_entry_t *qentry ODP_UNUSED, > +int pktin_enqueue(odp_queue_t queue ODP_UNUSED, > odp_buffer_hdr_t *buf_hdr ODP_UNUSED, int sustain > ODP_UNUSED) > { > ODP_ABORT("attempted enqueue to a pktin queue"); > return -1; > } > > -odp_buffer_hdr_t *pktin_dequeue(queue_entry_t *qentry) > +odp_buffer_hdr_t *pktin_dequeue(odp_queue_t queue) > { > odp_buffer_hdr_t *buf_hdr; > odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX]; > int pkts; > > - buf_hdr = queue_deq(qentry); > + buf_hdr = queue_deq(queue); > if (buf_hdr != NULL) > return buf_hdr; > > - pkts = pktin_recv_buf(qentry->s.pktin, hdr_tbl, QUEUE_MULTI_MAX); > + pkts = pktin_recv_buf(queue_get_pktin(queue), hdr_tbl, > QUEUE_MULTI_MAX); > > if (pkts <= 0) > return NULL; > > if (pkts > 1) > - queue_enq_multi(qentry, &hdr_tbl[1], pkts - 1, 0); > + queue_enq_multi(queue, &hdr_tbl[1], pkts - 1, 0); > buf_hdr = hdr_tbl[0]; > return buf_hdr; > } > > -int pktin_enq_multi(queue_entry_t *qentry ODP_UNUSED, > +int pktin_enq_multi(odp_queue_t queue ODP_UNUSED, > odp_buffer_hdr_t *buf_hdr[] ODP_UNUSED, > int num ODP_UNUSED, int sustain ODP_UNUSED) > { > @@ -654,13 +651,13 @@ int pktin_enq_multi(queue_entry_t *qentry ODP_UNUSED, > return 0; > } > > -int pktin_deq_multi(queue_entry_t *qentry, odp_buffer_hdr_t *buf_hdr[], > int num) > +int pktin_deq_multi(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr[], int > num) > { > int nbr; > odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX]; > int pkts, i, j; > > - nbr = queue_deq_multi(qentry, buf_hdr, num); > + nbr = queue_deq_multi(queue, buf_hdr, num); > if (odp_unlikely(nbr > num)) > ODP_ABORT("queue_deq_multi req: %d, returned %d\n", num, > nbr); > > @@ -670,7 +667,7 @@ int pktin_deq_multi(queue_entry_t *qentry, > odp_buffer_hdr_t *buf_hdr[], int num) > if (nbr == num) > return nbr; > > - pkts = pktin_recv_buf(qentry->s.pktin, hdr_tbl, QUEUE_MULTI_MAX); > + pkts = pktin_recv_buf(queue_get_pktin(queue), hdr_tbl, > QUEUE_MULTI_MAX); > if (pkts <= 0) > return nbr; > > @@ -682,7 +679,7 @@ int pktin_deq_multi(queue_entry_t *qentry, > odp_buffer_hdr_t *buf_hdr[], int num) > hdr_tbl[j] = hdr_tbl[i]; > > if (j) > - queue_enq_multi(qentry, hdr_tbl, j, 0); > + queue_enq_multi(queue, hdr_tbl, j, 0); > return nbr; > } > > @@ -704,7 +701,6 @@ int sched_cb_pktin_poll(int pktio_index, int > num_queue, int index[]) > } > > for (idx = 0; idx < num_queue; idx++) { > - queue_entry_t *qentry; > odp_queue_t queue; > odp_pktin_queue_t pktin = entry->s.in_queue[index[idx]]. > pktin; > > @@ -719,8 +715,7 @@ int sched_cb_pktin_poll(int pktio_index, int > num_queue, int index[]) > } > > queue = entry->s.in_queue[index[idx]].queue; > - qentry = queue_to_qentry(queue); > - queue_enq_multi(qentry, hdr_tbl, num, 0); > + queue_enq_multi(queue, hdr_tbl, num, 0); > } > > return 0; > @@ -1181,6 +1176,7 @@ int odp_pktin_queue_config(odp_pktio_t pktio, > int rc; > odp_queue_t queue; > odp_pktin_queue_param_t default_param; > + odp_pktin_queue_t pktin; > > if (param == NULL) { > odp_pktin_queue_param_init(&default_param); > @@ -1255,16 +1251,13 @@ int odp_pktin_queue_config(odp_pktio_t pktio, > } > > if (mode == ODP_PKTIN_MODE_QUEUE) { > - queue_entry_t *qentry; > - > - qentry = queue_to_qentry(queue); > - qentry->s.pktin.index = i; > - qentry->s.pktin.pktio = pktio; > - > - qentry->s.enqueue = pktin_enqueue; > - qentry->s.dequeue = pktin_dequeue; > - qentry->s.enqueue_multi = pktin_enq_multi; > - qentry->s.dequeue_multi = pktin_deq_multi; > + pktin.index = i; > + pktin.pktio = pktio; > + queue_set_pktin(queue, &pktin); > + queue_set_enq_func(queue, pktin_enqueue); > + queue_set_enq_multi_func(queue, > pktin_enq_multi); > + queue_set_deq_func(queue, pktin_dequeue); > + queue_set_deq_multi_func(queue, > pktin_deq_multi); > } > > entry->s.in_queue[i].queue = queue; > @@ -1294,6 +1287,7 @@ int odp_pktout_queue_config(odp_pktio_t pktio, > unsigned i; > int rc; > odp_pktout_queue_param_t default_param; > + odp_pktout_queue_t pktout; > > if (param == NULL) { > odp_pktout_queue_param_init(&default_param); > @@ -1361,7 +1355,6 @@ int odp_pktout_queue_config(odp_pktio_t pktio, > for (i = 0; i < num_queues; i++) { > odp_queue_t queue; > odp_queue_param_t queue_param; > - queue_entry_t *qentry; > char name[ODP_QUEUE_NAME_LEN]; > int pktio_id = pktio_to_id(pktio); > > @@ -1381,16 +1374,14 @@ int odp_pktout_queue_config(odp_pktio_t pktio, > return -1; > } > > - qentry = queue_to_qentry(queue); > - qentry->s.pktout.index = i; > - qentry->s.pktout.pktio = pktio; > - > + pktout.index = i; > + pktout.pktio = pktio; > + queue_set_pktout(queue, &pktout); > /* Override default enqueue / dequeue functions */ > - qentry->s.enqueue = queue_pktout_enq; > - qentry->s.dequeue = pktout_dequeue; > - qentry->s.enqueue_multi = queue_pktout_enq_multi; > - qentry->s.dequeue_multi = pktout_deq_multi; > - > + queue_set_enq_func(queue, queue_pktout_enq); > + queue_set_enq_multi_func(queue, > queue_pktout_enq_multi); > + queue_set_deq_func(queue, pktout_dequeue); > + queue_set_deq_multi_func(queue, pktout_deq_multi); > entry->s.out_queue[i].queue = queue; > } > } > diff --git a/platform/linux-generic/odp_queue.c > b/platform/linux-generic/odp_queue.c > index 8667076..634913b 100644 > --- a/platform/linux-generic/odp_queue.c > +++ b/platform/linux-generic/odp_queue.c > @@ -449,17 +449,17 @@ static inline int enq_multi(queue_entry_t *queue, > odp_buffer_hdr_t *buf_hdr[], > return num; /* All events enqueued */ > } > > -int queue_enq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], > int num, > +int queue_enq_multi(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr[], int > num, > int sustain) > { > - return enq_multi(queue, buf_hdr, num, sustain); > + return enq_multi(queue_to_qentry(queue), buf_hdr, num, sustain); > } > > -int queue_enq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr, int > sustain) > +int queue_enq(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr, int sustain) > { > int ret; > > - ret = enq_multi(queue, &buf_hdr, 1, sustain); > + ret = enq_multi(queue_to_qentry(queue), &buf_hdr, 1, sustain); > > if (ret == 1) > return 0; > @@ -481,7 +481,7 @@ int odp_queue_enq_multi(odp_queue_t handle, const > odp_event_t ev[], int num) > for (i = 0; i < num; i++) > buf_hdr[i] = odp_buf_to_hdr(odp_buffer_from_event(ev[i])); > > - return num == 0 ? 0 : queue->s.enqueue_multi(queue, buf_hdr, > + return num == 0 ? 0 : queue->s.enqueue_multi(handle, buf_hdr, > num, SUSTAIN_ORDER); > } > > @@ -496,7 +496,7 @@ int odp_queue_enq(odp_queue_t handle, odp_event_t ev) > /* No chains via this entry */ > buf_hdr->link = NULL; > > - return queue->s.enqueue(queue, buf_hdr, SUSTAIN_ORDER); > + return queue->s.enqueue(handle, buf_hdr, SUSTAIN_ORDER); > } > > static inline int deq_multi(queue_entry_t *queue, odp_buffer_hdr_t > *buf_hdr[], > @@ -587,17 +587,17 @@ static inline int deq_multi(queue_entry_t *queue, > odp_buffer_hdr_t *buf_hdr[], > return i; > } > > -int queue_deq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], > int num) > +int queue_deq_multi(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr[], int > num) > { > - return deq_multi(queue, buf_hdr, num); > + return deq_multi(queue_to_qentry(queue), buf_hdr, num); > } > > -odp_buffer_hdr_t *queue_deq(queue_entry_t *queue) > +odp_buffer_hdr_t *queue_deq(odp_queue_t queue) > { > odp_buffer_hdr_t *buf_hdr = NULL; > int ret; > > - ret = deq_multi(queue, &buf_hdr, 1); > + ret = deq_multi(queue_to_qentry(queue), &buf_hdr, 1); > > if (ret == 1) > return buf_hdr; > @@ -616,7 +616,7 @@ int odp_queue_deq_multi(odp_queue_t handle, > odp_event_t events[], int num) > > queue = queue_to_qentry(handle); > > - ret = queue->s.dequeue_multi(queue, buf_hdr, num); > + ret = queue->s.dequeue_multi(handle, buf_hdr, num); > > for (i = 0; i < ret; i++) > events[i] = odp_buffer_to_event(buf_hdr[i] > ->handle.handle); > @@ -631,7 +631,7 @@ odp_event_t odp_queue_deq(odp_queue_t handle) > odp_buffer_hdr_t *buf_hdr; > > queue = queue_to_qentry(handle); > - buf_hdr = queue->s.dequeue(queue); > + buf_hdr = queue->s.dequeue(handle); > > if (buf_hdr) > return odp_buffer_to_event(buf_hdr->handle.handle); > diff --git a/platform/linux-generic/odp_schedule_ordered.c > b/platform/linux-generic/odp_schedule_ordered.c > index 8412183..71ff074 100644 > --- a/platform/linux-generic/odp_schedule_ordered.c > +++ b/platform/linux-generic/odp_schedule_ordered.c > @@ -273,18 +273,18 @@ static inline void get_queue_order(queue_entry_t > **origin_qe, uint64_t *order, > } > } > > -int queue_tm_reenq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr, > +int queue_tm_reenq(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr, > int sustain ODP_UNUSED) > { > odp_tm_queue_t tm_queue = MAKE_ODP_TM_QUEUE((uint8_t *)queue - > > offsetof(tm_queue_obj_t, > - tm_qentry)); > + queue)); > odp_packet_t pkt = (odp_packet_t)buf_hdr->handle.handle; > > return odp_tm_enq(tm_queue, pkt); > } > > -int queue_tm_reenq_multi(queue_entry_t *queue ODP_UNUSED, > +int queue_tm_reenq_multi(odp_queue_t queue ODP_UNUSED, > odp_buffer_hdr_t *buf[] ODP_UNUSED, > int num ODP_UNUSED, > int sustain ODP_UNUSED) > @@ -293,7 +293,7 @@ int queue_tm_reenq_multi(queue_entry_t *queue > ODP_UNUSED, > return 0; > } > > -int queue_tm_reorder(queue_entry_t *queue, > +int queue_tm_reorder(odp_queue_t queue, > odp_buffer_hdr_t *buf_hdr) > { > queue_entry_t *origin_qe; > @@ -316,7 +316,7 @@ int queue_tm_reorder(queue_entry_t *queue, > > /* Wait if it's not our turn */ > if (order > origin_qe->s.order_out) { > - reorder_enq(queue, order, origin_qe, buf_hdr, > SUSTAIN_ORDER); > + reorder_enq(queue_to_qentry(queue), order, origin_qe, > buf_hdr, SUSTAIN_ORDER); > queue_unlock(origin_qe); > return 1; > } > @@ -333,7 +333,7 @@ int queue_tm_reorder(queue_entry_t *queue, > > static int queue_enq_internal(odp_buffer_hdr_t *buf_hdr) > { > - return buf_hdr->target_qe->s.enqueue(buf_hdr->target_qe, buf_hdr, > + return buf_hdr->target_qe->s.enqueue(buf_hdr->target_qe->s.handle, > buf_hdr, > buf_hdr->flags.sustain); > } > > @@ -483,10 +483,11 @@ int schedule_ordered_queue_enq_multi(uint32_t > queue_index, void *p_buf_hdr[], > return 0; > } > > -int queue_pktout_enq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr, > +int queue_pktout_enq(odp_queue_t queue, odp_buffer_hdr_t *buf_hdr, > int sustain) > { > queue_entry_t *origin_qe; > + queue_entry_t *qe; > uint64_t order; > int rc; > > @@ -505,8 +506,9 @@ int queue_pktout_enq(queue_entry_t *queue, > odp_buffer_hdr_t *buf_hdr, > > /* We can only complete the enq if we're in order */ > sched_enq_called(); > + qe = queue_to_qentry(queue); > if (order > origin_qe->s.order_out) { > - reorder_enq(queue, order, origin_qe, buf_hdr, sustain); > + reorder_enq(qe, order, origin_qe, buf_hdr, sustain); > > /* This enq can't complete until order is restored, so > * we're done here. > @@ -571,7 +573,7 @@ int queue_pktout_enq(queue_entry_t *queue, > odp_buffer_hdr_t *buf_hdr, > int release_count, placeholder_count; > > /* Send released buffers as well */ > - if (reorder_deq(queue, origin_qe, &reorder_tail, &placeholder_buf, > + if (reorder_deq(qe, origin_qe, &reorder_tail, &placeholder_buf, > &release_count, &placeholder_count)) { > xmit_buf = origin_qe->s.reorder_head; > origin_qe->s.reorder_head = reorder_tail->next; > @@ -616,7 +618,7 @@ int queue_pktout_enq(queue_entry_t *queue, > odp_buffer_hdr_t *buf_hdr, > return 0; > } > > -int queue_pktout_enq_multi(queue_entry_t *queue, odp_buffer_hdr_t > *buf_hdr[], > +int queue_pktout_enq_multi(odp_queue_t queue, odp_buffer_hdr_t > *buf_hdr[], > int num, int sustain) > { > int i, rc; > diff --git a/platform/linux-generic/odp_traffic_mngr.c > b/platform/linux-generic/odp_traffic_mngr.c > index 62e5c63..7a4c3dd 100644 > --- a/platform/linux-generic/odp_traffic_mngr.c > +++ b/platform/linux-generic/odp_traffic_mngr.c > @@ -1866,7 +1866,7 @@ static int tm_enqueue(tm_system_t *tm_system, > /* If we're from an ordered queue and not in order > * record the event and wait until order is resolved > */ > - if (queue_tm_reorder(&tm_queue_obj->tm_qentry, &pkt_hdr->buf_hdr)) > + if (queue_tm_reorder(tm_queue_obj->queue, &pkt_hdr->buf_hdr)) > return 0; > > tm_group = GET_TM_GROUP(tm_system->odp_tm_group); > @@ -3868,6 +3868,7 @@ odp_tm_queue_t odp_tm_queue_create(odp_tm_t odp_tm, > odp_tm_wred_t wred_profile; > tm_system_t *tm_system; > uint32_t color; > + char name[ODP_QUEUE_NAME_LEN]; > > /* Allocate a tm_queue_obj_t record. */ > tm_system = GET_TM_SYSTEM(odp_tm); > @@ -3900,10 +3901,11 @@ odp_tm_queue_t odp_tm_queue_create(odp_tm_t odp_tm, > tm_queue_obj->_odp_int_pkt_queue = _odp_int_pkt_queue; > tm_queue_obj->pkt = ODP_PACKET_INVALID; > odp_ticketlock_init(&tm_wred_node->tm_wred_node_lock); > - > - tm_queue_obj->tm_qentry.s.type = ODP_QUEUE_TYPE_TM; > - tm_queue_obj->tm_qentry.s.enqueue = queue_tm_reenq; > - tm_queue_obj->tm_qentry.s.enqueue_multi = queue_tm_reenq_multi; > + snprintf(name, sizeof(name), "odp-tm-%i",tm_queue_obj->tm_idx); > + tm_queue_obj->queue = odp_queue_create(name, NULL); > + queue_set_type(tm_queue_obj->queue, ODP_QUEUE_TYPE_TM); > + queue_set_enq_func(tm_queue_obj->queue, queue_tm_reenq); > + queue_set_enq_multi_func(tm_queue_obj->queue, > queue_tm_reenq_multi); > > tm_system->queue_num_tbl[tm_queue_obj->queue_num - 1] = > tm_queue_obj; > odp_ticketlock_lock(&tm_system->tm_system_lock); > @@ -3972,6 +3974,9 @@ int odp_tm_queue_destroy(odp_tm_queue_t tm_queue) > } > > /* Now that all of the checks are done, time to so some freeing. */ > + if(odp_queue_destroy(tm_queue_obj->queue)) > + return -1; > + > odp_ticketlock_lock(&tm_system->tm_system_lock); > tm_system->queue_num_tbl[tm_queue_obj->queue_num - 1] = NULL; > > diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/ > pktio/loop.c > index 21d7542..d81ae09 100644 > --- a/platform/linux-generic/pktio/loop.c > +++ b/platform/linux-generic/pktio/loop.c > @@ -55,7 +55,6 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int > index ODP_UNUSED, > { > int nbr, i; > odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX]; > - queue_entry_t *qentry; > odp_packet_hdr_t *pkt_hdr; > odp_packet_hdr_t parsed_hdr; > odp_packet_t pkt; > @@ -69,8 +68,7 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int > index ODP_UNUSED, > > odp_ticketlock_lock(&pktio_entry->s.rxl); > > - qentry = queue_to_qentry(pktio_entry->s.pkt_loop.loopq); > - nbr = queue_deq_multi(qentry, hdr_tbl, len); > + nbr = queue_deq_multi(pktio_entry->s.pkt_loop.loopq, hdr_tbl, > len); > > if (pktio_entry->s.config.pktin.bit.ts_all || > pktio_entry->s.config.pktin.bit.ts_ptp) { > @@ -153,7 +151,6 @@ static int loopback_send(pktio_entry_t *pktio_entry, > int index ODP_UNUSED, > const odp_packet_t pkt_tbl[], int len) > { > odp_buffer_hdr_t *hdr_tbl[QUEUE_MULTI_MAX]; > - queue_entry_t *qentry; > int i; > int ret; > uint32_t bytes = 0; > @@ -168,8 +165,7 @@ static int loopback_send(pktio_entry_t *pktio_entry, > int index ODP_UNUSED, > > odp_ticketlock_lock(&pktio_entry->s.txl); > > - qentry = queue_to_qentry(pktio_entry->s.pkt_loop.loopq); > - ret = queue_enq_multi(qentry, hdr_tbl, len, 0); > + ret = queue_enq_multi(pktio_entry->s.pkt_loop.loopq, hdr_tbl, > len, 0); > > if (ret > 0) { > pktio_entry->s.stats.out_ucast_pkts += ret; > -- > 1.9.1 > > -- Mike Holmes Program Manager - Linaro Networking Group Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs "Work should be fun and collaborative, the rest follows"