From patchwork Thu Apr 21 00:14:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 66263 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2742348qge; Wed, 20 Apr 2016 17:17:23 -0700 (PDT) X-Received: by 10.55.203.131 with SMTP id u3mr15239388qkl.16.1461197843547; Wed, 20 Apr 2016 17:17:23 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z129si2912qke.38.2016.04.20.17.17.23; Wed, 20 Apr 2016 17:17:23 -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=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 34AB168A4E; Thu, 21 Apr 2016 00:17:23 +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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 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 B620668A51; Thu, 21 Apr 2016 00:14:48 +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 D169D68A4E; Thu, 21 Apr 2016 00:14:44 +0000 (UTC) Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) by lists.linaro.org (Postfix) with ESMTPS id 00E81685FD for ; Thu, 21 Apr 2016 00:14:23 +0000 (UTC) Received: by mail-oi0-f49.google.com with SMTP id r78so61171457oie.0 for ; Wed, 20 Apr 2016 17:14:22 -0700 (PDT) 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=v2r4pzR0awnnXVwKqhH2VCdELwMgysk6UVpN9lGuCD0=; b=F8uYSFgA4OPx2MlxDhMlO8Ksth8+/Ooxj0zn6gm1JJEInxN5YaI2r0oYlIRABfM2iz KzXSnJLIKSkvzlPcjyOKH0sOJDokCvUc/iTCmeZpQABOw3Jru/NpfCkRG8gOSENqDpg7 7zEGMLKGeo1VyJBHVVJCzCkOvqntJJp2SwSxhC0MP4905iUtGf0a7XixS9iddD+akf0t OAqIoepFwDr4dZbhk7UWM/fuyEFmpDKAaoX7k729mcwksxo2JJ1NawXPAzH4OhdS8c8m qNg9tzrcFw+tQBXsDWWG5CMbTiuI4LAuNi7wIh0IxFFYAztYU//LPEfbIZp3PcLdisuE hDCg== X-Gm-Message-State: AOPr4FURLYcG4Z0n/SPE6C1qBNY7QvsOFcWIc66NUinG3JS1qYH+KemVZ5gRLv1Lg21lcwgtFxE= X-Received: by 10.202.107.148 with SMTP id g142mr4923173oic.38.1461197662425; Wed, 20 Apr 2016 17:14:22 -0700 (PDT) Received: from Ubuntu15.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id a34sm335otb.1.2016.04.20.17.14.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Apr 2016 17:14:21 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 20 Apr 2016 19:14:08 -0500 Message-Id: <1461197655-23743-5-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1461197655-23743-1-git-send-email-bill.fischofer@linaro.org> References: <1461197655-23743-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv4 04/11] linux-generic: pktio: implement odp_pktin_ts_from_ns() 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: Matias Elo Add default implementations for odp_pktin_ts_from_ns() using odp global time. Signed-off-by: Matias Elo Reviewed-and-tested-by: Bill Fischofer --- 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 | 1 + 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 | 1 + 10 files changed, 26 insertions(+) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index c76ea1f..ee7fc71 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -185,6 +185,7 @@ typedef struct pktio_if_ops { 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); + odp_time_t (*pktin_ts_from_ns)(pktio_entry_t *pktio_entry, uint64_t ns); 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 15a7de7..2650124 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -948,6 +948,23 @@ uint64_t odp_pktin_ts_res(odp_pktio_t id) return odp_time_global_res(); } +odp_time_t odp_pktin_ts_from_ns(odp_pktio_t id, uint64_t ns) +{ + pktio_entry_t *entry; + + entry = get_pktio_entry(id); + + if (entry == NULL) { + ODP_DBG("pktio entry %d does not exist\n", id); + return ODP_TIME_NULL; + } + + if (entry->s.ops->pktin_ts_from_ns) + return entry->s.ops->pktin_ts_from_ns(entry, ns); + + return odp_time_global_from_ns(ns); +} + 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 d67fb01..ea7b925 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -928,6 +928,7 @@ const pktio_if_ops_t dpdk_pktio_ops = { .mac_get = dpdk_mac_addr_get, .capability = dpdk_capability, .pktin_ts_res = NULL, + .pktin_ts_from_ns = 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 ca8eaa5..cd7e32f 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -727,4 +727,5 @@ const pktio_if_ops_t ipc_pktio_ops = { .promisc_mode_get = NULL, .mac_get = ipc_mac_addr_get, .pktin_ts_res = NULL, + .pktin_ts_from_ns = NULL, }; diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 1a7a572..396b769 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -185,6 +185,7 @@ const pktio_if_ops_t loopback_pktio_ops = { .link_status = loopback_link_status, .capability = NULL, .pktin_ts_res = NULL, + .pktin_ts_from_ns = 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 cf116fe..c2a6b34 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -862,6 +862,7 @@ const pktio_if_ops_t netmap_pktio_ops = { .mac_get = netmap_mac_addr_get, .capability = netmap_capability, .pktin_ts_res = NULL, + .pktin_ts_from_ns = 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 d33f04f..c8769f5 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -408,6 +408,7 @@ const pktio_if_ops_t pcap_pktio_ops = { .mac_get = pcapif_mac_addr_get, .capability = NULL, .pktin_ts_res = NULL, + .pktin_ts_from_ns = 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 7416a8c..c5cbc2d 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -857,6 +857,7 @@ const pktio_if_ops_t sock_mmsg_pktio_ops = { .link_status = sock_link_status, .capability = NULL, .pktin_ts_res = NULL, + .pktin_ts_from_ns = 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 d36668a..6d211ec 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -626,6 +626,7 @@ const pktio_if_ops_t sock_mmap_pktio_ops = { .link_status = sock_mmap_link_status, .capability = NULL, .pktin_ts_res = NULL, + .pktin_ts_from_ns = 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 d075bbb..abc49fa 100644 --- a/platform/linux-generic/pktio/tap.c +++ b/platform/linux-generic/pktio/tap.c @@ -325,4 +325,5 @@ const pktio_if_ops_t tap_pktio_ops = { .promisc_mode_get = tap_promisc_mode_get, .mac_get = tap_mac_addr_get, .pktin_ts_res = NULL, + .pktin_ts_from_ns = NULL, };