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
F169139473: D38904.id.diff
Mon, Aug 31, 1:45 PM
F169121860: D38904.id118318.diff
Mon, Aug 31, 11:49 AM
F169107971: D38904.diff
Mon, Aug 31, 10:45 AM
Unknown Object (File)
Sun, Aug 30, 3:23 AM
Unknown Object (File)
Sun, Aug 30, 1:58 AM
Unknown Object (File)
Sat, Aug 29, 4:18 AM
Unknown Object (File)
Thu, Aug 27, 10:33 PM
Unknown Object (File)
Thu, Aug 27, 10:21 PM

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 Not Applicable
Unit
Tests Not Applicable

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.