From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id F24331B22E for ; Thu, 16 Nov 2017 09:07:01 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id r68so7619001wmr.1 for ; Thu, 16 Nov 2017 00:07:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=WBIjtg1RkVBBNjf+oRjD/qvwEI+TXTyK6OAwzvakIKE=; b=h35uvGvf6ka+v/cXquJMELuikIpHQDjuleObehh3EsRgCLp5AgQJ04Eo8AbwtzbZBg f97AfRKpN0bwMNBz3yvIcf+6B8PX3N2QsBK+RgTXoh2uMqBJOl7J/c0JEIaluM1AiNW0 aoGiHPnbJac0fA57yRAKMy8ZYNP8COid8PZoLROJ/Ww0BMqyjpIa01HZn1Hh9aYhsojS ld98MmOMVYRGkF/8YzkZTnbZtHTx60JgIywHMPRWXCna92L1K6GOs3U3Pb/Rg9tWRSg4 l//UBhMm0PB3aoa8FT9ceR0gbZxSqL/GxDVgvoPefX0/QRtOs2JVP0OGW8ipbFKKfOkE +LrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=WBIjtg1RkVBBNjf+oRjD/qvwEI+TXTyK6OAwzvakIKE=; b=EhyuEOpsT9pt/xx5TbmQGrflr4851bKVogJbHzyFmKSLOr+OUQgGvKFRx7FttjiGCC thTiuMqWfvCmPKSPXT9tyQ3Un+kISSftKWVlV2xOHxfVKUPFfH4KFg6jT3UY1cOhQ0tx /qu2Uuv8U19GvK79OpVwHZYJCZGhy7h1U1ihdyrkRUg5CgPtcteW75WrXR/RbEeTyYGt Wc9YVv/PdtPeDs59xbg5Joy4nePu4tKGZw63ftZ1vsqHLADXjMCruuTEtNChR/qIUVl2 jrGkHtp4UxXt/uvMGUVquUeZgwXAO0F/IpnTyrULUj0HWNzFI6hBspjxKKHA7EbR7j8L piNQ== X-Gm-Message-State: AJaThX5xnqYCUNclDRYu43g+NGmI8HJem3OQOHPts5EPlf/J+lcYPo/y lKnj9jL+46ee4P1yooThnf4= X-Google-Smtp-Source: AGs4zMaugb8bRyRRo0vmiq0YK7B92G9qUxzap3rZ8k5tEDWe2S5igawbJGviIDxTh/p0b6NIFavIJw== X-Received: by 10.80.186.111 with SMTP id 44mr1510573eds.261.1510819621635; Thu, 16 Nov 2017 00:07:01 -0800 (PST) Received: from [10.0.1.214] ([185.92.25.154]) by smtp.gmail.com with ESMTPSA id w51sm572413edd.60.2017.11.16.00.07.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Nov 2017 00:07:01 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) From: Ilya Matveychikov In-Reply-To: <2fa9a7806c9e447995d6017c6def9894@XCH-RTP-017.cisco.com> Date: Thu, 16 Nov 2017 12:07:01 +0400 Cc: Olivier MATZ , Konstantin Ananyev , "dev@dpdk.org" Content-Transfer-Encoding: quoted-printable Message-Id: <47A6864E-02DC-4050-9C12-E76F8FAA4F5D@gmail.com> References: <20171115091413.27119-1-hhaim@cisco.com> <1D98684F-B8A9-4037-8534-0D4E3A1FD34C@gmail.com> <20171115173058.mrkrv3usbl5sfw3h@platinum> <2fa9a7806c9e447995d6017c6def9894@XCH-RTP-017.cisco.com> To: "Hanoch Haim (hhaim)" X-Mailer: Apple Mail (2.3273) Subject: Re: [dpdk-dev] [PATCH v3] mbuf: cleanup rte_pktmbuf_lastseg(), fix atomic usage 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: , X-List-Received-Date: Thu, 16 Nov 2017 08:07:02 -0000 > On Nov 16, 2017, at 11:16 AM, Hanoch Haim (hhaim) = wrote: >=20 > Hi Oliver,=20 >=20 > It's hard for me to follow this thread.=20 >=20 > 1) It is not about clear/not-clear, it is error prone to *replicate* = code that has the same logic. >=20 > "I'm not convinced that: >=20 > __rte_pktmbuf_reset_nb_segs(m); >=20 > is clearer than: >=20 > m->next =3D NULL; > m->nb_segs =3D 1; >=20 > Anyway, I agree this should not be part of this patch. We should only = keep the fix. > " > 2) This definitely does not look good.=20 > All the point in my patch is to move the ref-cnt operations to set of = API that already taking care of RTE_MBUF_REFCNT_ATOMIC >=20 > + /* We don't use rte_mbuf_refcnt_update() because we = already > + * tested that refcnt !=3D 1. > + */ > +#ifdef RTE_MBUF_REFCNT_ATOMIC > + ret =3D rte_atomic16_add_return(&m->refcnt_atomic, = -1);=20 > +#else > + ret =3D --m->refcnt; > +#endif > + if (ret !=3D 0) > + return NULL; >=20 Looks ugly, agreed.