mirror of
https://github.com/xdp-project/bpf-examples.git
synced 2024-05-06 15:54:53 +00:00
AF_XDP-interaction: rename --poll-mode to --wakeup-mode
It is confusing to name the option what will wait for packets on the file descriptor, for --poll, just because the function call have this name. It confusing as AF_XDP users often want to busy-poll for packets (for max performance reasons). Name the new option --wakeup instead of --wait as the effect of waiting for the FD is that the kernel needs to wakeup the userspace process. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
This commit is contained in:
@ -195,8 +195,8 @@ static const struct option_wrapper long_options[] = {
|
|||||||
{{"queue", required_argument, NULL, 'Q' },
|
{{"queue", required_argument, NULL, 'Q' },
|
||||||
"Configure interface receive queue for AF_XDP, default=0"},
|
"Configure interface receive queue for AF_XDP, default=0"},
|
||||||
|
|
||||||
{{"poll-mode", no_argument, NULL, 'p' },
|
{{"wakeup-mode", no_argument, NULL, 'w' },
|
||||||
"Use the poll() API waiting for packets to arrive"},
|
"Use poll() API waiting for packets to arrive via wakeup from kernel"},
|
||||||
|
|
||||||
{{"unload", no_argument, NULL, 'U' },
|
{{"unload", no_argument, NULL, 'U' },
|
||||||
"Unload XDP program instead of loading"},
|
"Unload XDP program instead of loading"},
|
||||||
@ -674,7 +674,8 @@ static void rx_and_process(struct config *cfg,
|
|||||||
fds[0].events = POLLIN;
|
fds[0].events = POLLIN;
|
||||||
|
|
||||||
while(!global_exit) {
|
while(!global_exit) {
|
||||||
if (cfg->xsk_poll_mode) {
|
if (cfg->xsk_wakeup_mode) {
|
||||||
|
/* poll will wait for events on file descriptors */
|
||||||
ret = poll(fds, nfds, -1);
|
ret = poll(fds, nfds, -1);
|
||||||
if (ret <= 0 || ret > 1)
|
if (ret <= 0 || ret > 1)
|
||||||
continue;
|
continue;
|
||||||
|
@ -22,7 +22,7 @@ struct config {
|
|||||||
char dest_mac[18];
|
char dest_mac[18];
|
||||||
__u16 xsk_bind_flags;
|
__u16 xsk_bind_flags;
|
||||||
int xsk_if_queue;
|
int xsk_if_queue;
|
||||||
bool xsk_poll_mode;
|
bool xsk_wakeup_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Defined in common_params.o */
|
/* Defined in common_params.o */
|
||||||
|
@ -154,8 +154,8 @@ void parse_cmdline_args(int argc, char **argv,
|
|||||||
case 'U':
|
case 'U':
|
||||||
cfg->do_unload = true;
|
cfg->do_unload = true;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'w':
|
||||||
cfg->xsk_poll_mode = true;
|
cfg->xsk_wakeup_mode = true;
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
verbose = false;
|
verbose = false;
|
||||||
|
Reference in New Issue
Block a user