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)
Mon, May 12, 12:38 PM
Unknown Object (File)
Sun, May 11, 12:40 PM
Unknown Object (File)
Sat, May 10, 5:11 AM
Unknown Object (File)
Thu, May 8, 5:16 PM
Unknown Object (File)
Tue, Apr 29, 2:24 PM
Unknown Object (File)
Thu, Apr 24, 9:09 AM
Unknown Object (File)
Sun, Apr 20, 3:23 PM
Unknown Object (File)
Sat, Apr 19, 9:13 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.