Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F169428109
D19639.id55275.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D19639.id55275.diff
View Options
Index: head/tests/sys/netmap/ctrl-api-test.c
===================================================================
--- head/tests/sys/netmap/ctrl-api-test.c
+++ head/tests/sys/netmap/ctrl-api-test.c
@@ -146,12 +146,12 @@
uint32_t nr_hdr_len; /* for PORT_HDR_SET and PORT_HDR_GET */
uint32_t nr_first_cpu_id; /* vale polling */
uint32_t nr_num_polling_cpus; /* vale polling */
+ uint32_t sync_kloop_mode; /* sync-kloop */
int fd; /* netmap file descriptor */
void *csb; /* CSB entries (atok and ktoa) */
struct nmreq_option *nr_opt; /* list of options */
sem_t *sem; /* for thread synchronization */
- struct nmport_d *nmport; /* nmport descriptor from libnetmap */
};
static struct TestContext ctx_;
@@ -352,8 +352,11 @@
/* The 11 ABI is the one right before the introduction of the new NIOCCTRL
* ABI. The 11 ABI is useful to perform tests with legacy applications
- * (which use the 11 ABI) and new kernel (which uses 12, or higher). */
-#define NETMAP_API_NIOCREGIF 11
+ * (which use the 11 ABI) and new kernel (which uses 12, or higher).
+ * However, version 14 introduced a change in the layout of struct netmap_if,
+ * so that binary backward compatibility to 11 is not supported anymore.
+ */
+#define NETMAP_API_NIOCREGIF 14
static int
legacy_regif_default(struct TestContext *ctx)
@@ -1113,7 +1116,7 @@
pools_info_fill(&pools_info);
/* Request a large ring size, to make sure that the kernel
* rejects our request. */
- pools_info.nr_ring_pool_objsize = (1 << 16);
+ pools_info.nr_ring_pool_objsize = (1 << 20);
return _extmem_option(ctx, &pools_info) < 0 ? 0 : -1;
}
@@ -1140,6 +1143,10 @@
save1 = e1;
save2 = e2;
+ strncpy(ctx->ifname_ext, "vale0:0", sizeof(ctx->ifname_ext));
+ ctx->nr_tx_slots = 16;
+ ctx->nr_rx_slots = 16;
+
ret = port_register_hwall(ctx);
if (ret >= 0) {
printf("duplicate option not detected\n");
@@ -1322,51 +1329,58 @@
static int
sync_kloop_eventfds(struct TestContext *ctx)
{
- struct nmreq_opt_sync_kloop_eventfds *opt = NULL;
- struct nmreq_option save;
+ struct nmreq_opt_sync_kloop_eventfds *evopt = NULL;
+ struct nmreq_opt_sync_kloop_mode modeopt;
+ struct nmreq_option evsave;
int num_entries;
size_t opt_size;
int ret, i;
+ memset(&modeopt, 0, sizeof(modeopt));
+ modeopt.nro_opt.nro_reqtype = NETMAP_REQ_OPT_SYNC_KLOOP_MODE;
+ modeopt.mode = ctx->sync_kloop_mode;
+ push_option(&modeopt.nro_opt, ctx);
+
num_entries = num_registered_rings(ctx);
- opt_size = sizeof(*opt) + num_entries * sizeof(opt->eventfds[0]);
- opt = calloc(1, opt_size);
- opt->nro_opt.nro_next = 0;
- opt->nro_opt.nro_reqtype = NETMAP_REQ_OPT_SYNC_KLOOP_EVENTFDS;
- opt->nro_opt.nro_status = 0;
- opt->nro_opt.nro_size = opt_size;
+ opt_size = sizeof(*evopt) + num_entries * sizeof(evopt->eventfds[0]);
+ evopt = calloc(1, opt_size);
+ evopt->nro_opt.nro_next = 0;
+ evopt->nro_opt.nro_reqtype = NETMAP_REQ_OPT_SYNC_KLOOP_EVENTFDS;
+ evopt->nro_opt.nro_status = 0;
+ evopt->nro_opt.nro_size = opt_size;
for (i = 0; i < num_entries; i++) {
int efd = eventfd(0, 0);
- opt->eventfds[i].ioeventfd = efd;
+ evopt->eventfds[i].ioeventfd = efd;
efd = eventfd(0, 0);
- opt->eventfds[i].irqfd = efd;
+ evopt->eventfds[i].irqfd = efd;
}
- push_option(&opt->nro_opt, ctx);
- save = opt->nro_opt;
+ push_option(&evopt->nro_opt, ctx);
+ evsave = evopt->nro_opt;
ret = sync_kloop_start_stop(ctx);
if (ret != 0) {
- free(opt);
+ free(evopt);
clear_options(ctx);
return ret;
}
#ifdef __linux__
- save.nro_status = 0;
+ evsave.nro_status = 0;
#else /* !__linux__ */
- save.nro_status = EOPNOTSUPP;
+ evsave.nro_status = EOPNOTSUPP;
#endif /* !__linux__ */
- ret = checkoption(&opt->nro_opt, &save);
- free(opt);
+ ret = checkoption(&evopt->nro_opt, &evsave);
+ free(evopt);
clear_options(ctx);
return ret;
}
static int
-sync_kloop_eventfds_all(struct TestContext *ctx)
+sync_kloop_eventfds_all_mode(struct TestContext *ctx,
+ uint32_t sync_kloop_mode)
{
int ret;
@@ -1375,10 +1389,18 @@
return ret;
}
+ ctx->sync_kloop_mode = sync_kloop_mode;
+
return sync_kloop_eventfds(ctx);
}
static int
+sync_kloop_eventfds_all(struct TestContext *ctx)
+{
+ return sync_kloop_eventfds_all_mode(ctx, 0);
+}
+
+static int
sync_kloop_eventfds_all_tx(struct TestContext *ctx)
{
struct nmreq_opt_csb opt;
@@ -1399,6 +1421,27 @@
}
static int
+sync_kloop_eventfds_all_direct(struct TestContext *ctx)
+{
+ return sync_kloop_eventfds_all_mode(ctx,
+ NM_OPT_SYNC_KLOOP_DIRECT_TX | NM_OPT_SYNC_KLOOP_DIRECT_RX);
+}
+
+static int
+sync_kloop_eventfds_all_direct_tx(struct TestContext *ctx)
+{
+ return sync_kloop_eventfds_all_mode(ctx,
+ NM_OPT_SYNC_KLOOP_DIRECT_TX);
+}
+
+static int
+sync_kloop_eventfds_all_direct_rx(struct TestContext *ctx)
+{
+ return sync_kloop_eventfds_all_mode(ctx,
+ NM_OPT_SYNC_KLOOP_DIRECT_RX);
+}
+
+static int
sync_kloop_nocsb(struct TestContext *ctx)
{
int ret;
@@ -1677,6 +1720,9 @@
decltest(sync_kloop),
decltest(sync_kloop_eventfds_all),
decltest(sync_kloop_eventfds_all_tx),
+ decltest(sync_kloop_eventfds_all_direct),
+ decltest(sync_kloop_eventfds_all_direct_tx),
+ decltest(sync_kloop_eventfds_all_direct_rx),
decltest(sync_kloop_nocsb),
decltest(sync_kloop_csb_enable),
decltest(sync_kloop_conflict),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 2, 12:46 PM (14 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37886970
Default Alt Text
D19639.id55275.diff (5 KB)
Attached To
Mode
D19639: netmap: update unit tests
Attached
Detach File
Event Timeline
Log In to Comment