Discussion:
CVS commit: src/sys/dev/usb
(too old to reply)
matthew green
2019-06-24 03:30:09 UTC
Permalink
splnet is obsolete in modern USB network drivers.
all the code runs at softipl.
removing spl was done entirely on purpose.
I saw the comment of ether_ioctl in sys/net/if_ethersubr.c
Note, we must be called at splnet().
so I asked.
that comment is true for old style drivers, but looking at other
drivers they also only skip this for NET_MPSAFE kernel builds.

Nick, do we need to make these go back to non-mpsafe stuff for
networking if !NET_MPSAFE?

eg, look what wm(4) idoes with WM_MPSAFE usage. are we getting
ahead of ourselves in usb? :)


.mrg.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Manuel Bouyer
2019-06-24 08:26:24 UTC
Permalink
Post by matthew green
splnet is obsolete in modern USB network drivers.
all the code runs at softipl.
removing spl was done entirely on purpose.
I saw the comment of ether_ioctl in sys/net/if_ethersubr.c
Note, we must be called at splnet().
so I asked.
that comment is true for old style drivers, but looking at other
drivers they also only skip this for NET_MPSAFE kernel builds.
Nick, do we need to make these go back to non-mpsafe stuff for
networking if !NET_MPSAFE?
I'm really not sure.
splnet is to prevent IPL_NET interrupt handlers (common for most
drivers) from running. USB ethernet devices don't have these, however.
All handling of device to host communications is done via USB callbacks
which run at splsoftserial (aka splusb).
Actually, I think splnet() ( + KERNEL_LOCK) is used to protect the network
stack when NET_MPSAFE is not defined.

For example pppoe(4) uses it when NET_MPSAFE is not defined.
--
Manuel Bouyer <***@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
sc dying
2019-06-24 13:06:10 UTC
Permalink
Only KERNEL_LOCK (and some splsoftnet) is required for the network stack
now. Remaining splnets are for network drivers. (softnet_lock is also required
in some cases but it's another story...)
great! i studied the code and i couldn't find any issues
in any of the relevant paths, so i'm glad to hear it's
supposed to be like this.
- * Common ioctls for Ethernet interfaces. Note, we must be
- * called at splnet().
+ * Common ioctls for Ethernet interfaces.
+ *
+ * Non IFEF_MPSAFE drivers must call this function at at least called
+ * at splsoftnet().
or should they also be with kernel lock?
Yes.
Also I think splnet is still needed for ether_ioctl for sure because
it has to care not only the network stack but also network drivers.
ozaki-r
Thank you all for detailed explanations.

I hope the source would be -DNET_MPSAFE by default.

Thanks,

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...