-
Notifications
You must be signed in to change notification settings - Fork 405
net: prefbusy poll mode #8443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
net: prefbusy poll mode #8443
Changes from all commits
1ade0c9
233c128
f2d9207
842c9f9
6df64dc
58ccca6
f56b6c5
189e6ad
fed91e1
c48a572
11fc180
ef97612
a7fd0a7
d5c0a99
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -983,6 +983,52 @@ dynamic_port_range = "8900-9000" | |||||
| # "operation not supported". | ||||||
| xdp_zero_copy = false | ||||||
|
|
||||||
| # This option moves the management of napi including | ||||||
| # when to poll as well as the poll budget, into userspace | ||||||
| # if in "prefbusy" mode. The fallback is "softirq" mode, | ||||||
| # which relies significantly more on linux to manage napi, through | ||||||
| # wakeups, softirqs and under higher network load, a seperate | ||||||
| # ksoftirqd thread which linux creates and manages. | ||||||
| # | ||||||
| # Please note that even in SKB mode or copy mode, "prefbusy" | ||||||
| # poll mode should work and be effective. | ||||||
| # | ||||||
| # "prefbusy" mode is the recommended choice of mode, | ||||||
| # as this will also automatically fallback to "softirq" | ||||||
| # mode if preferred busy polling is not available or | ||||||
| # the right choice for whatever reason (e.g. on an older | ||||||
| # kernel). A warning will be emitted if this fallback is made. | ||||||
| # | ||||||
| # On Intel's 100Gbps NIC ice driver it is reccommended to use | ||||||
| # "softirq" mode due to it not being able to support "prefbusy" | ||||||
| # mode, however on Mellanox's mlx5 it's well supported. | ||||||
| poll_mode = "softirq" | ||||||
|
|
||||||
| # AF_XDP socket configuration options which will eventually | ||||||
| # be moved to being fixed constants prior to the merge of | ||||||
| # prefbusy-poll-mode into main. | ||||||
| busy_poll_usecs = 100 | ||||||
| gro_flush_timeout_nanos = 5000000 | ||||||
|
|
||||||
| # This is the minimum time between napi polls if in prefbusy | ||||||
| # mode. This is important for protecting against a livelock | ||||||
| # scenario inwhich Firedancer is not given enough time in | ||||||
|
||||||
| # scenario inwhich Firedancer is not given enough time in | |
| # scenario in which Firedancer is not given enough time in |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1065,6 +1065,52 @@ telemetry = true | |||||||||
| # "operation not supported". | ||||||||||
| xdp_zero_copy = false | ||||||||||
|
|
||||||||||
| # This option moves the management of napi including | ||||||||||
| # when to poll as well as the poll budget, into userspace | ||||||||||
| # if in "prefbusy" mode. The fallback is "softirq" mode, | ||||||||||
| # which relies significantly more on linux to manage napi, through | ||||||||||
| # wakeups, softirqs and under higher network load, a seperate | ||||||||||
|
||||||||||
| # wakeups, softirqs and under higher network load, a seperate | |
| # wakeups, softirqs and under higher network load, a separate |
Copilot
AI
Feb 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'seperate' to 'separate'.
| # wakeups, softirqs and under higher network load, a seperate | |
| # wakeups, softirqs and under higher network load, a separate |
Copilot
AI
Feb 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "inwhich" should be "in which" (two words).
| # scenario inwhich Firedancer is not given enough time in | |
| # scenario in which Firedancer is not given enough time in |
Copilot
AI
Feb 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spacing: 'inwhich' should be 'in which'.
| # scenario inwhich Firedancer is not given enough time in | |
| # scenario in which Firedancer is not given enough time in |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,83 @@ | ||||||||||
| /* This stage configures the OS to support effective preferred busy | ||||||||||
| polling, allowing for significantly improved network stack (XDP) | ||||||||||
| performance if enabled. */ | ||||||||||
|
|
||||||||||
| #include "configure.h" | ||||||||||
|
|
||||||||||
| #define NAME "sysfs-poll" | ||||||||||
|
|
||||||||||
| #include "../../../platform/fd_file_util.h" | ||||||||||
|
|
||||||||||
| #include <errno.h> | ||||||||||
| #include <stdio.h> | ||||||||||
| #include <unistd.h> /* access */ | ||||||||||
| #include <linux/capability.h> | ||||||||||
|
|
||||||||||
| #define VERY_HIGH_VAL 1000000U | ||||||||||
|
|
||||||||||
| static char const setting_napi_defer_hard_irqs[] = "napi_defer_hard_irqs"; | ||||||||||
|
|
||||||||||
| static char const setting_gro_flush_timeout[] = "gro_flush_timeout"; | ||||||||||
|
|
||||||||||
| static int | ||||||||||
| enabled( config_t const * config ) { | ||||||||||
|
||||||||||
| enabled( config_t const * config ) { | |
| enabled( config_t const * config ) { | |
| if( !config->net.xdp.poll_mode ) | |
| return 0; |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -205,6 +205,12 @@ struct fd_config_net { | |||
| struct { | ||||
| char xdp_mode[ 8 ]; | ||||
| int xdp_zero_copy; | ||||
|
|
||||
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -184,6 +184,11 @@ fd_config_extract_pod( uchar * pod, | |
| CFG_POP ( uint, net.ingress_buffer_size ); | ||
| CFG_POP ( cstr, net.xdp.xdp_mode ); | ||
| CFG_POP ( bool, net.xdp.xdp_zero_copy ); | ||
| CFG_POP ( cstr, net.xdp.poll_mode ); | ||
| CFG_POP ( uint, net.xdp.busy_poll_usecs ); | ||
| CFG_POP ( ulong, net.xdp.gro_flush_timeout_nanos ); | ||
| CFG_POP ( uint, net.xdp.lwr_prefbusy_poll_timeout_micros ); | ||
| CFG_POP ( uint, net.xdp.upr_prefbusy_poll_timeout_micros ); | ||
|
Comment on lines
+187
to
+191
|
||
| CFG_POP ( uint, net.xdp.xdp_rx_queue_size ); | ||
| CFG_POP ( uint, net.xdp.xdp_tx_queue_size ); | ||
| CFG_POP ( uint, net.xdp.flush_timeout_micros ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -44,6 +44,14 @@ setup_xdp_tile( fd_topo_t * topo, | |||||||||||
| tile->xdp.zero_copy = net_cfg->xdp.xdp_zero_copy; | ||||||||||||
| fd_cstr_ncpy( tile->xdp.xdp_mode, net_cfg->xdp.xdp_mode, sizeof(tile->xdp.xdp_mode) ); | ||||||||||||
|
|
||||||||||||
| fd_cstr_ncpy( tile->xdp.poll_mode, net_cfg->xdp.poll_mode, sizeof(tile->xdp.poll_mode) ); | ||||||||||||
|
|
||||||||||||
| tile->xdp.busy_poll_usecs = net_cfg->xdp.busy_poll_usecs; | ||||||||||||
| tile->xdp.gro_flush_timeout_nanos = net_cfg->xdp.gro_flush_timeout_nanos; | ||||||||||||
|
|
||||||||||||
| tile->xdp.lwr_prefbusy_poll_timeout_ns = (long)net_cfg->xdp.lwr_prefbusy_poll_timeout_micros * 1000L; | ||||||||||||
| tile->xdp.upr_prefbusy_poll_timeout_ns = (long)net_cfg->xdp.upr_prefbusy_poll_timeout_micros * 1000L; | ||||||||||||
|
||||||||||||
| tile->xdp.upr_prefbusy_poll_timeout_ns = (long)net_cfg->xdp.upr_prefbusy_poll_timeout_micros * 1000L; | |
| tile->xdp.upr_prefbusy_poll_timeout_ns = (long)net_cfg->xdp.upr_prefbusy_poll_timeout_micros * 1000L; | |
| if( tile->xdp.lwr_prefbusy_poll_timeout_ns >= tile->xdp.upr_prefbusy_poll_timeout_ns ) { | |
| tile->xdp.upr_prefbusy_poll_timeout_ns = tile->xdp.lwr_prefbusy_poll_timeout_ns + 1000L; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "seperate" should be "separate".