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
F160384421: D42389.id.diff
Tue, Jun 23, 11:35 PM
Unknown Object (File)
Tue, Jun 23, 5:58 AM
Unknown Object (File)
Tue, Jun 23, 2:06 AM
Unknown Object (File)
Mon, Jun 22, 5:22 PM
Unknown Object (File)
Fri, Jun 19, 6:16 AM
Unknown Object (File)
Mon, Jun 8, 3:46 AM
Unknown Object (File)
May 14 2026, 2:58 PM
Unknown Object (File)
May 13 2026, 11:17 PM

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.