From patchwork Fri Apr 15 07:21:13 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: 65880 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1027982qge; Fri, 15 Apr 2016 00:26:48 -0700 (PDT) X-Received: by 10.141.44.69 with SMTP id v66mr24678136qhe.62.1460705208818; Fri, 15 Apr 2016 00:26:48 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id k33si18553336qkh.127.2016.04.15.00.26.48; Fri, 15 Apr 2016 00:26:48 -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 71D6A61E50; Fri, 15 Apr 2016 07:26:48 +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 3E23567504; Fri, 15 Apr 2016 07:21:59 +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 0936567525; Fri, 15 Apr 2016 07:21:52 +0000 (UTC) Received: from demumfd002.nsn-inter.net (demumfd002.nsn-inter.net [93.183.12.31]) by lists.linaro.org (Postfix) with ESMTPS id D6B2967436 for ; Fri, 15 Apr 2016 07:21:20 +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 u3F7LJLD026717 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Apr 2016 07:21:19 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 u3F7LEva001646 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Fri, 15 Apr 2016 09:21:19 +0200 From: Matias Elo To: lng-odp@lists.linaro.org Date: Fri, 15 Apr 2016 10:21:13 +0300 Message-Id: <1460704874-21163-11-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: 5102 X-purgate-ID: 151667::1460704879-00002418-90D555B8/0/0 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 10/11] linux-generic: pktio: add pktin timestamp argument to _odp_packet_cls_enq() 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" _odp_packet_cls_enq() allocates new odp packets internally. Add new packet timestamp argument to enable adding input timestamps to these packets. Signed-off-by: Matias Elo --- .../linux-generic/include/odp_packet_io_internal.h | 3 ++- platform/linux-generic/pktio/dpdk.c | 2 +- platform/linux-generic/pktio/netmap.c | 2 +- platform/linux-generic/pktio/pktio_common.c | 18 +++++++++++------- platform/linux-generic/pktio/socket.c | 3 ++- platform/linux-generic/pktio/socket_mmap.c | 3 ++- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index a807d13..9fc13a9 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -211,7 +211,8 @@ typedef struct pktio_if_ops { } pktio_if_ops_t; int _odp_packet_cls_enq(pktio_entry_t *pktio_entry, const uint8_t *base, - uint16_t buf_len, odp_packet_t *pkt_ret); + uint16_t buf_len, odp_time_t *ts, + odp_packet_t *pkt_ret); extern void *pktio_entry_ptr[]; diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 83fb1ba..3845448 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -677,7 +677,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, if (pktio_cls_enabled(pktio_entry)) { if (_odp_packet_cls_enq(pktio_entry, (const uint8_t *)buf, pkt_len, - &pkt_table[nb_pkts])) + NULL, &pkt_table[nb_pkts])) nb_pkts++; } else { pkt = packet_alloc(pktio_entry->s.pkt_dpdk.pool, diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 0b794a0..9112ba3 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -586,7 +586,7 @@ static inline int netmap_pkt_to_odp(pktio_entry_t *pktio_entry, if (pktio_cls_enabled(pktio_entry)) { ret = _odp_packet_cls_enq(pktio_entry, (const uint8_t *)buf, - len, pkt_out); + len, NULL, pkt_out); if (ret) return 0; return -1; diff --git a/platform/linux-generic/pktio/pktio_common.c b/platform/linux-generic/pktio/pktio_common.c index c568da3..e7bb3d8 100644 --- a/platform/linux-generic/pktio/pktio_common.c +++ b/platform/linux-generic/pktio/pktio_common.c @@ -10,18 +10,19 @@ int _odp_packet_cls_enq(pktio_entry_t *pktio_entry, const uint8_t *base, uint16_t buf_len, - odp_packet_t *pkt_ret) + odp_time_t *ts, odp_packet_t *pkt_ret) { cos_t *cos; odp_packet_t pkt; - odp_packet_hdr_t pkt_hdr; + odp_packet_hdr_t *pkt_hdr; + odp_packet_hdr_t src_pkt_hdr; int ret; odp_pool_t pool; - packet_parse_reset(&pkt_hdr); + packet_parse_reset(&src_pkt_hdr); - _odp_cls_parse(&pkt_hdr, base); - cos = pktio_select_cos(pktio_entry, base, &pkt_hdr); + _odp_cls_parse(&src_pkt_hdr, base); + cos = pktio_select_cos(pktio_entry, base, &src_pkt_hdr); /* if No CoS found then drop the packet */ if (cos == NULL || cos->s.queue == NULL || cos->s.pool == NULL) @@ -32,15 +33,18 @@ int _odp_packet_cls_enq(pktio_entry_t *pktio_entry, pkt = odp_packet_alloc(pool, buf_len); if (odp_unlikely(pkt == ODP_PACKET_INVALID)) return 0; + pkt_hdr = odp_packet_hdr(pkt); - copy_packet_parser_metadata(&pkt_hdr, odp_packet_hdr(pkt)); - odp_packet_hdr(pkt)->input = pktio_entry->s.handle; + copy_packet_parser_metadata(&src_pkt_hdr, pkt_hdr); + pkt_hdr->input = pktio_entry->s.handle; if (odp_packet_copydata_in(pkt, 0, buf_len, base) != 0) { odp_packet_free(pkt); return 0; } + packet_set_ts(pkt_hdr, ts); + /* Parse and set packet header data */ odp_packet_pull_tail(pkt, odp_packet_len(pkt) - buf_len); ret = queue_enq(cos->s.queue, odp_buf_to_hdr((odp_buffer_t)pkt), 0); diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 44f18c2..e28fd07 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -650,7 +650,8 @@ static int sock_mmsg_recv(pktio_entry_t *pktio_entry, continue; ret = _odp_packet_cls_enq(pktio_entry, base, - pkt_len, &pkt_table[nb_rx]); + pkt_len, NULL, + &pkt_table[nb_rx]); if (ret) nb_rx++; } diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index da0f7b7..5cd1ad6 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -149,7 +149,8 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, if (pktio_cls_enabled(pktio_entry)) { ret = _odp_packet_cls_enq(pktio_entry, pkt_buf, - pkt_len, &pkt_table[nb_rx]); + pkt_len, NULL, + &pkt_table[nb_rx]); if (ret) nb_rx++; } else {