diff options
Diffstat (limited to 'meta-romley/recipes-extended/dpdk/dpdk')
7 files changed, 623 insertions, 0 deletions
diff --git a/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.6.0r2-app-test-fix-build-switches-to-enable-cmdline-tests.patch b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.6.0r2-app-test-fix-build-switches-to-enable-cmdline-tests.patch new file mode 100644 index 00000000..87d2ef77 --- /dev/null +++ b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.6.0r2-app-test-fix-build-switches-to-enable-cmdline-tests.patch @@ -0,0 +1,53 @@ +From cf953d2bfa7df9aa67459b333db4d4d8a9e72fd6 Mon Sep 17 00:00:00 2001 +From: Thomas Monjalon <thomas.monjalon@6wind.com> +Date: Fri, 27 Jun 2014 11:21:11 +0200 +Subject: [PATCH] app/test: fix build switches to enable cmdline tests + +Upstream-Status: backport +Imported patch from: http://dpdk.org/browse/dpdk/log/ + +There were 2 typos since these commits (in 1.6.0 releases): + 21a7f4e264 fix build without librte_cmdline + cac6d08c8b replace --use-device option by --pci-whitelist and --vdev +In makefiles, the build options are prefixed with CONFIG_RTE_ +but in .c file, it is only RTE_. + +These typos were disabling cmdline unit tests and test of "--vdev eth_ring" option. + +Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> +Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> +Signed-off-by: Chan Wei Sern <wei.sern.chan@intel.com> +--- + app/test/test_cmdline.c | 2 +- + app/test/test_eal_flags.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/app/test/test_cmdline.c b/app/test/test_cmdline.c +index 77475c4..10a3f77 100644 +--- a/app/test/test_cmdline.c ++++ b/app/test/test_cmdline.c +@@ -39,7 +39,7 @@ + int + test_cmdline(void) + { +-#ifdef CONFIG_RTE_LIBRTE_CMDLINE ++#ifdef RTE_LIBRTE_CMDLINE + printf("Testind parsing ethernet addresses...\n"); + if (test_parse_etheraddr_valid() < 0) + return -1; +diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c +index a862654..1b80b80 100644 +--- a/app/test/test_eal_flags.c ++++ b/app/test/test_eal_flags.c +@@ -317,7 +317,7 @@ test_whitelist_flag(void) + const char *wlval3[] = {prgname, prefix, mp_flag, "-n", "1", "-c", "1", + pci_whitelist, "09:0B.3,type=test", + pci_whitelist, "08:00.1,type=normal", +-#ifdef CONFIG_RTE_LIBRTE_PMD_RING ++#ifdef RTE_LIBRTE_PMD_RING + vdev, "eth_ring,arg=test", + #endif + }; +-- +1.9.1 + diff --git a/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.6.0r2-eal-fix-option-base-virtaddr.patch b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.6.0r2-eal-fix-option-base-virtaddr.patch new file mode 100644 index 00000000..e724591e --- /dev/null +++ b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.6.0r2-eal-fix-option-base-virtaddr.patch @@ -0,0 +1,35 @@ +From be1816f59e772e427fc5815281f9458a9314973a Mon Sep 17 00:00:00 2001 +From: Pablo de Lara <pablo.de.lara.guarch@intel.com> +Date: Thu, 19 Jun 2014 16:35:22 +0100 +Subject: [PATCH] eal: fix option --base-virtaddr + +Upstream-Status: backport +Imported patch from: http://dpdk.org/browse/dpdk/log/ + +When parsing EAL option --base-virtaddr +errno was not being set to 0 before calling strtoull, +therefore function might fail unnecesarily. + +Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> +Signed-off-by: Aaron Campbell <aaron@arbor.net> +Acked-by: Anatoly Burakov <anatoly.burakov@intel.com> +Signed-off-by: Chan Wei Sern <wei.sern.chan@intel.com> +--- + lib/librte_eal/linuxapp/eal/eal.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c +index 6994303..d204387 100644 +--- a/lib/librte_eal/linuxapp/eal/eal.c ++++ b/lib/librte_eal/linuxapp/eal/eal.c +@@ -562,6 +562,7 @@ eal_parse_base_virtaddr(const char *arg) + char *end; + uint64_t addr; + ++ errno = 0; + addr = strtoull(arg, &end, 16); + + /* check for errors */ +-- +1.9.1 + diff --git a/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.6.0r2-examples-qos_sched-fix-makefile.patch b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.6.0r2-examples-qos_sched-fix-makefile.patch new file mode 100644 index 00000000..47b5ece7 --- /dev/null +++ b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.6.0r2-examples-qos_sched-fix-makefile.patch @@ -0,0 +1,35 @@ +From ea9a59b26c3c86b498337e968ee8f68c4e263614 Mon Sep 17 00:00:00 2001 +From: Olivier Matz <olivier.matz@6wind.com> +Date: Fri, 16 May 2014 10:18:59 +0200 +Subject: [PATCH] examples/qos_sched: fix makefile + +Upstream-Status: backport +Imported patch from: http://dpdk.org/browse/dpdk/log/ + +The example does not compile as the linker complains about duplicated +symbols. + +Remove -lsched from LDLIBS, it is already present in rte.app.mk and +added by the DPDK framework automatically. + +Signed-off-by: Olivier Matz <olivier.matz@6wind.com> +Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com> +Signed-off-by: Chan Wei Sern <wei.sern.chan@intel.com> +--- + examples/qos_sched/Makefile | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/examples/qos_sched/Makefile b/examples/qos_sched/Makefile +index b91fe37..9366efe 100755 +--- a/examples/qos_sched/Makefile ++++ b/examples/qos_sched/Makefile +@@ -54,6 +54,4 @@ CFLAGS += $(WERROR_FLAGS) + CFLAGS_args.o := -D_GNU_SOURCE + CFLAGS_cfg_file.o := -D_GNU_SOURCE + +-LDLIBS += -lrte_sched +- + include $(RTE_SDK)/mk/rte.extapp.mk +-- +1.9.1 + diff --git a/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-examples-Add-config-variables-to-enable-disable-dpdk.patch b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-examples-Add-config-variables-to-enable-disable-dpdk.patch new file mode 100644 index 00000000..d0721ca0 --- /dev/null +++ b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-examples-Add-config-variables-to-enable-disable-dpdk.patch @@ -0,0 +1,42 @@ +From 63f8ccc5a305b193e219d288ef9e43b9a9fa6aa8 Mon Sep 17 00:00:00 2001 +From: Sreeju Selvaraj <sreeju.armughanx.selvaraj@intel.com> +Date: Wed, 17 Sep 2014 19:10:01 +0800 +Subject: [PATCH] examples: Add config variables to enable/disable dpdk_qat and + vhost + +Upstream-Status: Inappropriate [configuration] + +This can be used to export CONFIG_EXAMPLE_DPDK_QAT=n if dpdk_qat is not +in PACKAGECONFIG and also allow to export CONFIG_EXAMPLE_DPDK_VHOST=n +if vhost is not in PACKAGECONFIG. + +Signed-off-by: Sreeju Selvaraj <sreeju.armughanx.selvaraj@intel.com> +--- + examples/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/examples/Makefile b/examples/Makefile +index d0624f6..885c938 100644 +--- a/examples/Makefile ++++ b/examples/Makefile +@@ -39,7 +39,7 @@ include $(RTE_SDK)/mk/rte.vars.mk + + DIRS-y += cmdline + ifneq ($(ICP_ROOT),) +-DIRS-y += dpdk_qat ++DIRS-$(CONFIG_EXAMPLE_DPDK_QAT) += dpdk_qat + endif + DIRS-y += exception_path + DIRS-y += helloworld +@@ -61,7 +61,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_METER) += qos_meter + DIRS-$(CONFIG_RTE_LIBRTE_SCHED) += qos_sched + DIRS-y += quota_watermark + DIRS-y += timer +-DIRS-y += vhost ++DIRS-$(CONFIG_EXAMPLE_DPDK_VHOST) += vhost + DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += vhost_xen + DIRS-y += vmdq + DIRS-y += vmdq_dcb +-- +1.9.1 + diff --git a/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-examples-pipeline-build-with-all-examples.patch b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-examples-pipeline-build-with-all-examples.patch new file mode 100644 index 00000000..25f029fe --- /dev/null +++ b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-examples-pipeline-build-with-all-examples.patch @@ -0,0 +1,34 @@ +From 15aef6e666ee2eb0befa153d277d47754f3656e4 Mon Sep 17 00:00:00 2001 +From: Thomas Monjalon <thomas.monjalon@6wind.com> +Date: Thu, 17 Jul 2014 10:30:52 +0200 +Subject: [PATCH] examples/pipeline: build with all examples + +Upstream-Status: Backport +Imported patch from: http://dpdk.org/browse/dpdk/log/ + +When adding this packet framework sample (commit 77a3346), +it has been forgotten to add it into the global makefile for +"make examples". + +Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> +(cherry picked from commit a6664a09a7caa5e63f9ae625cf1946b0eef7794e) +Signed-off-by: Sreeju Selvaraj <sreeju.armughanx.selvaraj@intel.com> +--- + examples/Makefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/examples/Makefile b/examples/Makefile +index 885c938..1788d6e 100644 +--- a/examples/Makefile ++++ b/examples/Makefile +@@ -43,6 +43,7 @@ DIRS-$(CONFIG_EXAMPLE_DPDK_QAT) += dpdk_qat + endif + DIRS-y += exception_path + DIRS-y += helloworld ++DIRS-y += ip_pipeline + DIRS-y += ip_reassembly + DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ip_fragmentation + DIRS-$(CONFIG_RTE_MBUF_SCATTER_GATHER) += ipv4_multicast +-- +1.9.1 + diff --git a/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-ring-remove-extra-devices-creation-with-vdev-option.patch b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-ring-remove-extra-devices-creation-with-vdev-option.patch new file mode 100644 index 00000000..25a4ea80 --- /dev/null +++ b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-ring-remove-extra-devices-creation-with-vdev-option.patch @@ -0,0 +1,44 @@ +From 70d3d9a6757e0c56ad3c6da0292479433e16aed3 Mon Sep 17 00:00:00 2001 +From: Pablo de Lara <pablo.de.lara.guarch@intel.com> +Date: Wed, 9 Jul 2014 15:35:35 +0100 +Subject: [PATCH] ring: remove extra devices creation with --vdev option + +Upstream-Status: Backport +Imported patch from: http://dpdk.org/browse/dpdk/log/ + +When passing extra arguments in EAL option --vdev, to create +ring ethdevs, API was creating three ethdevs, even if there +was just one argument, such as CREATE. + +Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> +Acked-by: Neil Horman <nhorman@tuxdriver.com> +(cherry picked from commit 546afbc6827f9f0f7ed501d2af1fc51755e40224) +Signed-off-by: Sreeju Selvaraj <sreeju.armughanx.selvaraj@intel.com> +--- + lib/librte_pmd_ring/rte_eth_ring.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c +index 73c649e..4f1b6ed 100644 +--- a/lib/librte_pmd_ring/rte_eth_ring.c ++++ b/lib/librte_pmd_ring/rte_eth_ring.c +@@ -493,7 +493,6 @@ rte_pmd_ring_devinit(const char *name, const char *params) + eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE); + return 0; + } else { +- eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE); + ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG); + info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) + + (sizeof(struct node_action_pair) * ret), 0); +@@ -510,7 +509,7 @@ rte_pmd_ring_devinit(const char *name, const char *params) + goto out_free; + + for (info->count = 0; info->count < info->total; info->count++) { +- eth_dev_ring_pair_create(name, info->list[info->count].node, ++ eth_dev_ring_create(name, info->list[info->count].node, + info->list[info->count].action); + } + } +-- +1.9.1 + diff --git a/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-ring-simplify-unit-tests.patch b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-ring-simplify-unit-tests.patch new file mode 100644 index 00000000..c17137b2 --- /dev/null +++ b/meta-romley/recipes-extended/dpdk/dpdk/dpdk-1.7.0-ring-simplify-unit-tests.patch @@ -0,0 +1,380 @@ +From 545a5fac5d6bd0b64693dfcb15b321280418ac13 Mon Sep 17 00:00:00 2001 +From: Pablo de Lara <pablo.de.lara.guarch@intel.com> +Date: Wed, 9 Jul 2014 15:35:36 +0100 +Subject: [PATCH] ring: simplify unit tests + +Upstream-Status: Backport +Imported patch from: http://dpdk.org/browse/dpdk/log/ + +As this unit test does not create devices anymore, +and uses devices created by EAL option --vdev, +there were unnecesary tests that were repeated, +so they have been removed. + +So now there are three tests: + +1 - Test two devices that share a ring, one device + with just one RX queue and the other with one + TX queue. + +2 - Test a device connected to itself (loopback) by + a ring, with both RX and TX queue. + +3 - Test two devices that share a ring, but both devices + with RX and TX queue, so they can send packets to themselves + and to the other device. + +Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> +Acked-by: Neil Horman <nhorman@tuxdriver.com> +(cherry picked from commit 572eb3cd834c5e21d7fa946432b89c1c9d63fe61) +Signed-off-by: Sreeju Selvaraj <sreeju.armughanx.selvaraj@intel.com> +--- + app/test/test_pmd_ring.c | 202 +++++++++++++++++------------------------------ + 1 file changed, 72 insertions(+), 130 deletions(-) + +diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c +index 0d3d95c..19ad0e9 100644 +--- a/app/test/test_pmd_ring.c ++++ b/app/test/test_pmd_ring.c +@@ -39,18 +39,13 @@ + #include <rte_eth_ring.h> + #include <rte_ethdev.h> + +-/* two test rings, r1 is used by two ports, r2 just by one */ +-static struct rte_ring *r1[2], *r2; +- + static struct rte_mempool *mp; +-static uint8_t start_idx; /* will store the port id of the first of our new ports */ +- +-#define TX_PORT (uint8_t)(start_idx + 1) +-#define RX_PORT (uint8_t)(start_idx + 2) +-#define RXTX_PORT (uint8_t)(start_idx + 3) +-#define RXTX_PORT2 (uint8_t)(start_idx + 4) +-#define RXTX_PORT4 (uint8_t)(start_idx + 6) +-#define RXTX_PORT5 (uint8_t)(start_idx + 7) ++ ++#define TX_PORT 0 ++#define RX_PORT 1 ++#define RXTX_PORT 2 ++#define RXTX_PORT2 3 ++#define RXTX_PORT3 4 + #define SOCKET0 0 + + #define RING_SIZE 256 +@@ -86,7 +81,7 @@ test_ethdev_configure(void) + return -1; + } + if (rte_eth_dev_configure(RXTX_PORT, 1, 1, &null_conf) < 0) { +- printf("Configure failed for RX port\n"); ++ printf("Configure failed for RXTX port\n"); + return -1; + } + +@@ -250,197 +245,162 @@ test_stats_reset(void) + } + + static int +-test_pmd_ring_init(void) ++test_pmd_ring_pair_create_attach(void) + { +- struct rte_eth_stats stats; ++ struct rte_eth_stats stats, stats2; + struct rte_mbuf buf, *pbuf = &buf; + struct rte_eth_conf null_conf; + +- printf("Testing ring pmd init\n"); +- +- if (RXTX_PORT2 >= RTE_MAX_ETHPORTS) { ++ if ((RXTX_PORT2 >= RTE_MAX_ETHPORTS) || (RXTX_PORT3 >= RTE_MAX_ETHPORTS)) { + printf(" TX/RX port exceed max eth ports\n"); + return -1; + } +- if (rte_eth_dev_configure(RXTX_PORT2, 1, 1, &null_conf) < 0) { ++ if ((rte_eth_dev_configure(RXTX_PORT2, 1, 1, &null_conf) < 0) ++ || (rte_eth_dev_configure(RXTX_PORT3, 1, 1, &null_conf) < 0)) { + printf("Configure failed for RXTX port\n"); + return -1; + } + +- if (rte_eth_tx_queue_setup(RXTX_PORT2, 0, RING_SIZE, SOCKET0, NULL) < 0) { ++ if ((rte_eth_tx_queue_setup(RXTX_PORT2, 0, RING_SIZE, SOCKET0, NULL) < 0) ++ || (rte_eth_tx_queue_setup(RXTX_PORT3, 0, RING_SIZE, SOCKET0, NULL) < 0)) { + printf("TX queue setup failed\n"); + return -1; + } + +- if (rte_eth_rx_queue_setup(RXTX_PORT2, 0, RING_SIZE, SOCKET0, +- NULL, mp) < 0) { ++ if ((rte_eth_rx_queue_setup(RXTX_PORT2, 0, RING_SIZE, SOCKET0, NULL, mp) < 0) ++ || (rte_eth_rx_queue_setup(RXTX_PORT3, 0, RING_SIZE, SOCKET0, NULL, mp) < 0)) { + printf("RX queue setup failed\n"); + return -1; + } + +- if (rte_eth_dev_start(RXTX_PORT2) < 0) { +- printf("Error starting RX port\n"); ++ if ((rte_eth_dev_start(RXTX_PORT2) < 0) ++ || (rte_eth_dev_start(RXTX_PORT3) < 0)) { ++ printf("Error starting RXTX port\n"); + return -1; + } + +- /* send and receive 1 packet and check for stats update */ ++ /* ++ * send and receive 1 packet (RXTX_PORT2 -> RXTX_PORT3) ++ * and check for stats update ++ */ + if (rte_eth_tx_burst(RXTX_PORT2, 0, &pbuf, 1) != 1) { + printf("Error sending packet to RXTX port\n"); + return -1; + } + +- if (rte_eth_rx_burst(RXTX_PORT2, 0, &pbuf, 1) != 1) { ++ if (rte_eth_rx_burst(RXTX_PORT3, 0, &pbuf, 1) != 1) { + printf("Error receiving packet from RXTX port\n"); + return -1; + } + + rte_eth_stats_get(RXTX_PORT2, &stats); +- if (stats.ipackets != 1 || stats.opackets != 1 || ++ rte_eth_stats_get(RXTX_PORT3, &stats2); ++ if (stats.ipackets != 0 || stats.opackets != 1 || + stats.ibytes != 0 || stats.obytes != 0 || + stats.ierrors != 0 || stats.oerrors != 0) { + printf("Error: RXTX port stats are not as expected\n"); + return -1; + } + +- rte_eth_dev_stop(RXTX_PORT2); +- +- return 0; +-} +- +-static int +-test_pmd_ring_pair_create(void) +-{ +- struct rte_eth_stats stats, stats2; +- struct rte_mbuf buf, *pbuf = &buf; +- struct rte_eth_conf null_conf; +- +- if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) { +- printf(" TX/RX port exceed max eth ports\n"); +- return -1; +- } +- if ((rte_eth_dev_configure(RXTX_PORT4, 1, 1, &null_conf) < 0) +- || (rte_eth_dev_configure(RXTX_PORT5, 1, 1, &null_conf) < 0)) { +- printf("Configure failed for RXTX port\n"); +- return -1; +- } +- +- if ((rte_eth_tx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL) < 0) +- || (rte_eth_tx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL) < 0)) { +- printf("TX queue setup failed\n"); +- return -1; +- } +- +- if ((rte_eth_rx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL, mp) < 0) +- || (rte_eth_rx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL, mp) < 0)) { +- printf("RX queue setup failed\n"); +- return -1; +- } +- +- if ((rte_eth_dev_start(RXTX_PORT4) < 0) +- || (rte_eth_dev_start(RXTX_PORT5) < 0)) { +- printf("Error starting RXTX port\n"); ++ if (stats2.ipackets != 1 || stats2.opackets != 0 || ++ stats2.ibytes != 0 || stats2.obytes != 0 || ++ stats2.ierrors != 0 || stats2.oerrors != 0) { ++ printf("Error: RXTX port stats are not as expected\n"); + return -1; + } + +- /* send and receive 1 packet and check for stats update */ +- if (rte_eth_tx_burst(RXTX_PORT4, 0, &pbuf, 1) != 1) { ++ /* ++ * send and receive 1 packet (RXTX_PORT3 -> RXTX_PORT2) ++ * and check for stats update ++ */ ++ if (rte_eth_tx_burst(RXTX_PORT3, 0, &pbuf, 1) != 1) { + printf("Error sending packet to RXTX port\n"); + return -1; + } + +- if (rte_eth_rx_burst(RXTX_PORT5, 0, &pbuf, 1) != 1) { ++ if (rte_eth_rx_burst(RXTX_PORT2, 0, &pbuf, 1) != 1) { + printf("Error receiving packet from RXTX port\n"); + return -1; + } + +- rte_eth_stats_get(RXTX_PORT4, &stats); +- rte_eth_stats_get(RXTX_PORT5, &stats2); +- if (stats.ipackets != 0 || stats.opackets != 1 || ++ rte_eth_stats_get(RXTX_PORT2, &stats); ++ rte_eth_stats_get(RXTX_PORT3, &stats2); ++ if (stats.ipackets != 1 || stats.opackets != 1 || + stats.ibytes != 0 || stats.obytes != 0 || + stats.ierrors != 0 || stats.oerrors != 0) { + printf("Error: RXTX port stats are not as expected\n"); + return -1; + } + +- if (stats2.ipackets != 1 || stats2.opackets != 0 || ++ if (stats2.ipackets != 1 || stats2.opackets != 1 || + stats2.ibytes != 0 || stats2.obytes != 0 || + stats2.ierrors != 0 || stats2.oerrors != 0) { + printf("Error: RXTX port stats are not as expected\n"); + return -1; + } + +- rte_eth_dev_stop(RXTX_PORT4); +- rte_eth_dev_stop(RXTX_PORT5); +- +- return 0; +-} +- +-static int +-test_pmd_ring_pair_attach(void) +-{ +- struct rte_eth_stats stats, stats2; +- struct rte_mbuf buf, *pbuf = &buf; +- struct rte_eth_conf null_conf; +- +- if ((RXTX_PORT4 >= RTE_MAX_ETHPORTS) || (RXTX_PORT5 >= RTE_MAX_ETHPORTS)) { +- printf(" TX/RX port exceed max eth ports\n"); +- return -1; +- } +- if ((rte_eth_dev_configure(RXTX_PORT4, 1, 1, &null_conf) < 0) +- || (rte_eth_dev_configure(RXTX_PORT5, 1, 1, &null_conf) < 0)) { +- printf("Configure failed for RXTX port\n"); ++ /* ++ * send and receive 1 packet (RXTX_PORT2 -> RXTX_PORT2) ++ * and check for stats update ++ */ ++ if (rte_eth_tx_burst(RXTX_PORT2, 0, &pbuf, 1) != 1) { ++ printf("Error sending packet to RXTX port\n"); + return -1; + } + +- if ((rte_eth_tx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL) < 0) +- || (rte_eth_tx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL) < 0)) { +- printf("TX queue setup failed\n"); ++ if (rte_eth_rx_burst(RXTX_PORT2, 0, &pbuf, 1) != 1) { ++ printf("Error receiving packet from RXTX port\n"); + return -1; + } + +- if ((rte_eth_rx_queue_setup(RXTX_PORT4, 0, RING_SIZE, SOCKET0, NULL, mp) < 0) +- || (rte_eth_rx_queue_setup(RXTX_PORT5, 0, RING_SIZE, SOCKET0, NULL, mp) < 0)) { +- printf("RX queue setup failed\n"); ++ rte_eth_stats_get(RXTX_PORT2, &stats); ++ rte_eth_stats_get(RXTX_PORT3, &stats2); ++ if (stats.ipackets != 2 || stats.opackets != 2 || ++ stats.ibytes != 0 || stats.obytes != 0 || ++ stats.ierrors != 0 || stats.oerrors != 0) { ++ printf("Error: RXTX port stats are not as expected\n"); + return -1; + } + +- if ((rte_eth_dev_start(RXTX_PORT4) < 0) +- || (rte_eth_dev_start(RXTX_PORT5) < 0)) { +- printf("Error starting RXTX port\n"); ++ if (stats2.ipackets != 1 || stats2.opackets != 1 || ++ stats2.ibytes != 0 || stats2.obytes != 0 || ++ stats2.ierrors != 0 || stats2.oerrors != 0) { ++ printf("Error: RXTX port stats are not as expected\n"); + return -1; + } + +- rte_eth_stats_reset(RXTX_PORT4); +- rte_eth_stats_reset(RXTX_PORT5); +- +- /* send and receive 1 packet and check for stats update */ +- if (rte_eth_tx_burst(RXTX_PORT4, 0, &pbuf, 1) != 1) { ++ /* ++ * send and receive 1 packet (RXTX_PORT3 -> RXTX_PORT3) ++ * and check for stats update ++ */ ++ if (rte_eth_tx_burst(RXTX_PORT3, 0, &pbuf, 1) != 1) { + printf("Error sending packet to RXTX port\n"); + return -1; + } +- if (rte_eth_rx_burst(RXTX_PORT5, 0, &pbuf, 1) != 1) { ++ ++ if (rte_eth_rx_burst(RXTX_PORT3, 0, &pbuf, 1) != 1) { + printf("Error receiving packet from RXTX port\n"); + return -1; + } + +- rte_eth_stats_get(RXTX_PORT4, &stats); +- rte_eth_stats_get(RXTX_PORT5, &stats2); +- if (stats.ipackets != 0 || stats.opackets != 1 || ++ rte_eth_stats_get(RXTX_PORT2, &stats); ++ rte_eth_stats_get(RXTX_PORT3, &stats2); ++ if (stats.ipackets != 2 || stats.opackets != 2 || + stats.ibytes != 0 || stats.obytes != 0 || + stats.ierrors != 0 || stats.oerrors != 0) { + printf("Error: RXTX port stats are not as expected\n"); + return -1; + } + +- if (stats2.ipackets != 1 || stats2.opackets != 0 || ++ if (stats2.ipackets != 2 || stats2.opackets != 2 || + stats2.ibytes != 0 || stats2.obytes != 0 || + stats2.ierrors != 0 || stats2.oerrors != 0) { + printf("Error: RXTX port stats are not as expected\n"); + return -1; + } + +- rte_eth_dev_stop(RXTX_PORT4); +- rte_eth_dev_stop(RXTX_PORT5); ++ rte_eth_dev_stop(RXTX_PORT2); ++ rte_eth_dev_stop(RXTX_PORT3); + + return 0; + } +@@ -448,17 +408,6 @@ test_pmd_ring_pair_attach(void) + int + test_pmd_ring(void) + { +- r1[0] = rte_ring_create("R1", RING_SIZE, 0, 0); +- r1[1] = rte_ring_create("R2", RING_SIZE, 0, 0); +- if (r1[0] == NULL && (r1[0] = rte_ring_lookup("R1")) == NULL) +- return -1; +- if (r1[1] == NULL && (r1[1] = rte_ring_lookup("R2")) == NULL) +- return -1; +- +- r2 = rte_ring_create("R3", RING_SIZE, 0, RING_F_SP_ENQ|RING_F_SC_DEQ); +- if (r2 == NULL && (r2 = rte_ring_lookup("R3")) == NULL) +- return -1; +- + mp = rte_mempool_create("mbuf_pool", NB_MBUF, + MBUF_SIZE, 32, + sizeof(struct rte_pktmbuf_pool_private), +@@ -468,8 +417,6 @@ test_pmd_ring(void) + if (mp == NULL) + return -1; + +- start_idx = rte_eth_dev_count(); +- + if ((TX_PORT >= RTE_MAX_ETHPORTS) || (RX_PORT >= RTE_MAX_ETHPORTS)\ + || (RXTX_PORT >= RTE_MAX_ETHPORTS)) { + printf(" TX/RX port exceed max eth ports\n"); +@@ -492,14 +439,9 @@ test_pmd_ring(void) + rte_eth_dev_stop(TX_PORT); + rte_eth_dev_stop(RXTX_PORT); + +- if (test_pmd_ring_init() < 0) ++ if (test_pmd_ring_pair_create_attach() < 0) + return -1; + +- if (test_pmd_ring_pair_create() < 0) +- return -1; +- +- if (test_pmd_ring_pair_attach() < 0) +- return -1; + return 0; + } + +-- +1.9.1 + |