Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Oct 2012 20:18:16 +0000 (UTC)
From:      Maksim Yevmenkin <emax@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241616 - in head/sys: dev/ixgbe net
Message-ID:  <201210162018.q9GKIG9q013028@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emax
Date: Tue Oct 16 20:18:15 2012
New Revision: 241616
URL: http://svn.freebsd.org/changeset/base/241616

Log:
  introduce concept of ifi_baudrate power factor. the idea is to work
  around the problem where high speed interfaces (such as ixgbe(4))
  are not able to report real ifi_baudrate. bascially, take a spare
  byte from struct if_data and use it to store ifi_baudrate power
  factor. in other words,
  
  real ifi_baudrate = ifi_baudrate * 10 ^ ifi_baudrate power factor
  
  this should be backwards compatible with old binaries. use ixgbe(4)
  as an example on how drivers would set ifi_baudrate power factor
  
  Discussed with:	kib, scottl, glebius
  MFC after:	1 week

Modified:
  head/sys/dev/ixgbe/ixgbe.c
  head/sys/net/if.h
  head/sys/net/if_var.h

Modified: head/sys/dev/ixgbe/ixgbe.c
==============================================================================
--- head/sys/dev/ixgbe/ixgbe.c	Tue Oct 16 19:59:13 2012	(r241615)
+++ head/sys/dev/ixgbe/ixgbe.c	Tue Oct 16 20:18:15 2012	(r241616)
@@ -2597,7 +2597,8 @@ ixgbe_setup_interface(device_t dev, stru
 		return (-1);
 	}
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
-	ifp->if_baudrate = 1000000000;
+	ifp->if_baudrate = IF_Gbps(1);
+	ifp->if_baudrate_pf = 1;	/* 1Gbps * 10^1 = 10Gbps */
 	ifp->if_init = ixgbe_init;
 	ifp->if_softc = adapter;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;

Modified: head/sys/net/if.h
==============================================================================
--- head/sys/net/if.h	Tue Oct 16 19:59:13 2012	(r241615)
+++ head/sys/net/if.h	Tue Oct 16 20:18:15 2012	(r241616)
@@ -86,7 +86,7 @@ struct if_data {
 	u_char	ifi_hdrlen;		/* media header length */
 	u_char	ifi_link_state;		/* current link state */
 	u_char	ifi_vhid;		/* carp vhid */
-	u_char	ifi_spare_char2;	/* spare byte */
+	u_char	ifi_baudrate_pf;	/* baudrate power factor */
 	u_char	ifi_datalen;		/* length of this data struct */
 	u_long	ifi_mtu;		/* maximum transmission unit */
 	u_long	ifi_metric;		/* routing metric (external only) */

Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h	Tue Oct 16 19:59:13 2012	(r241615)
+++ head/sys/net/if_var.h	Tue Oct 16 20:18:15 2012	(r241616)
@@ -228,6 +228,7 @@ typedef void if_init_f_t(void *);
 #define	if_metric	if_data.ifi_metric
 #define	if_link_state	if_data.ifi_link_state
 #define	if_baudrate	if_data.ifi_baudrate
+#define	if_baudrate_pf	if_data.ifi_baudrate_pf
 #define	if_hwassist	if_data.ifi_hwassist
 #define	if_ipackets	if_data.ifi_ipackets
 #define	if_ierrors	if_data.ifi_ierrors



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