From patchwork Mon Nov 17 11:03: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: 40906 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8C5782450C for ; Mon, 17 Nov 2014 11:06:06 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id k14sf2152362wgh.4 for ; Mon, 17 Nov 2014 03:06:01 -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:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=Yf6l9jf4ggenS5jh7gcIpQGpQq7s3PwHUbCFZzjUX3s=; b=IbS1i5+vGBdz6L82Q4bBc2JBIvBLk3TDG3RYoUaCtmdLRKcuQ0ke9S3Di7hA8u7n/R v2wI8ZmCZAOCKAA6ocFkz1qQejxCgGrfYuxgecpj9sRzbW/nayNpuFADg4ghRf2GHj4g qqsjZCDxS+5Foftfev0NKrVhOl5icY1YpIUnLZgvfBxrrHDE914yM7dFhlW9kMqmoZe8 l2rywjx6ybiyrkdwnxNSqI8Fw4AQYLlL0/XRi5Pr3JkvYY+d2oBeDO41YNwpz8uyxU4h q8H3iM8G5ThfaQSaS3QgrW4ADkThRNtvq2qfdTBs1xDLOaHaV/f251oTR4NsdMwrNpNz 6xvw== X-Gm-Message-State: ALoCoQlYKAgahzl6/Dqs69X8eUTYrGFPgq3mWztub7qu1GaWHGdpBiTb3P94xZ9eSKLb8p1YScT/ X-Received: by 10.112.138.234 with SMTP id qt10mr595902lbb.4.1416222361608; Mon, 17 Nov 2014 03:06:01 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.229 with SMTP id p5ls874450laf.4.gmail; Mon, 17 Nov 2014 03:06:01 -0800 (PST) X-Received: by 10.152.87.18 with SMTP id t18mr26719484laz.0.1416222361320; Mon, 17 Nov 2014 03:06:01 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id ra3si51499550lbb.24.2014.11.17.03.06.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Nov 2014 03:06:01 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id l4so15996626lbv.12 for ; Mon, 17 Nov 2014 03:06:01 -0800 (PST) X-Received: by 10.152.8.170 with SMTP id s10mr2242246laa.56.1416222361198; Mon, 17 Nov 2014 03:06:01 -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 ew9csp1135404lbc; Mon, 17 Nov 2014 03:06:00 -0800 (PST) X-Received: by 10.229.104.3 with SMTP id m3mr33712659qco.0.1416222359772; Mon, 17 Nov 2014 03:05:59 -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 50si63055450qgc.95.2014.11.17.03.05.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 17 Nov 2014 03:05:59 -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 1XqK85-0007ig-Qp; Mon, 17 Nov 2014 11:05:57 +0000 Received: from mail-yh0-f51.google.com ([209.85.213.51]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XqK7r-0007i2-Vs for lng-odp@lists.linaro.org; Mon, 17 Nov 2014 11:05:44 +0000 Received: by mail-yh0-f51.google.com with SMTP id a41so890140yho.10 for ; Mon, 17 Nov 2014 03:05:38 -0800 (PST) X-Received: by 10.236.26.229 with SMTP id c65mr23973279yha.13.1416222338765; Mon, 17 Nov 2014 03:05:38 -0800 (PST) Received: from bala-PowerEdge-T110-II.caveonetworks.com ([111.93.218.67]) by mx.google.com with ESMTPSA id e35sm14927257yhq.45.2014.11.17.03.05.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Nov 2014 03:05:38 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Mon, 17 Nov 2014 16:33:40 +0530 Message-Id: <1416222221-17496-2-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1416222221-17496-1-git-send-email-bala.manoharan@linaro.org> References: <1416222221-17496-1-git-send-email-bala.manoharan@linaro.org> X-Topics: Classification patch Subject: [lng-odp] [ODP/PATCHv1 2/3] Buffer Management changes for sync with classification 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.181 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 This patch contains Buffer Management changes synced for classification compilation. This patch will have to be redone once Packet Management change has been synced in repo. Signed-off-by: Balasubramanian Manoharan --- helper/include/odph_ip.h | 6 +++ helper/include/odph_tcp.h | 61 ++++++++++++++++++++++ .../include/odp_buffer_pool_internal.h | 10 ++++ platform/linux-generic/odp_buffer_pool.c | 10 ---- 4 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 helper/include/odph_tcp.h diff --git a/helper/include/odph_ip.h b/helper/include/odph_ip.h index 2c83c0f..f78724e 100644 --- a/helper/include/odph_ip.h +++ b/helper/include/odph_ip.h @@ -35,6 +35,9 @@ extern "C" { /** @internal Returns IPv4 header length */ #define ODPH_IPV4HDR_IHL(ver_ihl) ((ver_ihl) & 0x0f) +/** @internal Returns IPv4 DSCP */ +#define ODPH_IPV4HDR_DSCP(tos) (((tos) & 0xfc) >> 2) + /** @internal Returns IPv4 Don't fragment */ #define ODPH_IPV4HDR_FLAGS_DONT_FRAG(frag_offset) ((frag_offset) & 0x4000) @@ -47,6 +50,9 @@ extern "C" { /** @internal Returns true if IPv4 packet is a fragment */ #define ODPH_IPV4HDR_IS_FRAGMENT(frag_offset) ((frag_offset) & 0x3fff) +/** @internal Returns IPv4 DSCP */ +#define ODPH_IPV6HDR_DSCP(ver_tc_flow) (uint8_t)((((ver_tc_flow) & 0x0fc00000) >> 22) & 0xff) + /** IPv4 header */ typedef struct ODP_PACKED { uint8_t ver_ihl; /**< Version / Header length */ diff --git a/helper/include/odph_tcp.h b/helper/include/odph_tcp.h new file mode 100644 index 0000000..4c5912b --- /dev/null +++ b/helper/include/odph_tcp.h @@ -0,0 +1,61 @@ +/* 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 + +/** UDP header length */ +#define ODPH_TCPHDR_LEN 8 + +/** 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 { + uint32be_t flags_and_window; + struct { + uint32be_t rsvd1:8; + uint32be_t flags:8; /**< TCP flags as a byte */ + uint32be_t rsvd2:16; + }; + struct { + uint32be_t hl:4; /**< Hdr len, in words */ + uint32be_t rsvd3:6; /**< Reserved */ + uint32be_t urg:1; /**< ACK */ + uint32be_t ack:1; + uint32be_t psh:1; + uint32be_t rst:1; + uint32be_t syn:1; + uint32be_t fin:1; + uint32be_t window:16; /**< 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/odp_buffer_pool_internal.h b/platform/linux-generic/include/odp_buffer_pool_internal.h index e0210bd..bdbefff 100644 --- a/platform/linux-generic/include/odp_buffer_pool_internal.h +++ b/platform/linux-generic/include/odp_buffer_pool_internal.h @@ -64,6 +64,12 @@ struct pool_entry_s { size_t hdr_size; }; +typedef union pool_entry_u { + struct pool_entry_s s; + + uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(struct pool_entry_s))]; + +} pool_entry_t; extern void *pool_entry_ptr[]; @@ -73,6 +79,10 @@ static inline void *get_pool_entry(uint32_t pool_id) return pool_entry_ptr[pool_id]; } +static inline uint32_t pool_handle_to_index(odp_buffer_pool_t pool_hdl) +{ + return pool_hdl - 1; +} static inline odp_buffer_hdr_t *odp_buf_to_hdr(odp_buffer_t buf) { diff --git a/platform/linux-generic/odp_buffer_pool.c b/platform/linux-generic/odp_buffer_pool.c index a48d7d6..57393dd 100644 --- a/platform/linux-generic/odp_buffer_pool.c +++ b/platform/linux-generic/odp_buffer_pool.c @@ -56,12 +56,6 @@ typedef struct { } odp_any_buffer_hdr_t; -typedef union pool_entry_u { - struct pool_entry_s s; - - uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(struct pool_entry_s))]; - -} pool_entry_t; typedef struct pool_table_t { @@ -86,10 +80,6 @@ static inline odp_buffer_pool_t pool_index_to_handle(uint32_t pool_id) } -static inline uint32_t pool_handle_to_index(odp_buffer_pool_t pool_hdl) -{ - return pool_hdl -1; -} static inline void set_handle(odp_buffer_hdr_t *hdr,