From patchwork Wed Apr 15 16:00:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 47212 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 99A632121F for ; Wed, 15 Apr 2015 16:01:32 +0000 (UTC) Received: by lamp14 with SMTP id p14sf11205448lam.3 for ; Wed, 15 Apr 2015 09:01:31 -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: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=EuZJlRYvrqs/bkZa72nrz33eb/Bny+1/CIHd97lykVY=; b=bBZNP37V3knpJRv1eKrkR8EdUghUncULJG1k1sfeGTJVkNVVVAtTJMjnuYa8CmOqN/ n4xpse2BMY6fubK4GEPoyntcWRbGLfqW6l5woTTFsnc6AiPCrhbSVauxgQbvBdI7wiNX x68vw3nhHjjdvNlERobn2rNyH8NMsFySaMJ6tUKSPvpqHel4/eiX74j+VS+gsy1qxAez 3zicn+36fya8Lj+2wuKZxNGx62OlJjBFq+gCBSM07s9w/+58i5xeDeF0+QO2yXOGKsps CqZCw0UBNOefjjUFcqauWJFL6gSG3mVyr7Vf7GBpxLFDU1IUxWZxiYB27fIXLVO4/ECu UjHA== X-Gm-Message-State: ALoCoQmpFQQqHpp+tdhOeruNEPP6zxJy/whN7WJ0nD+D2E3I6SXpkrgWN9GuNTayF9Az8zCJXCNW X-Received: by 10.180.105.226 with SMTP id gp2mr5131117wib.1.1429113691409; Wed, 15 Apr 2015 09:01:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.38 with SMTP id w6ls216693laa.13.gmail; Wed, 15 Apr 2015 09:01:31 -0700 (PDT) X-Received: by 10.112.67.107 with SMTP id m11mr24352754lbt.43.1429113691238; Wed, 15 Apr 2015 09:01:31 -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 vt12si4198615lac.164.2015.04.15.09.01.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Apr 2015 09:01:31 -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 lbbzk7 with SMTP id zk7so37728621lbb.0 for ; Wed, 15 Apr 2015 09:01:31 -0700 (PDT) X-Received: by 10.152.116.11 with SMTP id js11mr24571568lab.106.1429113691148; Wed, 15 Apr 2015 09:01:31 -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.67.65 with SMTP id l1csp2604524lbt; Wed, 15 Apr 2015 09:01:30 -0700 (PDT) X-Received: by 10.140.108.201 with SMTP id j67mr21882984qgf.79.1429113690334; Wed, 15 Apr 2015 09:01:30 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id l92si5037318qgf.83.2015.04.15.09.01.29; Wed, 15 Apr 2015 09:01:30 -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 2DEDE61F2B; Wed, 15 Apr 2015 16:01:29 +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_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=unavailable autolearn_force=no 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 70D8661F2F; Wed, 15 Apr 2015 16:01:22 +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 2830561F29; Wed, 15 Apr 2015 16:01:18 +0000 (UTC) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by lists.linaro.org (Postfix) with ESMTPS id 2113261F26 for ; Wed, 15 Apr 2015 16:01:16 +0000 (UTC) Received: by wizk4 with SMTP id k4so160864525wiz.1 for ; Wed, 15 Apr 2015 09:01:15 -0700 (PDT) X-Received: by 10.180.81.70 with SMTP id y6mr42853426wix.47.1429113674964; Wed, 15 Apr 2015 09:01:14 -0700 (PDT) Received: from localhost.localdomain ([90.152.119.35]) by mx.google.com with ESMTPSA id df1sm22206484wib.12.2015.04.15.09.01.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Apr 2015 09:01:13 -0700 (PDT) From: Zoltan Kiss To: lng-odp@lists.linaro.org Date: Wed, 15 Apr 2015 17:00:56 +0100 Message-Id: <1429113656-14404-1-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [RFC API-NEXT PATCH] packet_io: add bitmap to specify what level of parsing needed 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: zoltan.kiss@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 odp_pktio_open() will have a 32 bit bitmask to specify what kind of header parsing is required by the application. Signed-off-by: Zoltan Kiss --- include/odp/api/packet_flags.h | 49 ++++++++++++++++++++++++++++++++++++++++++ include/odp/api/packet_io.h | 14 ++++++++---- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/include/odp/api/packet_flags.h b/include/odp/api/packet_flags.h index b1e179e..467d4f1 100644 --- a/include/odp/api/packet_flags.h +++ b/include/odp/api/packet_flags.h @@ -327,6 +327,55 @@ void odp_packet_has_sctp_set(odp_packet_t pkt, int val); void odp_packet_has_icmp_set(odp_packet_t pkt, int val); /** + * Shift values for enum odp_packet_parse. Has to be updated together with + * odp_packet_parse_e type. The parameter passed to odp_pktio_open is a 32 bit + * mask. + */ +typedef enum odp_packet_parse_shift { + ODP_PARSE_SHIFT_ETH, + ODP_PARSE_SHIFT_JUMBO, + ODP_PARSE_SHIFT_VLAN, + ODP_PARSE_SHIFT_VLAN_QINQ, + ODP_PARSE_SHIFT_ARP, + ODP_PARSE_SHIFT_IPV4, + ODP_PARSE_SHIFT_IPV6, + ODP_PARSE_SHIFT_IPFRAG, + ODP_PARSE_SHIFT_IPOPT, + ODP_PARSE_SHIFT_IPSEC, + ODP_PARSE_SHIFT_UDP, + ODP_PARSE_SHIFT_TCP, + ODP_PARSE_SHIFT_SCTP, + ODP_PARSE_SHIFT_ICMP, + ODP_PARSE_SHIFT_MAX = 31 +} odp_packet_parse_shift_e; + +#define ODP_PARSE(FIELD) ODP_PARSE_##FIELD = (ODP_PARSE_SHIFT_##FIELD << 1) + +/** + * Values to be used when calling odp_pktio_open. The parser_mask parameter has + * to be one or more of these values joined with bitwise OR. Or one of the two + * special values: ODP_PARSE_NONE or ODP_PARSE_ALL. + * Has to be updated together with odp_packet_parse_shift_e + */ +typedef enum odp_packet_parse { + ODP_PARSE_NONE = 0, /* The application don't want any parsing */ + ODP_PARSE(ETH), /* Parse Ethernet header */ + ODP_PARSE(JUMBO), /* Parse Ethernet header if a jumbo frame */ + ODP_PARSE(VLAN), /* Parse VLAN header */ + ODP_PARSE(VLAN_QINQ), /* Parse VLAN QinQ header */ + ODP_PARSE(ARP), /* Parse ARP header */ + ODP_PARSE(IPV4), /* Parse IPv4 header */ + ODP_PARSE(IPV6), /* Parse IPv6 header */ + ODP_PARSE(IPFRAG), /* Parse IPv4 header if fragmented */ + ODP_PARSE(IPOPT), /* Parse IP options */ + ODP_PARSE(IPSEC), /* Parse IPsec header */ + ODP_PARSE(UDP), /* Parse UDP header */ + ODP_PARSE(TCP), /* Parse TCP header */ + ODP_PARSE(SCTP), /* Parse SCTP header */ + ODP_PARSE(ICMP), /* Parse ICMP header */ + ODP_PARSE_ALL = UINT32_MAX /* The application wants full parsing */ +} odp_packet_parse_e; +/** * @} */ diff --git a/include/odp/api/packet_io.h b/include/odp/api/packet_io.h index 6d31aeb..8c989f3 100644 --- a/include/odp/api/packet_io.h +++ b/include/odp/api/packet_io.h @@ -51,9 +51,14 @@ extern "C" { * open device will fail, returning ODP_PKTIO_INVALID with errno set. * odp_pktio_lookup() may be used to obtain a handle to an already open device. * - * @param dev Packet IO device name - * @param pool Pool from which to allocate buffers for storing packets - * received over this packet IO + * @param dev Packet IO device name + * @param pool Pool from which to allocate buffers for storing packets + * received over this packet IO + * @param parsing_mask Mask to request parsing. Must be one or more ODP_PARSE_* + * value joined with bitwise OR to request particular + * fields to be parsed. Or one of two special values: + * ODP_PARSE_NONE or ODP_PARSE_ALL. See odp_packet_parse_e + * in packet_flags.h for more details * * @return ODP packet IO handle * @retval ODP_PKTIO_INVALID on failure @@ -62,7 +67,8 @@ extern "C" { * device used for testing. Usually it's loop back * interface. */ -odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool); +odp_pktio_t odp_pktio_open(const char *dev, odp_pool_t pool, + uint32_t parsing_mask); /** * Close an ODP packet IO instance