Skip to contentSkip to conversation

net/mlx5: missing error code in esw_create_offloads_fdb_table()

PATCH In review Dan Carpenter 6 participants 10 messages Jul 13, 2016 – Jul 14, 2016 1 message not in the archive

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: missing error code in esw_create_offloads_fdb_table()

We accidentally return success when we had intended to return an error code.

Fixes 69697b6e2086 ('net/mlx5: E-Switch, Add support for the sriov offloads mode')
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 -0
index 1842dfb..7d982cf 100644
@@ -183,6 +183,7 @@ static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports)
 
 	root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB);
 	if (!root_ns) {
+		err = -EINVAL;
 		esw_warn(dev, "Failed to get FDB flow namespace\n");
 		goto ns_err;
 	}

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 12 lines · Dan Carpenter

We accidentally return success when we had intended to return an error code.

Fixes 69697b6e2086 ('net/mlx5: E-Switch, Add support for the sriov offloads mode')
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +0 -0
index 1842dfb..7d982cf 100644

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports) · line 189

Quoted 7 lines
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 -0
@@ -183,6 +183,7 @@ static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports)
 
 	root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB);
 	if (!root_ns) {
+		err = -EINVAL;
 		esw_warn(dev, "Failed to get FDB flow namespace\n");
 		goto ns_err;
 	}

Hi,

Thanks for the patch.
I'm not sure EINVAL is the right error here though. Maybe -ENOTSUPP is a bit more appropriate here.

Regards,
Matan

#2 lore raw
Quoted 2 lines · Matan Barak

I'm not sure EINVAL is the right error here though. Maybe -ENOTSUPP is a bit more appropriate here.

I agree, Dan, can you please change to be along Matan's suggestion?

Or.

#3 lore raw
Quoted 5 lines · Or Gerlitz
Quoted 2 lines · Matan Barak

I'm not sure EINVAL is the right error here though. Maybe -ENOTSUPP is a bit more appropriate here.

I agree, Dan, can you please change to be along Matan's suggestion?

Or,
Dan already did it before Matan's response and we have very vivid discussion about it [1].

[1] http://marc.info/?t=146841063000002&r=1&w=2

Quoted 7 lines

Or.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by on v1 1/1
#5 lore raw
In reply to Dan Carpenter
Quoted 14 lines · Dan Carpenter

We accidentally return success when we had intended to return an error code.

Fixes 69697b6e2086 ('net/mlx5: E-Switch, Add support for the sriov offloads mode')

---
v2: return -ENOTSUPP instead --EINVAL

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +0 -0
index 1842dfb..7d982cf 100644

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports) · line 189

Quoted 7 lines
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 -0
@@ -183,6 +183,7 @@ static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports)
 
 	root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB);
 	if (!root_ns) {
+		err = -ENOTSUPP;
 		esw_warn(dev, "Failed to get FDB flow namespace\n");
 		goto ns_err;
 	}

Thanks.

#6 lore raw
In reply to Dan Carpenter
Quoted 7 lines · Dan Carpenter

We accidentally return success when we had intended to return an error code.

Fixes 69697b6e2086 ('net/mlx5: E-Switch, Add support for the sriov offloads mode')

---
v2: return -ENOTSUPP instead --EINVAL

I'm a little bit confused. Why did you prefer ENOTSUPP over EOPNOTSUPP?

Thanks.

A message that is not in the archive (sent off-list or not yet received): 20160713130459.GF10079-2ukJVAZIZ/[email protected]

#8 lore raw
Quoted 10 lines · Leon Romanovsky
Quoted 7 lines · Dan Carpenter

We accidentally return success when we had intended to return an error code.

Fixes 69697b6e2086 ('net/mlx5: E-Switch, Add support for the sriov offloads mode')

---
v2: return -ENOTSUPP instead --EINVAL

I'm a little bit confused. Why did you prefer ENOTSUPP over EOPNOTSUPP?

According to [1], it fits our case better - operation is valid and make sense, but isn't supported.

[1] https://lists.gnu.org/archive/html/bug-glibc/2002-08/msg00017.html

Quoted 3 lines

Thanks.

#9 lore raw
In reply to Dan Carpenter
Quoted 11 lines · Dan Carpenter

We accidentally return success when we had intended to return an error code.

Fixes 69697b6e2086 ('net/mlx5: E-Switch, Add support for the sriov offloads mode')

v2: return -ENOTSUPP instead --EINVAL

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 -0
index 1842dfb..7d982cf 100644
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports) · line 186

Quoted 4 lines
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 -0
@@ -183,6 +183,7 @@ static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports)
 
 	root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB);
 	if (!root_ns) {
+		err = -ENOTSUPP;

Did you mean ENOTSUP?

I thought ENOTSUPP was not to be used outside NFS, and isn't properly exported to userspace..

$ find /usr/include -name "*errno*" | xargs grep 524

Jason

#10 lore raw
Quoted 19 lines · Jason Gunthorpe
Quoted 11 lines · Dan Carpenter

We accidentally return success when we had intended to return an error code.

Fixes 69697b6e2086 ('net/mlx5: E-Switch, Add support for the sriov offloads mode')

v2: return -ENOTSUPP instead --EINVAL

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 -0
index 1842dfb..7d982cf 100644
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports) · line 186

Quoted 4 lines
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 -0
@@ -183,6 +183,7 @@ static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports)
 
 	root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB);
 	if (!root_ns) {
+		err = -ENOTSUPP;

Did you mean ENOTSUP?

Quoted 4 lines

I thought ENOTSUPP was not to be used outside NFS, and isn't properly exported to userspace..

$ find /usr/include -name "*errno*" | xargs grep 524

I asked similar question [1] with different return value in reply to this patch.

[1] http://marc.info/?l=linux-netdev&m=146843171508230&w=2

Quoted 6 lines

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html