Page MenuHomeFreeBSD

iflib: Set the get counter routine prior to attaching the interface
ClosedPublic

Authored by zlei on Jun 6 2025, 10:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 19, 6:43 AM
Unknown Object (File)
Fri, Sep 19, 5:00 AM
Unknown Object (File)
Sep 13 2025, 3:40 AM
Unknown Object (File)
Sep 12 2025, 6:18 PM
Unknown Object (File)
Sep 7 2025, 7:28 AM
Unknown Object (File)
Sep 5 2025, 5:04 PM
Unknown Object (File)
Sep 2 2025, 11:58 AM
Unknown Object (File)
Sep 2 2025, 5:58 AM

Details

Summary

This ensures other threads see the correct counter routine once the interface has been attached.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

zlei requested review of this revision.Jun 6 2025, 10:14 AM
zlei added inline comments.
sys/net/iflib.c
5363

This was changed in 23ac9029f96b2 , but without a clue why that is required.

@zlei do you know if all the consumer ifdi_get_counter implementations will still have been initialized correctly, for instance not making invalid references? It seems fine as long as there are no implicit initialization issues that relied on the current behavior.

@zlei do you know if all the consumer ifdi_get_counter implementations will still have been initialized correctly, for instance not making invalid references? It seems fine as long as there are no implicit initialization issues that relied on the current behavior.

The ifdi_get_counter will only be invoked after the interface been attached. At that point the ifdi_get_counter implementations should see already initialized softc and ifnet. So I believe there is no initialization issues right now.

This revision is now accepted and ready to land.Aug 27 2025, 3:52 AM

PS: This fix is part of my overhauling of the interface attaching / detaching process. But I think I can be a standalone fixed.