[dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), fix atomic usage

2017-11-15 Thread Hanoh Haim
Signed-off-by: Hanoh Haim 
---
 lib/librte_mbuf/rte_mbuf.h | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 7e326bb..ab110f8 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1159,6 +1159,15 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
__rte_mbuf_sanity_check(m, 1);
 }
 
+
+static __rte_always_inline void rte_pktmbuf_reset_before_free(struct rte_mbuf 
*m)
+{
+if (m->next != NULL) {
+m->next = NULL;
+m->nb_segs = 1;
+}
+}
+
 /**
  * Allocate a new mbuf from a mempool.
  *
@@ -1323,8 +1332,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
m->ol_flags = 0;
 
if (rte_mbuf_refcnt_update(md, -1) == 0) {
-   md->next = NULL;
-   md->nb_segs = 1;
+rte_pktmbuf_reset_before_free(m);
rte_mbuf_refcnt_set(md, 1);
rte_mbuf_raw_free(md);
}
@@ -1354,25 +1362,16 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
if (RTE_MBUF_INDIRECT(m))
rte_pktmbuf_detach(m);
 
-   if (m->next != NULL) {
-   m->next = NULL;
-   m->nb_segs = 1;
-   }
-
+rte_pktmbuf_reset_before_free(m);
return m;
 
-   } else if (rte_atomic16_add_return(&m->refcnt_atomic, -1) == 0) {
-
+   } else if (rte_mbuf_refcnt_update(md, -1) == 0) {
 
if (RTE_MBUF_INDIRECT(m))
rte_pktmbuf_detach(m);
 
-   if (m->next != NULL) {
-   m->next = NULL;
-   m->nb_segs = 1;
-   }
+rte_pktmbuf_reset_before_free(m);
rte_mbuf_refcnt_set(m, 1);
-
return m;
}
return NULL;
-- 
2.9.3



[dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), fix atomic usage

2017-11-15 Thread Hanoh Haim
Signed-off-by: Hanoh Haim 
---
 lib/librte_mbuf/rte_mbuf.h | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 7e326bb..ab110f8 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1159,6 +1159,15 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
__rte_mbuf_sanity_check(m, 1);
 }
 
+
+static __rte_always_inline void rte_pktmbuf_reset_before_free(struct rte_mbuf 
*m)
+{
+   if (m->next != NULL) {
+   m->next = NULL;
+   m->nb_segs = 1;
+   }
+}
+
 /**
  * Allocate a new mbuf from a mempool.
  *
@@ -1323,8 +1332,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
m->ol_flags = 0;
 
if (rte_mbuf_refcnt_update(md, -1) == 0) {
-   md->next = NULL;
-   md->nb_segs = 1;
+   rte_pktmbuf_reset_before_free(m);
rte_mbuf_refcnt_set(md, 1);
rte_mbuf_raw_free(md);
}
@@ -1354,25 +1362,16 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
if (RTE_MBUF_INDIRECT(m))
rte_pktmbuf_detach(m);
 
-   if (m->next != NULL) {
-   m->next = NULL;
-   m->nb_segs = 1;
-   }
-
+   rte_pktmbuf_reset_before_free(m);
return m;
 
-   } else if (rte_atomic16_add_return(&m->refcnt_atomic, -1) == 0) {
-
+   } else if (rte_mbuf_refcnt_update(md, -1) == 0) {
 
if (RTE_MBUF_INDIRECT(m))
rte_pktmbuf_detach(m);
 
-   if (m->next != NULL) {
-   m->next = NULL;
-   m->nb_segs = 1;
-   }
+   rte_pktmbuf_reset_before_free(m);
rte_mbuf_refcnt_set(m, 1);
-
return m;
}
return NULL;
-- 
2.9.3



[dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), fix atomic usage

2017-11-15 Thread Hanoh Haim
Signed-off-by: Hanoh Haim 
---
 lib/librte_mbuf/rte_mbuf.h | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 7e326bb..ab110f8 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1159,6 +1159,15 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
__rte_mbuf_sanity_check(m, 1);
 }
 
+
+static __rte_always_inline void rte_pktmbuf_reset_before_free(struct rte_mbuf 
*m)
+{
+   if (m->next != NULL) {
+   m->next = NULL;
+   m->nb_segs = 1;
+   }
+}
+
 /**
  * Allocate a new mbuf from a mempool.
  *
@@ -1323,8 +1332,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
m->ol_flags = 0;
 
if (rte_mbuf_refcnt_update(md, -1) == 0) {
-   md->next = NULL;
-   md->nb_segs = 1;
+   rte_pktmbuf_reset_before_free(m);
rte_mbuf_refcnt_set(md, 1);
rte_mbuf_raw_free(md);
}
@@ -1354,25 +1362,16 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
if (RTE_MBUF_INDIRECT(m))
rte_pktmbuf_detach(m);
 
-   if (m->next != NULL) {
-   m->next = NULL;
-   m->nb_segs = 1;
-   }
-
+   rte_pktmbuf_reset_before_free(m);
return m;
 
-   } else if (rte_atomic16_add_return(&m->refcnt_atomic, -1) == 0) {
-
+   } else if (rte_mbuf_refcnt_update(m, -1) == 0) {
 
if (RTE_MBUF_INDIRECT(m))
rte_pktmbuf_detach(m);
 
-   if (m->next != NULL) {
-   m->next = NULL;
-   m->nb_segs = 1;
-   }
+   rte_pktmbuf_reset_before_free(m);
rte_mbuf_refcnt_set(m, 1);
-
return m;
}
return NULL;
-- 
2.9.3



[dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), fix atomic usage

2017-11-15 Thread Hanoh Haim
Signed-off-by: Hanoh Haim 
---
 lib/librte_mbuf/rte_mbuf.h | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 7e326bb..ab110f8 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1159,6 +1159,15 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
__rte_mbuf_sanity_check(m, 1);
 }
 
+
+static __rte_always_inline void rte_pktmbuf_reset_before_free(struct rte_mbuf 
*m)
+{
+   if (m->next != NULL) {
+   m->next = NULL;
+   m->nb_segs = 1;
+   }
+}
+
 /**
  * Allocate a new mbuf from a mempool.
  *
@@ -1323,8 +1332,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
m->ol_flags = 0;
 
if (rte_mbuf_refcnt_update(md, -1) == 0) {
-   md->next = NULL;
-   md->nb_segs = 1;
+   rte_pktmbuf_reset_before_free(md);
rte_mbuf_refcnt_set(md, 1);
rte_mbuf_raw_free(md);
}
@@ -1354,25 +1362,16 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
if (RTE_MBUF_INDIRECT(m))
rte_pktmbuf_detach(m);
 
-   if (m->next != NULL) {
-   m->next = NULL;
-   m->nb_segs = 1;
-   }
-
+   rte_pktmbuf_reset_before_free(m);
return m;
 
-   } else if (rte_atomic16_add_return(&m->refcnt_atomic, -1) == 0) {
-
+   } else if (rte_mbuf_refcnt_update(m, -1) == 0) {
 
if (RTE_MBUF_INDIRECT(m))
rte_pktmbuf_detach(m);
 
-   if (m->next != NULL) {
-   m->next = NULL;
-   m->nb_segs = 1;
-   }
+   rte_pktmbuf_reset_before_free(m);
rte_mbuf_refcnt_set(m, 1);
-
return m;
}
return NULL;
-- 
2.9.3



[dpdk-dev] [PATCH v3] mbuf: cleanup rte_pktmbuf_lastseg(), fix atomic usage

2017-11-15 Thread Hanoh Haim
Signed-off-by: Hanoh Haim 
---
 lib/librte_mbuf/rte_mbuf.h | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 7e326bb..ab110f8 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1159,6 +1159,15 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
__rte_mbuf_sanity_check(m, 1);
 }
 
+
+static __rte_always_inline void rte_pktmbuf_reset_before_free(struct rte_mbuf 
*m)
+{
+   if (m->next != NULL) {
+   m->next = NULL;
+   m->nb_segs = 1;
+   }
+}
+
 /**
  * Allocate a new mbuf from a mempool.
  *
@@ -1323,8 +1332,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
m->ol_flags = 0;
 
if (rte_mbuf_refcnt_update(md, -1) == 0) {
-   md->next = NULL;
-   md->nb_segs = 1;
+   rte_pktmbuf_reset_before_free(md);
rte_mbuf_refcnt_set(md, 1);
rte_mbuf_raw_free(md);
}
@@ -1354,25 +1362,16 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
if (RTE_MBUF_INDIRECT(m))
rte_pktmbuf_detach(m);
 
-   if (m->next != NULL) {
-   m->next = NULL;
-   m->nb_segs = 1;
-   }
-
+   rte_pktmbuf_reset_before_free(m);
return m;
 
-   } else if (rte_atomic16_add_return(&m->refcnt_atomic, -1) == 0) {
-
+   } else if (rte_mbuf_refcnt_update(m, -1) == 0) {
 
if (RTE_MBUF_INDIRECT(m))
rte_pktmbuf_detach(m);
 
-   if (m->next != NULL) {
-   m->next = NULL;
-   m->nb_segs = 1;
-   }
+   rte_pktmbuf_reset_before_free(m);
rte_mbuf_refcnt_set(m, 1);
-
return m;
}
return NULL;
-- 
2.9.3



[dpdk-dev] Qos issue with new DPDK 20.02 and i40e driver

2020-07-14 Thread hanoh haim
Hi i40e driver experts,
We are **not** a typical user of i40e dpdk driver, we are using tx Qos
configuration (dcb) with strict latency tx queues. The feature stops
working with a new firmware 7.0.x.
We are using DDP (another thing that is not standard) to solve the drop
rate issue.

dpdk 19.05 - works fine
dpdk 20.02 (with new firmware) - does not work

I tried to look into what changed between 19.05->20.02 that was related to
dbc and couldn't find. Our patch is rather small, for now we have a
workaround (allocating one more tx queue) but it has not solved the problem.

more info here:
https://github.com/cisco-system-traffic-generator/trex-core/issues/508

Does it ring a bell?

-- 
Hanoh
Sent from my iPhone