DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix compilation issue on ARM SOC
@ 2018-10-15  8:23 Shahaf Shuler
  2018-10-15 10:20 ` Ori Kam
  2018-10-16  6:05 ` [dpdk-dev] [PATCH v2] " Shahaf Shuler
  0 siblings, 2 replies; 5+ messages in thread
From: Shahaf Shuler @ 2018-10-15  8:23 UTC (permalink / raw)
  To: yskoh; +Cc: dev, orika, xuemingl

On some ARM environment, the below compilation error will be seen

dpdk/drivers/net/mlx5/mlx5_flow_dv.c: In function
'flow_dv_translate_item_nvgre':
/tmp/dpdk/drivers/net/mlx5/mlx5_flow_dv.c:785:22: error: pointer targets
in initialization differ in signedness [-Werror=pointer-sign]
  const char *tni_v = nvgre_v->tni;

The reason for this error is that nvgre_v->tni is defined as byte array
in size of 3B. However the code in the function iterate till the 4B in
order to copy/set also the subsequent field after it (flow_id)

Fixing by pointing to this struct from a different pointer.

Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
Cc: orika@mellanox.com
Cc: xuemingl@mellanox.com

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index a013201eab..05df8d51a4 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -780,6 +780,7 @@ flow_dv_translate_item_nvgre(void *matcher, void *key,
 	const struct rte_flow_item_nvgre *nvgre_v = item->spec;
 	void *misc_m = MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters);
 	void *misc_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters);
+	const char *tni_v = (const char *)&nvgre_v->tni;
 	char *gre_key_m;
 	char *gre_key_v;
 	int size;
@@ -794,7 +795,7 @@ flow_dv_translate_item_nvgre(void *matcher, void *key,
 	gre_key_v = MLX5_ADDR_OF(fte_match_set_misc, misc_v, gre_key_h);
 	memcpy(gre_key_m, nvgre_m->tni, size);
 	for (i = 0; i < size; ++i)
-		gre_key_v[i] = gre_key_m[i] & ((const char *)(nvgre_v->tni))[i];
+		gre_key_v[i] = gre_key_m[i] & tni_v[i];
 	flow_dv_translate_item_gre(matcher, key, item, inner);
 }
 
-- 
2.12.0

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix compilation issue on ARM SOC
  2018-10-15  8:23 [dpdk-dev] [PATCH] net/mlx5: fix compilation issue on ARM SOC Shahaf Shuler
@ 2018-10-15 10:20 ` Ori Kam
  2018-10-16  6:05 ` [dpdk-dev] [PATCH v2] " Shahaf Shuler
  1 sibling, 0 replies; 5+ messages in thread
From: Ori Kam @ 2018-10-15 10:20 UTC (permalink / raw)
  To: Shahaf Shuler, Yongseok Koh; +Cc: dev, Xueming(Steven) Li

Hi

Small nit otherwise acked.



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Shahaf Shuler
> Sent: Monday, October 15, 2018 11:24 AM
> To: Yongseok Koh <yskoh@mellanox.com>
> Cc: dev@dpdk.org; Ori Kam <orika@mellanox.com>; Xueming(Steven) Li
> <xuemingl@mellanox.com>
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix compilation issue on ARM SOC
> 
> On some ARM environment, the below compilation error will be seen
> 
> dpdk/drivers/net/mlx5/mlx5_flow_dv.c: In function
> 'flow_dv_translate_item_nvgre':
> /tmp/dpdk/drivers/net/mlx5/mlx5_flow_dv.c:785:22: error: pointer targets
> in initialization differ in signedness [-Werror=pointer-sign]
>   const char *tni_v = nvgre_v->tni;
> 
> The reason for this error is that nvgre_v->tni is defined as byte array
> in size of 3B. However the code in the function iterate till the 4B in
> order to copy/set also the subsequent field after it (flow_id)
> 
> Fixing by pointing to this struct from a different pointer.
> 
> Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
> Cc: orika@mellanox.com
> Cc: xuemingl@mellanox.com
> 
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index a013201eab..05df8d51a4 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -780,6 +780,7 @@ flow_dv_translate_item_nvgre(void *matcher, void
> *key,
>  	const struct rte_flow_item_nvgre *nvgre_v = item->spec;
>  	void *misc_m = MLX5_ADDR_OF(fte_match_param, matcher,
> misc_parameters);
>  	void *misc_v = MLX5_ADDR_OF(fte_match_param, key,
> misc_parameters);
> +	const char *tni_v = (const char *)&nvgre_v->tni;

What about creating also tni_m?
Also to avoid confusion maybe change to nvgre_id?

>  	char *gre_key_m;
>  	char *gre_key_v;
>  	int size;
> @@ -794,7 +795,7 @@ flow_dv_translate_item_nvgre(void *matcher, void
> *key,
>  	gre_key_v = MLX5_ADDR_OF(fte_match_set_misc, misc_v,
> gre_key_h);
>  	memcpy(gre_key_m, nvgre_m->tni, size);
>  	for (i = 0; i < size; ++i)
> -		gre_key_v[i] = gre_key_m[i] & ((const char *)(nvgre_v->tni))[i];
> +		gre_key_v[i] = gre_key_m[i] & tni_v[i];
>  	flow_dv_translate_item_gre(matcher, key, item, inner);
>  }
> 
> --
> 2.12.0

Thanks,
Ori

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

* [dpdk-dev] [PATCH v2] net/mlx5: fix compilation issue on ARM SOC
  2018-10-15  8:23 [dpdk-dev] [PATCH] net/mlx5: fix compilation issue on ARM SOC Shahaf Shuler
  2018-10-15 10:20 ` Ori Kam
@ 2018-10-16  6:05 ` Shahaf Shuler
  2018-10-16  6:51   ` Ori Kam
  1 sibling, 1 reply; 5+ messages in thread
From: Shahaf Shuler @ 2018-10-16  6:05 UTC (permalink / raw)
  To: yskoh; +Cc: dev, orika, xuemingl

On some ARM environment, the below compilation error will be seen

dpdk/drivers/net/mlx5/mlx5_flow_dv.c: In function
'flow_dv_translate_item_nvgre':
/tmp/dpdk/drivers/net/mlx5/mlx5_flow_dv.c:785:22: error: pointer targets
in initialization differ in signedness [-Werror=pointer-sign]
  const char *tni_v = nvgre_v->tni;

The reason for this error is that nvgre_v->tni is defined as byte array
in size of 3B. However the code in the function iterate till the 4B in
order to copy/set also the subsequent field after it (flow_id)

Fixing by pointing to this struct from a different pointer.

Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
Cc: orika@mellanox.com
Cc: xuemingl@mellanox.com

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---

On v2:
 - changed pointer names.
 - added pointer for the tni and flow id mask

---
 drivers/net/mlx5/mlx5_flow_dv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index a013201eab..becbc57b55 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -780,6 +780,8 @@ flow_dv_translate_item_nvgre(void *matcher, void *key,
 	const struct rte_flow_item_nvgre *nvgre_v = item->spec;
 	void *misc_m = MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters);
 	void *misc_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters);
+	const char *tni_flow_id_m = (const char *)nvgre_m->tni;
+	const char *tni_flow_id_v = (const char *)nvgre_v->tni;
 	char *gre_key_m;
 	char *gre_key_v;
 	int size;
@@ -792,9 +794,9 @@ flow_dv_translate_item_nvgre(void *matcher, void *key,
 	size = sizeof(nvgre_m->tni) + sizeof(nvgre_m->flow_id);
 	gre_key_m = MLX5_ADDR_OF(fte_match_set_misc, misc_m, gre_key_h);
 	gre_key_v = MLX5_ADDR_OF(fte_match_set_misc, misc_v, gre_key_h);
-	memcpy(gre_key_m, nvgre_m->tni, size);
+	memcpy(gre_key_m, tni_flow_id_m, size);
 	for (i = 0; i < size; ++i)
-		gre_key_v[i] = gre_key_m[i] & ((const char *)(nvgre_v->tni))[i];
+		gre_key_v[i] = gre_key_m[i] & tni_flow_id_v[i];
 	flow_dv_translate_item_gre(matcher, key, item, inner);
 }
 
-- 
2.12.0

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

* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix compilation issue on ARM SOC
  2018-10-16  6:05 ` [dpdk-dev] [PATCH v2] " Shahaf Shuler
@ 2018-10-16  6:51   ` Ori Kam
  2018-10-16  7:48     ` Shahaf Shuler
  0 siblings, 1 reply; 5+ messages in thread
From: Ori Kam @ 2018-10-16  6:51 UTC (permalink / raw)
  To: Shahaf Shuler, Yongseok Koh; +Cc: dev, Xueming(Steven) Li



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Shahaf Shuler
> Sent: Tuesday, October 16, 2018 9:05 AM
> To: Yongseok Koh <yskoh@mellanox.com>
> Cc: dev@dpdk.org; Ori Kam <orika@mellanox.com>; Xueming(Steven) Li
> <xuemingl@mellanox.com>
> Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix compilation issue on ARM SOC
> 
> On some ARM environment, the below compilation error will be seen
> 
> dpdk/drivers/net/mlx5/mlx5_flow_dv.c: In function
> 'flow_dv_translate_item_nvgre':
> /tmp/dpdk/drivers/net/mlx5/mlx5_flow_dv.c:785:22: error: pointer targets
> in initialization differ in signedness [-Werror=pointer-sign]
>   const char *tni_v = nvgre_v->tni;
> 
> The reason for this error is that nvgre_v->tni is defined as byte array
> in size of 3B. However the code in the function iterate till the 4B in
> order to copy/set also the subsequent field after it (flow_id)
> 
> Fixing by pointing to this struct from a different pointer.
> 
> Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
> Cc: orika@mellanox.com
> Cc: xuemingl@mellanox.com
> 
> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> ---
> 
> On v2:
>  - changed pointer names.
>  - added pointer for the tni and flow id mask
> 
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index a013201eab..becbc57b55 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -780,6 +780,8 @@ flow_dv_translate_item_nvgre(void *matcher, void
> *key,
>  	const struct rte_flow_item_nvgre *nvgre_v = item->spec;
>  	void *misc_m = MLX5_ADDR_OF(fte_match_param, matcher,
> misc_parameters);
>  	void *misc_v = MLX5_ADDR_OF(fte_match_param, key,
> misc_parameters);
> +	const char *tni_flow_id_m = (const char *)nvgre_m->tni;
> +	const char *tni_flow_id_v = (const char *)nvgre_v->tni;
>  	char *gre_key_m;
>  	char *gre_key_v;
>  	int size;
> @@ -792,9 +794,9 @@ flow_dv_translate_item_nvgre(void *matcher, void
> *key,
>  	size = sizeof(nvgre_m->tni) + sizeof(nvgre_m->flow_id);
>  	gre_key_m = MLX5_ADDR_OF(fte_match_set_misc, misc_m,
> gre_key_h);
>  	gre_key_v = MLX5_ADDR_OF(fte_match_set_misc, misc_v,
> gre_key_h);
> -	memcpy(gre_key_m, nvgre_m->tni, size);
> +	memcpy(gre_key_m, tni_flow_id_m, size);
>  	for (i = 0; i < size; ++i)
> -		gre_key_v[i] = gre_key_m[i] & ((const char *)(nvgre_v->tni))[i];
> +		gre_key_v[i] = gre_key_m[i] & tni_flow_id_v[i];
>  	flow_dv_translate_item_gre(matcher, key, item, inner);
>  }
> 
> --
> 2.12.0


Acked-by: Ori Kam <orika@mellanox.com>

Thanks,
Ori

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

* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix compilation issue on ARM SOC
  2018-10-16  6:51   ` Ori Kam
@ 2018-10-16  7:48     ` Shahaf Shuler
  0 siblings, 0 replies; 5+ messages in thread
From: Shahaf Shuler @ 2018-10-16  7:48 UTC (permalink / raw)
  To: Ori Kam, Yongseok Koh; +Cc: dev, Xueming(Steven) Li, Raslan Darawsheh

Tuesday, October 16, 2018 9:51 AM, Ori Kam:
> Subject: RE: [dpdk-dev] [PATCH v2] net/mlx5: fix compilation issue on ARM
> SOC
> 
> 
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Shahaf Shuler
> > Sent: Tuesday, October 16, 2018 9:05 AM
> > To: Yongseok Koh <yskoh@mellanox.com>
> > Cc: dev@dpdk.org; Ori Kam <orika@mellanox.com>; Xueming(Steven) Li
> > <xuemingl@mellanox.com>
> > Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix compilation issue on ARM
> > SOC
> >
> > On some ARM environment, the below compilation error will be seen
> >
> > dpdk/drivers/net/mlx5/mlx5_flow_dv.c: In function
> > 'flow_dv_translate_item_nvgre':
> > /tmp/dpdk/drivers/net/mlx5/mlx5_flow_dv.c:785:22: error: pointer
> > targets in initialization differ in signedness [-Werror=pointer-sign]
> >   const char *tni_v = nvgre_v->tni;
> >
> > The reason for this error is that nvgre_v->tni is defined as byte
> > array in size of 3B. However the code in the function iterate till the
> > 4B in order to copy/set also the subsequent field after it (flow_id)
> >
> > Fixing by pointing to this struct from a different pointer.
> >
> > Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
> > Cc: orika@mellanox.com
> > Cc: xuemingl@mellanox.com
> >
> > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> > ---
> >
> > On v2:
> >  - changed pointer names.
> >  - added pointer for the tni and flow id mask
> >
> > ---

[...]

> > 2.12.0
> 
> 
> Acked-by: Ori Kam <orika@mellanox.com>

Applied to next-net-mlx, thanks. 

> 
> Thanks,
> Ori

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

end of thread, other threads:[~2018-10-16  7:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15  8:23 [dpdk-dev] [PATCH] net/mlx5: fix compilation issue on ARM SOC Shahaf Shuler
2018-10-15 10:20 ` Ori Kam
2018-10-16  6:05 ` [dpdk-dev] [PATCH v2] " Shahaf Shuler
2018-10-16  6:51   ` Ori Kam
2018-10-16  7:48     ` Shahaf Shuler

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