From patchwork Wed Feb 7 12:59:59 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: 127171 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp450321ljc; Wed, 7 Feb 2018 05:03:49 -0800 (PST) X-Google-Smtp-Source: AH8x224RUjwaJanWlT0due+pVrL8ucKpcJfYOhDjNLViLRgC2sWG71RM9wRhXFgV9FTun41EiL5u X-Received: by 10.55.167.132 with SMTP id q126mr9149379qke.224.1518008629214; Wed, 07 Feb 2018 05:03:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518008629; cv=none; d=google.com; s=arc-20160816; b=wDHV0k8KvinxV94y4LGb87RBHkGOcDdmi+Uc/xmYyS6O0erZHl4xbe8q6YalVM7yyu Ch2HBByp9Sjmth5poipoGwxEIkVJkqI+fSMdoW5aRgycYioxKyIbJUT8i1lgMhINLjls 46XFq2G+HwRxMjJLXHaef//o7sqtdQk4R/H30wH43Ju53qP/q4PJEzUujvt1yk7g45ZV 2/T18+Tl+BvX7tg4/4Lc3sAAGYUJMxRRKCq4C2rNpoZKHpzF1Eci3X3RmduYC/VLdi4c lY4fC+tlHj8GE4vhTpvEQH39xUeTO6EzvgQNhjqvd/f2W2gnnnyXf9JGyQMCtlMgRW8P R0HQ== 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=ooByRE60csf4BUNbrU7uIQl63T8ehkOsVlFDopl3YgI=; b=N4bjUAWPxAxSgoEEim/MXhx5XPQtI5p9aSMaErVMRnPHy/bpOpjIsmlTmzU01T+V4T gE0JUq3XSJtsUUY49098APDdxx1eMLOKhDJ9MAlRUSCuO0Bigy5ZhXgf7IhAovGQnaF2 DQT5Znl+0ODI4AcZtJXaZWyNwtHtGbR1oAngRvCX8czNagBkaCAmOx/v8sYSeaMdBUEw 77tn7h83dejnJJV1+if5MQ1GOzr+oXqpJe14/03YuBZUgdcFUwxP+egG2RfV/7pQFKYV 2xIGx3SxwRbi/UpAl9Uxsldyi7Pl7KFrXmsAaz8dGU1dvyZ5Cn+5qMJXQzS3nkGmpqQC k+yQ== 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 12si110950qkn.430.2018.02.07.05.03.48; Wed, 07 Feb 2018 05:03:49 -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 C1C2061746; Wed, 7 Feb 2018 13:03: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=-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 46E82616FF; Wed, 7 Feb 2018 13:00: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 B352A61519; Wed, 7 Feb 2018 13:00:27 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id 75D9A62789 for ; Wed, 7 Feb 2018 13:00:14 +0000 (UTC) Received: from mxback12j.mail.yandex.net (mxback12j.mail.yandex.net [IPv6:2a02:6b8:0:1619::87]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 5E7155605778 for ; Wed, 7 Feb 2018 16:00:12 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback12j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id NEI4jCoHp4-0CRO1AuB; Wed, 07 Feb 2018 16:00:12 +0300 Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2XfrietnG0-0BZOXvrc; Wed, 07 Feb 2018 16:00:11 +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 15:59:59 +0300 Message-Id: <1518008409-31750-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518008409-31750-1-git-send-email-odpbot@yandex.ru> References: <1518008409-31750-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 457 Subject: [lng-odp] [PATCH API-NEXT v3 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: 86fcf3650d33f5dd82712dda131fb8ca66a3bdf8 **/ platform/linux-generic/odp_packet.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index f5151d293..4b90e9f07 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2557,9 +2557,31 @@ 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.arp = (val == ODP_PROTO_L3_TYPE_ARP); + 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); +}