Page MenuHomeFreeBSD

LinuxKPI: add net_ratelimit()
ClosedPublic

Authored by bz on Mar 23 2021, 5:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 12:43 AM
Unknown Object (File)
Feb 8 2024, 2:29 PM
Unknown Object (File)
Jan 30 2024, 3:10 AM
Unknown Object (File)
Jan 5 2024, 5:42 PM
Unknown Object (File)
Dec 25 2023, 5:08 PM
Unknown Object (File)
Dec 5 2023, 6:04 AM
Unknown Object (File)
Nov 29 2023, 8:49 PM
Unknown Object (File)
Nov 20 2023, 7:05 AM

Details

Summary

Add a net_ratelimit() compat implementation based on ppsratecheck().
Add a sysctl to allow tuning of the number of messages.

Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: ...
Differential Revision:

Diff Detail

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

Event Timeline

bz requested review of this revision.Mar 23 2021, 5:13 PM
hselasky added inline comments.
sys/compat/linuxkpi/common/include/linux/net.h
79

Please don't declare static variables in header files.
Make them global and possibly into SYSCTLs.

Migrate function and static variables into the implementation file
and add a SYSCTl to allow tuning the number of messages as suggested
by @hselasky.

bz marked an inline comment as done.
sys/compat/linuxkpi/common/src/linux_compat.c
105

Does Linux default to 99 for its equivalent, or is this just a convenient number?

bz marked an inline comment as done.Mar 24 2021, 7:19 PM
bz added inline comments.
sys/compat/linuxkpi/common/src/linux_compat.c
105

I cannot tell you what Linux defaults to as that would require me reading (likely) GPL code. It is a convenience number as I figure I can survive with 99 log messages / s on a serial console these days if worse comes to worse.

This revision is now accepted and ready to land.Mar 24 2021, 7:32 PM
sys/compat/linuxkpi/common/src/linux_compat.c
106

Use CTLFLAG_RWTUN .

sys/compat/linuxkpi/common/src/linux_compat.c
105

Ok - mainly was just curious, but either way it doesn't matter much, we can change the default based on feedback if it proves necessary.

bz marked an inline comment as done.Mar 24 2021, 9:31 PM
bz added inline comments.
sys/compat/linuxkpi/common/src/linux_compat.c
106

Is there a specific reason we need this to be a tunable so it's available before /etc/rc.d/sysctl runs?

bz marked an inline comment as done.Mar 26 2021, 12:16 PM
This revision was automatically updated to reflect the committed changes.