Re: [PATCH RFC net-next 07/10] net: dsa: mv88e6xxx: Track bridge mdb objects

From: Joseph Huang
Date: Thu Apr 04 2024 - 16:43:55 EST


Hi Vladimir,

On 4/2/2024 8:23 AM, Vladimir Oltean wrote:
Can you comment on the feasibility/infeasibility of Tobias' proposal of:
"The bridge could just provide some MDB iterator to save us from having
to cache all the configured groups."?
https://lore.kernel.org/netdev/87sg31n04a.fsf@xxxxxxxxxxxxxx/

What is done here will have to be scaled to many drivers - potentially
all existing DSA ones, as far as I'm aware.


I thought about implementing an MDB iterator as suggested by Tobias, but I'm a bit concerned about the coherence of these MDB objects. In theory, when the device driver is trying to act on an event, the source of the trigger may have changed its state in the bridge already. If, upon receiving an event in the device driver, we iterate over what the bridge has at that instant, the differences between the worlds as seen by the bridge and the device driver might lead to some unexpected results. However, if we cache the MDB objects in the device driver, at least the order in which the events took place will be coherent and at any give time the state of the MDB objects in the device driver can be guaranteed to be sane. This is also the approach the prestera device driver took.

Thanks,
Joseph