From patchwork Mon Dec 8 12:02:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 41998 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CAD72202E0 for ; Mon, 8 Dec 2014 12:04:32 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id n15sf2646702lbi.4 for ; Mon, 08 Dec 2014 04:04:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=r30cHnm/u33hmE4cgY3XyTSQ/L85b01eeLe3tvUlDDs=; b=BD9jBUq0Fvy7FoCv2j4utyuzvm8OHwkXalqKLjCdvzPyfyo3dHFRyaeW9FuXYj7zC0 qaKtVYblMk8Ap6E4/iFDQD+sWaNFeYC5sNld/JYA5g6easkSf9bOl5g9wO4Lsod48H3b CFfXUMaevaazlb/kZ61x3hn5vnPw8sftwfPCD7O6B0aMLpND73ZTmA3zVJNLHgrq3D2R 75iMlM26TB1HihTej8RVhIV/StSmgpFV1XxCOLaXPkjHynwEmS5vkCCSoGD/jYnbPL8n 0Wl+yR7oY8Gw8ok4pZ4/XJtps95HGqdlRmxaIfA8SnhstrX1UOrMKtiCVPOD4JCuAS07 UALQ== X-Gm-Message-State: ALoCoQm2UHk2Dk46HnHQeQ7ttIrUwsjZIBeAz5WBgtf3kSmGEic/cSkCSDTewkF76YruPM6qu9/y X-Received: by 10.112.166.102 with SMTP id zf6mr283302lbb.12.1418040271764; Mon, 08 Dec 2014 04:04:31 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.39 with SMTP id j7ls639934laf.92.gmail; Mon, 08 Dec 2014 04:04:31 -0800 (PST) X-Received: by 10.112.61.169 with SMTP id q9mr16020575lbr.12.1418040271618; Mon, 08 Dec 2014 04:04:31 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id g1si21306177lag.18.2014.12.08.04.04.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Dec 2014 04:04:31 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id f15so3999427lbj.13 for ; Mon, 08 Dec 2014 04:04:31 -0800 (PST) X-Received: by 10.112.38.4 with SMTP id c4mr16108276lbk.46.1418040271490; Mon, 08 Dec 2014 04:04:31 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp591159lbc; Mon, 8 Dec 2014 04:04:30 -0800 (PST) X-Received: by 10.140.101.145 with SMTP id u17mr3314135qge.84.1418040269259; Mon, 08 Dec 2014 04:04:29 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id m107si43023535qge.114.2014.12.08.04.04.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 08 Dec 2014 04:04:29 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xxx3C-0006ij-2y; Mon, 08 Dec 2014 12:04:26 +0000 Received: from mail-ie0-f182.google.com ([209.85.223.182]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xxx33-0006iP-Ue for lng-odp@lists.linaro.org; Mon, 08 Dec 2014 12:04:17 +0000 Received: by mail-ie0-f182.google.com with SMTP id x19so4326655ier.27 for ; Mon, 08 Dec 2014 04:04:12 -0800 (PST) X-Received: by 10.50.66.144 with SMTP id f16mr14148850igt.3.1418040252553; Mon, 08 Dec 2014 04:04:12 -0800 (PST) Received: from bala-PowerEdge-T110-II.caveonetworks.com ([111.93.218.67]) by mx.google.com with ESMTPSA id b2sm16103616ioe.2.2014.12.08.04.04.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Dec 2014 04:04:11 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Mon, 8 Dec 2014 17:32:54 +0530 Message-Id: <1418040176-9134-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Topics: patch Subject: [lng-odp] [PATCH v6 1/3] helper: odph_tcp header description X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bala.manoharan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Adds TCP header description struct odph_tcphdr_t in helper directory. This structure is used for accessing TCP header information from the packet Signed-off-by: Balasubramanian Manoharan Reviewed-by: Bill Fischofer Reviewed-by: Victor Kamensky --- V6: Incoporates review comments from Bill helper/include/odph_tcp.h | 81 ++++++++++++++++++++++ platform/linux-generic/include/api/odp_byteorder.h | 7 ++ 2 files changed, 88 insertions(+) create mode 100644 helper/include/odph_tcp.h diff --git a/helper/include/odph_tcp.h b/helper/include/odph_tcp.h new file mode 100644 index 0000000..3992ecf --- /dev/null +++ b/helper/include/odph_tcp.h @@ -0,0 +1,81 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP TCP header + */ + +#ifndef ODPH_TCP_H_ +#define ODPH_TCP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/** TCP header */ +typedef struct ODP_PACKED { + uint16be_t src_port; /**< Source port */ + uint16be_t dst_port; /**< Destination port */ + uint32be_t seq_no; /**< Sequence number */ + uint32be_t ack_no; /**< Acknowledgment number */ + union { + uint16be_t doffset_flags; +#if defined(ODP_BIG_ENDIAN_BITFIELD) + struct { + uint16be_t rsvd1:8; + uint16be_t flags:8; /**< TCP flags as a byte */ + }; + struct { + uint16be_t hl:4; /**< Hdr len, in words */ + uint16be_t rsvd3:4; /**< Reserved */ + uint16be_t cwr:1; + uint16be_t ece:1; + uint16be_t urg:1; + uint16be_t ack:1; + uint16be_t psh:1; + uint16be_t rst:1; + uint16be_t syn:1; + uint16be_t fin:1; + }; +#elif defined(ODP_LITTLE_ENDIAN_BITFIELD) + struct { + uint16be_t flags:8; + uint16be_t rsvd1:8; /**< TCP flags as a byte */ + }; + struct { + uint16be_t rsvd3:4; /**< Reserved */ + uint16be_t hl:4; /**< Hdr len, in words */ + uint16be_t fin:1; + uint16be_t syn:1; + uint16be_t rst:1; + uint16be_t psh:1; + uint16be_t ack:1; + uint16be_t urg:1; + uint16be_t ece:1; + uint16be_t cwr:1; + }; + +#else +#error "Endian BitField order not defined!" +#endif + }; + uint16be_t window; /**< Window size */ + uint16be_t cksm; /**< Checksum */ + uint16be_t urgptr; /**< Urgent pointer */ +} odph_tcphdr_t; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/include/api/odp_byteorder.h b/platform/linux-generic/include/api/odp_byteorder.h index 79ddd75..5d7cceb 100644 --- a/platform/linux-generic/include/api/odp_byteorder.h +++ b/platform/linux-generic/include/api/odp_byteorder.h @@ -19,6 +19,7 @@ extern "C" { #endif #include +#include #include #include @@ -45,6 +46,12 @@ extern "C" { /** Little endian byte order */ #define ODP_LITTLE_ENDIAN __LITTLE_ENDIAN +/** Big endian bit field */ +#define ODP_BIG_ENDIAN_BITFIELD __BIG_ENDIAN_BITFIELD + +/** Little endian bit field */ +#define ODP_LITTLE_ENDIAN_BITFIELD __LITTLE_ENDIAN_BITFIELD + /** Selected byte order */ #if __BYTE_ORDER == __LITTLE_ENDIAN #define ODP_BYTE_ORDER ODP_LITTLE_ENDIAN