From patchwork Sat Dec 6 03:59:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 41987 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 D008D26667 for ; Sat, 6 Dec 2014 04:01:07 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id n15sf1162702lbi.0 for ; Fri, 05 Dec 2014 20:01:06 -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=CnWURehZkqb8vNY1XahiXDis4w8SHH513vTvjQiBzi4=; b=KO582oMei5u/yk0g8uhwTQEztExvbRSaKKGNOrGTF+H64hrhvC8Pn3UkG0IwMoMhkB NBAROgmDG/eQ49EaxaqbQZkEtb97j022m4RNFCydJ+fo3QTSUxuXCDF4bkEMEKkWw5a9 PPQDHIYGjHJuZ2PoWYSBs8+cm5Mmo59hcKReL08LF6hJPVr0Z+3MsgOGehZbvsTzZ6VP D8AkvGP18MKLZKq1JKSH0SKFXTaaW2RGt2ck+NHy0JeU5465mBrc474iXCtGiXfIlXQN yQ+tjV0aqrIHHF5j2ZOR7m3fcEYEoMFiZTaVeU9pKr7Jrf5QQpOHWGciWZg/Q2jNMoL2 ZRlA== X-Gm-Message-State: ALoCoQlLnt4xiQSzOPCzYZJqgIGhTh/LIpfnXf0/GIl46QBB6gxrbrfqOyNGyYOhKAGdcrNKaz0H X-Received: by 10.194.95.74 with SMTP id di10mr4132796wjb.0.1417838466773; Fri, 05 Dec 2014 20:01:06 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.136 with SMTP id kq8ls431119lac.84.gmail; Fri, 05 Dec 2014 20:01:06 -0800 (PST) X-Received: by 10.152.207.37 with SMTP id lt5mr5852325lac.66.1417838466420; Fri, 05 Dec 2014 20:01:06 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id uo8si30575418lbb.96.2014.12.05.20.01.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Dec 2014 20:01:05 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ms9so1666883lab.10 for ; Fri, 05 Dec 2014 20:01:05 -0800 (PST) X-Received: by 10.152.21.66 with SMTP id t2mr5761200lae.27.1417838465902; Fri, 05 Dec 2014 20:01:05 -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 ew9csp328061lbc; Fri, 5 Dec 2014 20:01:05 -0800 (PST) X-Received: by 10.224.80.6 with SMTP id r6mr31542584qak.5.1417838464269; Fri, 05 Dec 2014 20:01:04 -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 b100si36995462qge.80.2014.12.05.20.01.03 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 05 Dec 2014 20:01:04 -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 1Xx6YG-0000G4-Gi; Sat, 06 Dec 2014 04:01:00 +0000 Received: from mail-yh0-f52.google.com ([209.85.213.52]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xx6Y9-0000Ej-46 for lng-odp@lists.linaro.org; Sat, 06 Dec 2014 04:00:53 +0000 Received: by mail-yh0-f52.google.com with SMTP id z6so936907yhz.11 for ; Fri, 05 Dec 2014 20:00:47 -0800 (PST) X-Received: by 10.236.208.7 with SMTP id p7mr18036555yho.5.1417838447866; Fri, 05 Dec 2014 20:00:47 -0800 (PST) Received: from bala-PowerEdge-T110-II.caveonetworks.com ([111.93.218.67]) by mx.google.com with ESMTPSA id o38sm19111734yhp.34.2014.12.05.20.00.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Dec 2014 20:00:47 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Sat, 6 Dec 2014 09:29:40 +0530 Message-Id: <1417838383-3215-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Topics: patch Subject: [lng-odp] [PATCH v5 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.215.51 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 --- 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..7dbc0df --- /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; /**< Destinatino 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