From patchwork Wed Aug 20 17:11:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 35707 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f200.google.com (mail-yk0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3E0782055D for ; Wed, 20 Aug 2014 17:11:54 +0000 (UTC) Received: by mail-yk0-f200.google.com with SMTP id 9sf26475593ykp.7 for ; Wed, 20 Aug 2014 10:11:54 -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=SlLU89UWcBSzgsHpeI19xSwLG7D2tTKw5iFdR04uiMo=; b=m+aOIemrlFuzah6xU0eAjvG7G31rVtV0E6VocQcJQQZRyWUrwR0fOcKCZpZFrIbLb/ t2TGhW0/mDcyrz5DSDMKvCDiAuIALULxyuCES8diTlcwfO+oskjCO1ld/AOAM/E+sCmL dkUWDAkOjhRX45Pg1x2UJJ5ZLbHmFNG6auEGILaRZTXbHQHKx20fuSeQPCMGBnj2H9Ob aOHegeUIrcwvrH5jBMBE5hHjOFx5hbM/w+rUV4zxZ19czH0+pSLbZCErJM/jl+ZOp0EB iHGpGFQdlMaaLUFQyRdyA8A4eL+P5XEKQgnPrOuemYbF0b87fC0X0SJMIG1pVaoeWIVx M9dw== X-Gm-Message-State: ALoCoQlUnR7d3J88JJsbBfDSJMNgiBLA1pAxZ5QBLAYfwwjkvi3IPElsZq/WEOB5wcqbbr17kG1b X-Received: by 10.236.69.138 with SMTP id n10mr1205509yhd.49.1408554714070; Wed, 20 Aug 2014 10:11:54 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.240 with SMTP id n103ls410776qgd.13.gmail; Wed, 20 Aug 2014 10:11:53 -0700 (PDT) X-Received: by 10.220.127.17 with SMTP id e17mr2866741vcs.56.1408554713911; Wed, 20 Aug 2014 10:11:53 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id e20si11077367vdj.21.2014.08.20.10.11.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Aug 2014 10:11:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf12so9323167vcb.26 for ; Wed, 20 Aug 2014 10:11:53 -0700 (PDT) X-Received: by 10.220.97.5 with SMTP id j5mr37753414vcn.16.1408554713818; Wed, 20 Aug 2014 10:11:53 -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 uj3csp69761vcb; Wed, 20 Aug 2014 10:11:53 -0700 (PDT) X-Received: by 10.236.30.105 with SMTP id j69mr73701464yha.19.1408554713288; Wed, 20 Aug 2014 10:11:53 -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 p7si34822892qat.47.2014.08.20.10.11.50 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 20 Aug 2014 10:11:51 -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 1XK9QH-0002mr-QW; Wed, 20 Aug 2014 17:11:45 +0000 Received: from mail-lb0-f175.google.com ([209.85.217.175]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XK9QB-0002mQ-37 for lng-odp@lists.linaro.org; Wed, 20 Aug 2014 17:11:39 +0000 Received: by mail-lb0-f175.google.com with SMTP id 10so6951302lbg.20 for ; Wed, 20 Aug 2014 10:11:33 -0700 (PDT) X-Received: by 10.152.120.38 with SMTP id kz6mr7463638lab.8.1408554693051; Wed, 20 Aug 2014 10:11:33 -0700 (PDT) Received: from sestofb10.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id dv6sm2008002lbc.32.2014.08.20.10.11.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Aug 2014 10:11:32 -0700 (PDT) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Wed, 20 Aug 2014 19:11:15 +0200 Message-Id: <1408554678-55317-2-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408554678-55317-1-git-send-email-ciprian.barbu@linaro.org> References: <1408554678-55317-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [APPS PATCH 1/4] ofpbuf: Added OFPBUF_ODP type. 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: ciprian.barbu@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.220.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 will be used by ODP for zero copy IO. Signed-off-by: Ciprian Barbu --- lib/ofpbuf.c | 6 ++++-- lib/ofpbuf.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c index 198bbf6..28013d5 100644 --- a/lib/ofpbuf.c +++ b/lib/ofpbuf.c @@ -251,6 +251,8 @@ ofpbuf_resize__(struct ofpbuf *b, size_t new_headroom, size_t new_tailroom) new_allocated = new_headroom + ofpbuf_size(b) + new_tailroom; switch (b->source) { + case OFPBUF_ODP: + OVS_NOT_REACHED(); case OFPBUF_DPDK: OVS_NOT_REACHED(); @@ -321,7 +323,7 @@ ofpbuf_prealloc_headroom(struct ofpbuf *b, size_t size) void ofpbuf_trim(struct ofpbuf *b) { - ovs_assert(b->source != OFPBUF_DPDK); + ovs_assert(b->source != OFPBUF_DPDK && b->source != OFPBUF_ODP); if (b->source == OFPBUF_MALLOC && (ofpbuf_headroom(b) || ofpbuf_tailroom(b))) { @@ -481,7 +483,7 @@ void * ofpbuf_steal_data(struct ofpbuf *b) { void *p; - ovs_assert(b->source != OFPBUF_DPDK); + ovs_assert(b->source != OFPBUF_DPDK && b->source != OFPBUF_ODP); if (b->source == OFPBUF_MALLOC && ofpbuf_data(b) == ofpbuf_base(b)) { p = ofpbuf_data(b); diff --git a/lib/ofpbuf.h b/lib/ofpbuf.h index adaf526..6af9c64 100644 --- a/lib/ofpbuf.h +++ b/lib/ofpbuf.h @@ -34,6 +34,8 @@ enum OVS_PACKED_ENUM ofpbuf_source { OFPBUF_STUB, /* Starts on stack, may expand into heap. */ OFPBUF_DPDK, /* buffer data is from DPDK allocated memory. ref to build_ofpbuf() in netdev-dpdk. */ + OFPBUF_ODP, /* buffer data is from DPDK allocated memory. + ref to build_ofpbuf() in netdev-odp. */ }; /* Buffer for holding arbitrary data. An ofpbuf is automatically reallocated