From owner-svn-src-stable@freebsd.org Sun Jun 2 18:46:28 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FF4115BCF83; Sun, 2 Jun 2019 18:46:28 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 38986747B8; Sun, 2 Jun 2019 18:46:27 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22D1A2AE2B; Sun, 2 Jun 2019 18:46:22 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x52IkMnt015066; Sun, 2 Jun 2019 18:46:22 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x52IkM19015065; Sun, 2 Jun 2019 18:46:22 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201906021846.x52IkM19015065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sun, 2 Jun 2019 18:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348516 - stable/12/tests/sys/netmap X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/tests/sys/netmap X-SVN-Commit-Revision: 348516 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 38986747B8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jun 2019 18:46:28 -0000 Author: vmaffione Date: Sun Jun 2 18:46:21 2019 New Revision: 348516 URL: https://svnweb.freebsd.org/changeset/base/348516 Log: MFC r346184 netmap: add test cases for multiple host rings Extend the netmap unit tests with new test cases for the multiple-host-rings feature introduced by r345269. Modified: stable/12/tests/sys/netmap/ctrl-api-test.c Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/netmap/ctrl-api-test.c ============================================================================== --- stable/12/tests/sys/netmap/ctrl-api-test.c Sun Jun 2 16:44:50 2019 (r348515) +++ stable/12/tests/sys/netmap/ctrl-api-test.c Sun Jun 2 18:46:21 2019 (r348516) @@ -50,20 +50,16 @@ #ifdef __FreeBSD__ #include "freebsd_test_suite/macros.h" -#endif - -#ifdef __linux__ -#include -#else - static int eventfd(int x __unused, int y __unused) { errno = ENODEV; return -1; } -#endif /* __linux__ */ +#else /* __linux__ */ +#include +#endif static int exec_command(int argc, const char *const argv[]) @@ -144,6 +140,8 @@ struct TestContext { uint32_t nr_rx_slots; /* slots in rx rings */ uint16_t nr_tx_rings; /* number of tx rings */ uint16_t nr_rx_rings; /* number of rx rings */ + uint16_t nr_host_tx_rings; /* number of host tx rings */ + uint16_t nr_host_rx_rings; /* number of host rx rings */ uint16_t nr_mem_id; /* id of the memory allocator */ uint16_t nr_ringid; /* ring(s) we care about */ uint32_t nr_mode; /* specify NR_REG_* modes */ @@ -242,6 +240,8 @@ port_register(struct TestContext *ctx) req.nr_tx_slots = ctx->nr_tx_slots; req.nr_rx_slots = ctx->nr_rx_slots; req.nr_tx_rings = ctx->nr_tx_rings; + req.nr_host_tx_rings = ctx->nr_host_tx_rings; + req.nr_host_rx_rings = ctx->nr_host_rx_rings; req.nr_rx_rings = ctx->nr_rx_rings; req.nr_extra_bufs = ctx->nr_extra_bufs; ret = ioctl(ctx->fd, NIOCCTRL, &hdr); @@ -255,23 +255,29 @@ port_register(struct TestContext *ctx) printf("nr_rx_slots %u\n", req.nr_rx_slots); printf("nr_tx_rings %u\n", req.nr_tx_rings); printf("nr_rx_rings %u\n", req.nr_rx_rings); + printf("nr_host_tx_rings %u\n", req.nr_host_tx_rings); + printf("nr_host_rx_rings %u\n", req.nr_host_rx_rings); printf("nr_mem_id %u\n", req.nr_mem_id); printf("nr_extra_bufs %u\n", req.nr_extra_bufs); success = req.nr_memsize && (ctx->nr_mode == req.nr_mode) && - (ctx->nr_ringid == req.nr_ringid) && - (ctx->nr_flags == req.nr_flags) && - ((!ctx->nr_tx_slots && req.nr_tx_slots) || - (ctx->nr_tx_slots == req.nr_tx_slots)) && - ((!ctx->nr_rx_slots && req.nr_rx_slots) || - (ctx->nr_rx_slots == req.nr_rx_slots)) && - ((!ctx->nr_tx_rings && req.nr_tx_rings) || - (ctx->nr_tx_rings == req.nr_tx_rings)) && - ((!ctx->nr_rx_rings && req.nr_rx_rings) || - (ctx->nr_rx_rings == req.nr_rx_rings)) && - ((!ctx->nr_mem_id && req.nr_mem_id) || - (ctx->nr_mem_id == req.nr_mem_id)) && - (ctx->nr_extra_bufs == req.nr_extra_bufs); + (ctx->nr_ringid == req.nr_ringid) && + (ctx->nr_flags == req.nr_flags) && + ((!ctx->nr_tx_slots && req.nr_tx_slots) || + (ctx->nr_tx_slots == req.nr_tx_slots)) && + ((!ctx->nr_rx_slots && req.nr_rx_slots) || + (ctx->nr_rx_slots == req.nr_rx_slots)) && + ((!ctx->nr_tx_rings && req.nr_tx_rings) || + (ctx->nr_tx_rings == req.nr_tx_rings)) && + ((!ctx->nr_rx_rings && req.nr_rx_rings) || + (ctx->nr_rx_rings == req.nr_rx_rings)) && + ((!ctx->nr_host_tx_rings && req.nr_host_tx_rings) || + (ctx->nr_host_tx_rings == req.nr_host_tx_rings)) && + ((!ctx->nr_host_rx_rings && req.nr_host_rx_rings) || + (ctx->nr_host_rx_rings == req.nr_host_rx_rings)) && + ((!ctx->nr_mem_id && req.nr_mem_id) || + (ctx->nr_mem_id == req.nr_mem_id)) && + (ctx->nr_extra_bufs == req.nr_extra_bufs); if (!success) { return -1; } @@ -281,6 +287,8 @@ port_register(struct TestContext *ctx) ctx->nr_rx_slots = req.nr_rx_slots; ctx->nr_tx_rings = req.nr_tx_rings; ctx->nr_rx_rings = req.nr_rx_rings; + ctx->nr_host_tx_rings = req.nr_host_tx_rings; + ctx->nr_host_rx_rings = req.nr_host_rx_rings; ctx->nr_mem_id = req.nr_mem_id; ctx->nr_extra_bufs = req.nr_extra_bufs; @@ -448,7 +456,7 @@ port_register_hwall_host(struct TestContext *ctx) } static int -port_register_host(struct TestContext *ctx) +port_register_hostall(struct TestContext *ctx) { ctx->nr_mode = NR_REG_SW; return port_register(ctx); @@ -462,7 +470,7 @@ port_register_hwall(struct TestContext *ctx) } static int -port_register_single_ring_couple(struct TestContext *ctx) +port_register_single_hw_pair(struct TestContext *ctx) { ctx->nr_mode = NR_REG_ONE_NIC; ctx->nr_ringid = 0; @@ -470,6 +478,25 @@ port_register_single_ring_couple(struct TestContext *c } static int +port_register_single_host_pair(struct TestContext *ctx) +{ + ctx->nr_mode = NR_REG_ONE_SW; + ctx->nr_host_tx_rings = 2; + ctx->nr_host_rx_rings = 2; + ctx->nr_ringid = 1; + return port_register(ctx); +} + +static int +port_register_hostall_many(struct TestContext *ctx) +{ + ctx->nr_mode = NR_REG_SW; + ctx->nr_host_tx_rings = 5; + ctx->nr_host_rx_rings = 4; + return port_register(ctx); +} + +static int port_register_hwall_tx(struct TestContext *ctx) { ctx->nr_mode = NR_REG_ALL_NIC; @@ -1701,8 +1728,10 @@ static struct mytest tests[] = { decltest(port_info_get), decltest(port_register_hwall_host), decltest(port_register_hwall), - decltest(port_register_host), - decltest(port_register_single_ring_couple), + decltest(port_register_hostall), + decltest(port_register_single_hw_pair), + decltest(port_register_single_host_pair), + decltest(port_register_hostall_many), decltest(vale_attach_detach), decltest(vale_attach_detach_host_rings), decltest(vale_ephemeral_port_hdr_manipulation),