Re: [PATCH net 1/2] net: dsa: b53: Fix calculating number of switch ports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 9/1/2021 2:21 AM, Rafał Miłecki wrote:
From: Rafał Miłecki <rafal@xxxxxxxxxx>

It isn't true that CPU port is always the last one. Switches BCM5301x
have 9 ports (port 6 being inactive) and they use port 5 as CPU by
default (depending on design some other may be CPU ports too).

A more reliable way of determining number of ports is to check for the
last set bit in the "enabled_ports" bitfield.

This fixes b53 internal state, it will allow providing accurate info to
the DSA and is required to fix BCM5301x support.

Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Rafał Miłecki <rafal@xxxxxxxxxx>

For a bug fix, this looks appropriate to me, and for net-next, we need to remove the dev->num_ports and b53_for_each_port() entirely as there is no need to duplicate what DSA already maintains for us. Thanks!

Reviewed-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
--
Florian



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux