Commit ba7d16c7794213b591a0ea415d975858d6a7dfd8
Committed by
David S. Miller
1 parent
c7f0d4c898
devlink: Implicitly set auto recover flag when registering health reporter
When health reporter is registered to devlink, devlink will implicitly set auto recover if and only if the reporter has a recover method. No reason to explicitly get the auto recover flag from the driver. Remove this flag from all drivers that called devlink_health_reporter_create. All existing health reporters set auto recovery to true if they have a recover method. Yet, administrator can unset auto recover via netlink command as prior to this patch. Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 7 changed files with 13 additions and 17 deletions Side-by-side Diff
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
... | ... | @@ -150,7 +150,7 @@ |
150 | 150 | health->fw_reset_reporter = |
151 | 151 | devlink_health_reporter_create(bp->dl, |
152 | 152 | &bnxt_dl_fw_reset_reporter_ops, |
153 | - 0, true, bp); | |
153 | + 0, bp); | |
154 | 154 | if (IS_ERR(health->fw_reset_reporter)) { |
155 | 155 | netdev_warn(bp->dev, "Failed to create FW fatal health reporter, rc = %ld\n", |
156 | 156 | PTR_ERR(health->fw_reset_reporter)); |
... | ... | @@ -166,7 +166,7 @@ |
166 | 166 | health->fw_reporter = |
167 | 167 | devlink_health_reporter_create(bp->dl, |
168 | 168 | &bnxt_dl_fw_reporter_ops, |
169 | - 0, false, bp); | |
169 | + 0, bp); | |
170 | 170 | if (IS_ERR(health->fw_reporter)) { |
171 | 171 | netdev_warn(bp->dev, "Failed to create FW health reporter, rc = %ld\n", |
172 | 172 | PTR_ERR(health->fw_reporter)); |
... | ... | @@ -182,7 +182,7 @@ |
182 | 182 | health->fw_fatal_reporter = |
183 | 183 | devlink_health_reporter_create(bp->dl, |
184 | 184 | &bnxt_dl_fw_fatal_reporter_ops, |
185 | - 0, true, bp); | |
185 | + 0, bp); | |
186 | 186 | if (IS_ERR(health->fw_fatal_reporter)) { |
187 | 187 | netdev_warn(bp->dev, "Failed to create FW fatal health reporter, rc = %ld\n", |
188 | 188 | PTR_ERR(health->fw_fatal_reporter)); |
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c
... | ... | @@ -571,7 +571,7 @@ |
571 | 571 | reporter = devlink_health_reporter_create(devlink, |
572 | 572 | &mlx5_rx_reporter_ops, |
573 | 573 | MLX5E_REPORTER_RX_GRACEFUL_PERIOD, |
574 | - true, priv); | |
574 | + priv); | |
575 | 575 | if (IS_ERR(reporter)) { |
576 | 576 | netdev_warn(priv->netdev, "Failed to create rx reporter, err = %ld\n", |
577 | 577 | PTR_ERR(reporter)); |
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c
... | ... | @@ -416,7 +416,7 @@ |
416 | 416 | reporter = |
417 | 417 | devlink_health_reporter_create(devlink, &mlx5_tx_reporter_ops, |
418 | 418 | MLX5_REPORTER_TX_GRACEFUL_PERIOD, |
419 | - true, priv); | |
419 | + priv); | |
420 | 420 | if (IS_ERR(reporter)) { |
421 | 421 | netdev_warn(priv->netdev, |
422 | 422 | "Failed to create tx reporter, err = %ld\n", |
drivers/net/ethernet/mellanox/mlx5/core/health.c
... | ... | @@ -627,7 +627,7 @@ |
627 | 627 | |
628 | 628 | health->fw_reporter = |
629 | 629 | devlink_health_reporter_create(devlink, &mlx5_fw_reporter_ops, |
630 | - 0, false, dev); | |
630 | + 0, dev); | |
631 | 631 | if (IS_ERR(health->fw_reporter)) |
632 | 632 | mlx5_core_warn(dev, "Failed to create fw reporter, err = %ld\n", |
633 | 633 | PTR_ERR(health->fw_reporter)); |
... | ... | @@ -636,7 +636,7 @@ |
636 | 636 | devlink_health_reporter_create(devlink, |
637 | 637 | &mlx5_fw_fatal_reporter_ops, |
638 | 638 | MLX5_REPORTER_FW_GRACEFUL_PERIOD, |
639 | - true, dev); | |
639 | + dev); | |
640 | 640 | if (IS_ERR(health->fw_fatal_reporter)) |
641 | 641 | mlx5_core_warn(dev, "Failed to create fw fatal reporter, err = %ld\n", |
642 | 642 | PTR_ERR(health->fw_fatal_reporter)); |
drivers/net/netdevsim/health.c
... | ... | @@ -271,14 +271,14 @@ |
271 | 271 | health->empty_reporter = |
272 | 272 | devlink_health_reporter_create(devlink, |
273 | 273 | &nsim_dev_empty_reporter_ops, |
274 | - 0, false, health); | |
274 | + 0, health); | |
275 | 275 | if (IS_ERR(health->empty_reporter)) |
276 | 276 | return PTR_ERR(health->empty_reporter); |
277 | 277 | |
278 | 278 | health->dummy_reporter = |
279 | 279 | devlink_health_reporter_create(devlink, |
280 | 280 | &nsim_dev_dummy_reporter_ops, |
281 | - 0, true, health); | |
281 | + 0, health); | |
282 | 282 | if (IS_ERR(health->dummy_reporter)) { |
283 | 283 | err = PTR_ERR(health->dummy_reporter); |
284 | 284 | goto err_empty_reporter_destroy; |
include/net/devlink.h
... | ... | @@ -1040,8 +1040,7 @@ |
1040 | 1040 | struct devlink_health_reporter * |
1041 | 1041 | devlink_health_reporter_create(struct devlink *devlink, |
1042 | 1042 | const struct devlink_health_reporter_ops *ops, |
1043 | - u64 graceful_period, bool auto_recover, | |
1044 | - void *priv); | |
1043 | + u64 graceful_period, void *priv); | |
1045 | 1044 | void |
1046 | 1045 | devlink_health_reporter_destroy(struct devlink_health_reporter *reporter); |
1047 | 1046 |
net/core/devlink.c
... | ... | @@ -5124,14 +5124,12 @@ |
5124 | 5124 | * @devlink: devlink |
5125 | 5125 | * @ops: ops |
5126 | 5126 | * @graceful_period: to avoid recovery loops, in msecs |
5127 | - * @auto_recover: auto recover when error occurs | |
5128 | 5127 | * @priv: priv |
5129 | 5128 | */ |
5130 | 5129 | struct devlink_health_reporter * |
5131 | 5130 | devlink_health_reporter_create(struct devlink *devlink, |
5132 | 5131 | const struct devlink_health_reporter_ops *ops, |
5133 | - u64 graceful_period, bool auto_recover, | |
5134 | - void *priv) | |
5132 | + u64 graceful_period, void *priv) | |
5135 | 5133 | { |
5136 | 5134 | struct devlink_health_reporter *reporter; |
5137 | 5135 | |
... | ... | @@ -5141,8 +5139,7 @@ |
5141 | 5139 | goto unlock; |
5142 | 5140 | } |
5143 | 5141 | |
5144 | - if (WARN_ON(auto_recover && !ops->recover) || | |
5145 | - WARN_ON(graceful_period && !ops->recover)) { | |
5142 | + if (WARN_ON(graceful_period && !ops->recover)) { | |
5146 | 5143 | reporter = ERR_PTR(-EINVAL); |
5147 | 5144 | goto unlock; |
5148 | 5145 | } |
... | ... | @@ -5157,7 +5154,7 @@ |
5157 | 5154 | reporter->ops = ops; |
5158 | 5155 | reporter->devlink = devlink; |
5159 | 5156 | reporter->graceful_period = graceful_period; |
5160 | - reporter->auto_recover = auto_recover; | |
5157 | + reporter->auto_recover = !!ops->recover; | |
5161 | 5158 | mutex_init(&reporter->dump_lock); |
5162 | 5159 | refcount_set(&reporter->refcount, 1); |
5163 | 5160 | list_add_tail(&reporter->list, &devlink->reporter_list); |