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: <YYhWmUd5FdTYwPvn@Ansuel-xps.localdomain>
Date:   Sun, 7 Nov 2021 23:43:37 +0100
From:   Ansuel Smith <ansuelsmth@...il.com>
To:     Marek BehĂșn <kabel@...nel.org>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Jonathan Corbet <corbet@....net>, Pavel Machek <pavel@....cz>,
        John Crispin <john@...ozen.org>, netdev@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-doc@...r.kernel.org, linux-leds@...r.kernel.org
Subject: Re: [RFC PATCH 4/6] leds: trigger: add offload-phy-activity trigger

On Sun, Nov 07, 2021 at 11:10:09PM +0100, Marek BehĂșn wrote:
> On Sun,  7 Nov 2021 18:57:16 +0100
> Ansuel Smith <ansuelsmth@...il.com> wrote:
> 
> > Add Offload Trigger for PHY Activity. This special trigger is used to
> > configure and expose the different HW trigger that are provided by the
> > PHY. Each offload trigger can be configured by sysfs and on trigger
> > activation the offload mode is enabled.
> > 
> > This currently implement these hw triggers:
> >   - blink_tx: Blink LED on tx packet receive
> >   - blink_rx: Blink LED on rx packet receive
> >   - blink_collision: Blink LED on collision detection
> >   - link_10m: Keep LED on with 10m link speed
> >   - link_100m: Keep LED on with 100m link speed
> >   - link_1000m: Keep LED on with 1000m link speed
> >   - half_duplex: Keep LED on with half duplex link
> >   - full_duplex: Keep LED on with full duplex link
> >   - linkup_over: Keep LED on with link speed and blink on rx/tx traffic
> >   - power_on_reset: Keep LED on with switch reset
> >   - blink_2hz: Set blink speed at 2hz for every blink event
> >   - blink_4hz: Set blink speed at 4hz for every blink event
> >   - blink_8hz: Set blink speed at 8hz for every blink event
> >   - blink_auto: Set blink speed at 2hz for 10m link speed,
> >       4hz for 100m and 8hz for 1000m
> > 
> > The trigger will read the supported offload trigger in the led cdev and
> > will expose the offload triggers in sysfs and then activate the offload
> > mode for the led in offload mode has it configured by default. A flag is
> > passed to configure_offload with the related rule from this trigger to
> > active or disable.
> > It's in the led driver interest the detection and knowing how to
> > elaborate the passed flags.
> > 
> > The different hw triggers are exposed in the led sysfs dir under the
> > offload-phy-activity subdir.
> 
> NAK. The current plan is to use netdev trigger, and if it can
> transparently offload the settings to HW, it will.
> 
> Yes, netdev trigger currently does not support all these settings.
> But it supports indicating link and blinking on activity.
> 
> So the plan is to start with offloading the blinking on activity, i.e.
> I the user does
>   $ cd /sys/class/leds/<LED>
>   $ echo netdev >trigger
>   $ echo 1 >rx
>   $ echo eth0 >device_name
> 
> this would, instead of doing blinking in software, do it in HW instead.
> 
> After this is implemented, we can start working on extending netdev
> trigger to support more complicated features.
> 
> Marek

Using the netdev trigger would cause some problem. Most of the switch
can run in SW mode (with blink controlled by software of always on) or
be put in HW mode and they will autonomously control blinking and how
the LED will operate. So we just need to provide a way to trigger this
mode and configure it. Why having something that gets triggered and then
does nothing as it's offloaded?

The current way to configure this is very similar... Set the offload
trigger and use the deidcated subdir to set how the led will
blink/behave based on the supported trigger reported by the driver.

There is no reason to set a device_name as that would be hardcoded to
the phy (and it should not change... again in HW we can't control that
part, we can just tell the switch to blink on packet tx on that port)

So really the command is:
  $ cd /sys/class/leds/<LED>
  $ echo netdev > offload-phy-activity
  $ cd offload-phy-activity
  $ echo 1 > tx-blink

And the PHY will blink on tx packet.

I understand this should be an extension of netdev as they would do
similar task but honestly polluting the netdev trigger of if and else to
disable part of it if an offload mode can be supported seems bad and
confusionary. At this point introduce a dedicated trigger so an user can
switch between them. That way we can keep the flexibility of netdev
trigger that will always work but also permit to support the HW mode
with no load on the system.

-- 
	Ansuel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ