Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 May 2012 16:04:10 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r236316 - stable/9/sys/ofed/drivers/net/mlx4
Message-ID:  <201205301604.q4UG4ATT061114@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Wed May 30 16:04:10 2012
New Revision: 236316
URL: http://svn.freebsd.org/changeset/base/236316

Log:
  MFC 234099:
  Properly parse 40G media types from newer Mellanox adapters that are
  40G capable.  For now, map all 40G links to 40GBase-CR4.

Modified:
  stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c
  stable/9/sys/ofed/drivers/net/mlx4/en_port.c
  stable/9/sys/ofed/drivers/net/mlx4/en_port.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c
==============================================================================
--- stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c	Wed May 30 15:51:02 2012	(r236315)
+++ stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c	Wed May 30 16:04:10 2012	(r236316)
@@ -991,12 +991,20 @@ static int mlx4_en_calc_media(struct mlx
 	active |= IFM_FDX;
 	trans_type = priv->port_state.transciver;
 	/* XXX I don't know all of the transceiver values. */
-	if (priv->port_state.link_speed == 1000)
+	switch (priv->port_state.link_speed) {
+	case 1000:
 		active |= IFM_1000_T;
-	else if (trans_type > 0 && trans_type <= 0xC)
-		active |= IFM_10G_SR;
-	else if (trans_type == 0x80 || trans_type == 0)
-		active |= IFM_10G_CX4;
+		break;
+	case 10000:
+		if (trans_type > 0 && trans_type <= 0xC)
+			active |= IFM_10G_SR;
+		else if (trans_type == 0x80 || trans_type == 0)
+			active |= IFM_10G_CX4;
+		break;
+	case 40000:
+		active |= IFM_40G_CR4;
+		break;
+	}
 	if (priv->prof->tx_pause)
 		active |= IFM_ETH_TXPAUSE;
 	if (priv->prof->rx_pause)

Modified: stable/9/sys/ofed/drivers/net/mlx4/en_port.c
==============================================================================
--- stable/9/sys/ofed/drivers/net/mlx4/en_port.c	Wed May 30 15:51:02 2012	(r236315)
+++ stable/9/sys/ofed/drivers/net/mlx4/en_port.c	Wed May 30 16:04:10 2012	(r236316)
@@ -152,11 +152,21 @@ int mlx4_en_QUERY_PORT(struct mlx4_en_de
 	/* This command is always accessed from Ethtool context
 	 * already synchronized, no need in locking */
 	state->link_state = !!(qport_context->link_up & MLX4_EN_LINK_UP_MASK);
-	if ((qport_context->link_speed & MLX4_EN_SPEED_MASK) ==
-	    MLX4_EN_1G_SPEED)
+	switch (qport_context->link_speed & MLX4_EN_SPEED_MASK) {
+	case MLX4_EN_1G_SPEED:
 		state->link_speed = 1000;
-	else
+		break;
+	case MLX4_EN_10G_SPEED_XAUI:
+	case MLX4_EN_10G_SPEED_XFI:
 		state->link_speed = 10000;
+		break;
+	case MLX4_EN_40G_SPEED:
+		state->link_speed = 40000;
+		break;
+	default:
+		state->link_speed = -1;
+		break;
+	}
 	state->transciver = qport_context->transceiver;
 	if (be32_to_cpu(qport_context->transceiver_code_hi) & 0x400)
 		state->transciver = 0x80;

Modified: stable/9/sys/ofed/drivers/net/mlx4/en_port.h
==============================================================================
--- stable/9/sys/ofed/drivers/net/mlx4/en_port.h	Wed May 30 15:51:02 2012	(r236315)
+++ stable/9/sys/ofed/drivers/net/mlx4/en_port.h	Wed May 30 16:04:10 2012	(r236316)
@@ -85,6 +85,14 @@ enum {
 	MLX4_MCAST_ENABLE       = 2,
 };
 
+enum {
+	MLX4_EN_1G_SPEED	= 0x02,
+	MLX4_EN_10G_SPEED_XFI	= 0x01,
+	MLX4_EN_10G_SPEED_XAUI	= 0x00,
+	MLX4_EN_40G_SPEED	= 0x40,
+	MLX4_EN_OTHER_SPEED	= 0x0f,
+};
+
 struct mlx4_en_query_port_context {
 	u8 link_up;
 #define MLX4_EN_LINK_UP_MASK	0x80
@@ -92,8 +100,7 @@ struct mlx4_en_query_port_context {
 	__be16 mtu;
 	u8 reserved2;
 	u8 link_speed;
-#define MLX4_EN_SPEED_MASK	0x3
-#define MLX4_EN_1G_SPEED	0x2
+#define MLX4_EN_SPEED_MASK	0x43
 	u16 reserved3[5];
 	__be64 mac;
 	u8 transceiver;



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