Skip to content
Snippets Groups Projects
  1. Jul 25, 2018
  2. Jul 21, 2018
  3. Jul 16, 2018
  4. Jun 03, 2018
  5. Apr 28, 2018
    • Florian Fainelli's avatar
      net: phy: Fix modular PHYLIB build · 9e8d438e
      Florian Fainelli authored
      
      After commit c59530d0 ("net: Move PHY statistics code into PHY
      library helpers") we made net/core/ethtool.c reference symbols which are
      part of the library which can be modular. David introduced a temporary
      fix with 1ecd6e8a ("phy: Temporary build fix after phylib changes.")
      which would prevent such modularity.
      
      This is not desireable of course, so instead, just inline the functions
      into include/linux/phy.h to keep both options available.
      
      Fixes: c59530d0 ("net: Move PHY statistics code into PHY library helpers")
      Fixes: 1ecd6e8a ("phy: Temporary build fix after phylib changes.")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9e8d438e
  6. Apr 27, 2018
  7. Mar 12, 2018
    • Brad Mouring's avatar
      net: phy: Tell caller result of phy_change() · a2c054a8
      Brad Mouring authored
      
      In 664fcf12 (net: phy: Threaded interrupts allow some simplification)
      the phy_interrupt system was changed to use a traditional threaded
      interrupt scheme instead of a workqueue approach.
      
      With this change, the phy status check moved into phy_change, which
      did not report back to the caller whether or not the interrupt was
      handled. This means that, in the case of a shared phy interrupt,
      only the first phydev's interrupt registers are checked (since
      phy_interrupt() would always return IRQ_HANDLED). This leads to
      interrupt storms when it is a secondary device that's actually the
      interrupt source.
      
      Signed-off-by: default avatarBrad Mouring <brad.mouring@ni.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a2c054a8
  8. Mar 07, 2018
  9. Feb 27, 2018
  10. Feb 08, 2018
  11. Jan 15, 2018
  12. Dec 13, 2017
    • Russell King's avatar
      net: phy: fix resume handling · f5e64032
      Russell King authored
      
      When a PHY has the BMCR_PDOWN bit set, it may decide to ignore writes
      to other registers, or reset the registers to power-on defaults.
      Micrel PHYs do this for their interrupt registers.
      
      The current structure of phylib tries to enable interrupts before
      resuming (and releasing) the BMCR_PDOWN bit.  This fails, causing
      Micrel PHYs to stop working after a suspend/resume sequence if they
      are using interrupts.
      
      Fix this by ensuring that the PHY driver resume methods do not take
      the phydev->lock mutex themselves, but the callers of phy_resume()
      take that lock.  This then allows us to move the call to phy_resume()
      before we enable interrupts in phy_start().
      
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f5e64032
  13. Dec 04, 2017
  14. Dec 01, 2017
  15. Sep 21, 2017
  16. Aug 31, 2017
    • Florian Fainelli's avatar
      Revert "net: phy: Correctly process PHY_HALTED in phy_stop_machine()" · ebc8254a
      Florian Fainelli authored
      
      This reverts commit 7ad813f2 ("net: phy:
      Correctly process PHY_HALTED in phy_stop_machine()") because it is
      creating the possibility for a NULL pointer dereference.
      
      David Daney provide the following call trace and diagram of events:
      
      When ndo_stop() is called we call:
      
       phy_disconnect()
          +---> phy_stop_interrupts() implies: phydev->irq = PHY_POLL;
          +---> phy_stop_machine()
          |      +---> phy_state_machine()
          |              +----> queue_delayed_work(): Work queued.
          +--->phy_detach() implies: phydev->attached_dev = NULL;
      
      Now at a later time the queued work does:
      
       phy_state_machine()
          +---->netif_carrier_off(phydev->attached_dev): Oh no! It is NULL:
      
       CPU 12 Unable to handle kernel paging request at virtual address
      0000000000000048, epc == ffffffff80de37ec, ra == ffffffff80c7c
      Oops[#1]:
      CPU: 12 PID: 1502 Comm: kworker/12:1 Not tainted 4.9.43-Cavium-Octeon+ #1
      Workqueue: events_power_efficient phy_state_machine
      task: 80000004021ed100 task.stack: 8000000409d70000
      $ 0   : 0000000000000000 ffffffff84720060 0000000000000048 0000000000000004
      $ 4   : 0000000000000000 0000000000000001 0000000000000004 0000000000000000
      $ 8   : 0000000000000000 0000000000000000 00000000ffff98f3 0000000000000000
      $12   : 8000000409d73fe0 0000000000009c00 ffffffff846547c8 000000000000af3b
      $16   : 80000004096bab68 80000004096babd0 0000000000000000 80000004096ba800
      $20   : 0000000000000000 0000000000000000 ffffffff81090000 0000000000000008
      $24   : 0000000000000061 ffffffff808637b0
      $28   : 8000000409d70000 8000000409d73cf0 80000000271bd300 ffffffff80c7804c
      Hi    : 000000000000002a
      Lo    : 000000000000003f
      epc   : ffffffff80de37ec netif_carrier_off+0xc/0x58
      ra    : ffffffff80c7804c phy_state_machine+0x48c/0x4f8
      Status: 14009ce3        KX SX UX KERNEL EXL IE
      Cause : 00800008 (ExcCode 02)
      BadVA : 0000000000000048
      PrId  : 000d9501 (Cavium Octeon III)
      Modules linked in:
      Process kworker/12:1 (pid: 1502, threadinfo=8000000409d70000,
      task=80000004021ed100, tls=0000000000000000)
      Stack : 8000000409a54000 80000004096bab68 80000000271bd300 80000000271c1e00
              0000000000000000 ffffffff808a1708 8000000409a54000 80000000271bd300
              80000000271bd320 8000000409a54030 ffffffff80ff0f00 0000000000000001
              ffffffff81090000 ffffffff808a1ac0 8000000402182080 ffffffff84650000
              8000000402182080 ffffffff84650000 ffffffff80ff0000 8000000409a54000
              ffffffff808a1970 0000000000000000 80000004099e8000 8000000402099240
              0000000000000000 ffffffff808a8598 0000000000000000 8000000408eeeb00
              8000000409a54000 00000000810a1d00 0000000000000000 8000000409d73de8
              8000000409d73de8 0000000000000088 000000000c009c00 8000000409d73e08
              8000000409d73e08 8000000402182080 ffffffff808a84d0 8000000402182080
              ...
      Call Trace:
      [<ffffffff80de37ec>] netif_carrier_off+0xc/0x58
      [<ffffffff80c7804c>] phy_state_machine+0x48c/0x4f8
      [<ffffffff808a1708>] process_one_work+0x158/0x368
      [<ffffffff808a1ac0>] worker_thread+0x150/0x4c0
      [<ffffffff808a8598>] kthread+0xc8/0xe0
      [<ffffffff808617f0>] ret_from_kernel_thread+0x14/0x1c
      
      The original motivation for this change originated from Marc Gonzales
      indicating that his network driver did not have its adjust_link callback
      executing with phydev->link = 0 while he was expecting it.
      
      PHYLIB has never made any such guarantees ever because phy_stop() merely just
      tells the workqueue to move into PHY_HALTED state which will happen
      asynchronously.
      
      Reported-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reported-by: default avatarDavid Daney <ddaney.cavm@gmail.com>
      Fixes: 7ad813f2 ("net: phy: Correctly process PHY_HALTED in phy_stop_machine()")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ebc8254a
  17. Aug 07, 2017
  18. Aug 01, 2017
  19. Jul 31, 2017
  20. Jul 28, 2017
  21. Jun 13, 2017
  22. Jun 09, 2017
  23. Jun 07, 2017
  24. Jun 06, 2017
  25. Jun 05, 2017
  26. May 16, 2017
    • Mauro Carvalho Chehab's avatar
      net: fix some identation issues at kernel-doc markups · d651983d
      Mauro Carvalho Chehab authored
      
      Sphinx is very pedantic with regards to identation and
      escape sequences:
      
        ./include/net/sock.h:1967: ERROR: Unexpected indentation.
        ./include/net/sock.h:1969: ERROR: Unexpected indentation.
        ./include/net/sock.h:1970: WARNING: Block quote ends without a blank line; unexpected unindent.
        ./include/net/sock.h:1971: WARNING: Block quote ends without a blank line; unexpected unindent.
        ./include/net/sock.h:2268: WARNING: Inline emphasis start-string without end-string.
        ./net/core/sock.c:2686: ERROR: Unexpected indentation.
        ./net/core/sock.c:2687: WARNING: Block quote ends without a blank line; unexpected unindent.
        ./net/core/datagram.c:182: WARNING: Inline emphasis start-string without end-string.
        ./include/linux/netdevice.h:1444: ERROR: Unexpected indentation.
        ./drivers/net/phy/phy.c:381: ERROR: Unexpected indentation.
        ./drivers/net/phy/phy.c:382: WARNING: Block quote ends without a blank line; unexpected unindent.
      
      - Fix spacing where needed;
      - Properly escape constants;
      - Use a literal block for a race description.
      
      No functional changes.
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      d651983d
  27. Apr 26, 2017
    • Alexander Kochetkov's avatar
      net: phy: fix auto-negotiation stall due to unavailable interrupt · f555f34f
      Alexander Kochetkov authored
      
      The Ethernet link on an interrupt driven PHY was not coming up if the Ethernet
      cable was plugged before the Ethernet interface was brought up.
      
      The patch trigger PHY state machine to update link state if PHY was requested to
      do auto-negotiation and auto-negotiation complete flag already set.
      
      During power-up cycle the PHY do auto-negotiation, generate interrupt and set
      auto-negotiation complete flag. Interrupt is handled by PHY state machine but
      doesn't update link state because PHY is in PHY_READY state. After some time
      MAC bring up, start and request PHY to do auto-negotiation. If there are no new
      settings to advertise genphy_config_aneg() doesn't start PHY auto-negotiation.
      PHY continue to stay in auto-negotiation complete state and doesn't fire
      interrupt. At the same time PHY state machine expect that PHY started
      auto-negotiation and is waiting for interrupt from PHY and it won't get it.
      
      Fixes: 321beec5 ("net: phy: Use interrupts when available in NOLINK state")
      Signed-off-by: default avatarAlexander Kochetkov <al.kochet@gmail.com>
      Cc: stable <stable@vger.kernel.org> # v4.9+
      Tested-by: default avatarRoger Quadros <rogerq@ti.com>
      Tested-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f555f34f
  28. Apr 17, 2017
    • Russell King's avatar
      net: phy: simplify phy_supported_speeds() · 786df9c2
      Russell King authored
      
      Simplify the loop in phy_supported_speeds().
      
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      786df9c2
    • Russell King's avatar
      net: phy: improve phylib correctness for non-autoneg settings · d0613037
      Russell King authored
      
      phylib has some undesirable behaviour when forcing a link mode through
      ethtool.  phylib uses this code:
      
      	idx = phy_find_valid(phy_find_setting(phydev->speed, phydev->duplex),
      			features);
      
      to find an index in the settings table.  phy_find_setting() starts at
      index 0, and scans upwards looking for an exact speed and duplex match.
      When it doesn't find it, it returns MAX_NUM_SETTINGS - 1, which is
      10baseT-Half duplex.
      
      phy_find_valid() then scans from the point (and effectively only checks
      one entry) before bailing out, returning MAX_NUM_SETTINGS - 1.
      
      phy_sanitize_settings() then sets ->speed to SPEED_10 and ->duplex to
      DUPLEX_HALF whether or not 10baseT-Half is supported or not.  This goes
      against all the comments against these functions, and 10baseT-Half may
      not even be supported by the hardware.
      
      Rework these functions, introducing a new method of scanning the table.
      There are two modes of lookup that phylib wants: exact, and inexact.
      
      - in exact mode, we return either an exact match or failure
      - in inexact mode, we return an exact match if it exists, a match at
        the highest speed that is not greater than the requested speed
        (ignoring duplex), or failing that, the lowest supported speed, or
        failure.
      
      The biggest difference is that we always check whether the entry is
      supported before further consideration, so all unsupported entries are
      not considered as candidates.
      
      This results in arguably saner behaviour, better matches the comments,
      and is probably what users would expect.
      
      This becomes important as ethernet speeds increase, PHYs exist which do
      not support the 10Mbit speeds, and half-duplex is likely to become
      obsolete - it's already not even an option on 10Gbit and faster links.
      
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d0613037
  29. Apr 05, 2017
  30. Apr 02, 2017
Loading