All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Ioana Ciornei <ioana.ciornei@nxp.com>
Subject: Re: Cutting the link on ndo_stop - phy_stop or phy_disconnect?
Date: Wed, 5 Jun 2019 01:03:27 +0300	[thread overview]
Message-ID: <CA+h21hrOPCVoDwbQa9uFVu3uVWtoP+2Vp2z94An2qtv=u8wWKg@mail.gmail.com> (raw)
In-Reply-To: <20190604214845.wlelh454qfnrs42s@shell.armlinux.org.uk>

On Wed, 5 Jun 2019 at 00:48, Russell King - ARM Linux admin
<linux@armlinux.org.uk> wrote:
>
> On Tue, Jun 04, 2019 at 02:37:31PM -0700, Florian Fainelli wrote:
> > The firmware/boot loader transition to a full fledged OS with a switch
> > is a tricky one to answer though, and there are no perfect answers
> > AFAICT. If your SW is totally hosed, you might want the switch to
> > forward traffic between all LAN ports (excluding WAN, otherwise you
> > expose your home devices to the outside world, whoops).
> >
> > If your SW is fully operational, then the questions are:
> >
> > - do you want a DSA like behavior in your boot loader, in that all ports
> > are separated but fully usable or do you want a dumb switch model where
> > any port can forward to the CPU/management port, without any tags or
> > anything (unmanaged mode)
> >
> > - what happens during bootloader to OS handover, should the switch be
> > held in reset so as to avoid any possible indirect DMA into main memory
> > as much as power saving? Should nothing happen and let the OS wipe out
> > clean the setting left by the boot loader?
> >
> > All of these are in the realm of policy and trade offs as far as
> > initializing/disruption goes, so there are no hard and fast answers.
>
> For a switch, there are four stages, not two:
>
> 1. The out-of-reset state, which from what I've seen seems to be to
>    behave like a dumb switch.
>
> 2. The boot loader state, which is generally the same as the
>    out-of-reset state.
>
> 3. The OS-booting state, which for a DSA switch in Linux isolates each
>    port from each other.
>
> 4. The OS-booted state, which depends on the system configuration.
>
> If you are setting up a switch in a STP environment, you _have_ to be
> aware of all of those states, and plan your network accordingly.
> While it's possible to argue that the boot loader should isolate the
> ports, it may be that the system gets hosed to the point that the boot
> loader is unable to run - then you have a switch operating in a STP
> environment acting as a dumb switch.
>
> The same actually goes for many switches - consider your typical DSL
> router integrated with a four port switch.  By default, that switch
> forwards traffic between each port.  If you've setup the ports to be
> isolated, each time the router is rebooted (e.g., due to a
> configuration change) it will forward traffic between all ports until
> the routers OS has finished booting and applied the switch
> configuration.
>
> What I'm basically saying is that if you're going to the point of
> using such hardware in a STP environment, you _must_ pay attention
> to the behaviour of the hardware through all phases of its operation
> and consider the consequences should it fail in any of those phases.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
> According to speedtest.net: 11.9Mbps down 500kbps up

Hi Russell,

The dumb switch was just an example. The absolute same thing (unwanted
PHY connection) applies to regular NICs. I am not aware of any setting
that makes the MAC ignore frames as long as they observe the
appropriate MII spec. And the hardware will go on to process those
frames, potentially calling into the operating system and making it
susceptible to denial of service. That is unless you set up your
buffer rings/queues/whatever in the ndo_open/ndo_close callbacks.
The point is that having a way to make a link dead/have it dead by
default is the easiest way to prevent a lot of problems. Call that
policy, whatever, but I think at the very least the Linux kernel
should have a way to operate in this mode (if not even be the default
one, unless the user knows better).

Regards,
-Vladimir

  parent reply	other threads:[~2019-06-04 22:03 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 19:58 Cutting the link on ndo_stop - phy_stop or phy_disconnect? Vladimir Oltean
2019-06-04 20:07 ` Andrew Lunn
2019-06-04 20:42   ` Vladimir Oltean
2019-06-04 20:55     ` Heiner Kallweit
2019-06-04 21:23       ` Vladimir Oltean
2019-06-04 20:57     ` Florian Fainelli
2019-06-04 21:26       ` Vladimir Oltean
2019-06-04 21:12     ` Andrew Lunn
2019-06-04 21:29       ` Vladimir Oltean
2019-06-04 21:37         ` Florian Fainelli
2019-06-04 21:48           ` Russell King - ARM Linux admin
2019-06-04 21:56             ` Andrew Lunn
2019-06-04 22:03             ` Vladimir Oltean [this message]
2019-06-04 22:16               ` Russell King - ARM Linux admin
2019-06-04 22:44                 ` Vladimir Oltean
2019-06-04 22:59                   ` Russell King - ARM Linux admin
2019-06-04 23:03                     ` Vladimir Oltean
2019-06-04 23:24                       ` Russell King - ARM Linux admin
2019-06-04 23:46                         ` Vladimir Oltean
2019-06-05  0:04                           ` Russell King - ARM Linux admin
2019-06-05  3:06                           ` Florian Fainelli
2019-06-05  8:27                             ` Vladimir Oltean
2019-06-05  9:30                               ` Russell King - ARM Linux admin
2019-06-05 11:19                                 ` Vladimir Oltean
2019-06-05 12:16                           ` Russell King - ARM Linux admin
2019-06-05 12:35                             ` Russell King - ARM Linux admin
2019-06-04 20:25 ` Florian Fainelli
2019-06-04 21:36 ` Russell King - ARM Linux admin
2019-06-05  2:25   ` Florian Fainelli
2019-06-05  8:45     ` Russell King - ARM Linux admin
2019-06-05 18:01       ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+h21hrOPCVoDwbQa9uFVu3uVWtoP+2Vp2z94An2qtv=u8wWKg@mail.gmail.com' \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.