DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable
@ 2017-11-14 13:44 Ilya Matveychikov
  2017-11-14 20:32 ` Hanoch Haim (hhaim)
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ilya Matveychikov @ 2017-11-14 13:44 UTC (permalink / raw)
  To: dev

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable
  2017-11-14 13:44 [dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable Ilya Matveychikov
@ 2017-11-14 20:32 ` Hanoch Haim (hhaim)
  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
  2 siblings, 1 reply; 8+ messages in thread
From: Hanoch Haim (hhaim) @ 2017-11-14 20:32 UTC (permalink / raw)
  To: Ilya Matveychikov, dev; +Cc: Hanoch Haim (hhaim)

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable
  2017-11-14 20:32 ` Hanoch Haim (hhaim)
@ 2017-11-14 20:50   ` Ilya Matveychikov
  0 siblings, 0 replies; 8+ messages in thread
From: Ilya Matveychikov @ 2017-11-14 20:50 UTC (permalink / raw)
  To: Hanoch Haim (hhaim); +Cc: dev


> On Nov 15, 2017, at 12:32 AM, Hanoch Haim (hhaim) <hhaim@cisco.com> wrote:
> 
> 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
> 

Why not to send the separate patch for the change?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable
  2017-11-14 13:44 [dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable Ilya Matveychikov
  2017-11-14 20:32 ` Hanoch Haim (hhaim)
@ 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
  2 siblings, 0 replies; 8+ messages in thread
From: Olivier MATZ @ 2017-12-01 16:36 UTC (permalink / raw)
  To: Ilya Matveychikov; +Cc: dev

Hi Ilya,

On Tue, Nov 14, 2017 at 05:44:49PM +0400, Ilya Matveychikov wrote:
> Fixes: af75078fece3 ("first public release")
> Cc: intel.com

The Cc tag seems wrong, should be removed.

> Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
> ---
> 
> There is no reason to have local variable m2 or am I wrong?

Yes, you're right. Can you please say it in the commit log?

Thanks,
Olivier

> 
>  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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH v2] mbuf: cleanup rte_pktmbuf_lastseg function
  2017-11-14 13:44 [dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable Ilya Matveychikov
  2017-11-14 20:32 ` Hanoch Haim (hhaim)
  2017-12-01 16:36 ` Olivier MATZ
@ 2017-12-09 21:08 ` Ilya V. Matveychikov
  2017-12-14  8:48   ` Olivier MATZ
  2 siblings, 1 reply; 8+ messages in thread
From: Ilya V. Matveychikov @ 2017-12-09 21:08 UTC (permalink / raw)
  To: dev; +Cc: olivier.matz, Ilya V. Matveychikov

There is no reason to have local variable m2.

Fixes: af75078fece3 ("first public release")
Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
---
 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 ce8a05ddf..e4e3917f6 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1541,12 +1541,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.14.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2] mbuf: cleanup rte_pktmbuf_lastseg function
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Olivier MATZ @ 2017-12-14  8:48 UTC (permalink / raw)
  To: Ilya V. Matveychikov; +Cc: dev

On Sun, Dec 10, 2017 at 12:08:22AM +0300, Ilya V. Matveychikov wrote:
> There is no reason to have local variable m2.
> 
> Fixes: af75078fece3 ("first public release")
> Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2] mbuf: cleanup rte_pktmbuf_lastseg function
  2017-12-14  8:48   ` Olivier MATZ
@ 2017-12-14  9:30     ` Olivier MATZ
  2018-01-11 23:21       ` Thomas Monjalon
  0 siblings, 1 reply; 8+ messages in thread
From: Olivier MATZ @ 2017-12-14  9:30 UTC (permalink / raw)
  To: Ilya V. Matveychikov; +Cc: dev

On Thu, Dec 14, 2017 at 09:48:29AM +0100, Olivier MATZ wrote:
> On Sun, Dec 10, 2017 at 12:08:22AM +0300, Ilya V. Matveychikov wrote:
> > There is no reason to have local variable m2.
> > 
> > Fixes: af75078fece3 ("first public release")
> > Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Just realized the title does not match ./devtools/check-git-log.sh
constraints. I suggest instead:

  mbuf: cleanup function to get last segment

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH v2] mbuf: cleanup rte_pktmbuf_lastseg function
  2017-12-14  9:30     ` Olivier MATZ
@ 2018-01-11 23:21       ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2018-01-11 23:21 UTC (permalink / raw)
  To: Ilya V. Matveychikov; +Cc: dev, Olivier MATZ

14/12/2017 10:30, Olivier MATZ:
> On Thu, Dec 14, 2017 at 09:48:29AM +0100, Olivier MATZ wrote:
> > On Sun, Dec 10, 2017 at 12:08:22AM +0300, Ilya V. Matveychikov wrote:
> > > There is no reason to have local variable m2.
> > > 
> > > Fixes: af75078fece3 ("first public release")
> > > Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
> > 
> > Acked-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Just realized the title does not match ./devtools/check-git-log.sh
> constraints. I suggest instead:
> 
>   mbuf: cleanup function to get last segment

Applied, thanks

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-11 23:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-14 13:44 [dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable Ilya Matveychikov
2017-11-14 20:32 ` Hanoch Haim (hhaim)
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

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).