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.
         */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to