@@ -2613,6 +2613,13 @@ odp_tm_t odp_tm_create(const char *name,
uint32_t max_tm_queues, max_sorted_lists;
int rc;
+ /* If we are using pktio output (usual case) get the first associated
+ * pktout_queue for this pktio and fail if there isn't one.
+ */
+ if (egress->egress_kind == ODP_TM_EGRESS_PKT_IO &&
+ odp_pktout_queue(egress->pktio, &pktout, 1) != 1)
+ return ODP_TM_INVALID;
+
/* Allocate tm_system_t record. */
odp_ticketlock_lock(&tm_create_lock);
tm_system = tm_system_alloc();
@@ -2629,9 +2636,6 @@ odp_tm_t odp_tm_create(const char *name,
return ODP_TM_INVALID;
}
- if (odp_pktout_queue(egress->pktio, &pktout, 1) != 1)
- return ODP_TM_INVALID;
-
tm_system->pktout = pktout;
tm_system->name_tbl_id = name_tbl_id;
max_tm_queues = requirements->max_tm_queues;
Resolve bug https://bugs.linaro.org/show_bug.cgi?id=2458 by only checking for a proper pktout_queue count if the egress_kind is ODP_TM_EGRESS_PKT_IO. This check is also moved before locking and allocating a tm_system struct to avoid deadlocks and memory leaks that were another side-effect of this bug. Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- platform/linux-generic/odp_traffic_mngr.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.7.4