Author: hselasky
Date: Tue Feb 13 15:09:03 2018
New Revision: 329207
URL: https://svnweb.freebsd.org/changeset/base/329207

Log:
  MFC r325653:
  Add API functions to set and query dropless port mode in mlx5 core.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/driver.h
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/driver.h
==============================================================================
--- stable/11/sys/dev/mlx5/driver.h     Tue Feb 13 15:07:39 2018        
(r329206)
+++ stable/11/sys/dev/mlx5/driver.h     Tue Feb 13 15:09:03 2018        
(r329207)
@@ -983,6 +983,8 @@ int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, i
 void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common);
 u8 mlx5_is_wol_supported(struct mlx5_core_dev *dev);
 int mlx5_set_wol(struct mlx5_core_dev *dev, u8 wol_mode);
+int mlx5_set_dropless_mode(struct mlx5_core_dev *dev, u16 timeout);
+int mlx5_query_dropless_mode(struct mlx5_core_dev *dev, u16 *timeout);
 int mlx5_query_wol(struct mlx5_core_dev *dev, u8 *wol_mode);
 int mlx5_core_access_pvlc(struct mlx5_core_dev *dev,
                          struct mlx5_pvlc_reg *pvlc, int write);

Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c        Tue Feb 13 15:07:39 
2018        (r329206)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_port.c        Tue Feb 13 15:09:03 
2018        (r329207)
@@ -459,6 +459,46 @@ int mlx5_set_wol(struct mlx5_core_dev *dev, u8 wol_mod
 }
 EXPORT_SYMBOL_GPL(mlx5_set_wol);
 
+int mlx5_query_dropless_mode(struct mlx5_core_dev *dev, u16 *timeout)
+{
+       u32 in[MLX5_ST_SZ_DW(query_delay_drop_params_in)];
+       u32 out[MLX5_ST_SZ_DW(query_delay_drop_params_out)];
+       int err = 0;
+
+       memset(in, 0, sizeof(in));
+       memset(out, 0, sizeof(out));
+
+       MLX5_SET(query_delay_drop_params_in, in, opcode,
+                MLX5_CMD_OP_QUERY_DELAY_DROP_PARAMS);
+
+       err = mlx5_cmd_exec_check_status(dev, in, sizeof(in), out, sizeof(out));
+       if (err)
+               return err;
+
+       *timeout = MLX5_GET(query_delay_drop_params_out, out,
+                           delay_drop_timeout);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(mlx5_query_dropless_mode);
+
+int mlx5_set_dropless_mode(struct mlx5_core_dev *dev, u16 timeout)
+{
+       u32 in[MLX5_ST_SZ_DW(set_delay_drop_params_in)];
+       u32 out[MLX5_ST_SZ_DW(set_delay_drop_params_out)];
+
+       memset(in, 0, sizeof(in));
+       memset(out, 0, sizeof(out));
+
+       MLX5_SET(set_delay_drop_params_in, in, opcode,
+                MLX5_CMD_OP_SET_DELAY_DROP_PARAMS);
+       MLX5_SET(set_delay_drop_params_in, in, delay_drop_timeout, timeout);
+
+       return mlx5_cmd_exec_check_status(dev, in, sizeof(in),
+                                          out, sizeof(out));
+}
+EXPORT_SYMBOL_GPL(mlx5_set_dropless_mode);
+
 int mlx5_core_access_pvlc(struct mlx5_core_dev *dev,
                          struct mlx5_pvlc_reg *pvlc, int write)
 {
_______________________________________________
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