svn commit: r332653 - head/sys/dev/ixgbe

Andrew Gallatin gallatin at FreeBSD.org
Tue Apr 17 16:51:28 UTC 2018


Author: gallatin
Date: Tue Apr 17 16:51:27 2018
New Revision: 332653
URL: https://svnweb.freebsd.org/changeset/base/332653

Log:
  Restore SIOCGI2C functionality to ixgbe
  
  When ixgbe was converted to iflib, it lost the SIOCGI2C support
  that allows ifconfig to print SFP state, optical light levels, etc.
  Restore this by plugging in to the ifdi_i2c_req iflib method.  Note
  that the sanity checking on dev_addr that used to be done in ixgbe is
  now done in iflib.
  
  Reviewed by:	erj, Matthew Macy <mmacy at mattmacy.io>
  Sponsored by:	Netflix

Modified:
  head/sys/dev/ixgbe/if_ix.c

Modified: head/sys/dev/ixgbe/if_ix.c
==============================================================================
--- head/sys/dev/ixgbe/if_ix.c	Tue Apr 17 16:46:08 2018	(r332652)
+++ head/sys/dev/ixgbe/if_ix.c	Tue Apr 17 16:51:27 2018	(r332653)
@@ -137,7 +137,7 @@ static void ixgbe_if_timer(if_ctx_t ctx, uint16_t);
 static void ixgbe_if_update_admin_status(if_ctx_t ctx);
 static void ixgbe_if_vlan_register(if_ctx_t ctx, u16 vtag);
 static void ixgbe_if_vlan_unregister(if_ctx_t ctx, u16 vtag);
-
+static int  ixgbe_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req);
 int ixgbe_intr(void *arg);
 
 /************************************************************************
@@ -270,6 +270,7 @@ static device_method_t ixgbe_if_methods[] = {
 	DEVMETHOD(ifdi_vlan_register, ixgbe_if_vlan_register),
 	DEVMETHOD(ifdi_vlan_unregister, ixgbe_if_vlan_unregister),
 	DEVMETHOD(ifdi_get_counter, ixgbe_if_get_counter),
+	DEVMETHOD(ifdi_i2c_req, ixgbe_if_i2c_req),
 #ifdef PCI_IOV
 	DEVMETHOD(ifdi_iov_init, ixgbe_if_iov_init),
 	DEVMETHOD(ifdi_iov_uninit, ixgbe_if_iov_uninit),
@@ -1232,6 +1233,25 @@ ixgbe_if_get_counter(if_ctx_t ctx, ift_counter cnt)
 } /* ixgbe_if_get_counter */
 
 /************************************************************************
+ * ixgbe_if_i2c_req
+ ************************************************************************/
+static int
+ixgbe_if_i2c_req(if_ctx_t ctx, struct ifi2creq *req)
+{
+	struct adapter		*adapter = iflib_get_softc(ctx);
+	struct ixgbe_hw 	*hw = &adapter->hw;
+	int 			i;
+
+
+	if (hw->phy.ops.read_i2c_byte == NULL)
+		return (ENXIO);
+	for (i = 0; i < req->len; i++)
+		hw->phy.ops.read_i2c_byte(hw, req->offset + i,
+		    req->dev_addr, &req->data[i]);
+	return (0);
+} /* ixgbe_if_i2c_req */
+
+/************************************************************************
  * ixgbe_add_media_types
  ************************************************************************/
 static void
@@ -4547,4 +4567,3 @@ ixgbe_check_fan_failure(struct adapter *adapter, u32 r
 	if (reg & mask)
 		device_printf(adapter->dev, "\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n");
 } /* ixgbe_check_fan_failure */
-


More information about the svn-src-all mailing list