From owner-svn-src-head@freebsd.org Tue Apr 17 16:51:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62F1BF89C64; Tue, 17 Apr 2018 16:51:28 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1276C7C621; Tue, 17 Apr 2018 16:51:28 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7BD172BF; Tue, 17 Apr 2018 16:51:27 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3HGpRe8044157; Tue, 17 Apr 2018 16:51:27 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3HGpRbj044156; Tue, 17 Apr 2018 16:51:27 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201804171651.w3HGpRbj044156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Tue, 17 Apr 2018 16:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332653 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 332653 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Apr 2018 16:51:28 -0000 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 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 */ -