From patchwork Thu Aug 9 12:00:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 143825 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2003598ljj; Thu, 9 Aug 2018 05:01:24 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzJDsDWfbo6tgJnl4F97M4kQ+ytlgF6asGVCXFSqSQQfWXVjjizWJhhKnuOHFzD4FeXBiA1 X-Received: by 2002:ac8:71c9:: with SMTP id i9-v6mr1604305qtp.22.1533816084831; Thu, 09 Aug 2018 05:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533816084; cv=none; d=google.com; s=arc-20160816; b=aml/Y7KhbtROOMI95X53vALnInGuw9wey5OcQmrSzfazOKIJRI7ZHwXxxWFsnXDT8r lug0skPENZFubKkbJhxCmVmVwf2bx81Y8B2ky5Awnv3fZs53BK3ikN/t5ZzhATSEb+ET jmR7lIav6ngGWiLf/ku5NAAdGhRwuE77scYGl/XLMWUlCageIDl5G0bpVSpn7GB9wSo7 BPQrkEFUwE+Vdk7ECKyY3LuI2jYy/i7wdXF6W5VAVZgNjfdqxX/O80IxrIFxjG+6GHOO Gdw5OBUTRn4vixG23APrKb878RVEI0nAptgR44Hop61JKuOzeRy7t6xkBpdUGNH4T8Tn AYwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=/UmGcz0JOIrgQV5WR9+H/UCNT6BNlG8ncjGDddVHVX0=; b=Zr8c+ZynVEPQZHUsglHbm5rBhd/RlK6+fEv3MdE1iufeU9NE2zkwvxpj94X8+PiKgK FQ4RB/vA+klGFmxcJaTWfVmzaOpfOWhcov4RoKiYVQibSLC0m/tTpbPAWhjuRlqsNLZw C7HjQhz8L+C5draG5YI8NquvFhMupSQhhuES2ZmpLjLi6DftGZpIo5cvUykpfQ6ojYXC /W622IG6NgSAbIN2TE1lrcAPLlSxfkIF90GWUIS3facdJLJ1lcb2CnYjE7XmE+/K9uKN F3e1lnOIWBulwsFQ95MHJ24dVTE/voKV3PXMLrTDpTvClD+eSBr/OlH5yOoA0cmN0g/f u0iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id p66-v6si2494191qkc.39.2018.08.09.05.01.24; Thu, 09 Aug 2018 05:01:24 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 340436861C; Thu, 9 Aug 2018 12:01:24 +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=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW 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 712F360736; Thu, 9 Aug 2018 12:01:20 +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 05B596861F; Thu, 9 Aug 2018 12:01:14 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 6097F68625 for ; Thu, 9 Aug 2018 12:00:12 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 678895D85284 for ; Thu, 9 Aug 2018 15:00:10 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 5Pky7r6FsN-0ALOgD3Y; Thu, 09 Aug 2018 15:00:10 +0300 Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id M6ygb3U54b-09vioXT3; Thu, 09 Aug 2018 15:00:09 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 9 Aug 2018 12:00:06 +0000 Message-Id: <1533816007-30726-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533816007-30726-1-git-send-email-odpbot@yandex.ru> References: <1533816007-30726-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 669 Subject: [lng-odp] [PATCH API-NEXT v1 2/3] linux-gen: packet: implementation subtype api 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Add inlined implementation of the new subtype API call and use that internally. Signed-off-by: Petri Savolainen --- /** Email created from pull request 669 (psavol:next-packet-subtype) ** https://github.com/Linaro/odp/pull/669 ** Patch: https://github.com/Linaro/odp/pull/669.patch ** Base sha: 9b2b5a9695ad66977c964c83691cd2fef4c45b85 ** Merge commit sha: 3a6201b601ab55e07cbfd561fa9904ba48035478 **/ .../include/odp/api/plat/packet_inline_types.h | 1 + .../linux-generic/include/odp/api/plat/packet_inlines.h | 7 +++++++ platform/linux-generic/include/odp_packet_internal.h | 5 ----- platform/linux-generic/odp_event.c | 5 +++-- platform/linux-generic/odp_packet.c | 3 ++- platform/linux-generic/pktio/loop.c | 3 ++- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h index 9a285fe4a..ca3abbfab 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h @@ -45,6 +45,7 @@ typedef struct _odp_packet_inline_offset_t { uint16_t timestamp; uint16_t input_flags; uint16_t flags; + uint16_t subtype; } _odp_packet_inline_offset_t; diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index e2c32728c..ec5beb819 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -64,6 +65,7 @@ #define odp_packet_to_event __odp_packet_to_event #define odp_packet_from_event_multi __odp_packet_from_event_multi #define odp_packet_to_event_multi __odp_packet_to_event_multi + #define odp_packet_subtype __odp_packet_subtype #else #undef _ODP_INLINE #define _ODP_INLINE @@ -355,6 +357,11 @@ _ODP_INLINE void odp_packet_to_event_multi(const odp_packet_t pkt[], ev[i] = odp_packet_to_event(pkt[i]); } +_ODP_INLINE odp_event_subtype_t odp_packet_subtype(odp_packet_t pkt) +{ + return (odp_event_subtype_t)_odp_pkt_get(pkt, int8_t, subtype); +} + /** @endcond */ #endif diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index cd2db2ecd..9b995c61c 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -155,11 +155,6 @@ static inline seg_entry_t *seg_entry_last(odp_packet_hdr_t *hdr) return &last->buf_hdr.seg[last_seg]; } -static inline odp_event_subtype_t packet_subtype(odp_packet_t pkt) -{ - return packet_hdr(pkt)->subtype; -} - static inline void packet_subtype_set(odp_packet_t pkt, int ev) { packet_hdr(pkt)->subtype = ev; diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index fa20af5f5..bb378528b 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -19,6 +19,7 @@ /* Inlined API functions */ #include +#include odp_event_subtype_t odp_event_subtype(odp_event_t event) { @@ -26,7 +27,7 @@ odp_event_subtype_t odp_event_subtype(odp_event_t event) ODP_EVENT_PACKET) return ODP_EVENT_NO_SUBTYPE; - return packet_subtype(odp_packet_from_event(event)); + return odp_packet_subtype(odp_packet_from_event(event)); } odp_event_type_t odp_event_types(odp_event_t event, @@ -36,7 +37,7 @@ odp_event_type_t odp_event_types(odp_event_t event, odp_event_type_t event_type = _odp_buffer_event_type(buf); *subtype = event_type == ODP_EVENT_PACKET ? - packet_subtype(odp_packet_from_event(event)) : + odp_packet_subtype(odp_packet_from_event(event)) : ODP_EVENT_NO_SUBTYPE; return event_type; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 11f8bd43d..7bb93e1e1 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -50,7 +50,8 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE _odp_packet_inline = { .flow_hash = offsetof(odp_packet_hdr_t, flow_hash), .timestamp = offsetof(odp_packet_hdr_t, timestamp), .input_flags = offsetof(odp_packet_hdr_t, p.input_flags), - .flags = offsetof(odp_packet_hdr_t, p.flags) + .flags = offsetof(odp_packet_hdr_t, p.flags), + .subtype = offsetof(odp_packet_hdr_t, subtype) }; diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index faaef3ab5..4c0cba3f9 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -309,7 +310,7 @@ static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED, for (i = 0; i < nb_tx; ++i) { odp_ipsec_packet_result_t result; - if (packet_subtype(pkt_tbl[i]) == + if (odp_packet_subtype(pkt_tbl[i]) == ODP_EVENT_PACKET_IPSEC && pktio_entry->s.config.outbound_ipsec) {