1. 18 4月, 2017 1 次提交
    • G
      net: phy: micrel: fix crash when statistic requested for KSZ9031 phy · bfe72442
      Grygorii Strashko 提交于
      Now the command:
      	ethtool --phy-statistics eth0
      will cause system crash with meassage "Unable to handle kernel NULL pointer
      dereference at virtual address 00000010" from:
      
       (kszphy_get_stats) from [<c069f1d8>] (ethtool_get_phy_stats+0xd8/0x210)
       (ethtool_get_phy_stats) from [<c06a0738>] (dev_ethtool+0x5b8/0x228c)
       (dev_ethtool) from [<c06b5484>] (dev_ioctl+0x3fc/0x964)
       (dev_ioctl) from [<c0679f7c>] (sock_ioctl+0x170/0x2c0)
       (sock_ioctl) from [<c02419d4>] (do_vfs_ioctl+0xa8/0x95c)
       (do_vfs_ioctl) from [<c02422c4>] (SyS_ioctl+0x3c/0x64)
       (SyS_ioctl) from [<c0107d60>] (ret_fast_syscall+0x0/0x44)
      
      The reason: phy_driver structure for KSZ9031 phy has no .probe() callback
      defined. As result, struct phy_device *phydev->priv pointer will not be
      initializes (null).
      This issue will affect also following phys:
       KSZ8795, KSZ886X, KSZ8873MLL, KSZ9031, KSZ9021, KSZ8061, KS8737
      
      Fix it by:
      - adding .probe() = kszphy_probe() callback to KSZ9031, KSZ9021
      phys. The kszphy_probe() can be re-used as it doesn't do any phy specific
      settings.
      - removing statistic callbacks from other phys (KSZ8795, KSZ886X,
      KSZ8873MLL, KSZ8061, KS8737) as they doesn't have corresponding
      statistic counters.
      
      Fixes: 2b2427d0 ("phy: micrel: Add ethtool statistics counters")
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bfe72442
  2. 30 1月, 2017 1 次提交
  3. 28 1月, 2017 1 次提交
  4. 11 12月, 2016 1 次提交
    • T
      net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause · 529ed127
      Timur Tabi 提交于
      Instead of having individual PHY drivers set the SUPPORTED_Pause and
      SUPPORTED_Asym_Pause flags, phylib itself should set those flags,
      unless there is a hardware erratum or other special case.  During
      autonegotiation, the PHYs will determine whether to enable pause
      frame support.
      
      Pause frames are a feature that is supported by the MAC.  It is the MAC
      that generates the frames and that processes them.  The PHY can only be
      configured to allow them to pass through.
      
      This commit also effectively reverts the recently applied c7a61319
      ("net: phy: dp83848: Support ethernet pause frames").
      
      So the new process is:
      
      1) Unless the PHY driver overrides it, phylib sets the SUPPORTED_Pause
      and SUPPORTED_AsymPause bits in phydev->supported.  This indicates that
      the PHY supports pause frames.
      
      2) The MAC driver checks phydev->supported before it calls phy_start().
      If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver
      sets those bits in phydev->advertising, if it wants to enable pause
      frame support.
      
      3) When the link state changes, the MAC driver checks phydev->pause and
      phydev->asym_pause,  If the bits are set, then it enables the corresponding
      features in the MAC.  The algorithm is:
      
      	if (phydev->pause)
      		The MAC should be programmed to receive and honor
                      pause frames it receives, i.e. enable receive flow control.
      
      	if (phydev->pause != phydev->asym_pause)
      		The MAC should be programmed to transmit pause
      		frames when needed, i.e. enable transmit flow control.
      Signed-off-by: NTimur Tabi <timur@codeaurora.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      529ed127
  5. 24 11月, 2016 1 次提交
  6. 06 10月, 2016 1 次提交
  7. 24 8月, 2016 1 次提交
  8. 10 8月, 2016 1 次提交
  9. 01 8月, 2016 1 次提交
  10. 16 7月, 2016 1 次提交
  11. 13 5月, 2016 1 次提交
  12. 02 3月, 2016 2 次提交
  13. 20 2月, 2016 1 次提交
    • A
      phy: marvell/micrel: Fix Unpossible condition · 321b4d4b
      Andrew Lunn 提交于
      commit 2b2427d0 ("phy: micrel: Add ethtool statistics counters")
      from Dec 30, 2015, leads to the following static checker
      warning:
      
              drivers/net/phy/micrel.c:609 kszphy_get_stat()
              warn: unsigned 'val' is never less than zero.
      
      drivers/net/phy/micrel.c
         602  static u64 kszphy_get_stat(struct phy_device *phydev, int i)
         603  {
         604          struct kszphy_hw_stat stat = kszphy_hw_stats[i];
         605          struct kszphy_priv *priv = phydev->priv;
         606          u64 val;
         607
         608          val = phy_read(phydev, stat.reg);
         609          if (val < 0) {
                          ^^^^^^^
      Unpossible!
      
         610                  val = UINT64_MAX;
         611          } else {
         612                  val = val & ((1 << stat.bits) - 1);
         613                  priv->stats[i] += val;
         614                  val = priv->stats[i];
         615          }
         616
         617          return val;
         618  }
      
      The same problem exists in the Marvell driver. Fix both.
      
      Fixes: 2b2427d0 ("phy: micrel: Add ethtool statistics counters")
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Reported-by: NJulia.Lawall <julia.lawall@lip6.fr>
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      321b4d4b
  14. 09 1月, 2016 1 次提交
  15. 08 1月, 2016 3 次提交
  16. 31 12月, 2015 1 次提交
  17. 12 12月, 2015 1 次提交
  18. 23 10月, 2015 1 次提交
  19. 08 6月, 2015 3 次提交
  20. 13 5月, 2015 1 次提交
  21. 15 2月, 2015 1 次提交
  22. 27 12月, 2014 1 次提交
  23. 22 11月, 2014 7 次提交
  24. 13 11月, 2014 6 次提交