From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Hanoch Haim (hhaim)" Subject: Re: [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable Date: Tue, 14 Nov 2017 20:32:37 +0000 Message-ID: References: <3DBFD712-8DA6-4FDB-B139-66398039B4C0@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "Hanoch Haim (hhaim)" To: Ilya Matveychikov , "dev@dpdk.org" Return-path: Received: from rcdn-iport-4.cisco.com (rcdn-iport-4.cisco.com [173.37.86.75]) by dpdk.org (Postfix) with ESMTP id B840B1B1C3 for ; Tue, 14 Nov 2017 21:32:39 +0100 (CET) In-Reply-To: <3DBFD712-8DA6-4FDB-B139-66398039B4C0@gmail.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" I would add this too=20 - } else if (rte_atomic16_add_return(&m->refcnt_atomic, -1) =3D=3D 0) Should be : + } else if (likely(rte_mbuf_refcnt_update(m, -1) =3D=3D 0)) { Hanoh -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ilya Matveychikov Sent: Tuesday, November 14, 2017 3:45 PM To: dev@dpdk.org Subject: [dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove use= less variable Fixes: af75078fece3 ("first public release") Cc: intel.com Signed-off-by: Ilya V. Matveychikov --- There is no reason to have local variable m2 or am I wrong? lib/librte_mbuf/rte_mbuf.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index = 7e326bbc2..be79e3728 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1538,12 +1538,10 @@ static inline uint16_t rte_pktmbuf_tailroom(const s= truct rte_mbuf *m) */ static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m) { - struct rte_mbuf *m2 =3D (struct rte_mbuf *)m; - __rte_mbuf_sanity_check(m, 1); - while (m2->next !=3D NULL) - m2 =3D m2->next; - return m2; + while (m->next !=3D NULL) + m =3D m->next; + return m; } /** -- 2.15.0