From patchwork Thu Dec 14 17:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 121990 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp7060864qgn; Thu, 14 Dec 2017 09:00:28 -0800 (PST) X-Google-Smtp-Source: ACJfBotS8iycxApLJchIFTb2PqNpjQWeJEfMn/dpb1+O7iIlF6htz6PpB+3klhTzxc7Tp3zE08tO X-Received: by 10.200.63.107 with SMTP id w40mr17150890qtk.24.1513270828231; Thu, 14 Dec 2017 09:00:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513270828; cv=none; d=google.com; s=arc-20160816; b=fkYkyxUM0eOrkUdeTqmBoD4sVAYJjwfbj2AQXHeekefOT7CDbhhaF+U1Q7k50d5V33 DSIYjV2re1WmQC89mAVOAP2FqbFeWfDqArk8ShEQn1S5qK3jGQFHBqnalrSv2uv9MOHN hvpxBo+MZYDIDTSdMpMoG6PRE/BboRxx7Pju5qDo25VUImVmadE9gB7NOXsRA1he0Lk1 qd4XxquOaZGpHGsfOW+90dF+HwNQRqBCWLa3paSMMAVbaVMThiqBHgkzyuwAvPzOIJNk rDDaTYCUw6EpmXr22lEidEAha4wRQtKIdGZ9M5gNXp8BBSUg9gcp/F8WdK2E42zT42Es SY8A== 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=RLU0xj+GfkQIJVMfw+N6ek+IlUyywPAxCD+b7bCqqBw=; b=msBxMByeEggdhy8bnnky2oQ8/3zO83GpW0ji2IoqT7fAt+urnJ8JkFJd9OyiaGSRmX FLhUkf8VxZudX3Rhbf8d6deQETV6IMfdAw3nmAzuErR1Z2CGgzDqy7Q08ilpiWkEH/jO awRyFeARsRThXTC8OiiFSL+rrKwMTAA9our3TbYtiUfeN1jo/S82ENF5yYdV4Ilc0f34 xF4Y0FzAR27rXTIJnKSfPkDr3Ut4zjbOpU7zNzeeuuZgBxAqzBfUpZhXgJpeid9rkbOV hACJRiI8+aiGmwMa0MQIYli91ALsF9Oo7Y00LTbqxZIY9xHlXxyp3JnDM8SNdsxap1KO PZQg== 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 w19si554003qka.243.2017.12.14.09.00.27; Thu, 14 Dec 2017 09:00:28 -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 A543B60970; Thu, 14 Dec 2017 17:00:27 +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, 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 C6C0660926; Thu, 14 Dec 2017 17:00:22 +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 2FCA060933; Thu, 14 Dec 2017 17:00:15 +0000 (UTC) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [37.140.190.182]) by lists.linaro.org (Postfix) with ESMTPS id 887FC6084F for ; Thu, 14 Dec 2017 17:00:13 +0000 (UTC) Received: from mxback8g.mail.yandex.net (mxback8g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:169]) by forward102o.mail.yandex.net (Yandex) with ESMTP id E62D65A0269E for ; Thu, 14 Dec 2017 20:00:11 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback8g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 7qNKxPniUQ-0BtmXRM0; Thu, 14 Dec 2017 20:00:11 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id P3vbKkCfK1-0BrOrZ8q; Thu, 14 Dec 2017 20: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: Thu, 14 Dec 2017 20:00:07 +0300 Message-Id: <1513270810-29728-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513270810-29728-1-git-send-email-odpbot@yandex.ru> References: <1513270810-29728-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 345 Subject: [lng-odp] [PATCH v2 1/4] helper: add vxlan protocol header structure 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: Balasubramanian Manoharan adds vxlan header protocol structure Signed-off-by: Balasubramanian Manoharan --- /** Email created from pull request 345 (bala-manoharan:BUG2903) ** https://github.com/Linaro/odp/pull/345 ** Patch: https://github.com/Linaro/odp/pull/345.patch ** Base sha: 6b5cdc77eb9759a2349b10372a964648559bc92c ** Merge commit sha: 65c561d30ea4c8c5f8ae17c2b407df9c6cc35f3d **/ helper/include/odp/helper/odph_api.h | 2 +- helper/include/odp/helper/vxlan.h | 58 ++++++++++++++++++++++++ platform/linux-generic/include/protocols/vxlan.h | 56 +++++++++++++++++++++++ 3 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 helper/include/odp/helper/vxlan.h create mode 100644 platform/linux-generic/include/protocols/vxlan.h diff --git a/helper/include/odp/helper/odph_api.h b/helper/include/odp/helper/odph_api.h index 7ed0e7786..4f38c58e7 100644 --- a/helper/include/odp/helper/odph_api.h +++ b/helper/include/odp/helper/odph_api.h @@ -32,7 +32,7 @@ extern "C" { #include #include #include - +#include #ifdef __cplusplus } #endif diff --git a/helper/include/odp/helper/vxlan.h b/helper/include/odp/helper/vxlan.h new file mode 100644 index 000000000..cfe0a9aa4 --- /dev/null +++ b/helper/include/odp/helper/vxlan.h @@ -0,0 +1,58 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODPH VxLAN header + */ + +#ifndef ODPH_VXLAN_H_ +#define ODPH_VXLAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** @addtogroup odp_header ODP HEADER + * @{ + */ + +/** VXLAN header length */ +#define ODPH_VXLANHDR_LEN 8 + +/** VNI from VXLAN header format */ +#define ODPH_VXLAN_VNI(vxlan_vni) ((vxlan_vni & 0xffffff00) >> 8) + +/** UDP VXLAN destination port */ +#define ODPH_UDP_VXLAN_PORT 4789 + +/** VNI to VXLAN header format */ +#define ODPH_VNI_VXLAN(vxlan_vni) (vxlan_vni << 8) + +/** VXLAN header */ +typedef struct ODP_PACKED { + uint8_t flags; /**< Vxlan flags */ + uint8_t reserve1; /**< reserved bits */ + uint16_t reseve2; /**< reserved bits */ + odp_u32be_t vni; /**< VNI Identifier */ +} odph_vxlanhdr_t; + +/** @internal Compile time assert */ +ODP_STATIC_ASSERT(sizeof(odph_vxlanhdr_t) == ODPH_VXLANHDR_LEN, + "ODPH_VXLANHDR_T__SIZE_ERROR"); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/protocols/vxlan.h b/platform/linux-generic/include/protocols/vxlan.h new file mode 100644 index 000000000..b42e79097 --- /dev/null +++ b/platform/linux-generic/include/protocols/vxlan.h @@ -0,0 +1,56 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP VxLAN header + */ + +#ifndef ODP_VXLAN_H_ +#define ODP_VXLAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** @addtogroup odp_header ODP HEADER + * @{ + */ + +/** VXLAN header length */ +#define _ODP_VXLANHDR_LEN 8 + +/** VXLAN UDP destination port */ +#define _ODP_UDP_VXLAN_PORT 4789 + +#define ODPH_VXLAN_VNI(vxlan_vni) ((vxlan_vni & 0xffffff00) >> 8) + +#define ODPH_VXLAN_BIT(vxlan_flag) (vxlan_flag & 0x08) + +/** UDP header */ +typedef struct ODP_PACKED { + uint8_t flags; /**< Vxlan flags */ + uint8_t reserve1; /**< reserved bits */ + uint16_t reseve2; /**< reserved bits */ + odp_u32be_t vni; /**< VNI Identifier */ +} _odp_vxlanhdr_t; + +/** @internal Compile time assert */ +ODP_STATIC_ASSERT(sizeof(_odp_vxlanhdr_t) == _ODP_VXLANHDR_LEN, + "_ODP_VXLANHDR_T__SIZE_ERROR"); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif