From patchwork Fri Apr 15 07:21:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elo, Matias \(Nokia - FI/Espoo\)" X-Patchwork-Id: 65878 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1027618qge; Fri, 15 Apr 2016 00:25:40 -0700 (PDT) X-Received: by 10.140.104.13 with SMTP id z13mr23177603qge.68.1460705140450; Fri, 15 Apr 2016 00:25:40 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a192si182239qkb.70.2016.04.15.00.25.40; Fri, 15 Apr 2016 00:25:40 -0700 (PDT) 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; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id 0AB9662D1B; Fri, 15 Apr 2016 07:25:40 +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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 A1A8B674F3; Fri, 15 Apr 2016 07:21:51 +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 3D5BC67467; Fri, 15 Apr 2016 07:21:24 +0000 (UTC) Received: from demumfd002.nsn-inter.net (demumfd002.nsn-inter.net [93.183.12.31]) by lists.linaro.org (Postfix) with ESMTPS id 8B0276200C for ; Fri, 15 Apr 2016 07:21:18 +0000 (UTC) Received: from demuprx016.emea.nsn-intra.net ([10.150.129.55]) by demumfd002.nsn-inter.net (8.15.2/8.15.2) with ESMTPS id u3F7LGRX026615 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Apr 2016 07:21:17 GMT Received: from 10.144.19.15 ([10.144.104.112]) by demuprx016.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id u3F7LEvT001646 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Fri, 15 Apr 2016 09:21:15 +0200 From: Matias Elo To: lng-odp@lists.linaro.org Date: Fri, 15 Apr 2016 10:21:06 +0300 Message-Id: <1460704874-21163-4-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460704874-21163-1-git-send-email-matias.elo@nokia.com> References: <1460704874-21163-1-git-send-email-matias.elo@nokia.com> X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 6267 X-purgate-ID: 151667::1460704877-00002418-FCE5B191/0/0 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 03/11] linux-generic: pktio: implement odp_pktin_ts_res() 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" Add default implementations for odp_pktin_ts_res() using odp global time. Signed-off-by: Matias Elo --- platform/linux-generic/include/odp_packet_io_internal.h | 1 + platform/linux-generic/odp_packet_io.c | 17 +++++++++++++++++ platform/linux-generic/pktio/dpdk.c | 1 + platform/linux-generic/pktio/ipc.c | 3 ++- platform/linux-generic/pktio/loop.c | 1 + platform/linux-generic/pktio/netmap.c | 1 + platform/linux-generic/pktio/pcap.c | 1 + platform/linux-generic/pktio/socket.c | 1 + platform/linux-generic/pktio/socket_mmap.c | 1 + platform/linux-generic/pktio/tap.c | 3 ++- 10 files changed, 28 insertions(+), 2 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index aaa9387..c76ea1f 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -184,6 +184,7 @@ typedef struct pktio_if_ops { int (*stop)(pktio_entry_t *pktio_entry); int (*stats)(pktio_entry_t *pktio_entry, odp_pktio_stats_t *stats); int (*stats_reset)(pktio_entry_t *pktio_entry); + uint64_t (*pktin_ts_res)(pktio_entry_t *pktio_entry); int (*recv)(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[], unsigned len); int (*send)(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[], diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 574f987..295a758 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -921,6 +921,23 @@ int odp_pktio_info(odp_pktio_t id, odp_pktio_info_t *info) return 0; } +uint64_t odp_pktin_ts_res(odp_pktio_t id) +{ + pktio_entry_t *entry; + + entry = get_pktio_entry(id); + + if (entry == NULL) { + ODP_DBG("pktio entry %d does not exist\n", id); + return 0; + } + + if (entry->s.ops->pktin_ts_res) + return entry->s.ops->pktin_ts_res(entry); + + return odp_time_global_res(); +} + void odp_pktio_print(odp_pktio_t id) { pktio_entry_t *entry; diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 0e57d90..d67fb01 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -927,6 +927,7 @@ const pktio_if_ops_t dpdk_pktio_ops = { .promisc_mode_get = dpdk_promisc_mode_get, .mac_get = dpdk_mac_addr_get, .capability = dpdk_capability, + .pktin_ts_res = NULL, .input_queues_config = dpdk_input_queues_config, .output_queues_config = dpdk_output_queues_config }; diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c index ad8dc55..2a276ca 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -725,5 +725,6 @@ const pktio_if_ops_t ipc_pktio_ops = { .mtu_get = ipc_mtu_get, .promisc_mode_set = NULL, .promisc_mode_get = NULL, - .mac_get = ipc_mac_addr_get + .mac_get = ipc_mac_addr_get, + .pktin_ts_res = NULL, }; diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 0ea6d0e..1a7a572 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -184,6 +184,7 @@ const pktio_if_ops_t loopback_pktio_ops = { .mac_get = loopback_mac_addr_get, .link_status = loopback_link_status, .capability = NULL, + .pktin_ts_res = NULL, .input_queues_config = NULL, .output_queues_config = NULL, .recv_queue = NULL, diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 0e160c5..cf116fe 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -861,6 +861,7 @@ const pktio_if_ops_t netmap_pktio_ops = { .promisc_mode_get = netmap_promisc_mode_get, .mac_get = netmap_mac_addr_get, .capability = netmap_capability, + .pktin_ts_res = NULL, .input_queues_config = netmap_input_queues_config, .output_queues_config = netmap_output_queues_config, .recv_queue = netmap_recv_queue, diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index d1458bf..d33f04f 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -407,6 +407,7 @@ const pktio_if_ops_t pcap_pktio_ops = { .promisc_mode_get = pcapif_promisc_mode_get, .mac_get = pcapif_mac_addr_get, .capability = NULL, + .pktin_ts_res = NULL, .input_queues_config = NULL, .output_queues_config = NULL, .recv_queue = NULL, diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index edc36a1..7416a8c 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -856,6 +856,7 @@ const pktio_if_ops_t sock_mmsg_pktio_ops = { .mac_get = sock_mac_addr_get, .link_status = sock_link_status, .capability = NULL, + .pktin_ts_res = NULL, .input_queues_config = NULL, .output_queues_config = NULL, .recv_queue = NULL, diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index caca708..d36668a 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -625,6 +625,7 @@ const pktio_if_ops_t sock_mmap_pktio_ops = { .mac_get = sock_mmap_mac_addr_get, .link_status = sock_mmap_link_status, .capability = NULL, + .pktin_ts_res = NULL, .input_queues_config = NULL, .output_queues_config = NULL, .recv_queue = NULL, diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c index c895878..d075bbb 100644 --- a/platform/linux-generic/pktio/tap.c +++ b/platform/linux-generic/pktio/tap.c @@ -323,5 +323,6 @@ const pktio_if_ops_t tap_pktio_ops = { .mtu_get = tap_mtu_get, .promisc_mode_set = tap_promisc_mode_set, .promisc_mode_get = tap_promisc_mode_get, - .mac_get = tap_mac_addr_get + .mac_get = tap_mac_addr_get, + .pktin_ts_res = NULL, };