1. 07 6月, 2017 2 次提交
  2. 28 5月, 2017 1 次提交
  3. 27 5月, 2017 1 次提交
    • F
      net: phy: Create sysfs reciprocal links for attached_dev/phydev · 5568363f
      Florian Fainelli 提交于
      There is currently no way for a program scanning /sys to know whether a
      network device is attached to a particular PHY device, just like the PHY
      device is not pointed back to its attached network device.
      
      Create a symbolic link in the network device's namespace named "phydev"
      which points to the PHY device and create a symbolic link in the PHY
      device's namespace named "attached_dev" that points back to the network
      device. These links are set up during phy_attach_direct() and removed
      during phy_detach() for symetry.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5568363f
  4. 26 5月, 2017 1 次提交
  5. 23 3月, 2017 1 次提交
  6. 06 3月, 2017 1 次提交
  7. 20 2月, 2017 2 次提交
  8. 10 2月, 2017 1 次提交
    • F
      net: phy: Fix PHY module checks and NULL deref in phy_attach_direct() · 6d9f66ac
      Florian Fainelli 提交于
      The Generic PHY drivers gets assigned after we checked that the current
      PHY driver is NULL, so we need to check a few things before we can
      safely dereference d->driver. This would be causing a NULL deference to
      occur when a system binds to the Generic PHY driver. Update
      phy_attach_direct() to do the following:
      
      - grab the driver module reference after we have assigned the Generic
        PHY drivers accordingly, and remember we came from the generic PHY
        path
      
      - update the error path to clean up the module reference in case the
        Generic PHY probe function fails
      
      - split the error path involving phy_detacht() to avoid double free/put
        since phy_detach() does all the clean up
      
      - finally, have phy_detach() drop the module reference count before we
        call device_release_driver() for the Generic PHY driver case
      
      Fixes: cafe8df8 ("net: phy: Fix lack of reference count on PHY driver")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6d9f66ac
  9. 03 2月, 2017 1 次提交
    • M
      net: phy: Fix lack of reference count on PHY driver · cafe8df8
      Mao Wenan 提交于
      There is currently no reference count being held on the PHY driver,
      which makes it possible to remove the PHY driver module while the PHY
      state machine is running and polling the PHY. This could cause crashes
      similar to this one to show up:
      
      [   43.361162] BUG: unable to handle kernel NULL pointer dereference at 0000000000000140
      [   43.361162] IP: phy_state_machine+0x32/0x490
      [   43.361162] PGD 59dc067
      [   43.361162] PUD 0
      [   43.361162]
      [   43.361162] Oops: 0000 [#1] SMP
      [   43.361162] Modules linked in: dsa_loop [last unloaded: broadcom]
      [   43.361162] CPU: 0 PID: 1299 Comm: kworker/0:3 Not tainted 4.10.0-rc5+ #415
      [   43.361162] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
      BIOS Ubuntu-1.8.2-1ubuntu2 04/01/2014
      [   43.361162] Workqueue: events_power_efficient phy_state_machine
      [   43.361162] task: ffff880006782b80 task.stack: ffffc90000184000
      [   43.361162] RIP: 0010:phy_state_machine+0x32/0x490
      [   43.361162] RSP: 0018:ffffc90000187e18 EFLAGS: 00000246
      [   43.361162] RAX: 0000000000000000 RBX: ffff8800059e53c0 RCX:
      ffff880006a15c60
      [   43.361162] RDX: ffff880006782b80 RSI: 0000000000000000 RDI:
      ffff8800059e5428
      [   43.361162] RBP: ffffc90000187e48 R08: ffff880006a15c40 R09:
      0000000000000000
      [   43.361162] R10: 0000000000000000 R11: 0000000000000000 R12:
      ffff8800059e5428
      [   43.361162] R13: ffff8800059e5000 R14: 0000000000000000 R15:
      ffff880006a15c40
      [   43.361162] FS:  0000000000000000(0000) GS:ffff880006a00000(0000)
      knlGS:0000000000000000
      [   43.361162] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   43.361162] CR2: 0000000000000140 CR3: 0000000005979000 CR4:
      00000000000006f0
      [   43.361162] Call Trace:
      [   43.361162]  process_one_work+0x1b4/0x3e0
      [   43.361162]  worker_thread+0x43/0x4d0
      [   43.361162]  ? __schedule+0x17f/0x4e0
      [   43.361162]  kthread+0xf7/0x130
      [   43.361162]  ? process_one_work+0x3e0/0x3e0
      [   43.361162]  ? kthread_create_on_node+0x40/0x40
      [   43.361162]  ret_from_fork+0x29/0x40
      [   43.361162] Code: 56 41 55 41 54 4c 8d 67 68 53 4c 8d af 40 fc ff ff
      48 89 fb 4c 89 e7 48 83 ec 08 e8 c9 9d 27 00 48 8b 83 60 ff ff ff 44 8b
      73 98 <48> 8b 90 40 01 00 00 44 89 f0 48 85 d2 74 08 4c 89 ef ff d2 8b
      
      Keep references on the PHY driver module right before we are going to
      utilize it in phy_attach_direct(), and conversely when we don't use it
      anymore in phy_detach().
      Signed-off-by: NMao Wenan <maowenan@huawei.com>
      [florian: rebase, rework commit message]
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cafe8df8
  10. 21 12月, 2016 2 次提交
  11. 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
  12. 09 12月, 2016 1 次提交
    • W
      phy: add phy fixup unregister functions · f38e7a32
      Woojung.Huh@microchip.com 提交于
      >From : Woojung Huh <woojung.huh@microchip.com>
      
      Add functions to unregister phy fixup for modules.
      
      int phy_unregister_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask)
      	Unregister phy fixup from phy_fixup_list per bus_id, phy_uid &
      	phy_uid_mask
      
      int phy_unregister_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask)
      	Unregister phy fixup from phy_fixup_list.
      	Use it for fixup registered by phy_register_fixup_for_uid()
      
      int phy_unregister_fixup_for_id(const char *bus_id)
      	Unregister phy fixup from phy_fixup_list.
      	Use it for fixup registered by phy_register_fixup_for_id()
      Signed-off-by: NWoojung Huh <woojung.huh@microchip.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f38e7a32
  13. 08 12月, 2016 1 次提交
  14. 30 11月, 2016 2 次提交
  15. 26 11月, 2016 1 次提交
  16. 08 11月, 2016 1 次提交
  17. 18 10月, 2016 1 次提交
    • Z
      net: phy: leds: add support for led triggers on phy link state change · 2e0bc452
      Zach Brown 提交于
      Create an option CONFIG_LED_TRIGGER_PHY (default n), which will create a
      set of led triggers for each instantiated PHY device. There is one LED
      trigger per link-speed, per-phy.
      The triggers are registered during phy_attach and unregistered during
      phy_detach.
      
      This allows for a user to configure their system to allow a set of LEDs
      not controlled by the phy to represent link state changes on the phy.
      LEDS controlled by the phy are unaffected.
      
      For example, we have a board where some of the leds in the
      RJ45 socket are controlled by the phy, but others are not. Using the
      triggers provided by this patch the leds not controlled by the phy can
      be configured to show the current speed of the ethernet connection. The
      leds controlled by the phy are unaffected.
      Signed-off-by: NJosh Cartwright <josh.cartwright@ni.com>
      Signed-off-by: NNathan Sullivan <nathan.sullivan@ni.com>
      Signed-off-by: NZach Brown <zach.brown@ni.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2e0bc452
  18. 17 10月, 2016 1 次提交
  19. 21 5月, 2016 1 次提交
  20. 17 5月, 2016 1 次提交
  21. 27 4月, 2016 1 次提交
  22. 16 4月, 2016 1 次提交
  23. 17 2月, 2016 1 次提交
  24. 16 1月, 2016 1 次提交
    • S
      net: phy: turn carrier off on phy attach · 113c74d8
      Sjoerd Simons 提交于
      The operstate of a networking device initially IF_OPER_UNKNOWN aka
      "unknown", updated on carrier state changes (with carrier state being on
      by default). This means it will stay unknown unless the carrier state
      goes to off at some point, which is not the case if the phy is already
      up/connected at startup.
      
      Explicitly turn off the carrier on phy attach, leaving the phy state
      machine to turn the carrier on when it has done the initial negotiation.
      Signed-off-by: NSjoerd Simons <sjoerd.simons@collabora.co.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      113c74d8
  25. 13 1月, 2016 1 次提交
  26. 08 1月, 2016 10 次提交
  27. 03 11月, 2015 1 次提交
    • S
      net: phy: fix a bug in get_phy_c45_ids · 5f6c99e0
      Shaohui Xie 提交于
      When probing devices-in-package for a c45 phy, device zero is the last
      device to probe, however, if driver reads 0 from device zero,
      c45_ids->devices_in_package is set to '0', the loop condition of probing
      will be matched again, see codes below:
      
      for (i = 1;i < num_ids && c45_ids->devices_in_package == 0;i++)
      
      driver will run in a dead loop.
      
      This patch restructures the bug and confusing loop, it provides a helper
      function get_phy_c45_devs_in_pkg which to read devices-in-package registers
      of a MMD, and rewrites the loop with using the helper function.
      Signed-off-by: NShaohui Xie <Shaohui.Xie@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5f6c99e0