DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Hanoch Haim (hhaim)" <hhaim@cisco.com>
To: Ilya Matveychikov <matvejchikov@gmail.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "Hanoch Haim (hhaim)" <hhaim@cisco.com>
Subject: Re: [dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable
Date: Tue, 14 Nov 2017 20:32:37 +0000	[thread overview]
Message-ID: <c09a80d037c2438f9fb4dc5c012a4b4d@XCH-RTP-017.cisco.com> (raw)
In-Reply-To: <3DBFD712-8DA6-4FDB-B139-66398039B4C0@gmail.com>

I would add this too 

-  } else if (rte_atomic16_add_return(&m->refcnt_atomic, -1) == 0)

Should be :

+ } else if (likely(rte_mbuf_refcnt_update(m, -1) == 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 useless variable

Fixes: af75078fece3 ("first public release")
Cc: intel.com

Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
---

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 struct rte_mbuf *m)
  */
 static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m)  {
-	struct rte_mbuf *m2 = (struct rte_mbuf *)m;
-
 	__rte_mbuf_sanity_check(m, 1);
-	while (m2->next != NULL)
-		m2 = m2->next;
-	return m2;
+	while (m->next != NULL)
+		m = m->next;
+	return m;
 }

 /**
--
2.15.0

  reply	other threads:[~2017-11-14 20:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 13:44 Ilya Matveychikov
2017-11-14 20:32 ` Hanoch Haim (hhaim) [this message]
2017-11-14 20:50   ` Ilya Matveychikov
2017-12-01 16:36 ` Olivier MATZ
2017-12-09 21:08 ` [dpdk-dev] [PATCH v2] mbuf: cleanup rte_pktmbuf_lastseg function Ilya V. Matveychikov
2017-12-14  8:48   ` Olivier MATZ
2017-12-14  9:30     ` Olivier MATZ
2018-01-11 23:21       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c09a80d037c2438f9fb4dc5c012a4b4d@XCH-RTP-017.cisco.com \
    --to=hhaim@cisco.com \
    --cc=dev@dpdk.org \
    --cc=matvejchikov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).