Re: [PATCH v2 2/2] leds: trigger: netdev: add additional specific link duplex mode

From: Christian Marangi
Date: Sun Jun 11 2023 - 12:08:38 EST


On Sun, Jun 11, 2023 at 06:01:46PM +0200, Andrew Lunn wrote:
> > static ssize_t device_name_show(struct device *dev,
> > @@ -230,6 +241,7 @@ static int set_device_name(struct led_netdev_data *trigger_data,
> >
> > trigger_data->carrier_link_up = false;
> > trigger_data->link_speed = 0;
> > + trigger_data->duplex = 0;
>
> /* Duplex, half or full. */
> #define DUPLEX_HALF 0x00
> #define DUPLEX_FULL 0x01
> #define DUPLEX_UNKNOWN 0xff
>
> You probably want to initialise it to DUPLEX_UNKNOWN, not DUPLEX_HALF.
>
> There is also SPEED_UNKNOWN, which might be good to use, rather than
> 0.
>

Nice catch!

Fun this for SPEED_UNKNOWN. The value is -1 but the speed type is
unsigned (I used the same definition from ksettings)

So from what I can see ksettings report 0 (I assume) but other struct
(link_mode_info) use speed as int and correctly use SPEED_UNKNOWN.

So I guess for speed we should stick to 0?

--
Ansuel