Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Nov 2018 07:09:24 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r341317 - head/sys/dev/sfxge/common
Message-ID:  <201811300709.wAU79OFh083654@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Fri Nov 30 07:09:23 2018
New Revision: 341317
URL: https://svnweb.freebsd.org/changeset/base/341317

Log:
  sfxge(4): infer port mode bandwidth from max link speed
  
  Limit the port mode bandwidth calculations by the maximum
  reported link speed. This system detects 25G vs 10G cards,
  and 100G port modes vs 40G.
  
  Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18279

Modified:
  head/sys/dev/sfxge/common/ef10_nic.c

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==============================================================================
--- head/sys/dev/sfxge/common/ef10_nic.c	Fri Nov 30 07:09:11 2018	(r341316)
+++ head/sys/dev/sfxge/common/ef10_nic.c	Fri Nov 30 07:09:23 2018	(r341317)
@@ -160,9 +160,11 @@ ef10_nic_get_port_mode_bandwidth(
 {
 	uint32_t port_modes;
 	uint32_t current_mode;
-	uint32_t single_lane = 10000;
-	uint32_t dual_lane   = 50000;
-	uint32_t quad_lane   = 40000;
+	efx_port_t *epp = &(enp->en_port);
+
+	uint32_t single_lane;
+	uint32_t dual_lane;
+	uint32_t quad_lane;
 	uint32_t bandwidth;
 	efx_rc_t rc;
 
@@ -171,6 +173,21 @@ ef10_nic_get_port_mode_bandwidth(
 		/* No port mode info available. */
 		goto fail1;
 	}
+
+	if (epp->ep_phy_cap_mask & (1 << EFX_PHY_CAP_25000FDX))
+		single_lane = 25000;
+	else
+		single_lane = 10000;
+
+	if (epp->ep_phy_cap_mask & (1 << EFX_PHY_CAP_50000FDX))
+		dual_lane = 50000;
+	else
+		dual_lane = 20000;
+
+	if (epp->ep_phy_cap_mask & (1 << EFX_PHY_CAP_100000FDX))
+		quad_lane = 100000;
+	else
+		quad_lane = 40000;
 
 	switch (current_mode) {
 	case TLV_PORT_MODE_1x1_NA:			/* mode 0 */



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