From patchwork Thu Jul 2 16:42:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 50603 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 C8EB7218E1 for ; Thu, 2 Jul 2015 16:43:20 +0000 (UTC) Received: by lagh6 with SMTP id h6sf21412298lag.0 for ; Thu, 02 Jul 2015 09:43:19 -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: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=Usjmcn2wmpx6suufNT01qSjBr283AsXGDOpVLrp0wCc=; b=eIwevDp/E7BHc5byZwzFFsJo4jfYx2IGslsOs2tlqqQQxGvPmYRkTR6MCs2HHYYpTK b3mge+hpngDuxAd9cLrXdLVNLmq3IFB7ep4g03FnNNQovKnGYUqnKgBzjG7P9GBzVZTb HI/lz7nmgKNgcNW3XbJqPzX7l1q3Ezllgr1ZCVruOD+MRBFxebQ3oha3W3UYP0L2SeDu OT7VOT844Vinr5i0jpM2WgIcdtqa1qOmsOma5dg5JpGOw716kFrJRDwH/+VHJ4sFYok6 yqeDKKyxlmx96aldmCDDzK6AAeWMPnTEDq7ou7KRL/AInXZuQVqQkoTmO2LOsTyJUNdE DVng== X-Gm-Message-State: ALoCoQnmMvmdIMfduRIYk6ndtj6M8uhbSMlVyQsHphEmmfIM22ESb3Jw2O9XRi9z20ZrKmTICh5j X-Received: by 10.112.138.2 with SMTP id qm2mr20345996lbb.19.1435855399770; Thu, 02 Jul 2015 09:43:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.70 with SMTP id be6ls347695lab.103.gmail; Thu, 02 Jul 2015 09:43:19 -0700 (PDT) X-Received: by 10.152.88.68 with SMTP id be4mr28964425lab.76.1435855399618; Thu, 02 Jul 2015 09:43:19 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id qg4si4904977lbb.25.2015.07.02.09.43.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 09:43:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by lagx9 with SMTP id x9so64988697lag.1 for ; Thu, 02 Jul 2015 09:43:19 -0700 (PDT) X-Received: by 10.112.204.6 with SMTP id ku6mr31620125lbc.73.1435855399333; Thu, 02 Jul 2015 09:43:19 -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 hn6csp598196lbb; Thu, 2 Jul 2015 09:43:18 -0700 (PDT) X-Received: by 10.140.106.196 with SMTP id e62mr43089838qgf.42.1435855397936; Thu, 02 Jul 2015 09:43:17 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id i65si6954561qkh.58.2015.07.02.09.43.17; Thu, 02 Jul 2015 09:43:17 -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 E47CA61FAF; Thu, 2 Jul 2015 16:43:16 +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=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 A32FC61FA7; Thu, 2 Jul 2015 16:43:03 +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 21CFD61FA5; Thu, 2 Jul 2015 16:43:01 +0000 (UTC) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by lists.linaro.org (Postfix) with ESMTPS id 4DC1861FA3 for ; Thu, 2 Jul 2015 16:42:59 +0000 (UTC) Received: by wicgi11 with SMTP id gi11so79155488wic.0 for ; Thu, 02 Jul 2015 09:42:58 -0700 (PDT) X-Received: by 10.194.23.194 with SMTP id o2mr27857922wjf.63.1435855378260; Thu, 02 Jul 2015 09:42:58 -0700 (PDT) Received: from localhost.localdomain ([90.152.119.35]) by mx.google.com with ESMTPSA id c11sm28083544wib.1.2015.07.02.09.42.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Jul 2015 09:42:57 -0700 (PDT) From: Zoltan Kiss To: lng-odp@lists.linaro.org Date: Thu, 2 Jul 2015 17:42:43 +0100 Message-Id: <1435855363-20180-1-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Cc: lng-odp-ovs@lists.linaro.org, lng-odp-dpdk@lists.linaro.org, Petri Savolainen Subject: [lng-odp] [API-NEXT PATCH RFC] api: packet: add optional persistent metadata 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.215.41 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 requirement came from ODP-OVS: it handles buffers through 'struct ofpbuf' (in upstream it became 'struct dp_packet'), and they can be non-ODP buffers as well. Therefore after receiving a packet currently we have to reset three fields in it: 'source' (to ODP), 'allocated' (segment size, OVS doesn't support multiple segments in this struct) and 'odp_pkt' (points to the containing odp_packet_t) The native DPDK implementation takes advantage of the fact that the buffer and user metadata area, where this struct is stored is allocated during pool creation time, therefore it initializes it to static values at startup. When I've tried this behaviour with ODP-DPDK, the performance increased from ~12.7 to ~12.9 Mpp. That's only ~%1.6 increase, but in other words it's ~%17 of the gap between the current and OVS-DPDK performance (13.9 Mpp) I would like a propose an optional feature where the implementation can signal if it guarantees this behaviour. I think most implementations would preallocate these areas to achieve good performance, but e.g. linux-generic does not AFAIK. Signed-off-by: Zoltan Kiss --- include/odp/api/config.h | 10 ++++++++++ include/odp/api/packet.h | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/odp/api/config.h b/include/odp/api/config.h index 91ea34e..d48030e 100644 --- a/include/odp/api/config.h +++ b/include/odp/api/config.h @@ -121,6 +121,16 @@ extern "C" { */ #define ODP_CONFIG_PACKET_BUF_LEN_MAX (ODP_CONFIG_PACKET_SEG_LEN_MIN*6) +/** + * Guarantee that user metadata is allocated during pool creation + * + * If this parameter is 1, applications can avoid reseting persistent parts of + * the area returned by odp_packet_user_area() by setting them once, after pool + * creation. It will keep its content between odp_packet_free() and + * odp_packet_alloc(). + */ +#define ODP_CONFIG_PACKET_PERSISTENT_MD 0 + /** Maximum number of shared memory blocks. * * This the the number of separate SHM areas that can be reserved concurrently diff --git a/include/odp/api/packet.h b/include/odp/api/packet.h index 91a124a..d7aeb95 100644 --- a/include/odp/api/packet.h +++ b/include/odp/api/packet.h @@ -448,7 +448,9 @@ void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx); * User area address * * Each packet has an area for user data. Size of the area is fixed and defined - * in packet pool parameters. + * in packet pool parameters. If ODP_CONFIG_PACKET_PERSISTENT_MD is 1, this + * area is allocated during pool creation, and keep its content between + * odp_packet_free() and odp_packet_alloc(). * * @param pkt Packet handle *