mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable
PATCH 1/1 mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable
---
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(-)
lib/librte_mbuf/rte_mbuf.h +3 -5
@@ -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
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:[email protected]] On Behalf Of Ilya Matveychikov
Sent: Tuesday, November 14, 2017 3:45 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable
---
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(-)
lib/librte_mbuf/rte_mbuf.h +3 -6
@@ -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
Quoted 14 lines · 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
Why not to send the separate patch for the change?
Hi Ilya,
Quoted 2 lines · Ilya Matveychikov
Fixes af75078fece3 ("first public release")Cc intel.com
The Cc tag seems wrong, should be removed.
Quoted 4 lines
Signed-off-by Ilya V. Matveychikov <[email protected]>---
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
Quoted 26 lines
lib/librte_mbuf/rte_mbuf.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)lib/librte_mbuf/rte_mbuf.h +3
-6@@ -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
PATCH v2 1/1 mbuf: cleanup rte_pktmbuf_lastseg function
In reply to Ilya MatveychikovThere is no reason to have local variable m2.
--- lib/librte_mbuf/rte_mbuf.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
lib/librte_mbuf/rte_mbuf.h +3 -5
@@ -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; }/**
Signature · 1 line
2.14.2
Re: [PATCH v2] mbuf: cleanup rte_pktmbuf_lastseg function
Quoted 4 lines · Ilya V. Matveychikov
There is no reason to have local variable m2.
Fixes af75078fece3 ("first public release")Signed-off-by Ilya V. Matveychikov <[email protected]>
Re: [PATCH v2] mbuf: cleanup rte_pktmbuf_lastseg function
Quoted 7 lines · Olivier MATZ
Quoted 4 lines · Ilya V. Matveychikov
There is no reason to have local variable m2.
Fixes af75078fece3 ("first public release")Signed-off-by Ilya V. Matveychikov <[email protected]>Acked-by Olivier Matz <[email protected]>
Just realized the title does not match ./devtools/check-git-log.sh constraints. I suggest instead:
mbuf: cleanup function to get last segment
Thomas Monjalon
AppliedRe: [PATCH v2] mbuf: cleanup rte_pktmbuf_lastseg function
14/12/2017 10:30, Olivier MATZ:
Quoted 7 lines · Olivier MATZ
Quoted 6 lines · Ilya V. Matveychikov
Quoted 4 lines
There is no reason to have local variable m2.
Fixes af75078fece3 ("first public release")Signed-off-by Ilya V. Matveychikov <[email protected]>
Quoted 6 lines
Quoted 1 line
Acked-by Olivier Matz <[email protected]>Just realized the title does not match
./devtools/check-git-log.shconstraints. I suggest instead:mbuf: cleanup function to get last segment
Applied, thanks