From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9C8CBA0526; Mon, 20 Jan 2020 18:40:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2E6DA1C01E; Mon, 20 Jan 2020 18:40:39 +0100 (CET) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id A06091BF87 for ; Mon, 20 Jan 2020 18:40:38 +0100 (CET) Received: by mail-wm1-f68.google.com with SMTP id q9so166410wmj.5 for ; Mon, 20 Jan 2020 09:40:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=oObIdVf/lC54CeS7hziHGHeB9BFhsrWfkALnYWXj9Rw=; b=LixbdPL6b0y3uxQM+WWa+/8nu1ZT5z4OM0NgpXF2YoYWZT9LSNeVx1bvY2EH7Q5Z8Y lNAsumRk7K0rQwQ2TCGumuSVsd8/LdLRfWkPUVVZBBHMGXfGJm1E5VOg+ZBVfWIy3+fa 8v0oojt8a63QBrPz7BCzIUj/KjC0FWO2y1+WItWN2OsEmRxHqrh27fTPNILDF382kGrr Tbr4VrbR5XqeoyR7GQ8e633wMA1yAbQHtsdlqEBpbkMZiUqHhSerZsia+0fCRx2GlZVA e8RMh7gWCmK9h3cvGfRmkl0bOmPAla2JD+Hi93iPDTXtNuAveQbafaYg1Dz3dtg95evn yyJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oObIdVf/lC54CeS7hziHGHeB9BFhsrWfkALnYWXj9Rw=; b=RT1E6eCDuJOCHHR8BqEbcZPPAQiqPTLXEZ97t5xbr3YlKb8fvzXkROL1PqM6s9NzYu AkZEM6zR1DMYuG7ARJM+2bM2aOA6hoDBvcEWv1hOg1ICx9CxnuF0ANuD2ZF9QTIIf7M3 +OYmrqyB0ZEEgA+cTvJzhGIF1pWwZsvRf7/SDcHowfquJ67MZZS5wK7u/zzsLcrZat2B D6jR+B8y8CoV3NGSIEUUAzCIpLp9YbhcmOVI19T1Zd4XfZzUoiPoiLN0nKiSwm4nSAuH u6r/IWWVCw8s/3q7Dm4hijvc5XBUc/qVsKh1Z0QmRG7ZQUc6A7CHoDHyZ/cQWNzlJNVW RcsQ== X-Gm-Message-State: APjAAAUhbjvOIQOoLJWC/XW354xgfUmdEfuOQKcTVQjJQlTaoHqYAVC7 NVgfWyoUsAeeyx1AUO4c46iGNA== X-Google-Smtp-Source: APXvYqzokbst+V56UqZ6ubB4oM8+/9sO9g3p0b6ik5l3utizfABJJ3/cmQi8JlNXUvoXQ+rgebr/Sw== X-Received: by 2002:a7b:c190:: with SMTP id y16mr12079wmi.107.1579542038378; Mon, 20 Jan 2020 09:40:38 -0800 (PST) Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0]) by smtp.gmail.com with ESMTPSA id v8sm46638979wrw.2.2020.01.20.09.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2020 09:40:37 -0800 (PST) Date: Mon, 20 Jan 2020 18:40:37 +0100 From: Olivier Matz To: Viacheslav Ovsiienko Cc: dev@dpdk.org, matan@mellanox.com, rasland@mellanox.com, orika@mellanox.com, shahafs@mellanox.com, stephen@networkplumber.org, thomas@mellanox.net Message-ID: <20200120174037.GD22738@platinum> References: <20191118094938.192850-1-shahafs@mellanox.com> <1579541003-2399-1-git-send-email-viacheslavo@mellanox.com> <1579541003-2399-3-git-send-email-viacheslavo@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1579541003-2399-3-git-send-email-viacheslavo@mellanox.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v5 2/5] mbuf: detach mbuf with pinned external buffer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, Jan 20, 2020 at 05:23:20PM +0000, Viacheslav Ovsiienko wrote: > Update detach routine to check the mbuf pool type. > Introduce the special internal version of detach routine to handle > the special case of pinned external bufferon mbuf freeing. > > Signed-off-by: Shahaf Shuler > Signed-off-by: Viacheslav Ovsiienko [...] In case there is a new version, can you please add some newlines: > +static inline int __rte_pktmbuf_pinned_extbuf_decref(struct rte_mbuf *m) > +{ > + struct rte_mbuf_ext_shared_info *shinfo; > + > + /* Clear flags, mbuf is being freed. */ > + m->ol_flags = EXT_ATTACHED_MBUF; > + shinfo = m->shinfo; here > + /* Optimize for performance - do not dec/reinit */ > + if (likely(rte_mbuf_ext_refcnt_read(shinfo) == 1)) > + return 0; here > + /* > + * Direct usage of add primitive to avoid > + * duplication of comparing with one. > + */ > + if (likely(rte_atomic16_add_return > + (&shinfo->refcnt_atomic, -1))) > + return 1; here > + /* Reinitialize counter before mbuf freeing. */ > + rte_mbuf_ext_refcnt_set(shinfo, 1); > + return 0; > +} > + > +/** > * Decrease reference counter and unlink a mbuf segment > * > * This function does the same than a free, except that it does not Apart from this, Acked-by: Olivier Matz