lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4dc00fa3-daef-bfdb-cb50-6bcddaa2d2c9@gmail.com>
Date:   Wed, 1 Aug 2018 10:31:16 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     rpjday@...shcourse.ca, netdev@...r.kernel.org, andrew@...n.ch
Subject: Re: how PHY driver is notified that cable is unplugged? (possibly
 related to IFF_RUNNING flag)

On 08/01/2018 05:58 AM, rpjday@...shcourse.ca wrote:
> 
>   (warning that i have a few questions that are probably trivial until i
> get up to speed
> with networking code.)
> 
>   a colleague asked for advice about the following -- apparently a new
> PHY driver works
> properly when being brought up with "ifconfig <ifname> up", part of that
> process
> apparently setting the IFF_RUNNING net_device flags bit. so far, so good.
> 
>   now, when the cable is physically unplugged, the claim is that there
> is no obvious
> status change for that port, accompanied by the suggestion that it is
> that IFF_RUNNING
> flag bit that is not being unset.
> 
>   asking a more general question, where can i read up on the proper
> protocol for
> a driver being notified of, and properly handling, physical
> disconnection on that
> port? and, of course, the cable being plugged back in.

The basic mechanism used by the PHY library is to read the standard
Basic Mode Status Register and check the Link status bit to determine
what the state of the link is set. This event can be triggered either
through polling, or the use of an interrupt that the PHY is generating.

Once the link state is determined, because the PHY device is "connected"
to a network device, the PHY library can call netif_carrier_{on,off}
against the network device attached to the PHY and that propagates
through the networking stack and sets the appropriate bits, including
IFF_RUNNING.

Hope this helps.
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ