Date: Mon, 4 Jan 2016 09:49:53 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293154 - stable/10/sys/dev/mlx5/mlx5_en Message-ID: <201601040949.u049nrR9030204@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon Jan 4 09:49:53 2016 New Revision: 293154 URL: https://svnweb.freebsd.org/changeset/base/293154 Log: MFC r292837: Add support for sysctl tunables to 10-stable and older. Pushed through head first to simplify driver maintenance. MFC after: 1 week Submitted by: Drew Gallatin <gallatin@freebsd.org> Differential Revision: https://reviews.freebsd.org/D4552 Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Jan 4 09:47:20 2016 (r293153) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Jan 4 09:49:53 2016 (r293154) @@ -58,13 +58,17 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG PRIV_LOCK(priv); value = priv->params_ethtool.arg[arg2]; - error = sysctl_handle_64(oidp, &value, 0, req); - if (error || req->newptr == NULL || - value == priv->params_ethtool.arg[arg2]) - goto done; + if (req != NULL) { + error = sysctl_handle_64(oidp, &value, 0, req); + if (error || req->newptr == NULL || + value == priv->params_ethtool.arg[arg2]) + goto done; - /* assign new value */ - priv->params_ethtool.arg[arg2] = value; + /* assign new value */ + priv->params_ethtool.arg[arg2] = value; + } else { + error = 0; + } /* check if device is gone */ if (priv->gone) { @@ -483,10 +487,30 @@ mlx5e_create_ethtool(struct mlx5e_priv * CTLFLAG_MPSAFE, priv, x, &mlx5e_ethtool_handler, "QU", mlx5e_params_desc[2 * x + 1]); } else { +#if (__FreeBSD_version < 1100000) + char path[64]; +#endif + /* + * NOTE: In FreeBSD-11 and newer the + * CTLFLAG_RWTUN flag will take care of + * loading default sysctl value from the + * kernel environment, if any: + */ SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, mlx5e_params_desc[2 * x], CTLTYPE_U64 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, priv, x, &mlx5e_ethtool_handler, "QU", mlx5e_params_desc[2 * x + 1]); + +#if (__FreeBSD_version < 1100000) + /* compute path for sysctl */ + snprintf(path, sizeof(path), "dev.mce.%d.conf.%s", + device_get_unit(priv->mdev->pdev->dev.bsddev), + mlx5e_params_desc[2 * x]); + + /* try to fetch tunable, if any */ + if (TUNABLE_QUAD_FETCH(path, &priv->params_ethtool.arg[x])) + mlx5e_ethtool_handler(NULL, priv, x, NULL); +#endif } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601040949.u049nrR9030204>