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: <CAE4R7bCxb8Ni4b5=o80FG+iGEA_dtpefWm9o5eqqKLboC35stg@mail.gmail.com>
Date:	Thu, 27 Aug 2015 09:41:23 -0700
From:	Scott Feldman <sfeldma@...il.com>
To:	Andrew Lunn <andrew@...n.ch>
Cc:	Netdev <netdev@...r.kernel.org>,
	Ji??í Pírko <jiri@...nulli.us>,
	"David S. Miller" <davem@...emloft.net>,
	Florian Fainelli <f.fainelli@...il.com>,
	Roopa Prabhu <roopa@...ulusnetworks.com>
Subject: Re: [RFC PATCH net-next 0/2] Add new switchdev device class

On Thu, Aug 27, 2015 at 2:06 AM, Andrew Lunn <andrew@...n.ch> wrote:
> On Thu, Aug 27, 2015 at 01:42:24AM -0700, Scott Feldman wrote:
>> On Thu, Aug 27, 2015 at 12:45 AM, Andrew Lunn <andrew@...n.ch> wrote:
>> >> I don't know about how this overlaps with DSA platform_class.  Florian?
>> >
>> > There is some overlap with DSA, but the current DSA model, with
>> > respect to probing, is broken. So this might be interesting as a way
>> > towards fix that.
>> >
>> > One thing to keep in mind is the D in DSA. You talk about switch,
>> > singular. DSA has a number of switches in a cluster. We currently
>> > export a single switchdev interface for the cluster, but there are
>> > some properties which are per switch, e.g. temperature, eeprom
>> > contents, statistics, power management etc.
>>
>> Export a single 'switchdev' or 'netdev' for the cluster?  I hope that
>> was a typo.
>
> I probably expressed that badly. The hardware i have on my desk has
> three Marvell switches in a chain, with one end of the chain connected
> to a host Ethernet interface.
>
> From the switchdev ops level, you don't see anything of this
> chain. But some of the operations do need to be aware of this chain,
> for example vlans which span multiple chips in this chain.
>
>> With switchdev device class, you'd instantiate one per
>> phy switch, and have per-switch props (temp, eeprom, etc) thru each
>> switchdev instance.
>
> O.K. This is fine, but we need people to understand that a switchdev
> device class represents some middle layer in the hierarchy, not the
> top layer. Otherwise false assumptions might be made.

So with kobj, a device can have a parent.  So I experimented with my
RFC patch and changed register_switchdev to take a parent switchdev
arg, which is NULL for leaf switchdevs:

int register_switchdev(struct switchdev *sdev, const char *name,
                       struct switchdev *parent)
{
        struct device *dev = &sdev->dev;
        int err;

        device_initialize(dev);

        dev->class = &switchdev_class;
        if (parent)
                dev->parent = &parent->dev;

        err = dev_set_name(dev, "%s", name);
        if (err)
                return err;

        return device_add(dev);
}

Then I tried this with rocker and it works as expected.  On module
load, I create the master switchdev, and then on PCI probe for each
phys switch dev, I put the slave switchdev in the master using
register_switchdev.  Here's one slave in the master "rockers" switch:

tree /sys/class/switchdev/rockers
/sys/class/switchdev/rockers
├── 5254001235010000
│   ├── device -> ../../rocker
│   ├── foo
│   ├── power
│   │   ├── async
│   │   ├── autosuspend_delay_ms
│   │   ├── control
│   │   ├── runtime_active_kids
│   │   ├── runtime_active_time
│   │   ├── runtime_enabled
│   │   ├── runtime_status
│   │   ├── runtime_suspended_time
│   │   └── runtime_usage
│   ├── subsystem -> ../../../../../class/switchdev
│   └── uevent
├── foo
├── power
│   ├── async
│   ├── autosuspend_delay_ms
│   ├── control
│   ├── runtime_active_kids
│   ├── runtime_active_time
│   ├── runtime_enabled
│   ├── runtime_status
│   ├── runtime_suspended_time
│   └── runtime_usage
├── subsystem -> ../../../../class/switchdev
└── uevent

With this, we can stack switchdevs, I guess as high as we want.  Does
this look usable for DSA?   An attr set on the master would get pushed
down to the leaves.  We'd can do it with the same style of recursive
algos we use for switchdev port attrs.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ