From patchwork Sat Jul 18 20:03:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 51255 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1EF1422A28 for ; Sat, 18 Jul 2015 20:08:05 +0000 (UTC) Received: by lbvb1 with SMTP id b1sf32129237lbv.3 for ; Sat, 18 Jul 2015 13:08:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:cc: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=pEPFxFfIDkOD0d9Q5/6tlgHL4OeUwYfpgfwJ7HwwW9M=; b=OYPSnY+Tf0Xc3ddoYnXLnH+pLOOBMJvJv3Jdx9Ux9L+EzSXcGiXfQktt5VEhLPPIQ6 TEmi+cMihsO0OUztpB3v1IxKz+igHxshVtcdD02O4iHe6Ha/VLmkC0YNKsXCArZrUloB dz2KUF4bqDWkNi9jdRvATDxYqgT2pioYWm4527Ut7fIRm4uiFcec4cHnYZ0UHrZDMby8 jN0UyT3FD3b+T9kmbc5mc+M1KrH4KUXbTEWPkbyXf11vC6/1UxYK/4AFcpTltjVTdZdU mV4PrxUZc/W5J9Ty5AbSusLPEQ+AZaVEM9h9ZIWqsMh84R1Dug3wKwQRDhEAfzKmmt9d Q8pg== X-Gm-Message-State: ALoCoQl7jftv2NleyMHLqRmtUvBjxqlb+uX54GXWCB3R3o3O1Og5y+FLKy0etu/4EW/k9YoQMaWt X-Received: by 10.180.216.12 with SMTP id om12mr2121210wic.1.1437250084030; Sat, 18 Jul 2015 13:08:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.38 with SMTP id lt6ls652473lac.50.gmail; Sat, 18 Jul 2015 13:08:03 -0700 (PDT) X-Received: by 10.112.161.197 with SMTP id xu5mr20251955lbb.69.1437250083735; Sat, 18 Jul 2015 13:08:03 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id uo6si13424996lbc.21.2015.07.18.13.08.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Jul 2015 13:08:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbbpo10 with SMTP id po10so76546868lbb.3 for ; Sat, 18 Jul 2015 13:08:03 -0700 (PDT) X-Received: by 10.112.133.72 with SMTP id pa8mr20218545lbb.117.1437250083432; Sat, 18 Jul 2015 13:08:03 -0700 (PDT) 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.108.230 with SMTP id hn6csp534591lbb; Sat, 18 Jul 2015 13:08:02 -0700 (PDT) X-Received: by 10.140.146.83 with SMTP id 80mr29888108qhs.76.1437250082221; Sat, 18 Jul 2015 13:08:02 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q106si18634213qgq.84.2015.07.18.13.08.01; Sat, 18 Jul 2015 13:08:02 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 7BFCC61CAF; Sat, 18 Jul 2015 20:08:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 71E4C61D18; Sat, 18 Jul 2015 20:05:17 +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 7137C61CF9; Sat, 18 Jul 2015 20:04:26 +0000 (UTC) Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) by lists.linaro.org (Postfix) with ESMTPS id BF24B61D13 for ; Sat, 18 Jul 2015 20:03:59 +0000 (UTC) Received: by oige126 with SMTP id e126so88674138oig.0 for ; Sat, 18 Jul 2015 13:03:59 -0700 (PDT) X-Received: by 10.60.50.232 with SMTP id f8mr18695887oeo.55.1437249839322; Sat, 18 Jul 2015 13:03:59 -0700 (PDT) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by smtp.gmail.com with ESMTPSA id y5sm8537998oes.15.2015.07.18.13.03.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Jul 2015 13:03:58 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sat, 18 Jul 2015 15:03:39 -0500 Message-Id: <1437249827-578-5-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1437249827-578-1-git-send-email-bill.fischofer@linaro.org> References: <1437249827-578-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Cc: Barry Spinney Subject: [lng-odp] [RFC API-NEXT PATCH 04/12] linux-generic: packet: implementation of new packet apis for tm X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bill.fischofer@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.172 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 Signed-off-by: Barry Spinney Signed-off-by: Mike Holmes Signed-off-by: Bill Fischofer --- .../linux-generic/include/odp_packet_internal.h | 5 +++ platform/linux-generic/odp_packet_flags.c | 45 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 8c41491..c1b1f2f 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -61,6 +61,9 @@ typedef union { uint32_t tcpopt:1; /**< TCP options present */ uint32_t sctp:1; /**< SCTP */ uint32_t icmp:1; /**< ICMP */ + + uint32_t color:2; /**< Packet color for traffic mgmt */ + uint32_t nodrop:1; /**< Drop eligibility status */ }; } input_flags_t; @@ -102,6 +105,8 @@ typedef union { uint32_t l3_chksum:1; /**< L3 chksum override */ uint32_t l4_chksum_set:1; /**< L3 chksum bit is valid */ uint32_t l4_chksum:1; /**< L4 chksum override */ + + int8_t shaper_len_adj; /**< adjustment for traffic mgr */ }; } output_flags_t; diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 4f680a1..eeb2eb6 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -202,3 +202,48 @@ void odp_packet_has_icmp_set(odp_packet_t pkt, int val) { setflag(pkt, input_flags.icmp, val); } + +odp_pkt_color_t odp_packet_color(odp_packet_t pkt) +{ + retflag(pkt, input_flags.color); +} + +void odp_packet_color_set(odp_packet_t pkt, odp_pkt_color_t color) +{ + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + + if (pkt_hdr->input_flags.unparsed) + _odp_packet_parse(pkt_hdr); + + pkt_hdr->input_flags.color = color; +} + +odp_bool_t odp_packet_drop_eligible(odp_packet_t pkt) +{ + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + + if (pkt_hdr->input_flags.unparsed) + _odp_packet_parse(pkt_hdr); + + return !pkt_hdr->input_flags.nodrop; +} + +void odp_packet_drop_eligible_set(odp_packet_t pkt, odp_bool_t drop) +{ + setflag(pkt, input_flags.nodrop, !drop); +} + +int8_t odp_packet_shaper_len_adjust(odp_packet_t pkt) +{ + retflag(pkt, output_flags.shaper_len_adj); +} + +void odp_packet_shaper_len_adjust_set(odp_packet_t pkt, int8_t adj) +{ + odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); + + if (pkt_hdr->input_flags.unparsed) + _odp_packet_parse(pkt_hdr); + + pkt_hdr->output_flags.shaper_len_adj = adj; +}