Author: hselasky
Date: Wed Oct  2 10:24:13 2019
New Revision: 352986
URL: https://svnweb.freebsd.org/changeset/base/352986

Log:
  Return an error from ioctl(MLX5_FW_RESET) if reset was rejected in mlx5core.
  
  Submitted by: kib@
  MFC after:    3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_core.h
  head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_core.h     Wed Oct  2 10:22:15 2019        
(r352985)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h     Wed Oct  2 10:24:13 2019        
(r352986)
@@ -110,7 +110,7 @@ void mlx5e_cleanup(void);
 int mlx5_ctl_init(void);
 void mlx5_ctl_fini(void);
 void mlx5_fwdump_prep(struct mlx5_core_dev *mdev);
-void mlx5_fwdump(struct mlx5_core_dev *mdev);
+int mlx5_fwdump(struct mlx5_core_dev *mdev);
 void mlx5_fwdump_clean(struct mlx5_core_dev *mdev);
 
 struct mlx5_crspace_regmap {

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c   Wed Oct  2 10:22:15 2019        
(r352985)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c   Wed Oct  2 10:24:13 2019        
(r352986)
@@ -148,7 +148,7 @@ unlock_vsc:
        mlx5_vsc_unlock(mdev);
 }
 
-void
+int
 mlx5_fwdump(struct mlx5_core_dev *mdev)
 {
        const struct mlx5_crspace_regmap *r;
@@ -157,12 +157,15 @@ mlx5_fwdump(struct mlx5_core_dev *mdev)
 
        mlx5_core_info(mdev, "Issuing FW dump\n");
        mtx_lock(&mdev->dump_lock);
-       if (mdev->dump_data == NULL)
+       if (mdev->dump_data == NULL) {
+               error = EIO;
                goto failed;
+       }
        if (mdev->dump_valid) {
                /* only one dump */
                mlx5_core_warn(mdev,
                    "Only one FW dump can be captured aborting FW dump\n");
+               error = EEXIST;
                goto failed;
        }
 
@@ -187,6 +190,7 @@ unlock_vsc:
        mlx5_vsc_unlock(mdev);
 failed:
        mtx_unlock(&mdev->dump_lock);
+       return (error);
 }
 
 void
@@ -400,7 +404,7 @@ mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t d
                error = mlx5_dbsf_to_core(devaddr, &mdev);
                if (error != 0)
                        break;
-               mlx5_fwdump(mdev);
+               error = mlx5_fwdump(mdev);
                break;
        case MLX5_FW_UPDATE:
                if ((fflag & FWRITE) == 0) {

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Wed Oct  2 10:22:15 2019        
(r352985)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c   Wed Oct  2 10:24:13 2019        
(r352986)
@@ -300,7 +300,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev,
 
                /* Execute cr-dump and SW reset */
                if (lock != -EBUSY) {
-                       mlx5_fwdump(dev);
+                       (void)mlx5_fwdump(dev);
                        reset_fw_if_needed(dev);
                        delay_ms = MLX5_FW_RESET_WAIT_MS;
                }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to