netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* question lan9303: DSA concurrency and locking,
@ 2017-11-15 12:08 Egil Hjelmeland
  2017-11-15 14:08 ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Egil Hjelmeland @ 2017-11-15 12:08 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli; +Cc: netdev

Hi experts

I am hoping for some guidance.

Does DSA offer any protection against concurrent calls of dsa_switch_ops?

I did not include any locking in the code I contributed to lan9303. 
First I felt bad locking is worse than no locking. Second I assumed that 
reviewers would point out if locking is needed.

The most "interesting" part of the lan9303 driver that has no locking is 
the ALR (=fdb/mdb). ALR access is a sequence of register operations. 
Anyway it is very unlikely that mdb related calls are reentered. But if 
it can happen, it would mean that IGMP snooping can go wrong. (Which is 
actually very bad in our applications.)

Is this something to worry about?

If yes, what is the best strategy to deal with it?

Looking in drivers/net/dsa/lan9303-core.c :

lan9303_indirect_phy_read/lan9303_indirect_phy_write + 
lan9303_write_switch_reg/lan9303_read_switch_reg are already protected 
by chip->indirect_mutex

ALR access uses lan9303_write_switch_reg/lan9303_read_switch_reg.

Adding a chip->alr_mutex on top of chip->indirect_mutex does not feel 
right to me. Would it be better to move the locking up to the relevant 
dsa_switch_ops functions?

Thanks

Egil Hjelmeland

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-16 10:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-15 12:08 question lan9303: DSA concurrency and locking, Egil Hjelmeland
2017-11-15 14:08 ` Andrew Lunn
2017-11-15 16:56   ` Vivien Didelot
2017-11-16 10:51   ` Egil Hjelmeland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).