Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Sep 2018 12:41:09 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338493 - in head/sys/dev/mlx5: . mlx5_core
Message-ID:  <201809061241.w86Cf9Ej056754@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu Sep  6 12:41:09 2018
New Revision: 338493
URL: https://svnweb.freebsd.org/changeset/base/338493

Log:
  Make the MSIX module parameter limit per device, in mlx5en(4).
  
  MFC after:		3 days
  Approved by:		re (marius)
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/dev/mlx5/driver.h
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c

Modified: head/sys/dev/mlx5/driver.h
==============================================================================
--- head/sys/dev/mlx5/driver.h	Thu Sep  6 12:28:06 2018	(r338492)
+++ head/sys/dev/mlx5/driver.h	Thu Sep  6 12:41:09 2018	(r338493)
@@ -682,6 +682,9 @@ struct mlx5_core_dev {
 	struct mlx5_flow_root_namespace *sniffer_tx_root_ns;
 	u32 num_q_counter_allocated[MLX5_INTERFACE_NUMBER];
 	struct mlx5_dump_data	*dump_data;
+
+	struct sysctl_ctx_list	sysctl_ctx;
+	int			msix_eqvec;
 };
 
 enum {

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c	Thu Sep  6 12:28:06 2018	(r338492)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c	Thu Sep  6 12:41:09 2018	(r338493)
@@ -61,10 +61,6 @@ static int prof_sel = MLX5_DEFAULT_PROF;
 module_param_named(prof_sel, prof_sel, int, 0444);
 MODULE_PARM_DESC(prof_sel, "profile selector. Valid range 0 - 2");
 
-static int mlx5_core_msix_eqvec;
-module_param_named(msix_eqvec, mlx5_core_msix_eqvec, int, 0644);
-MODULE_PARM_DESC(msix_eqvec, "Maximum number of MSIX event queue vectors");
-
 #define NUMA_NO_NODE       -1
 
 static LIST_HEAD(intf_list);
@@ -243,7 +239,7 @@ static int mlx5_enable_msix(struct mlx5_core_dev *dev)
 	struct mlx5_priv *priv = &dev->priv;
 	struct mlx5_eq_table *table = &priv->eq_table;
 	int num_eqs = 1 << MLX5_CAP_GEN(dev, log_max_eq);
-	int limit = mlx5_core_msix_eqvec;
+	int limit = dev->msix_eqvec;
 	int nvec = MLX5_EQ_VEC_COMP_BASE;
 	int i;
 
@@ -1206,6 +1202,7 @@ static int init_one(struct pci_dev *pdev,
 {
 	struct mlx5_core_dev *dev;
 	struct mlx5_priv *priv;
+	device_t bsddev = pdev->dev.bsddev;
 	int err;
 
 	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
@@ -1221,6 +1218,12 @@ static int init_one(struct pci_dev *pdev,
 	dev->pdev = pdev;
 	dev->event = mlx5_core_event;
 
+	sysctl_ctx_init(&dev->sysctl_ctx);
+	SYSCTL_ADD_INT(&dev->sysctl_ctx,
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(bsddev)),
+	    OID_AUTO, "msix_eqvec", CTLFLAG_RDTUN, &dev->msix_eqvec, 0,
+	    "Maximum number of MSIX event queue vectors, if set");
+
 	INIT_LIST_HEAD(&priv->ctx_list);
 	spin_lock_init(&priv->ctx_lock);
         mutex_init(&dev->pci_status_mutex);
@@ -1256,6 +1259,7 @@ clean_health:
 close_pci:
         mlx5_pci_close(dev, priv);
 clean_dev:
+	sysctl_ctx_free(&dev->sysctl_ctx);
 	kfree(dev);
 	return err;
 }
@@ -1276,6 +1280,7 @@ static void remove_one(struct pci_dev *pdev)
 	mlx5_health_cleanup(dev);
 	mlx5_pci_close(dev, priv);
 	pci_set_drvdata(pdev, NULL);
+	sysctl_ctx_free(&dev->sysctl_ctx);
 	kfree(dev);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809061241.w86Cf9Ej056754>