From 9a40de458b3884d9f526172110392501f075bd87 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 9 May 2014 15:46:38 +0200 Subject: ring: Merge common ring_{rx,tx} initialization into own function Instead of having to perform the individual steps to initialize a ring and open coding them in multiple places, provide convenience functions to do all at once. This has the nice side effect of allowing to make most of these *_{rx,tx}_ring() functions static in their respective module. Signed-off-by: Tobias Klauser --- trafgen.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'trafgen.c') diff --git a/trafgen.c b/trafgen.c index 419988e..307d596 100644 --- a/trafgen.c +++ b/trafgen.c @@ -592,25 +592,16 @@ static void xmit_fastpath_or_die(struct ctx *ctx, int cpu, unsigned long orig_nu uint8_t *out = NULL; unsigned int it = 0; unsigned long num = 1, i = 0; - size_t size; + size_t size = ring_size(ctx->device, ctx->reserve_size); struct ring tx_ring; struct frame_map *hdr; struct timeval start, end, diff; struct packet_dyn *pktd; unsigned long long tx_bytes = 0, tx_packets = 0; - fmemset(&tx_ring, 0, sizeof(tx_ring)); - - size = ring_size(ctx->device, ctx->reserve_size); - set_sock_prio(sock, 512); - set_packet_loss_discard(sock); - setup_tx_ring_layout(sock, &tx_ring, size, ctx->jumbo_support); - create_tx_ring(sock, &tx_ring, ctx->verbose); - mmap_tx_ring(sock, &tx_ring); - alloc_tx_ring_frames(sock, &tx_ring); - bind_tx_ring(sock, &tx_ring, ifindex); + ring_tx_setup(&tx_ring, sock, size, ifindex, ctx->jumbo_support, ctx->verbose); drop_privileges(ctx->enforce, ctx->uid, ctx->gid); -- cgit v1.2.3-54-g00ecf gi/linux/net-next.git/tree/?id=85dc600263c2291cea33bffa90038808ee64198b'>treecommitdiff
diff options
context:
space:
mode: