From patchwork Wed Feb 7 10:59:58 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: 127146 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp355982ljc; Wed, 7 Feb 2018 03:03:23 -0800 (PST) X-Google-Smtp-Source: AH8x227buATc0Tj/TMf5HKwROa/+waNt46rkprQg3lPNDt+ummRIDbvwIg5G8eE/ABVJsAQ51oc9 X-Received: by 10.237.33.130 with SMTP id l2mr1755895qtc.100.1518001403326; Wed, 07 Feb 2018 03:03:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518001403; cv=none; d=google.com; s=arc-20160816; b=N9yFBOG5cde0w7P1P2dCG0FRrPp2pxaGxUSTDuQMh5m/PLZhNIqE7LTvUaDAm05xUt 0LvC3zXW98CDFDZqR0CUkqDsGUpnrqutjV92OX165UTPl5TyrxfLK326PqMdPdJB6iNT ljsPibdA7e0fuPERt9x4YGldYxZVNU1bhuYHDB0WnKnYBUFEeECQKGU2sKibFouahvYV TgIMAXlaWcQ3W8WYmsTPeW3VcbRVObadmUysGc5J1dXswZeIpCd05HRE+w4Vlo1+PD03 OHb2nHZiY9jGBy9V1+7mGzDR/Qx9rNLViAOF8rNePQWNaHw8GpHDVCW9sUXMhGt+eIEw EdUw== 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=NOciIT1axqvb+Q+wjnQytVWG3gJqtzIyRrD1xLUJTGs=; b=ql/zRyBvCDjq1g6VHtv/7MghgrQBI15jfAx6gENPnmQZq9xvxy5C09ZgPX4dZ5yJrr nbJ774a0ZqxRtpulUynamDZDmkSuekMQh4r6omwIp7GldwWECGhuv8LKf+XhwhAJBHAl +DCwK/H/OQEVXzqvuky6MKXYU/avbiPsVGV9W18beESBNsJBuC7OjydRnjTSKOS6JDOB ruB1mAdv2LZaQRvdQt9KzonS8bSayJ5OmISk9ebw89sXMg7Og/u9NPVsEpF2ig7iNaV4 Xr6eeM8VOQtgwqK+t+/UCgiZV0e6ZOwlYPD7cqn5uBhOpwlFp0AW1u/zrmsSoejJIpBU LvBA== 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 v22si1198924qka.234.2018.02.07.03.03.23; Wed, 07 Feb 2018 03:03:23 -0800 (PST) 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 00701622AC; Wed, 7 Feb 2018 11:03:22 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 EC9CE617C9; Wed, 7 Feb 2018 11:02: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 5EFA161819; Wed, 7 Feb 2018 11:02:17 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id D0BC560A6E for ; Wed, 7 Feb 2018 11:01:01 +0000 (UTC) Received: from mxback6o.mail.yandex.net (mxback6o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::20]) by forward103j.mail.yandex.net (Yandex) with ESMTP id BA91234C5040 for ; Wed, 7 Feb 2018 14:01:00 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback6o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id ekefHLjGz0-10UiUMx1; Wed, 07 Feb 2018 14:01:00 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id LVw23zZMqp-0sVaEUHo; Wed, 07 Feb 2018 14:00:54 +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: Wed, 7 Feb 2018 13:59:58 +0300 Message-Id: <1518001208-29529-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518001208-29529-1-git-send-email-odpbot@yandex.ru> References: <1518001208-29529-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 457 Subject: [lng-odp] [PATCH API-NEXT v1 4/14] linux-gen: packet: implement L3/L4 type setters 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: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 457 (lumag:packet-types) ** https://github.com/Linaro/odp/pull/457 ** Patch: https://github.com/Linaro/odp/pull/457.patch ** Base sha: e1175d5a69c65bb465022c9f1381c40fdb5c4069 ** Merge commit sha: 802ddfc5ea6f47a8935993bf6f8c1675a4c94930 **/ platform/linux-generic/odp_packet.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index f5151d293..fce5a730b 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2557,9 +2557,30 @@ odp_proto_l3_type_t odp_packet_l3_type(odp_packet_t pkt) return pkt_hdr->p.input_flags.l3_type; } +void odp_packet_l3_type_set(odp_packet_t pkt, odp_proto_l3_type_t val) +{ + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + + pkt_hdr->p.input_flags.l3_type = val; + pkt_hdr->p.input_flags.ipv4 = (val == ODP_PROTO_L3_TYPE_IPV4); + pkt_hdr->p.input_flags.ipv6 = (val == ODP_PROTO_L3_TYPE_IPV6); +} + odp_proto_l4_type_t odp_packet_l4_type(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); return pkt_hdr->p.input_flags.l4_type; } + +void odp_packet_l4_type_set(odp_packet_t pkt, odp_proto_l4_type_t val) +{ + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + + pkt_hdr->p.input_flags.l4_type = val; + pkt_hdr->p.input_flags.tcp = (val == ODP_PROTO_L4_TYPE_TCP); + pkt_hdr->p.input_flags.udp = (val == ODP_PROTO_L4_TYPE_UDP); + pkt_hdr->p.input_flags.sctp = (val == ODP_PROTO_L4_TYPE_SCTP); + pkt_hdr->p.input_flags.icmp = (val == ODP_PROTO_L4_TYPE_ICMPV4) || + (val == ODP_PROTO_L4_TYPE_ICMPV6); +}