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, May 11, 9:15 PM
Unknown Object (File)
Sat, May 11, 9:15 PM
Unknown Object (File)
Sat, May 11, 4:29 PM
Unknown Object (File)
Wed, May 8, 10:02 PM
Unknown Object (File)
Wed, May 8, 10:02 PM
Unknown Object (File)
Wed, May 8, 10:02 PM
Unknown Object (File)
Wed, May 8, 8:13 AM
Unknown Object (File)
Wed, May 8, 8:13 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 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.