Subject: Re: [PATCH v4 2/7] net: dsa: Add DSA driver for Hirschmann Hellcreek switches

From: Kurt Kanzenbach <[email-masked]>
Date: Tue, 01 Sep 2020 16:05:42 +0200

Hi Vladimir,

On Tue Sep 01 2020, Vladimir Oltean wrote:
> Hi Kurt,
>
> On Tue, Sep 01, 2020 at 02:50:09PM +0200, Kurt Kanzenbach wrote:
[snip]
>> +struct hellcreek {
>> +	const struct hellcreek_platform_data *pdata;
>> +	struct device *dev;
>> +	struct dsa_switch *ds;
>> +	struct hellcreek_port *ports;
>> +	struct mutex reg_lock;	/* Switch IP register lock */
>
> Pardon me asking, but I went back through the previous review comments
> and I didn't see this being asked.

It was asked multiple times, why there was a spinlock without interrupts
being registered (see e.g. [1], [2]). I've used the spinlock variant,
because the previously used hrtimers act like interrupts. As there are
no timers anymore, there's no need for spinlocks and mutexes can be
used.

Florian Fainelli also asked if the reg lock can be removed
completely. See below.

>
> What is the register lock protecting against, exactly?

A lot of the register operations work by:

 * Select port, priority, vlan or counter
 * Configure it

These sequences have to be atomic. That's what I wanted to ensure.

Thanks,
Kurt

[1] - https://lkml.kernel.org/netdev/[email-masked]/
[2] - https://lkml.kernel.org/netdev/20200624130318.GD7247@localhost/