Page MenuHomeFreeBSD

ifnet: add if_foreach_sleep() to allow ifnet iterations with sleep.
ClosedPublic

Authored by melifaro on Mar 4 2023, 10:10 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 16, 6:29 AM
Unknown Object (File)
Fri, Nov 15, 8:49 PM
Unknown Object (File)
Sun, Nov 10, 2:18 PM
Unknown Object (File)
Sun, Nov 10, 12:07 PM
Unknown Object (File)
Sun, Nov 10, 11:39 AM
Unknown Object (File)
Mon, Oct 21, 2:41 PM
Unknown Object (File)
Mon, Oct 21, 8:19 AM
Unknown Object (File)
Mon, Oct 21, 4:49 AM

Details

Summary

Some kernel customers exporting network interfaces may require sleep during the iteration. Netlink and linsysfs can be the examples.

This change adds the generic iteration interface, similar to if_foreach(), but allowing the callback to sleep.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 50142
Build 47034: arc lint + arc unit

Event Timeline

Update match function signature.

sys/net/if.c
4591

seems should be error = cb();

This revision was not accepted when it landed; it landed in state Needs Review.Mar 6 2023, 3:09 PM
This revision was automatically updated to reflect the committed changes.

As discussed in email, if_foreach_sleep() sounds like the loop itself inserts a delay. I suggest changing it to if_foreach_sleepable(), which more accurately conveys that it can sleep (or use callbacks that can sleep), not that that it does sleep.