* [dpdk-dev] [PATCH] lib/table: fix wrong type of nht field
@ 2016-06-20 10:10 Michal Jastrzebski
2016-06-20 10:13 ` Thomas Monjalon
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Michal Jastrzebski @ 2016-06-20 10:10 UTC (permalink / raw)
To: dev; +Cc: Michal Kobylinski
From: Michal Kobylinski <michalx.kobylinski@intel.com>
Change type of nht field from uint32_t to uint8_t and increase max of
next hops.
Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
examples/ip_pipeline/pipeline/pipeline_routing_be.h | 2 +-
lib/librte_table/rte_table_lpm.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/examples/ip_pipeline/pipeline/pipeline_routing_be.h b/examples/ip_pipeline/pipeline/pipeline_routing_be.h
index 1276342..ea50896 100644
--- a/examples/ip_pipeline/pipeline/pipeline_routing_be.h
+++ b/examples/ip_pipeline/pipeline/pipeline_routing_be.h
@@ -42,7 +42,7 @@
* Pipeline argument parsing
*/
#ifndef PIPELINE_ROUTING_N_ROUTES_DEFAULT
-#define PIPELINE_ROUTING_N_ROUTES_DEFAULT 4096
+#define PIPELINE_ROUTING_N_ROUTES_DEFAULT 65536
#endif
enum pipeline_routing_encap {
diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c
index cdeb0f5..f2eaed5 100644
--- a/lib/librte_table/rte_table_lpm.c
+++ b/lib/librte_table/rte_table_lpm.c
@@ -44,7 +44,7 @@
#include "rte_table_lpm.h"
-#define RTE_TABLE_LPM_MAX_NEXT_HOPS 256
+#define RTE_TABLE_LPM_MAX_NEXT_HOPS 65536
#ifdef RTE_TABLE_STATS_COLLECT
@@ -74,7 +74,7 @@ struct rte_table_lpm {
/* Next Hop Table (NHT) */
uint32_t nht_users[RTE_TABLE_LPM_MAX_NEXT_HOPS];
- uint32_t nht[0] __rte_cache_aligned;
+ uint8_t nht[0] __rte_cache_aligned;
};
static void *
@@ -188,7 +188,7 @@ nht_find_existing(struct rte_table_lpm *lpm, void *entry, uint32_t *pos)
uint32_t i;
for (i = 0; i < RTE_TABLE_LPM_MAX_NEXT_HOPS; i++) {
- uint32_t *nht_entry = &lpm->nht[i * lpm->entry_size];
+ uint8_t *nht_entry = &lpm->nht[i * lpm->entry_size];
if ((lpm->nht_users[i] > 0) && (memcmp(nht_entry, entry,
lpm->entry_unique_size) == 0)) {
@@ -242,7 +242,7 @@ rte_table_lpm_entry_add(
/* Find existing or free NHT entry */
if (nht_find_existing(lpm, entry, &nht_pos) == 0) {
- uint32_t *nht_entry;
+ uint8_t *nht_entry;
if (nht_find_free(lpm, &nht_pos) == 0) {
RTE_LOG(ERR, TABLE, "%s: NHT full\n", __func__);
--
1.9.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH] lib/table: fix wrong type of nht field
2016-06-20 10:10 [dpdk-dev] [PATCH] lib/table: fix wrong type of nht field Michal Jastrzebski
@ 2016-06-20 10:13 ` Thomas Monjalon
2016-06-21 11:16 ` Dumitrescu, Cristian
2016-06-21 11:20 ` Dumitrescu, Cristian
2016-06-21 12:27 ` [dpdk-dev] [PATCH v2] " Michal Kobylinski
2 siblings, 1 reply; 10+ messages in thread
From: Thomas Monjalon @ 2016-06-20 10:13 UTC (permalink / raw)
To: Michal Jastrzebski, Michal Kobylinski; +Cc: dev
2016-06-20 12:10, Michal Jastrzebski:
> From: Michal Kobylinski <michalx.kobylinski@intel.com>
>
> Change type of nht field from uint32_t to uint8_t and increase max of
> next hops.
>
> Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
Why the type is wrong?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH] lib/table: fix wrong type of nht field
2016-06-20 10:13 ` Thomas Monjalon
@ 2016-06-21 11:16 ` Dumitrescu, Cristian
0 siblings, 0 replies; 10+ messages in thread
From: Dumitrescu, Cristian @ 2016-06-21 11:16 UTC (permalink / raw)
To: Thomas Monjalon, Jastrzebski, MichalX K, Kobylinski, MichalX; +Cc: dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Monday, June 20, 2016 11:14 AM
> To: Jastrzebski, MichalX K <michalx.k.jastrzebski@intel.com>; Kobylinski,
> MichalX <michalx.kobylinski@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] lib/table: fix wrong type of nht field
>
> 2016-06-20 12:10, Michal Jastrzebski:
> > From: Michal Kobylinski <michalx.kobylinski@intel.com>
> >
> > Change type of nht field from uint32_t to uint8_t and increase max of
> > next hops.
> >
> > Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
>
> Why the type is wrong?
The lpm->nht is simply some raw memory allocated at the end of the table context using the usual pattern:
struct rte_table_lpm {
...
uint8_t nht[0] __rte_cache_aligned;
}
Therefore, when we do:
nht_entry = &lpm->nht[i * lpm->entry_size];
in several places, it makes big difference whether nht_entry is declared as uin8_t * (correct) or uint32_t * (incorrect), as the position computed by the latter is 4 times the position computed by the former ;(
Michal K and Michal J,
I just realized we still need to do a small change to this patch, I will reply to the original mail now. So Thomas, sorry, there is one small change, we'll send new version soon.
Thanks,
Cristian
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH] lib/table: fix wrong type of nht field
2016-06-20 10:10 [dpdk-dev] [PATCH] lib/table: fix wrong type of nht field Michal Jastrzebski
2016-06-20 10:13 ` Thomas Monjalon
@ 2016-06-21 11:20 ` Dumitrescu, Cristian
2016-06-21 12:27 ` [dpdk-dev] [PATCH v2] " Michal Kobylinski
2 siblings, 0 replies; 10+ messages in thread
From: Dumitrescu, Cristian @ 2016-06-21 11:20 UTC (permalink / raw)
To: Jastrzebski, MichalX K, dev; +Cc: Kobylinski, MichalX
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michal Jastrzebski
> Sent: Monday, June 20, 2016 11:10 AM
> To: dev@dpdk.org
> Cc: Kobylinski, MichalX <michalx.kobylinski@intel.com>
> Subject: [dpdk-dev] [PATCH] lib/table: fix wrong type of nht field
>
> From: Michal Kobylinski <michalx.kobylinski@intel.com>
>
> Change type of nht field from uint32_t to uint8_t and increase max of
> next hops.
>
> Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
>
> Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> ---
> examples/ip_pipeline/pipeline/pipeline_routing_be.h | 2 +-
> lib/librte_table/rte_table_lpm.c | 8 ++++----
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/examples/ip_pipeline/pipeline/pipeline_routing_be.h
> b/examples/ip_pipeline/pipeline/pipeline_routing_be.h
> index 1276342..ea50896 100644
> --- a/examples/ip_pipeline/pipeline/pipeline_routing_be.h
> +++ b/examples/ip_pipeline/pipeline/pipeline_routing_be.h
> @@ -42,7 +42,7 @@
> * Pipeline argument parsing
> */
> #ifndef PIPELINE_ROUTING_N_ROUTES_DEFAULT
> -#define PIPELINE_ROUTING_N_ROUTES_DEFAULT 4096
> +#define PIPELINE_ROUTING_N_ROUTES_DEFAULT 65536
> #endif
>
Changing the PIPELINE_ROUTING_N_ROUTES_DEFAULT is actually not required, this is simply the default value which can be changed through the configuration file. Please remove this.
> enum pipeline_routing_encap {
> diff --git a/lib/librte_table/rte_table_lpm.c
> b/lib/librte_table/rte_table_lpm.c
> index cdeb0f5..f2eaed5 100644
> --- a/lib/librte_table/rte_table_lpm.c
> +++ b/lib/librte_table/rte_table_lpm.c
> @@ -44,7 +44,7 @@
>
> #include "rte_table_lpm.h"
>
> -#define RTE_TABLE_LPM_MAX_NEXT_HOPS 256
> +#define RTE_TABLE_LPM_MAX_NEXT_HOPS 65536
>
With the next hop size of 24 bits, we can now make this configurable, so please use:
#ifndef RTE_TABLE_LPM_MAX_NEXT_HOPS
#define RTE_TABLE_LPM_MAX_NEXT_HOPS 65536
#endif
> #ifdef RTE_TABLE_STATS_COLLECT
>
> @@ -74,7 +74,7 @@ struct rte_table_lpm {
>
> /* Next Hop Table (NHT) */
> uint32_t nht_users[RTE_TABLE_LPM_MAX_NEXT_HOPS];
> - uint32_t nht[0] __rte_cache_aligned;
> + uint8_t nht[0] __rte_cache_aligned;
> };
>
> static void *
> @@ -188,7 +188,7 @@ nht_find_existing(struct rte_table_lpm *lpm, void
> *entry, uint32_t *pos)
> uint32_t i;
>
> for (i = 0; i < RTE_TABLE_LPM_MAX_NEXT_HOPS; i++) {
> - uint32_t *nht_entry = &lpm->nht[i * lpm->entry_size];
> + uint8_t *nht_entry = &lpm->nht[i * lpm->entry_size];
>
> if ((lpm->nht_users[i] > 0) && (memcmp(nht_entry, entry,
> lpm->entry_unique_size) == 0)) {
> @@ -242,7 +242,7 @@ rte_table_lpm_entry_add(
>
> /* Find existing or free NHT entry */
> if (nht_find_existing(lpm, entry, &nht_pos) == 0) {
> - uint32_t *nht_entry;
> + uint8_t *nht_entry;
>
> if (nht_find_free(lpm, &nht_pos) == 0) {
> RTE_LOG(ERR, TABLE, "%s: NHT full\n", __func__);
> --
> 1.9.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v2] lib/table: fix wrong type of nht field
2016-06-20 10:10 [dpdk-dev] [PATCH] lib/table: fix wrong type of nht field Michal Jastrzebski
2016-06-20 10:13 ` Thomas Monjalon
2016-06-21 11:20 ` Dumitrescu, Cristian
@ 2016-06-21 12:27 ` Michal Kobylinski
2016-06-21 13:09 ` Dumitrescu, Cristian
2016-06-21 13:20 ` [dpdk-dev] [PATCH v3] " Michal Kobylinski
2 siblings, 2 replies; 10+ messages in thread
From: Michal Kobylinski @ 2016-06-21 12:27 UTC (permalink / raw)
To: dev; +Cc: cristian.dumitrescu, Michal Kobylinski
Change type of nht field from uint32_t to uint8_t and increase max of
next hops.
Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
---
v2:
- removed changing from file: pipeline_routing_be.h
- changed macro: RTE_TABLE_LPM_MAX_NEXT_HOP
lib/librte_table/rte_table_lpm.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c
index cdeb0f5..598b79f 100644
--- a/lib/librte_table/rte_table_lpm.c
+++ b/lib/librte_table/rte_table_lpm.c
@@ -44,7 +44,9 @@
#include "rte_table_lpm.h"
-#define RTE_TABLE_LPM_MAX_NEXT_HOPS 256
+#ifndef RTE_TABLE_LPM_MAX_NEXT_HOPS
+#define RTE_TABLE_LPM_MAX_NEXT_HOPS 65536
+#endif
#ifdef RTE_TABLE_STATS_COLLECT
@@ -74,7 +76,7 @@ struct rte_table_lpm {
/* Next Hop Table (NHT) */
uint32_t nht_users[RTE_TABLE_LPM_MAX_NEXT_HOPS];
- uint32_t nht[0] __rte_cache_aligned;
+ uint8_t nht[0] __rte_cache_aligned;
};
static void *
@@ -188,7 +190,7 @@ nht_find_existing(struct rte_table_lpm *lpm, void *entry, uint32_t *pos)
uint32_t i;
for (i = 0; i < RTE_TABLE_LPM_MAX_NEXT_HOPS; i++) {
- uint32_t *nht_entry = &lpm->nht[i * lpm->entry_size];
+ uint8_t *nht_entry = &lpm->nht[i * lpm->entry_size];
if ((lpm->nht_users[i] > 0) && (memcmp(nht_entry, entry,
lpm->entry_unique_size) == 0)) {
@@ -242,7 +244,7 @@ rte_table_lpm_entry_add(
/* Find existing or free NHT entry */
if (nht_find_existing(lpm, entry, &nht_pos) == 0) {
- uint32_t *nht_entry;
+ uint8_t *nht_entry;
if (nht_find_free(lpm, &nht_pos) == 0) {
RTE_LOG(ERR, TABLE, "%s: NHT full\n", __func__);
--
1.9.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2] lib/table: fix wrong type of nht field
2016-06-21 12:27 ` [dpdk-dev] [PATCH v2] " Michal Kobylinski
@ 2016-06-21 13:09 ` Dumitrescu, Cristian
2016-06-21 13:15 ` Thomas Monjalon
2016-06-21 13:20 ` [dpdk-dev] [PATCH v3] " Michal Kobylinski
1 sibling, 1 reply; 10+ messages in thread
From: Dumitrescu, Cristian @ 2016-06-21 13:09 UTC (permalink / raw)
To: Kobylinski, MichalX, dev
> -----Original Message-----
> From: Kobylinski, MichalX
> Sent: Tuesday, June 21, 2016 1:28 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Kobylinski,
> MichalX <michalx.kobylinski@intel.com>
> Subject: [PATCH v2] lib/table: fix wrong type of nht field
>
> Change type of nht field from uint32_t to uint8_t and increase max of
> next hops.
>
> Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
> Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
> ---
> v2:
> - removed changing from file: pipeline_routing_be.h
> - changed macro: RTE_TABLE_LPM_MAX_NEXT_HOP
>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2] lib/table: fix wrong type of nht field
2016-06-21 13:09 ` Dumitrescu, Cristian
@ 2016-06-21 13:15 ` Thomas Monjalon
2016-06-21 13:21 ` Dumitrescu, Cristian
0 siblings, 1 reply; 10+ messages in thread
From: Thomas Monjalon @ 2016-06-21 13:15 UTC (permalink / raw)
To: Dumitrescu, Cristian, Kobylinski, MichalX; +Cc: dev
> > Change type of nht field from uint32_t to uint8_t and increase max of
> > next hops.
> >
> > Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
> > Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
> > ---
> > v2:
> > - removed changing from file: pipeline_routing_be.h
> > - changed macro: RTE_TABLE_LPM_MAX_NEXT_HOP
>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Cristian, the explanation is still missing in this commit.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v2] lib/table: fix wrong type of nht field
2016-06-21 13:15 ` Thomas Monjalon
@ 2016-06-21 13:21 ` Dumitrescu, Cristian
0 siblings, 0 replies; 10+ messages in thread
From: Dumitrescu, Cristian @ 2016-06-21 13:21 UTC (permalink / raw)
To: Thomas Monjalon, Kobylinski, MichalX; +Cc: dev
> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, June 21, 2016 2:16 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Kobylinski,
> MichalX <michalx.kobylinski@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2] lib/table: fix wrong type of nht field
>
> > > Change type of nht field from uint32_t to uint8_t and increase max of
> > > next hops.
> > >
> > > Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
> > > Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
> > > ---
> > > v2:
> > > - removed changing from file: pipeline_routing_be.h
> > > - changed macro: RTE_TABLE_LPM_MAX_NEXT_HOP
> >
> > Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
>
> Cristian, the explanation is still missing in this commit.
Yes, you're right, sorry.
Michal K, please send updated version with the explanation and my ack included, thank you!
Regards,
Cristian
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-dev] [PATCH v3] lib/table: fix wrong type of nht field
2016-06-21 12:27 ` [dpdk-dev] [PATCH v2] " Michal Kobylinski
2016-06-21 13:09 ` Dumitrescu, Cristian
@ 2016-06-21 13:20 ` Michal Kobylinski
2016-06-21 20:43 ` Thomas Monjalon
1 sibling, 1 reply; 10+ messages in thread
From: Michal Kobylinski @ 2016-06-21 13:20 UTC (permalink / raw)
To: dev; +Cc: cristian.dumitrescu, Michal Kobylinski
Change type of nht field from uint32_t to uint8_t and increase max of
next hops.
nht_entry and nht should be declared as uint8_t because
entry_size is in bytes and is given as a parameter to compute
the position in nht array.
Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
v3:
- added the explanation
v2:
- removed changing from file: pipeline_routing_be.h
- changed macro: RTE_TABLE_LPM_MAX_NEXT_HOP
lib/librte_table/rte_table_lpm.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c
index cdeb0f5..598b79f 100644
--- a/lib/librte_table/rte_table_lpm.c
+++ b/lib/librte_table/rte_table_lpm.c
@@ -44,7 +44,9 @@
#include "rte_table_lpm.h"
-#define RTE_TABLE_LPM_MAX_NEXT_HOPS 256
+#ifndef RTE_TABLE_LPM_MAX_NEXT_HOPS
+#define RTE_TABLE_LPM_MAX_NEXT_HOPS 65536
+#endif
#ifdef RTE_TABLE_STATS_COLLECT
@@ -74,7 +76,7 @@ struct rte_table_lpm {
/* Next Hop Table (NHT) */
uint32_t nht_users[RTE_TABLE_LPM_MAX_NEXT_HOPS];
- uint32_t nht[0] __rte_cache_aligned;
+ uint8_t nht[0] __rte_cache_aligned;
};
static void *
@@ -188,7 +190,7 @@ nht_find_existing(struct rte_table_lpm *lpm, void *entry, uint32_t *pos)
uint32_t i;
for (i = 0; i < RTE_TABLE_LPM_MAX_NEXT_HOPS; i++) {
- uint32_t *nht_entry = &lpm->nht[i * lpm->entry_size];
+ uint8_t *nht_entry = &lpm->nht[i * lpm->entry_size];
if ((lpm->nht_users[i] > 0) && (memcmp(nht_entry, entry,
lpm->entry_unique_size) == 0)) {
@@ -242,7 +244,7 @@ rte_table_lpm_entry_add(
/* Find existing or free NHT entry */
if (nht_find_existing(lpm, entry, &nht_pos) == 0) {
- uint32_t *nht_entry;
+ uint8_t *nht_entry;
if (nht_find_free(lpm, &nht_pos) == 0) {
RTE_LOG(ERR, TABLE, "%s: NHT full\n", __func__);
--
1.9.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-dev] [PATCH v3] lib/table: fix wrong type of nht field
2016-06-21 13:20 ` [dpdk-dev] [PATCH v3] " Michal Kobylinski
@ 2016-06-21 20:43 ` Thomas Monjalon
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2016-06-21 20:43 UTC (permalink / raw)
To: Michal Kobylinski; +Cc: dev, cristian.dumitrescu
2016-06-21 15:20, Michal Kobylinski:
> Change type of nht field from uint32_t to uint8_t and increase max of
> next hops.
>
> nht_entry and nht should be declared as uint8_t because
> entry_size is in bytes and is given as a parameter to compute
> the position in nht array.
>
> Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
>
> Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-06-21 20:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-20 10:10 [dpdk-dev] [PATCH] lib/table: fix wrong type of nht field Michal Jastrzebski
2016-06-20 10:13 ` Thomas Monjalon
2016-06-21 11:16 ` Dumitrescu, Cristian
2016-06-21 11:20 ` Dumitrescu, Cristian
2016-06-21 12:27 ` [dpdk-dev] [PATCH v2] " Michal Kobylinski
2016-06-21 13:09 ` Dumitrescu, Cristian
2016-06-21 13:15 ` Thomas Monjalon
2016-06-21 13:21 ` Dumitrescu, Cristian
2016-06-21 13:20 ` [dpdk-dev] [PATCH v3] " Michal Kobylinski
2016-06-21 20:43 ` 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).