DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix errno in case of unsupported Direct Rules
@ 2019-05-07 13:41 Ori Kam
  2019-05-07 13:41 ` Ori Kam
  2019-05-08  4:44 ` Shahaf Shuler
  0 siblings, 2 replies; 4+ messages in thread
From: Ori Kam @ 2019-05-07 13:41 UTC (permalink / raw)
  To: yskoh, shahafs, matan; +Cc: dev, orika

When Direct Rules API is not supported we don't set the errno.
this results in failing the function but with errno equals to zero.
The result of this is that a function that failed, is considered as
a function that worked correctly.

This commit fixes this issue by setting the errno to ENOTSUP and
returning this error when error value should be returned.

Since RDMA-CORE are returning positive errno we are also returning
positive error values.

Fixes: 4f84a19779ca ("net/mlx5: add Direct Rules API")

Signed-off-by: Ori Kam <orika@mellanox.com>
---
 drivers/net/mlx5/mlx5_glue.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
index 6172e0d..21cd3bb 100644
--- a/drivers/net/mlx5/mlx5_glue.c
+++ b/drivers/net/mlx5/mlx5_glue.c
@@ -296,6 +296,7 @@
 #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45
 	(void)context;
 	(void)init_attr;
+	errno = ENOTSUP;
 	return NULL;
 #else
 	return ibv_create_counters(context, init_attr);
@@ -377,6 +378,7 @@
 	return mlx5dv_dr_action_create_dest_table(tbl);
 #else
 	(void)tbl;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -389,6 +391,7 @@
 #else
 	(void)domain;
 	(void)vport;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -399,6 +402,7 @@
 #ifdef HAVE_MLX5DV_DR_ESWITCH
 	return mlx5dv_dr_action_create_drop();
 #else
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -411,6 +415,7 @@
 #else
 	(void)domain;
 	(void)level;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -422,7 +427,8 @@
 	return mlx5dv_dr_table_destroy(tbl);
 #else
 	(void)tbl;
-	return 0;
+	errno = ENOTSUP;
+	return errno;
 #endif
 }
 
@@ -435,6 +441,7 @@
 #else
 	(void)ctx;
 	(void)domain;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -446,7 +453,8 @@
 	return mlx5dv_dr_domain_destroy(domain);
 #else
 	(void)domain;
-	return 0;
+	errno = ENOTSUP;
+	return errno;
 #endif
 }
 
@@ -467,6 +475,7 @@
 	(void)context;
 	(void)wq_attr;
 	(void)mlx5_wq_attr;
+	errno = ENOTSUP;
 	return NULL;
 #else
 	return mlx5dv_create_wq(context, wq_attr, mlx5_wq_attr);
@@ -504,6 +513,7 @@
 	(void)context;
 	(void)qp_init_attr_ex;
 	(void)dv_qp_init_attr;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -527,6 +537,7 @@
 	(void)context;
 	(void)matcher_attr;
 	(void)tbl;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -581,6 +592,7 @@
 #else
 	(void)counter_obj;
 	(void)offset;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -603,6 +615,7 @@
 #endif
 #else
 	(void)qp;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -641,6 +654,7 @@
 	(void)flags;
 	(void)actions_sz;
 	(void)actions;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -681,6 +695,7 @@
 	(void)flags;
 	(void)data_sz;
 	(void)data;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -702,6 +717,7 @@
 #endif
 #endif
 	(void)tag;
+	errno = ENOTSUP;
 	return NULL;
 }
 
@@ -726,7 +742,8 @@
 #endif
 #else
 	(void)matcher;
-	return 0;
+	errno = ENOTSUP;
+	return errno;
 #endif
 }
 
@@ -740,6 +757,7 @@
 				  });
 #else
 	(void)device;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -757,6 +775,7 @@
 	(void)inlen;
 	(void)out;
 	(void)outlen;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
-- 
1.8.3.1

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

* [dpdk-dev] [PATCH] net/mlx5: fix errno in case of unsupported Direct Rules
  2019-05-07 13:41 [dpdk-dev] [PATCH] net/mlx5: fix errno in case of unsupported Direct Rules Ori Kam
@ 2019-05-07 13:41 ` Ori Kam
  2019-05-08  4:44 ` Shahaf Shuler
  1 sibling, 0 replies; 4+ messages in thread
From: Ori Kam @ 2019-05-07 13:41 UTC (permalink / raw)
  To: yskoh, shahafs, matan; +Cc: dev, orika

When Direct Rules API is not supported we don't set the errno.
this results in failing the function but with errno equals to zero.
The result of this is that a function that failed, is considered as
a function that worked correctly.

This commit fixes this issue by setting the errno to ENOTSUP and
returning this error when error value should be returned.

Since RDMA-CORE are returning positive errno we are also returning
positive error values.

Fixes: 4f84a19779ca ("net/mlx5: add Direct Rules API")

Signed-off-by: Ori Kam <orika@mellanox.com>
---
 drivers/net/mlx5/mlx5_glue.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
index 6172e0d..21cd3bb 100644
--- a/drivers/net/mlx5/mlx5_glue.c
+++ b/drivers/net/mlx5/mlx5_glue.c
@@ -296,6 +296,7 @@
 #ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45
 	(void)context;
 	(void)init_attr;
+	errno = ENOTSUP;
 	return NULL;
 #else
 	return ibv_create_counters(context, init_attr);
@@ -377,6 +378,7 @@
 	return mlx5dv_dr_action_create_dest_table(tbl);
 #else
 	(void)tbl;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -389,6 +391,7 @@
 #else
 	(void)domain;
 	(void)vport;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -399,6 +402,7 @@
 #ifdef HAVE_MLX5DV_DR_ESWITCH
 	return mlx5dv_dr_action_create_drop();
 #else
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -411,6 +415,7 @@
 #else
 	(void)domain;
 	(void)level;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -422,7 +427,8 @@
 	return mlx5dv_dr_table_destroy(tbl);
 #else
 	(void)tbl;
-	return 0;
+	errno = ENOTSUP;
+	return errno;
 #endif
 }
 
@@ -435,6 +441,7 @@
 #else
 	(void)ctx;
 	(void)domain;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -446,7 +453,8 @@
 	return mlx5dv_dr_domain_destroy(domain);
 #else
 	(void)domain;
-	return 0;
+	errno = ENOTSUP;
+	return errno;
 #endif
 }
 
@@ -467,6 +475,7 @@
 	(void)context;
 	(void)wq_attr;
 	(void)mlx5_wq_attr;
+	errno = ENOTSUP;
 	return NULL;
 #else
 	return mlx5dv_create_wq(context, wq_attr, mlx5_wq_attr);
@@ -504,6 +513,7 @@
 	(void)context;
 	(void)qp_init_attr_ex;
 	(void)dv_qp_init_attr;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -527,6 +537,7 @@
 	(void)context;
 	(void)matcher_attr;
 	(void)tbl;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -581,6 +592,7 @@
 #else
 	(void)counter_obj;
 	(void)offset;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -603,6 +615,7 @@
 #endif
 #else
 	(void)qp;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -641,6 +654,7 @@
 	(void)flags;
 	(void)actions_sz;
 	(void)actions;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -681,6 +695,7 @@
 	(void)flags;
 	(void)data_sz;
 	(void)data;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -702,6 +717,7 @@
 #endif
 #endif
 	(void)tag;
+	errno = ENOTSUP;
 	return NULL;
 }
 
@@ -726,7 +742,8 @@
 #endif
 #else
 	(void)matcher;
-	return 0;
+	errno = ENOTSUP;
+	return errno;
 #endif
 }
 
@@ -740,6 +757,7 @@
 				  });
 #else
 	(void)device;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
@@ -757,6 +775,7 @@
 	(void)inlen;
 	(void)out;
 	(void)outlen;
+	errno = ENOTSUP;
 	return NULL;
 #endif
 }
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix errno in case of unsupported Direct Rules
  2019-05-07 13:41 [dpdk-dev] [PATCH] net/mlx5: fix errno in case of unsupported Direct Rules Ori Kam
  2019-05-07 13:41 ` Ori Kam
@ 2019-05-08  4:44 ` Shahaf Shuler
  2019-05-08  4:44   ` Shahaf Shuler
  1 sibling, 1 reply; 4+ messages in thread
From: Shahaf Shuler @ 2019-05-08  4:44 UTC (permalink / raw)
  To: Ori Kam, Yongseok Koh, Matan Azrad; +Cc: dev, Ori Kam

Tuesday, May 7, 2019 4:42 PM, Ori Kam:
> Subject: [PATCH] net/mlx5: fix errno in case of unsupported Direct Rules
> 
> When Direct Rules API is not supported we don't set the errno.
> this results in failing the function but with errno equals to zero.
> The result of this is that a function that failed, is considered as a function that
> worked correctly.
> 
> This commit fixes this issue by setting the errno to ENOTSUP and returning
> this error when error value should be returned.
> 
> Since RDMA-CORE are returning positive errno we are also returning positive
> error values.
> 
> Fixes: 4f84a19779ca ("net/mlx5: add Direct Rules API")
> 
> Signed-off-by: Ori Kam <orika@mellanox.com>

Applied to next-net-mlx, thanks. 

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix errno in case of unsupported Direct Rules
  2019-05-08  4:44 ` Shahaf Shuler
@ 2019-05-08  4:44   ` Shahaf Shuler
  0 siblings, 0 replies; 4+ messages in thread
From: Shahaf Shuler @ 2019-05-08  4:44 UTC (permalink / raw)
  To: Ori Kam, Yongseok Koh, Matan Azrad; +Cc: dev, Ori Kam

Tuesday, May 7, 2019 4:42 PM, Ori Kam:
> Subject: [PATCH] net/mlx5: fix errno in case of unsupported Direct Rules
> 
> When Direct Rules API is not supported we don't set the errno.
> this results in failing the function but with errno equals to zero.
> The result of this is that a function that failed, is considered as a function that
> worked correctly.
> 
> This commit fixes this issue by setting the errno to ENOTSUP and returning
> this error when error value should be returned.
> 
> Since RDMA-CORE are returning positive errno we are also returning positive
> error values.
> 
> Fixes: 4f84a19779ca ("net/mlx5: add Direct Rules API")
> 
> Signed-off-by: Ori Kam <orika@mellanox.com>

Applied to next-net-mlx, thanks. 


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

end of thread, other threads:[~2019-05-08  4:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07 13:41 [dpdk-dev] [PATCH] net/mlx5: fix errno in case of unsupported Direct Rules Ori Kam
2019-05-07 13:41 ` Ori Kam
2019-05-08  4:44 ` Shahaf Shuler
2019-05-08  4:44   ` 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).