From patchwork Thu Nov 5 14:06:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 56051 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp426627lbr; Thu, 5 Nov 2015 06:09:12 -0800 (PST) X-Received: by 10.140.20.116 with SMTP id 107mr7435812qgi.40.1446732552752; Thu, 05 Nov 2015 06:09:12 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j197si4549859qhc.96.2015.11.05.06.09.12; Thu, 05 Nov 2015 06:09:12 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id 4BF6B619C3; Thu, 5 Nov 2015 14:09:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 749A7619C9; Thu, 5 Nov 2015 14:08:09 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id E31996199B; Thu, 5 Nov 2015 14:07:58 +0000 (UTC) Received: from mail-ob0-f173.google.com (mail-ob0-f173.google.com [209.85.214.173]) by lists.linaro.org (Postfix) with ESMTPS id 31F936199A for ; Thu, 5 Nov 2015 14:07:12 +0000 (UTC) Received: by obbza9 with SMTP id za9so66775309obb.1 for ; Thu, 05 Nov 2015 06:07:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1FrzMfhPZyV4cgdva6AtphB4rjC8PTfVckDe1Q31J0k=; b=AwG5EJrg93BdDXV4IZ3LcB+9eewWA8FjftooNmral66hvc7QvsSjTbryH00fXHtoWk RHaq0yXWluwsJajDwTYk/MboXrvrAmNv9rf8ttDvXK0fK4ZjKCIoXKmBkPBMQBuElAYG vhqZjoRPK/AKI9zzyF0o2k/N9XoygweHS5rfR+gdQPopJeeWdweaJjWdhrffQyw7ZVmk DF7plN3/i1nft1OtOWbZDrHxx99F8AafOeehvoIPJ+Oua51rPuyJnjo05MW/u0Gf17cJ MwzxLdmwPzZXX83kFy3ta78xi0rJWmekyQ7BSD9HSoMBWWGZEZr7wB4u6HrJQRQGacfu fPjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1FrzMfhPZyV4cgdva6AtphB4rjC8PTfVckDe1Q31J0k=; b=NqOxDom25UR1YUXkmlfiM0URtQSOWIE+P/nxRWbU2eUM9di674op3I6zx12bqa22qk LB37iIuYFkS6SNIdme2tUXqfAbURHcn52KzgiFE0QxbF9N7eKsXDgofLUViJE1z/RwTn L+FaibyW3HD6aq8zRv3Nyu4nGqO+CdNNJTdkrzcdv3U8AxuyeJR0+SnzbHx9f/AgyF6U IbJrILdPJtoFeeL33rIpE6XgaKtjRTO+qF1d6RTOIa2H2ZIhKClrRbKkn+zT6gtTpJih Nv/FkUWrc74V2P2rkmRIH83H84xTHrSmX+/6AKco2sztsS6ZK2fJmWvn803OBkjWPtof jC8w== X-Gm-Message-State: ALoCoQnPNnfP1e2Pspn8bRKJX0eLPjrtj9SA4tQwEBo1Y/js9LhfgNBV9oPzCLr3k8HIHXKtPJRF X-Received: by 10.182.88.165 with SMTP id bh5mr4514032obb.21.1446732431668; Thu, 05 Nov 2015 06:07:11 -0800 (PST) Received: from Ubuntu15.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id w139sm2656511oiw.16.2015.11.05.06.07.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 06:07:11 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 5 Nov 2015 08:06:59 -0600 Message-Id: <1446732420-27235-4-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1446732420-27235-1-git-send-email-bill.fischofer@linaro.org> References: <1446732420-27235-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Cc: Barry Spinney Subject: [lng-odp] [API-NEXT PATCHv8 3/4] linux-generic: tm: add tm to build X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Barry Spinney This commit causes the traffic_mgr to become part of the ODP linux-generic build. Signed-off-by: Barry Spinney Signed-off-by: Bill Fischofer --- 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 --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; } -