Skip to content
Snippets Groups Projects
Commit 9bc4c6df authored by Jan Hák's avatar Jan Hák Committed by Daniel Salzman
Browse files

kxdpgun: option for setup network interface

parent 5abc4df5
No related branches found
No related tags found
No related merge requests found
......@@ -215,7 +215,7 @@ Key still published, but no longer used for signing.
Key no longer published, but still used for signing (only for algorithm rollover).
.TP
\fBrevoke\fP
Key revoked according to RFC 5011 trust anchor roll\-over.
Key revoked according to \fI\%RFC 5011\fP trust anchor roll\-over.
.TP
\fBremove\fP
Key deleted.
......
......@@ -72,6 +72,10 @@ CPU ID increment for next thread (default is 0s1).
\fB\-i\fP, \fB\-\-infile\fP \fIfilename\fP
Path to a file with query templates.
.TP
\fB\-I\fP, \fB\-\-interface\fP \fIinterface\fP
Network interface for outgoing communication. This can be useful in situations
when the interfaces are in a bond for example.
.TP
\fItargetIP\fP
The IPv4 or IPv6 address of remote destination.
.TP
......
......@@ -49,6 +49,10 @@ Options
**-i**, **--infile** *filename*
Path to a file with query templates.
**-I**, **--interface** *interface*
Network interface for outgoing communication. This can be useful in situations
when the interfaces are in a bond for example.
*targetIP*
The IPv4 or IPv6 address of remote destination.
......
......@@ -74,6 +74,7 @@ typedef struct {
} xdp_gun_ctx_t;
const static xdp_gun_ctx_t ctx_defaults = {
.dev[0] = '\0',
.qps = 1000,
.duration = 5000000UL, // usecs
.at_once = 10,
......@@ -491,7 +492,7 @@ static bool configure_target(char *target_str, xdp_gun_ctx_t *ctx)
printf("device names comming from `ip` and `arp` differ (%s != %s)\n",
dev1, dev2);
return false;
} else {
} else if (ctx->dev[0] == '\0') {
strlcpy(ctx->dev, dev1, IFNAMSIZ);
}
ret = dev2mac(ctx->dev, ctx->local_mac);
......@@ -514,28 +515,29 @@ static bool configure_target(char *target_str, xdp_gun_ctx_t *ctx)
static void print_help(void) {
printf("Usage: %s [-t duration] [-Q qps] [-b batch_size] [-r] [-p port] "
"[-F cpu_affinity] -i queries_file dest_ip\n", PROGRAM_NAME);
"[-F cpu_affinity] [-I interface] -i queries_file dest_ip\n", PROGRAM_NAME);
}
static bool get_opts(int argc, char *argv[], xdp_gun_ctx_t *ctx)
{
struct option opts[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "duration", required_argument, NULL, 't' },
{ "qps", required_argument, NULL, 'Q' },
{ "batch", required_argument, NULL, 'b' },
{ "drop", no_argument, NULL, 'r' },
{ "port", required_argument, NULL, 'p' },
{ "affinity", required_argument, NULL, 'F' },
{ "infile", required_argument, NULL, 'i' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "duration", required_argument, NULL, 't' },
{ "qps", required_argument, NULL, 'Q' },
{ "batch", required_argument, NULL, 'b' },
{ "drop", no_argument, NULL, 'r' },
{ "port", required_argument, NULL, 'p' },
{ "affinity", required_argument, NULL, 'F' },
{ "interface", required_argument, NULL, 'I' },
{ "infile", required_argument, NULL, 'i' },
{ NULL }
};
int opt = 0, arg;
double argf;
char *argcp;
while ((opt = getopt_long(argc, argv, "hVt:Q:b:rp:F:i:", opts, NULL)) != -1) {
while ((opt = getopt_long(argc, argv, "hVt:Q:b:rp:F:I:i:", opts, NULL)) != -1) {
switch (opt) {
case 'h':
print_help();
......@@ -581,12 +583,6 @@ static bool get_opts(int argc, char *argv[], xdp_gun_ctx_t *ctx)
return false;
}
break;
case 'i':
if (!load_queries(optarg)) {
printf("failed to load queries from file '%s'\n", optarg);
return false;
}
break;
case 'F':
if ((arg = atoi(optarg)) > 0) {
global_cpu_aff_start = arg;
......@@ -596,6 +592,15 @@ static bool get_opts(int argc, char *argv[], xdp_gun_ctx_t *ctx)
global_cpu_aff_step = arg;
}
break;
case 'I':
strlcpy(ctx->dev, optarg, IFNAMSIZ);
break;
case 'i':
if (!load_queries(optarg)) {
printf("failed to load queries from file '%s'\n", optarg);
return false;
}
break;
default:
return false;
}
......@@ -610,6 +615,7 @@ static bool get_opts(int argc, char *argv[], xdp_gun_ctx_t *ctx)
return false;
}
ctx->qps /= ctx->n_threads;
printf("using interface %s, XDP threads %d\n", ctx->dev, ctx->n_threads);
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment