Skip to content

Commit

Permalink
xdp-trafficgen: Fix exiting after completion of packet send loop
Browse files Browse the repository at this point in the history
The runners_exited boolean no longer causes the event loop to exit, so
xdp-trafficgen will no longer exit if instructed to send a fixed number
of packets, after the porting to util/xdp_sample. Instead of setting the
boolean, have the packet sender thread send a SIGINT to itself after
exiting, which will cause the signal handler in xdp_sample to exit.

Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
  • Loading branch information
tohojo committed Jan 9, 2025
1 parent 4a73a24 commit 0b92f9b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions xdp-trafficgen/xdp-trafficgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ static int mask = SAMPLE_DEVMAP_XMIT_CNT_MULTI | SAMPLE_DROP_OK;
DEFINE_SAMPLE_INIT(xdp_trafficgen);

static bool status_exited = false;
static bool runners_exited = false;

struct udp_packet {
struct ethhdr eth;
Expand Down Expand Up @@ -132,7 +131,7 @@ static void *run_traffic(void *arg)
if (err)
pr_warn("Couldn't run trafficgen program: %s\n", strerror(-err));

runners_exited = true;
kill(getpid(), SIGINT);
return NULL;
}

Expand Down

0 comments on commit 0b92f9b

Please sign in to comment.