From patchwork Wed Jan 10 01:00:07 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: 123988 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4665760qgn; Tue, 9 Jan 2018 17:01:47 -0800 (PST) X-Google-Smtp-Source: ACJfBovC64DYSMsYcVfN4ZfokBtr67FjYRoU40lJ4AL5ywRDwvrUbjmJISM6HBkA85KVzgl5sibO X-Received: by 10.200.58.2 with SMTP id w2mr25088589qte.156.1515546107110; Tue, 09 Jan 2018 17:01:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515546107; cv=none; d=google.com; s=arc-20160816; b=G9QUL3HR4GMqfy09rAbbF5BzizMIn7ToGW95W5hpSOmYtfg7hsQMDdFL4TYqPBLiL6 Nos5l7SFLfF+arRFguU66d0tSLPaHYRFAUsMlqn7qqqYul8ofRY7PyPTtnlAWgavKVZy b0GQED5QhqF8uyNlz1EGF8ind54yz57gRSL4lRqVaVC5Lt/XhYPHnOP8sy4n9SmxrGD+ 8RL/N8QBKEy3RhfaIwq47RJaYLBc9k+P5A3gDa6FO4xbBT2+UFj4/mLzNjXmVULNm0WG 9HQbh5LRtdMORlprtgWQHIjUXo/S3TPRoWqFNaE4PWRxm1jLjoOnN1nAN0MsvIEReCbn LLPg== 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=W+SeIbFxcXz7fkIZrHL74hS8ETUy/+UEcFHhjNM+6FQ=; b=U2QRi2t5ekgAJnYCtgVAXRGVcZAYiBSApvdNEzaD8WXQTB1qmY2mGUtp2JjupCkjtk aQEFCEJjTpryO+ITYTfD++Z85RWkvtBb7ziE3K4IXmv3/6YkMeHxqx+oV5OEycnYIad2 AuN05oiRBOakIuMIhsWE0IBdFAfo+nAy48H1Usbs2KwQuwgtYNPrgm+tXIRvByKxwSFW jw5Ig7Wjb2fQpJAu6MscoshwYESjCvvx7FNFzkmqyGnJZGL64J7sLypODTxtGkvl8P4a 6ceUbi6bjcRhrxQEWFEy3D09phUCAxJWlCag5cBvza2yZaiTZ3rqikEOn/8QpUX2ezDy tOlA== 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 t2si7169084qkb.41.2018.01.09.17.01.46; Tue, 09 Jan 2018 17:01:47 -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 CB9F261702; Wed, 10 Jan 2018 01:01:46 +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,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 AA6736171D; Wed, 10 Jan 2018 01:00:56 +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 1C46B61702; Wed, 10 Jan 2018 01:00:51 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 675FF616DE for ; Wed, 10 Jan 2018 01:00:17 +0000 (UTC) Received: from mxback6g.mail.yandex.net (mxback6g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:167]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 39D30184CDE for ; Wed, 10 Jan 2018 04:00:16 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback6g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id yPvi8Jg7gw-0G4KDvRc; Wed, 10 Jan 2018 04:00:16 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id LBg8WI4ByR-0FXCmd40; Wed, 10 Jan 2018 04:00:15 +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, 10 Jan 2018 04:00:07 +0300 Message-Id: <1515546007-13757-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515546007-13757-1-git-send-email-odpbot@yandex.ru> References: <1515546007-13757-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 386 Subject: [lng-odp] [PATCH API-NEXT v1 2/2] helper: provide icmp non-camelcase alternative 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: Bill Fischofer Add the ODPH_IPPROTO_ICMPV4 and ODPH_IPPROTO_ICMPV6 defines to avoid camelcase issues in ODP examples. Since the helpers are part of the public API, the camelcase variants are retained for compatibility, however ODP example code that uses helpers is updated to use the non-camelcase forms. --- /** Email created from pull request 386 (Bill-Fischofer-Linaro:icmp-camelcase) ** https://github.com/Linaro/odp/pull/386 ** Patch: https://github.com/Linaro/odp/pull/386.patch ** Base sha: 6303c7d0e98fafe0f14c8c4dd9989b3b7633ebf4 ** Merge commit sha: 9b488231de93541f9a2c75a6e277921c55041427 **/ example/generator/odp_generator.c | 4 ++-- example/ipsec/odp_ipsec_stream.c | 6 +++--- helper/include/odp/helper/ip.h | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index b1827e9c9..0fc4c9ccd 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -426,7 +426,7 @@ static odp_packet_t setup_icmp_pkt_ref(odp_pool_t pool, ip->ttl = 64; ip->tot_len = odp_cpu_to_be_16(args->appl.payload + ODPH_ICMPHDR_LEN + ODPH_IPV4HDR_LEN); - ip->proto = ODPH_IPPROTO_ICMPv4; + ip->proto = ODPH_IPPROTO_ICMPV4; ip->id = 0; ip->chksum = 0; @@ -806,7 +806,7 @@ static void print_pkts(int thr, thread_args_t *thr_args, thr_args->counters.ctr_udp_rcv++; /* icmp */ - if (ip->proto == ODPH_IPPROTO_ICMPv4) { + if (ip->proto == ODPH_IPPROTO_ICMPV4) { icmp = (odph_icmphdr_t *)(buf + offset); process_icmp_pkt(thr_args, icmp, msg); diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index c287282e8..3773ce525 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -217,7 +217,7 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, ip->src_addr = odp_cpu_to_be_32(entry->tun_src_ip); ip->dst_addr = odp_cpu_to_be_32(entry->tun_dst_ip); } else { - ip->proto = ODPH_IPPROTO_ICMPv4; + ip->proto = ODPH_IPPROTO_ICMPV4; ip->src_addr = odp_cpu_to_be_32(stream->src_ip); ip->dst_addr = odp_cpu_to_be_32(stream->dst_ip); } @@ -260,7 +260,7 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, inner_ip = (odph_ipv4hdr_t *)data; memset((char *)inner_ip, 0, sizeof(*inner_ip)); inner_ip->ver_ihl = 0x45; - inner_ip->proto = ODPH_IPPROTO_ICMPv4; + inner_ip->proto = ODPH_IPPROTO_ICMPV4; inner_ip->id = odp_cpu_to_be_16(stream->id); inner_ip->ttl = 64; inner_ip->tos = 0; @@ -518,7 +518,7 @@ odp_bool_t verify_ipv4_packet(stream_db_entry_t *stream, icmp = (odph_icmphdr_t *)(inner_ip + 1); data = (uint8_t *)icmp; } else { - if (ODPH_IPPROTO_ICMPv4 != ip->proto) + if (ODPH_IPPROTO_ICMPV4 != ip->proto) return FALSE; icmp = (odph_icmphdr_t *)data; } diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h index b96aab280..a47030a39 100644 --- a/helper/include/odp/helper/ip.h +++ b/helper/include/odp/helper/ip.h @@ -252,6 +252,7 @@ typedef struct ODP_PACKED { * @{*/ #define ODPH_IPPROTO_HOPOPTS 0x00 /**< IPv6 hop-by-hop options */ #define ODPH_IPPROTO_ICMPv4 0x01 /**< Internet Control Message Protocol (1) */ +#define ODPH_IPPROTO_ICMPV4 0x01 /**< Internet Control Message Protocol (1) */ #define ODPH_IPPROTO_TCP 0x06 /**< Transmission Control Protocol (6) */ #define ODPH_IPPROTO_UDP 0x11 /**< User Datagram Protocol (17) */ #define ODPH_IPPROTO_ROUTE 0x2B /**< IPv6 Routing header (43) */ @@ -259,6 +260,7 @@ typedef struct ODP_PACKED { #define ODPH_IPPROTO_AH 0x33 /**< Authentication Header (51) */ #define ODPH_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload (50) */ #define ODPH_IPPROTO_ICMPv6 0x3A /**< Internet Control Message Protocol (58) */ +#define ODPH_IPPROTO_ICMPV6 0x3A /**< Internet Control Message Protocol (58) */ #define ODPH_IPPROTO_INVALID 0xFF /**< Reserved invalid by IANA */ /**@}*/