diff options
author | jfv <jfv@FreeBSD.org> | 2012-11-30 22:41:32 +0000 |
---|---|---|
committer | jfv <jfv@FreeBSD.org> | 2012-11-30 22:41:32 +0000 |
commit | 6b9e611792ee4f48ab4641666945e218339e3da7 (patch) | |
tree | 46b7eee970c27750e0fe4c22042ef281abbedb25 /sys/dev/ixgbe/ixgbe.c | |
parent | 80b1e3c11a8669b594b04bbf14358a75c69c6117 (diff) | |
download | FreeBSD-src-6b9e611792ee4f48ab4641666945e218339e3da7.zip FreeBSD-src-6b9e611792ee4f48ab4641666945e218339e3da7.tar.gz |
Patch #3 - Add a new ioctl to access SFP+ module diagnostic
data via the I2C routines in shared code.
Diffstat (limited to 'sys/dev/ixgbe/ixgbe.c')
-rw-r--r-- | sys/dev/ixgbe/ixgbe.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sys/dev/ixgbe/ixgbe.c b/sys/dev/ixgbe/ixgbe.c index 40a1dc0..b1c905a 100644 --- a/sys/dev/ixgbe/ixgbe.c +++ b/sys/dev/ixgbe/ixgbe.c @@ -47,7 +47,7 @@ int ixgbe_display_debug_stats = 0; /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.5.0 - 2"; +char ixgbe_driver_version[] = "2.5.0 - 3"; /********************************************************************* * PCI Device ID Table @@ -919,6 +919,7 @@ static int ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) { struct adapter *adapter = ifp->if_softc; + struct ixgbe_hw *hw = &adapter->hw; struct ifreq *ifr = (struct ifreq *) data; #if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; @@ -1024,7 +1025,22 @@ ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) VLAN_CAPABILITIES(ifp); break; } - + case SIOCGI2C: + { + struct ixgbe_i2c_req i2c; + IOCTL_DEBUGOUT("ioctl: SIOCGI2C (Get I2C Data)"); + error = copyin(ifr->ifr_data, &i2c, sizeof(i2c)); + if (error) + break; + if ((i2c.dev_addr != 0xA0) || (i2c.dev_addr != 0xA2)){ + error = EINVAL; + break; + } + hw->phy.ops.read_i2c_byte(hw, i2c.offset, + i2c.dev_addr, i2c.data); + error = copyout(&i2c, ifr->ifr_data, sizeof(i2c)); + break; + } default: IOCTL_DEBUGOUT1("ioctl: UNKNOWN (0x%X)\n", (int)command); error = ether_ioctl(ifp, command, data); |