Skip to contentSkip to conversation

net/mlx5: Fix some error messages

PATCH Superseded Dan Carpenter 4 participants 5 messages Apr 23, 2021 – Apr 27, 2021

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: Fix some error messages

This code was using IS_ERR() instead of PTR_ERR() so it prints 1 instead of the correct error code.

Fixes 25cb31768042 ("net/mlx5: E-Switch, Improve error messages in term table creation")
---
 .../mellanox/mlx5/core/eswitch_offloads_termtbl.c    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c +6 -6
index a81ece94f599..95f5c1a27718 100644
@@ -83,16 +83,16 @@ mlx5_eswitch_termtbl_create(struct mlx5_core_dev *dev,
 	ft_attr.autogroup.max_num_groups = 1;
 	tt->termtbl = mlx5_create_auto_grouped_flow_table(root_ns, &ft_attr);
 	if (IS_ERR(tt->termtbl)) {
-		esw_warn(dev, "Failed to create termination table (error %d)\n",
-			 IS_ERR(tt->termtbl));
+		esw_warn(dev, "Failed to create termination table (error %ld)\n",
+			 PTR_ERR(tt->termtbl));
 		return -EOPNOTSUPP;
 	}
 
 	tt->rule = mlx5_add_flow_rules(tt->termtbl, NULL, flow_act,
 				       &tt->dest, 1);
 	if (IS_ERR(tt->rule)) {
-		esw_warn(dev, "Failed to create termination table rule (error %d)\n",
-			 IS_ERR(tt->rule));
+		esw_warn(dev, "Failed to create termination table rule (error %ld)\n",
+			 PTR_ERR(tt->rule));
 		goto add_flow_err;
 	}
 	return 0;
@@ -283,8 +283,8 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw,
 		tt = mlx5_eswitch_termtbl_get_create(esw, &term_tbl_act,
 						     &dest[i], attr);
 		if (IS_ERR(tt)) {
-			esw_warn(esw->dev, "Failed to get termination table (error %d)\n",
-				 IS_ERR(tt));
+			esw_warn(esw->dev, "Failed to get termination table (error %ld)\n",
+				 PTR_ERR(tt));
 			goto revert_changes;
 		}
 		attr->dests[num_vport_dests].termtbl = tt;
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dan Carpenter

This code was using IS_ERR() instead of PTR_ERR() so it prints 1 instead of the correct error code.

Fixes 25cb31768042 ("net/mlx5: E-Switch, Improve error messages in term table creation")
---
 .../mellanox/mlx5/core/eswitch_offloads_termtbl.c    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

It should go through netdev@.

Thanks,

Quoted 39 lines
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c +6 -6
index a81ece94f599..95f5c1a27718 100644
@@ -83,16 +83,16 @@ mlx5_eswitch_termtbl_create(struct mlx5_core_dev *dev,
 	ft_attr.autogroup.max_num_groups = 1;
 	tt->termtbl = mlx5_create_auto_grouped_flow_table(root_ns, &ft_attr);
 	if (IS_ERR(tt->termtbl)) {
-		esw_warn(dev, "Failed to create termination table (error %d)\n",
-			 IS_ERR(tt->termtbl));
+		esw_warn(dev, "Failed to create termination table (error %ld)\n",
+			 PTR_ERR(tt->termtbl));
 		return -EOPNOTSUPP;
 	}
 
 	tt->rule = mlx5_add_flow_rules(tt->termtbl, NULL, flow_act,
 				       &tt->dest, 1);
 	if (IS_ERR(tt->rule)) {
-		esw_warn(dev, "Failed to create termination table rule (error %d)\n",
-			 IS_ERR(tt->rule));
+		esw_warn(dev, "Failed to create termination table rule (error %ld)\n",
+			 PTR_ERR(tt->rule));
 		goto add_flow_err;
 	}
 	return 0;
@@ -283,8 +283,8 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw,
 		tt = mlx5_eswitch_termtbl_get_create(esw, &term_tbl_act,
 						     &dest[i], attr);
 		if (IS_ERR(tt)) {
-			esw_warn(esw->dev, "Failed to get termination table (error %d)\n",
-				 IS_ERR(tt));
+			esw_warn(esw->dev, "Failed to get termination table (error %ld)\n",
+				 PTR_ERR(tt));
 			goto revert_changes;
 		}
 		attr->dests[num_vport_dests].termtbl = tt;
Signature · 1 line
2.30.2
maintainer
#2 lore raw
Quoted 4 lines · On Sun, 25 Apr 2021 09:39:29 +0300 Leon Romanovsky wrote:
Quoted 4 lines
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c +0 -0
index a81ece94f599..95f5c1a27718 100644
Quoted 8 lines

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c mlx5_eswitch_termtbl_create(struct mlx5_core_dev *dev, · line 87

Quoted 8 lines
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c +2 -2
@@ -83,16 +83,16 @@ mlx5_eswitch_termtbl_create(struct mlx5_core_dev *dev,
 	ft_attr.autogroup.max_num_groups = 1;
 	tt->termtbl = mlx5_create_auto_grouped_flow_table(root_ns, &ft_attr);
 	if (IS_ERR(tt->termtbl)) {
-		esw_warn(dev, "Failed to create termination table (error %d)\n",
-			 IS_ERR(tt->termtbl));
+		esw_warn(dev, "Failed to create termination table (error %ld)\n",
+			 PTR_ERR(tt->termtbl));

If these are error pointers - perhaps %pe?

#3 lore raw
Quoted 19 lines · Jakub Kicinski
Quoted 18 lines · On Sun, 25 Apr 2021 09:39:29 +0300 Leon Romanovsky wrote:
Quoted 18 lines

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtb l.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtb l.c
index a81ece94f599..95f5c1a27718 100644
---
a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtb l.c
+++
b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtb l.c

(quoted diff) +0 -0
@@ -83,16 +83,16 @@ mlx5_eswitch_termtbl_create(struct
 mlx5_core_dev *dev,
         ft_attr.autogroup.max_num_groups = 1;

        tt->termtbl = mlx5_create_auto_grouped_flow_table(root_ns, &ft_attr); if (IS_ERR(tt->termtbl)) {

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

-               esw_warn(dev, "Failed to create termination table (error %d)\n",
-                        IS_ERR(tt->termtbl));
+               esw_warn(dev, "Failed to create termination table (error %ld)\n",
+                        PTR_ERR(tt->termtbl));

If these are error pointers - perhaps %pe?

no reason to use %pe, we know it is an err ptr at this point so just report PTR_ERR()

#4 lore raw
Quoted 29 lines · Saeed Mahameed
Quoted 19 lines · Jakub Kicinski
Quoted 18 lines · On Sun, 25 Apr 2021 09:39:29 +0300 Leon Romanovsky wrote:
Quoted 18 lines

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtb l.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtb l.c
index a81ece94f599..95f5c1a27718 100644
---
a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtb l.c
+++
b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtb l.c

(quoted diff) +0 -0
@@ -83,16 +83,16 @@ mlx5_eswitch_termtbl_create(struct
 mlx5_core_dev *dev,
         ft_attr.autogroup.max_num_groups = 1;

        tt->termtbl = mlx5_create_auto_grouped_flow_table(root_ns, &ft_attr); if (IS_ERR(tt->termtbl)) {

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

-               esw_warn(dev, "Failed to create termination table (error %d)\n",
-                        IS_ERR(tt->termtbl));
+               esw_warn(dev, "Failed to create termination table (error %ld)\n",
+                        PTR_ERR(tt->termtbl));

If these are error pointers - perhaps %pe?

Quoted 2 lines

no reason to use %pe, we know it is an err ptr at this point so just report PTR_ERR()

Saeed,

%pe prints string "-EINVAL" instead of "22", which is better.

I didn't know about such format specifier.

Thanks