svn commit: r337108 - stable/11/sys/dev/mlx5/mlx5_en
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Aug 2 08:47:25 UTC 2018
Author: hselasky
Date: Thu Aug 2 08:47:24 2018
New Revision: 337108
URL: https://svnweb.freebsd.org/changeset/base/337108
Log:
MFC r336403:
Add context numbers for HW elements in mlx5en(4).
To access the data, set sysctl dev.mce.N.conf.debug_stats to 1.
This enables the sysctl node dev.mce.N.hw_ctx_debug. Its content is
the mapping of each channel' number to used receive queue and associated
completion queue, set of the transmit queues numbers and corresponding
completion queues.
Trimmed example output:
channel 30 rq 188 cq 1085
channel 30 tc 0 sq 187 cq 1084
channel 31 rq 191 cq 1087
channel 31 tc 0 sq 190 cq 1086
Sponsored by: Mellanox Technologies
Modified:
stable/11/sys/dev/mlx5/mlx5_en/en.h
stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 2 08:46:27 2018 (r337107)
+++ stable/11/sys/dev/mlx5/mlx5_en/en.h Thu Aug 2 08:47:24 2018 (r337108)
@@ -759,6 +759,7 @@ struct mlx5e_priv {
struct sysctl_oid *sysctl_hw;
int sysctl_debug;
struct mlx5e_stats stats;
+ struct sysctl_ctx_list sysctl_ctx_channel_debug;
int counter_set_id;
struct workqueue_struct *wq;
Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 2 08:46:27 2018 (r337107)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Thu Aug 2 08:47:24 2018 (r337108)
@@ -916,27 +916,75 @@ static const char *mlx5e_port_stats_debug_desc[] = {
};
static int
+mlx5e_ethtool_debug_channel_info(SYSCTL_HANDLER_ARGS)
+{
+ struct mlx5e_priv *priv;
+ struct sbuf sb;
+ struct mlx5e_channel *c;
+ struct mlx5e_sq *sq;
+ struct mlx5e_rq *rq;
+ int error, i, tc;
+
+ priv = arg1;
+ error = sysctl_wire_old_buffer(req, 0);
+ if (error != 0)
+ return (error);
+ if (sbuf_new_for_sysctl(&sb, NULL, 128, req) == NULL)
+ return (ENOMEM);
+ sbuf_clear_flags(&sb, SBUF_INCLUDENUL);
+
+ PRIV_LOCK(priv);
+ if (test_bit(MLX5E_STATE_OPENED, &priv->state) == 0)
+ goto out;
+ for (i = 0; i < priv->params.num_channels; i++) {
+ c = priv->channel[i];
+ rq = &c->rq;
+ sbuf_printf(&sb, "channel %d rq %d cq %d\n",
+ c->ix, rq->rqn, rq->cq.mcq.cqn);
+ for (tc = 0; tc < c->num_tc; tc++) {
+ sq = &c->sq[tc];
+ sbuf_printf(&sb, "channel %d tc %d sq %d cq %d\n",
+ c->ix, tc, sq->sqn, sq->cq.mcq.cqn);
+ }
+ }
+out:
+ PRIV_UNLOCK(priv);
+ error = sbuf_finish(&sb);
+ sbuf_delete(&sb);
+ return (error);
+}
+
+static int
mlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS)
{
struct mlx5e_priv *priv = arg1;
- int error;
- int sys_debug;
+ int error, sys_debug;
sys_debug = priv->sysctl_debug;
error = sysctl_handle_int(oidp, &priv->sysctl_debug, 0, req);
- if (error || !req->newptr)
+ if (error != 0 || !req->newptr)
return (error);
- priv->sysctl_debug = !!priv->sysctl_debug;
+ priv->sysctl_debug = priv->sysctl_debug != 0;
if (sys_debug == priv->sysctl_debug)
- return (error);
- if (priv->sysctl_debug)
+ return (0);
+
+ PRIV_LOCK(priv);
+ if (priv->sysctl_debug) {
mlx5e_create_stats(&priv->stats.port_stats_debug.ctx,
SYSCTL_CHILDREN(priv->sysctl_ifnet), "debug_stats",
mlx5e_port_stats_debug_desc, MLX5E_PORT_STATS_DEBUG_NUM,
priv->stats.port_stats_debug.arg);
- else
+ SYSCTL_ADD_PROC(&priv->sysctl_ctx_channel_debug,
+ SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO,
+ "hw_ctx_debug",
+ CTLFLAG_RD | CTLFLAG_MPSAFE | CTLTYPE_STRING, priv, 0,
+ mlx5e_ethtool_debug_channel_info, "S", "");
+ } else {
sysctl_ctx_free(&priv->stats.port_stats_debug.ctx);
- return (error);
+ sysctl_ctx_free(&priv->sysctl_ctx_channel_debug);
+ }
+ PRIV_UNLOCK(priv);
+ return (0);
}
static void
Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:46:27 2018 (r337107)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Aug 2 08:47:24 2018 (r337108)
@@ -3407,6 +3407,8 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
if (ifp->if_capenable & IFCAP_TXCSUM_IPV6)
ifp->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6);
+ sysctl_ctx_init(&priv->sysctl_ctx_channel_debug);
+
/* ifnet sysctl tree */
sysctl_ctx_init(&priv->sysctl_ctx);
priv->sysctl_ifnet = SYSCTL_ADD_NODE(&priv->sysctl_ctx, SYSCTL_STATIC_CHILDREN(_dev),
@@ -3565,6 +3567,7 @@ err_free_wq:
err_free_sysctl:
sysctl_ctx_free(&priv->sysctl_ctx);
+ sysctl_ctx_free(&priv->sysctl_ctx_channel_debug);
if_free(ifp);
@@ -3612,8 +3615,10 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp
if_free(ifp);
/* destroy all remaining sysctl nodes */
- if (priv->sysctl_debug)
+ if (priv->sysctl_debug) {
+ sysctl_ctx_free(&priv->sysctl_ctx_channel_debug);
sysctl_ctx_free(&priv->stats.port_stats_debug.ctx);
+ }
sysctl_ctx_free(&priv->stats.vport.ctx);
sysctl_ctx_free(&priv->stats.pport.ctx);
sysctl_ctx_free(&priv->sysctl_ctx);
More information about the svn-src-stable-11
mailing list