Page MenuHomeFreeBSD

ethernet: Reduce a runtime ntohs() in fast path
Needs ReviewPublic

Authored by zlei on Oct 28 2023, 7:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Feb 15, 12:09 AM
Unknown Object (File)
Jan 11 2026, 12:43 AM
Unknown Object (File)
Jan 10 2026, 4:33 AM
Unknown Object (File)
Jan 9 2026, 7:15 PM
Unknown Object (File)
Jan 5 2026, 8:41 PM
Unknown Object (File)
Dec 30 2025, 8:23 AM
Unknown Object (File)
Dec 18 2025, 1:21 PM
Unknown Object (File)
Dec 11 2025, 5:13 AM

Details

Reviewers
None
Group Reviewers
network
Summary

For untagged traffic, we always hit the check for ether_type.

No functional change intended.

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

zlei requested review of this revision.Oct 28 2023, 7:13 PM
zlei added inline comments.
sys/net/if_ethersubr.c
633

An extra space to improve readability.

I’d rather avoid doing that. ntohs is fast and branchless, so I’d vote for optimizing for readability here (unless there is a measurable performance gain)

I’d rather avoid doing that.
ntohs is fast and branchless,

True indeed.

so I’d vote for optimizing for readability here (unless there is a measurable performance gain)

No measurable performance gain.

I’d rather avoid doing that. ntohs is fast and branchless, so I’d vote for optimizing for readability here (unless there is a measurable performance gain)

Agrreed.