From patchwork Fri Sep 5 17:11:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robbie King X-Patchwork-Id: 36873 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 60D6A202E4 for ; Fri, 5 Sep 2014 17:12:21 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf70276482pde.11 for ; Fri, 05 Sep 2014 10:12:20 -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: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=DftmygDIXDxWFSb+a2msexIuWecYj1ZK4ixtTXyDSSA=; b=h85KLHV2YNNJh9oj3MOuNZq7JkEKJcQasCWFvA89QygWO0mBvP8A/kCIQx6oCPXnoZ 0cE2hOyG2EMreKyocN1O5hLSjhu1fVwG2UjLDxauipj/Ry7aYhcYcB7NhmZNTl+RJfo1 vY3buMC3+wO63S8gHZ6pvIpI1HSZGkP3NW1Ut68w2ald7vSZTWpaPm4kEfScZcjqgN6z VbNXIFe9g0ISruUVecF6hxHp52j9H+Y6IpSHOTGvc+zkEwFt1/kM7KhC0QrunbS+taWq VZ8rNs59F8spoTrospF0Xfu0fNB0RnMsY7yB2bk9KCj0++nJO4xq01VH7JyJxXxIvU11 WVuw== X-Gm-Message-State: ALoCoQk+EcjnRV0DXS9VCHPSXYx9SqmK/5ye6PkoJDGaV4KEgmTqnOKbuCwBH0pSJmzgNtkU5433 X-Received: by 10.66.171.231 with SMTP id ax7mr7453138pac.29.1409937140686; Fri, 05 Sep 2014 10:12:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.206 with SMTP id l72ls813148qgl.46.gmail; Fri, 05 Sep 2014 10:12:20 -0700 (PDT) X-Received: by 10.52.1.39 with SMTP id 7mr9876029vdj.17.1409937140575; Fri, 05 Sep 2014 10:12:20 -0700 (PDT) Received: from mail-vc0-x230.google.com (mail-vc0-x230.google.com [2607:f8b0:400c:c03::230]) by mx.google.com with ESMTPS id h9si1811885vdw.30.2014.09.05.10.12.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 10:12:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::230 as permitted sender) client-ip=2607:f8b0:400c:c03::230; Received: by mail-vc0-f176.google.com with SMTP id ik5so12689778vcb.35 for ; Fri, 05 Sep 2014 10:12:20 -0700 (PDT) X-Received: by 10.52.94.108 with SMTP id db12mr9941717vdb.8.1409937140483; Fri, 05 Sep 2014 10:12:20 -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.221.45.67 with SMTP id uj3csp113508vcb; Fri, 5 Sep 2014 10:12:20 -0700 (PDT) X-Received: by 10.140.88.41 with SMTP id s38mr19420030qgd.73.1409937139754; Fri, 05 Sep 2014 10:12:19 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id 5si2391520qgb.33.2014.09.05.10.12.18 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 05 Sep 2014 10:12:19 -0700 (PDT) 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-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XPx3a-0002dE-1E; Fri, 05 Sep 2014 17:12:18 +0000 Received: from alln-iport-4.cisco.com ([173.37.142.91]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XPx3P-0002cg-Dh for lng-odp@lists.linaro.org; Fri, 05 Sep 2014 17:12:07 +0000 X-IronPort-AV: E=Sophos;i="5.04,474,1406592000"; d="scan'208";a="75349517" Received: from rcdn-core-12.cisco.com ([173.37.93.148]) by alln-iport-4.cisco.com with ESMTP; 05 Sep 2014 17:12:02 +0000 Received: from cpp-rtpbld-55.cisco.com (cpp-rtpbld-55.cisco.com [172.18.5.199]) by rcdn-core-12.cisco.com (8.14.5/8.14.5) with ESMTP id s85HC1ok007046 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 5 Sep 2014 17:12:02 GMT Received: from cpp-rtpbld-55.cisco.com (localhost.localdomain [127.0.0.1]) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8) with ESMTP id s85HC1FR001189; Fri, 5 Sep 2014 13:12:01 -0400 Received: (from robking@localhost) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8/Submit) id s85HC1Me001188; Fri, 5 Sep 2014 13:12:01 -0400 From: Robbie King To: lng-odp@lists.linaro.org Date: Fri, 5 Sep 2014 13:11:03 -0400 Message-Id: <1409937064-1036-4-git-send-email-robking@cisco.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1409937064-1036-1-git-send-email-robking@cisco.com> References: <1409937064-1036-1-git-send-email-robking@cisco.com> X-Topics: patch Subject: [lng-odp] [PATCHv6 3/4] Add ability to set packet flags 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-Original-Sender: robking@cisco.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::230 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=fail header.i=@cisco.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Robbie King Reviewed-by: Anders Roxell --- .../linux-generic/include/api/odp_packet_flags.h | 136 ++++++++++++++++++++ platform/linux-generic/odp_packet_flags.c | 87 +++++++++++++ 2 files changed, 223 insertions(+), 0 deletions(-) diff --git a/platform/linux-generic/include/api/odp_packet_flags.h b/platform/linux-generic/include/api/odp_packet_flags.h index eb9315b..2c19440 100644 --- a/platform/linux-generic/include/api/odp_packet_flags.h +++ b/platform/linux-generic/include/api/odp_packet_flags.h @@ -182,6 +182,142 @@ int odp_packet_inflag_icmp(odp_packet_t pkt); */ void odp_packet_outflag_l4_chksum(odp_packet_t pkt); +/** + * Set flag for L2 header, e.g. ethernet + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_l2(odp_packet_t pkt, int val); + +/** + * Set flag for L3 header, e.g. IPv4, IPv6 + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_l3(odp_packet_t pkt, int val); + +/** + * Set flag for L4 header, e.g. UDP, TCP, SCTP (also ICMP) + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_l4(odp_packet_t pkt, int val); + +/** + * Set flag for Ethernet header + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_eth(odp_packet_t pkt, int val); + +/** + * Set flag for jumbo frame + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_jumbo(odp_packet_t pkt, int val); + +/** + * Set flag for VLAN + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_vlan(odp_packet_t pkt, int val); + +/** + * Set flag for VLAN QinQ (stacked VLAN) + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_vlan_qinq(odp_packet_t pkt, int val); + +/** + * Set flag for ARP + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_arp(odp_packet_t pkt, int val); + +/** + * Set flag for IPv4 + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_ipv4(odp_packet_t pkt, int val); + +/** + * Set flag for IPv6 + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_ipv6(odp_packet_t pkt, int val); + +/** + * Set flag for IP fragment + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_ipfrag(odp_packet_t pkt, int val); + +/** + * Set flag for IP options + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_ipopt(odp_packet_t pkt, int val); + +/** + * Set flag for IPSec + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_ipsec(odp_packet_t pkt, int val); + +/** + * Set flag for UDP + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_udp(odp_packet_t pkt, int val); + +/** + * Set flag for TCP + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_tcp(odp_packet_t pkt, int val); + +/** + * Set flag for SCTP + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_sctp(odp_packet_t pkt, int val); + +/** + * Set flag for ICMP + * + * @param pkt Packet handle + * @param val Value + */ +void odp_packet_set_inflag_icmp(odp_packet_t pkt, int val); + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 992b94b..06fdeed 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -113,3 +113,90 @@ void odp_packet_outflag_l4_chksum(odp_packet_t pkt) { odp_packet_hdr(pkt)->output_flags.l4_chksum = 1; } + +/* Set Input Flags */ + +void odp_packet_set_inflag_l2(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.l2 = val; +} + +void odp_packet_set_inflag_l3(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.l3 = val; +} + +void odp_packet_set_inflag_l4(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.l4 = val; +} + +void odp_packet_set_inflag_eth(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.eth = val; +} + +void odp_packet_set_inflag_jumbo(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.jumbo = val; +} + +void odp_packet_set_inflag_vlan(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.vlan = val; +} + +void odp_packet_set_inflag_vlan_qinq(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.vlan_qinq = val; +} + +void odp_packet_set_inflag_arp(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.arp = val; +} + +void odp_packet_set_inflag_ipv4(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.ipv4 = val; +} + +void odp_packet_set_inflag_ipv6(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.ipv6 = val; +} + +void odp_packet_set_inflag_ipfrag(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.ipfrag = val; +} + +void odp_packet_set_inflag_ipopt(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.ipopt = val; +} + +void odp_packet_set_inflag_ipsec(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.ipsec = val; +} + +void odp_packet_set_inflag_udp(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.udp = val; +} + +void odp_packet_set_inflag_tcp(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.tcp = val; +} + +void odp_packet_set_inflag_sctp(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.sctp = val; +} + +void odp_packet_set_inflag_icmp(odp_packet_t pkt, int val) +{ + odp_packet_hdr(pkt)->input_flags.icmp = val; +}