From patchwork Wed Jan 31 14:00:28 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: 126342 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp770231ljc; Wed, 31 Jan 2018 06:15:41 -0800 (PST) X-Google-Smtp-Source: AH8x2240hqzWiY+zz8yOE/4j+fCP3YQKFp4fUGggDvwARzKWGuU/xVbD1euX2LGKgjoIziH2EWlW X-Received: by 10.200.39.71 with SMTP id h7mr52090917qth.198.1517408141227; Wed, 31 Jan 2018 06:15:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517408141; cv=none; d=google.com; s=arc-20160816; b=PTuwiTYgx+pd/OFArmahy5jRZnbORRrFwUDrQYRmZZIXqYuURbskSB4MHL1GG7JBTI s7+8q1gvCf70GIy33oHu64qRlLFOetmnPrMdA865TcjLcb5s7p7jxXoDL360rVandSyl yivuedT+0VPvlIr5WolJqMkVXbqz1gwUvqK8A4JWhlvUYcwbuBlySonldMu1JVrjmCHP 5LP4UcFkJHa7QEP+OyQP+M6ejeCMdRcvTPZrX3MvhXDkBo89twFBavUudNclrQVd76px 7zLd3gryYJvbcCrj8sCEtOBXPnR0w0hUOOdXbBsEeqlRKWfQBrVfCQuBaCEWCiUbeAHn qgMg== 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=40KPQZOF8vCR/FA72MH86oRaxZ7Hg0YoTQMDp1DZcwk=; b=XYn4eVF68sW5WWfuXiOPAHSMOeaKRhjPOZpGT2OkzRD+J3RDRe9VU7Cm95Ahxc4sF4 EBtKN95UEQ9BMpVZ1hVP0/32ZgJQ0h8ICSIaZmlIn8OdKCh5AWG/zBpiPZQ/3sP2Wgqm IvzrN/qQLQb9OnpOZ2xT+38MEIwzMTUc0Ls51wvybtiik1gRqplUz5VGQjNm1jEnlXJ0 mhmybv3kHDF8WsUnlJ8jOwBVOuEiDK7uJmv2thK0ErVUasxH0AccAMtnBdF2ilQpBMoy YQPUnIjE2jRCzi9M4Pl9HuLzaJX8dVnXNskfUi2UykFV0E8IJsLOGywv3Kf85ZqNwqg/ eFWw== 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 n15si4000172qki.387.2018.01.31.06.15.40; Wed, 31 Jan 2018 06:15:41 -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 DDDB1617B6; Wed, 31 Jan 2018 14:15:40 +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_H2 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 0CE0261788; Wed, 31 Jan 2018 14:03:26 +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 47422617DD; Wed, 31 Jan 2018 14:03:12 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id EB09561783 for ; Wed, 31 Jan 2018 14:00:37 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 4B4694302F13 for ; Wed, 31 Jan 2018 17:00:36 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id iaNpJnUgFW-0aUitq6A; Wed, 31 Jan 2018 17:00:36 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Tps9JIjLUO-0ZqCxwOB; Wed, 31 Jan 2018 17:00:35 +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, 31 Jan 2018 17:00:28 +0300 Message-Id: <1517407234-19273-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517407234-19273-1-git-send-email-odpbot@yandex.ru> References: <1517407234-19273-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 403 Subject: [lng-odp] [PATCH API-NEXT v4 1/7] api: packet: add protocol type enumeration 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 enumerations for L3 and L4 protocol types, and functions to request those. Signed-off-by: Petri Savolainen --- /** Email created from pull request 403 (psavol:next-ipsec-tfc) ** https://github.com/Linaro/odp/pull/403 ** Patch: https://github.com/Linaro/odp/pull/403.patch ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3 ** Merge commit sha: 5fe995377a907528cc4b1ce80386e5238f99e8de **/ include/odp/api/abi-default/packet.h | 28 +++++++ include/odp/api/spec/packet.h | 95 ++++++++++++++++++++++ .../linux-generic/include-abi/odp/api/abi/packet.h | 28 +++++++ 3 files changed, 151 insertions(+) diff --git a/include/odp/api/abi-default/packet.h b/include/odp/api/abi-default/packet.h index 3d6876731..349b6b1fa 100644 --- a/include/odp/api/abi-default/packet.h +++ b/include/odp/api/abi-default/packet.h @@ -30,6 +30,34 @@ typedef _odp_abi_packet_seg_t *odp_packet_seg_t; #define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)0xffffffff) #define ODP_PACKET_OFFSET_INVALID 0xffff +typedef uint8_t odp_proto_l3_type_t; + +#define ODP_PROTO_L3_TYPE_NONE 0 +#define ODP_PROTO_L3_TYPE_ARP 1 +#define ODP_PROTO_L3_TYPE_RARP 2 +#define ODP_PROTO_L3_TYPE_MPLS 3 +#define ODP_PROTO_L3_TYPE_IPV4 4 +#define ODP_PROTO_L3_TYPE_IPV6 6 + +typedef uint8_t odp_proto_l4_type_t; + +/* Numbers from IANA Assigned Internet Protocol Numbers list */ +#define ODP_PROTO_L4_TYPE_NONE 0 +#define ODP_PROTO_L4_TYPE_ICMPV4 1 +#define ODP_PROTO_L4_TYPE_IGMP 2 +#define ODP_PROTO_L4_TYPE_IPV4 4 +#define ODP_PROTO_L4_TYPE_TCP 6 +#define ODP_PROTO_L4_TYPE_UDP 17 +#define ODP_PROTO_L4_TYPE_IPV6 41 +#define ODP_PROTO_L4_TYPE_GRE 47 +#define ODP_PROTO_L4_TYPE_ESP 50 +#define ODP_PROTO_L4_TYPE_AH 51 +#define ODP_PROTO_L4_TYPE_ICMPV6 58 +#define ODP_PROTO_L4_TYPE_NO_NEXT 59 +#define ODP_PROTO_L4_TYPE_IPCOMP 108 +#define ODP_PROTO_L4_TYPE_SCTP 132 +#define ODP_PROTO_L4_TYPE_ROCH 142 + typedef enum { ODP_PACKET_GREEN = 0, ODP_PACKET_YELLOW = 1, diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 3222ff5c2..6f6aa0658 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -71,6 +71,79 @@ extern "C" { * Packet is red */ +/** + * @typedef odp_proto_l3_type_t + * Layer 3 protocol type + */ + +/** + * @def ODP_PROTO_L3_TYPE_NONE + * Layer 3 protocol type not defined + * + * @def ODP_PROTO_L3_TYPE_ARP + * Layer 3 protocol is ARP + * + * @def ODP_PROTO_L3_TYPE_RARP + * Layer 3 protocol is RARP + * + * @def ODP_PROTO_L3_TYPE_MPLS + * Layer 3 protocol is MPLS + * + * @def ODP_PROTO_L3_TYPE_IPV4 + * Layer 3 protocol type is IPv4 + * + * @def ODP_PROTO_L3_TYPE_IPV6 + * Layer 3 protocol type is IPv6 + */ + +/** + * @def ODP_PROTO_L4_TYPE_NONE + * Layer 4 protocol type not defined + * + * @def ODP_PROTO_L4_TYPE_ICMPV4 + * Layer 4 protocol type is ICMPv4 + * + * @def ODP_PROTO_L4_TYPE_IGMP + * Layer 4 protocol type is IGMP + * + * @def ODP_PROTO_L4_TYPE_IPV4 + * Layer 4 protocol type is IPv4 + * + * @def ODP_PROTO_L4_TYPE_TCP + * Layer 4 protocol type is TCP + * + * @def ODP_PROTO_L4_TYPE_UDP + * Layer 4 protocol type is UDP + * + * @def ODP_PROTO_L4_TYPE_IPV6 + * Layer 4 protocol type is IPv6 + * + * @def ODP_PROTO_L4_TYPE_GRE + * Layer 4 protocol type is GRE + * + * @def ODP_PROTO_L4_TYPE_ESP + * Layer 4 protocol type is IPSEC ESP + * + * @def ODP_PROTO_L4_TYPE_AH + * Layer 4 protocol type is IPSEC AH + * + * @def ODP_PROTO_L4_TYPE_ICMPV6 + * Layer 4 protocol type is ICMPv6 + * + * @def ODP_PROTO_L4_TYPE_NO_NEXT + * Layer 4 protocol type is "No Next Header". + * Protocol / next header number is 59. + * + * @def ODP_PROTO_L4_TYPE_IPCOMP + * Layer 4 protocol type is IP Payload Compression Protocol + * + * @def ODP_PROTO_L4_TYPE_SCTP + * Layer 4 protocol type is SCTP + * + * @def ODP_PROTO_L4_TYPE_ROCH + * Layer 4 protocol type is ROCH + */ + /** * Protocol */ @@ -1542,6 +1615,28 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt); */ int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset); +/** + * Layer 3 protocol type + * + * Returns layer 3 protocol type. Initial type value is ODP_PROTO_L3_TYPE_NONE. + * + * @param pkt Packet handle + * + * @return Layer 3 protocol type + */ +odp_proto_l3_type_t odp_packet_l3_type(odp_packet_t pkt); + +/** + * Layer 4 protocol type + * + * Returns layer 4 protocol type. Initial type value is ODP_PROTO_L4_TYPE_NONE. + * + * @param pkt Packet handle + * + * @return Layer 4 protocol type + */ +odp_proto_l4_type_t odp_packet_l4_type(odp_packet_t pkt); + /** * Layer 3 checksum check status * diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet.h b/platform/linux-generic/include-abi/odp/api/abi/packet.h index 1aa7cbd58..c68ac7b48 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/packet.h +++ b/platform/linux-generic/include-abi/odp/api/abi/packet.h @@ -47,6 +47,34 @@ static inline odp_packet_seg_t _odp_packet_seg_from_ndx(uint8_t ndx) #define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)-1) +typedef uint8_t odp_proto_l3_type_t; + +#define ODP_PROTO_L3_TYPE_NONE 0 +#define ODP_PROTO_L3_TYPE_ARP 1 +#define ODP_PROTO_L3_TYPE_RARP 2 +#define ODP_PROTO_L3_TYPE_MPLS 3 +#define ODP_PROTO_L3_TYPE_IPV4 4 +#define ODP_PROTO_L3_TYPE_IPV6 6 + +typedef uint8_t odp_proto_l4_type_t; + +/* Numbers from IANA Assigned Internet Protocol Numbers list */ +#define ODP_PROTO_L4_TYPE_NONE 0 +#define ODP_PROTO_L4_TYPE_ICMPV4 1 +#define ODP_PROTO_L4_TYPE_IGMP 2 +#define ODP_PROTO_L4_TYPE_IPV4 4 +#define ODP_PROTO_L4_TYPE_TCP 6 +#define ODP_PROTO_L4_TYPE_UDP 17 +#define ODP_PROTO_L4_TYPE_IPV6 41 +#define ODP_PROTO_L4_TYPE_GRE 47 +#define ODP_PROTO_L4_TYPE_ESP 50 +#define ODP_PROTO_L4_TYPE_AH 51 +#define ODP_PROTO_L4_TYPE_ICMPV6 58 +#define ODP_PROTO_L4_TYPE_NO_NEXT 59 +#define ODP_PROTO_L4_TYPE_IPCOMP 108 +#define ODP_PROTO_L4_TYPE_SCTP 132 +#define ODP_PROTO_L4_TYPE_ROCH 142 + typedef enum { ODP_PACKET_GREEN = 0, ODP_PACKET_YELLOW = 1,