diff mbox

[API-NEXT,PATCHv8,3/4] linux-generic: tm: add tm to build

Message ID 1446732420-27235-4-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Nov. 5, 2015, 2:06 p.m. UTC
From: Barry Spinney <spinney@ezchip.com>

This commit causes the traffic_mgr to become part of the ODP linux-generic
build.

Signed-off-by: Barry Spinney <spinney@ezchip.com>
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/Makefile.am            | 13 ++++++++
 platform/linux-generic/include/odp_internal.h |  2 ++
 platform/linux-generic/odp_init.c             |  5 +++
 platform/linux-generic/odp_packet_flags.c     | 46 ++++++++++++++++++++++++++-
 4 files changed, 65 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 610c79c..3e6df94 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -51,6 +51,7 @@  odpinclude_HEADERS = \
 		  $(srcdir)/include/odp/ticketlock.h \
 		  $(srcdir)/include/odp/time.h \
 		  $(srcdir)/include/odp/timer.h \
+		  $(srcdir)/include/odp/traffic_mngr.h \
 		  $(srcdir)/include/odp/version.h
 
 odpplatincludedir= $(includedir)/odp/plat
@@ -77,6 +78,7 @@  odpplatinclude_HEADERS = \
 		  $(srcdir)/include/odp/plat/thrmask_types.h \
 		  $(srcdir)/include/odp/plat/ticketlock_types.h \
 		  $(srcdir)/include/odp/plat/timer_types.h \
+		  $(srcdir)/include/odp/plat/traffic_mngr_types.h \
 		  $(srcdir)/include/odp/plat/version_types.h
 
 odpapiincludedir= $(includedir)/odp/api
@@ -121,6 +123,7 @@  odpapiinclude_HEADERS = \
 		  $(top_srcdir)/include/odp/api/ticketlock.h \
 		  $(top_srcdir)/include/odp/api/time.h \
 		  $(top_srcdir)/include/odp/api/timer.h \
+		  $(top_srcdir)/include/odp/api/traffic_mngr.h \
 		  $(top_srcdir)/include/odp/api/version.h
 
 noinst_HEADERS = \
@@ -136,16 +139,21 @@  noinst_HEADERS = \
 		  ${srcdir}/include/odp_debug_internal.h \
 		  ${srcdir}/include/odp_forward_typedefs_internal.h \
 		  ${srcdir}/include/odp_internal.h \
+		  ${srcdir}/include/odp_name_table_internal.h \
 		  ${srcdir}/include/odp_packet_internal.h \
 		  ${srcdir}/include/odp_packet_io_internal.h \
 		  ${srcdir}/include/odp_packet_io_queue.h \
 		  ${srcdir}/include/odp_packet_netmap.h \
 		  ${srcdir}/include/odp_packet_socket.h \
+		  ${srcdir}/include/odp_pkt_queue_internal.h \
 		  ${srcdir}/include/odp_pool_internal.h \
 		  ${srcdir}/include/odp_queue_internal.h \
 		  ${srcdir}/include/odp_schedule_internal.h \
+		  ${srcdir}/include/odp_sorted_list_internal.h \
 		  ${srcdir}/include/odp_spin_internal.h \
 		  ${srcdir}/include/odp_timer_internal.h \
+		  ${srcdir}/include/odp_timer_wheel_internal.h \
+		  ${srcdir}/include/odp_traffic_mngr_internal.h \
 		  ${srcdir}/include/odp_cpu_internal.h \
 		  ${srcdir}/Makefile.inc
 
@@ -162,6 +170,7 @@  __LIB__libodp_la_SOURCES = \
 			   odp_hash.c \
 			   odp_init.c \
 			   odp_impl.c \
+			   odp_name_table.c \
 			   odp_packet.c \
 			   odp_packet_flags.c \
 			   odp_packet_io.c \
@@ -170,12 +179,14 @@  __LIB__libodp_la_SOURCES = \
 			   pktio/netmap.c \
 			   pktio/socket.c \
 			   pktio/socket_mmap.c \
+			   odp_pkt_queue.c \
 			   odp_pool.c \
 			   odp_queue.c \
 			   odp_rwlock.c \
 			   odp_rwlock_recursive.c \
 			   odp_schedule.c \
 			   odp_shared_memory.c \
+			   odp_sorted_list.c \
 			   odp_spinlock.c \
 			   odp_spinlock_recursive.c \
 			   odp_system_info.c \
@@ -184,6 +195,8 @@  __LIB__libodp_la_SOURCES = \
 			   odp_ticketlock.c \
 			   odp_time.c \
 			   odp_timer.c \
+			   odp_timer_wheel.c \
+			   odp_traffic_mngr.c \
 			   odp_version.c \
 			   odp_weak.c \
 			   arch/@ARCH@/odp_cpu_cycles.c
diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h
index 14ba159..74e48a9 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -79,6 +79,8 @@  int odp_schedule_term_local(void);
 int odp_timer_init_global(void);
 int odp_timer_disarm_all(void);
 
+int odp_tm_init_global(void);
+
 void _odp_flush_caches(void);
 
 #ifdef __cplusplus
diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c
index 5e19d86..7f35962 100644
--- a/platform/linux-generic/odp_init.c
+++ b/platform/linux-generic/odp_init.c
@@ -71,6 +71,11 @@  int odp_init_global(const odp_init_t *params,
 		return -1;
 	}
 
+	if (odp_tm_init_global()) {
+		ODP_ERR("ODP traffic manager init failed\n");
+		return -1;
+	}
+
 	return 0;
 }
 
diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c
index dbc3137..3537aa9 100644
--- a/platform/linux-generic/odp_packet_flags.c
+++ b/platform/linux-generic/odp_packet_flags.c
@@ -129,6 +129,51 @@  int odp_packet_has_flow_hash(odp_packet_t pkt)
 	return pkt_hdr->has_hash;
 }
 
+odp_packet_color_t odp_packet_color(odp_packet_t pkt)
+{
+	retflag(pkt, input_flags.color);
+}
+
+void odp_packet_color_set(odp_packet_t pkt, odp_packet_color_t color)
+{
+	odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
+
+	if (packet_parse_not_complete(pkt_hdr))
+		packet_parse_full(pkt_hdr);
+
+	pkt_hdr->input_flags.color = color;
+}
+
+odp_bool_t odp_packet_drop_eligible(odp_packet_t pkt)
+{
+	odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
+
+	if (packet_parse_not_complete(pkt_hdr))
+		packet_parse_full(pkt_hdr);
+
+	return !pkt_hdr->input_flags.nodrop;
+}
+
+void odp_packet_drop_eligible_set(odp_packet_t pkt, odp_bool_t drop)
+{
+	setflag(pkt, input_flags.nodrop, !drop);
+}
+
+int8_t odp_packet_shaper_len_adjust(odp_packet_t pkt)
+{
+	retflag(pkt, output_flags.shaper_len_adj);
+}
+
+void odp_packet_shaper_len_adjust_set(odp_packet_t pkt, int8_t adj)
+{
+	odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt);
+
+	if (packet_parse_not_complete(pkt_hdr))
+		packet_parse_full(pkt_hdr);
+
+	pkt_hdr->output_flags.shaper_len_adj = adj;
+}
+
 /* Set Input Flags */
 
 void odp_packet_has_l2_set(odp_packet_t pkt, int val)
@@ -222,4 +267,3 @@  void odp_packet_has_flow_hash_clr(odp_packet_t pkt)
 
 	pkt_hdr->has_hash = 0;
 }
-