Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Oct 2014 16:39:02 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273593 - head/sys/ofed/drivers/net/mlx4
Message-ID:  <201410241639.s9OGd2xC016324@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Oct 24 16:39:01 2014
New Revision: 273593
URL: https://svnweb.freebsd.org/changeset/base/273593

Log:
  Update the network interface baudrate integer according to the actual
  line rate.
  
  Submitted by:	jhb @
  MFC after:	1 week

Modified:
  head/sys/ofed/drivers/net/mlx4/en_netdev.c

Modified: head/sys/ofed/drivers/net/mlx4/en_netdev.c
==============================================================================
--- head/sys/ofed/drivers/net/mlx4/en_netdev.c	Fri Oct 24 16:18:16 2014	(r273592)
+++ head/sys/ofed/drivers/net/mlx4/en_netdev.c	Fri Oct 24 16:39:01 2014	(r273593)
@@ -970,6 +970,9 @@ static void mlx4_en_do_set_rx_mode(struc
 			/* Important note: the following call for if_link_state_change
 			 * is needed for interface up scenario (start port, link state
 			 * change) */
+			/* update netif baudrate */
+			priv->dev->if_baudrate =
+			    IF_Mbps(priv->port_state.link_speed);
 			if_link_state_change(priv->dev, LINK_STATE_UP);
 			en_dbg(HW, priv, "Link Up\n");
 		}
@@ -1186,6 +1189,9 @@ static void mlx4_en_linkstate(struct wor
 		if (linkstate == MLX4_DEV_EVENT_PORT_DOWN) {
 			en_info(priv, "Link Down\n");
 			if_link_state_change(priv->dev, LINK_STATE_DOWN);
+			/* update netif baudrate */
+			priv->dev->if_baudrate = 0;
+
 		/* make sure the port is up before notifying the OS. 
 		 * This is tricky since we get here on INIT_PORT and 
 		 * in such case we can't tell the OS the port is up.
@@ -1193,6 +1199,10 @@ static void mlx4_en_linkstate(struct wor
 		 * in set_rx_mode.
 		 * */
 		} else if (priv->port_up && (linkstate == MLX4_DEV_EVENT_PORT_UP)){
+			if (mlx4_en_QUERY_PORT(priv->mdev, priv->port))
+				en_info(priv, "Query port failed\n");
+			priv->dev->if_baudrate =
+			    IF_Mbps(priv->port_state.link_speed);
 			en_info(priv, "Link Up\n");
 			if_link_state_change(priv->dev, LINK_STATE_UP);
 		}
@@ -1978,7 +1988,6 @@ int mlx4_en_init_netdev(struct mlx4_en_d
 	dev->if_softc = priv;
 	if_initname(dev, "mlxen", atomic_fetchadd_int(&mlx4_en_unit, 1));
 	dev->if_mtu = ETHERMTU;
-	dev->if_baudrate = 1000000000;
 	dev->if_init = mlx4_en_open;
 	dev->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	dev->if_ioctl = mlx4_en_ioctl;



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