Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Feb 2016 01:10:56 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r296018 - head/sys/dev/cxgbe
Message-ID:  <201602250110.u1P1AucG028913@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Thu Feb 25 01:10:56 2016
New Revision: 296018
URL: https://svnweb.freebsd.org/changeset/base/296018

Log:
  cxgbe(4): Add a sysctl to retrieve the maximum speed/bandwidth supported by a
  port.
  
  dev.cxgbe.<n>.max_speed
  dev.cxl.<n>.max_speed
  
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/adapter.h
==============================================================================
--- head/sys/dev/cxgbe/adapter.h	Thu Feb 25 01:03:34 2016	(r296017)
+++ head/sys/dev/cxgbe/adapter.h	Thu Feb 25 01:10:56 2016	(r296018)
@@ -1011,6 +1011,22 @@ is_40G_port(const struct port_info *pi)
 }
 
 static inline int
+port_top_speed(const struct port_info *pi)
+{
+
+	if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100G)
+		return (100);
+	if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G)
+		return (40);
+	if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G)
+		return (10);
+	if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_1G)
+		return (1);
+
+	return (0);
+}
+
+static inline int
 tx_resume_threshold(struct sge_eq *eq)
 {
 

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c	Thu Feb 25 01:03:34 2016	(r296017)
+++ head/sys/dev/cxgbe/t4_main.c	Thu Feb 25 01:10:56 2016	(r296018)
@@ -5499,6 +5499,9 @@ cxgbe_sysctls(struct port_info *pi)
 	    CTLTYPE_STRING | CTLFLAG_RW, pi, PAUSE_TX, sysctl_pause_settings,
 	    "A", "PAUSE settings (bit 0 = rx_pause, bit 1 = tx_pause)");
 
+	SYSCTL_ADD_INT(ctx, children, OID_AUTO, "max_speed", CTLFLAG_RD, NULL,
+	    port_top_speed(pi), "max speed (in Gbps)");
+
 	/*
 	 * dev.cxgbe.X.stats.
 	 */



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