[dpdk-dev] [PATCH 4/4] vmxnet3: Updated comments.
Signed-off-by: Maciej Gajdzica --- lib/librte_eal/common/include/rte_pci_dev_ids.h | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/include/rte_pci_dev_ids.h b/lib/librte_eal/common/include/rte_pci_dev_ids.h index 9c1ee04..b0737a5 100644 --- a/lib/librte_eal/common/include/rte_pci_dev_ids.h +++ b/lib/librte_eal/common/include/rte_pci_dev_ids.h @@ -63,17 +63,18 @@ * This file contains a list of the PCI device IDs recognised by DPDK, which * can be used to fill out an array of structures describing the devices. * - * Currently four families of devices are recognised: those supported by the + * Currently five families of devices are recognised: those supported by the * IGB driver, by EM driver, those supported by the IXGBE driver, and by virtio - * driver which is a para virtualization driver running in guest virtual machine. - * The inclusion of these in an array built using this file depends on the - * definition of + * and vmxnet3 drivers which are para virtualization drivers running in guest + * virtual machine. The inclusion of these in an array built using this file + * depends on the definition of * RTE_PCI_DEV_ID_DECL_EM * RTE_PCI_DEV_ID_DECL_IGB * RTE_PCI_DEV_ID_DECL_IGBVF * RTE_PCI_DEV_ID_DECL_IXGBE * RTE_PCI_DEV_ID_DECL_IXGBEVF * RTE_PCI_DEV_ID_DECL_VIRTIO + * RTE_PCI_DEV_ID_DECL_VMXNET3 * at the time when this file is included. * * In order to populate an array, the user of this file must define this macro: -- 2.0.0
[dpdk-dev] [PATCH 0/4] VMXNET3 support for FreeBSD.
Enabled VMXNET3 compilation for FreeBSD in the makefiles. Fixed some minor issues to make it run. Maciej Gajdzica (4): vmxnet3: Removed unused include that broke VMXNET3 driver compilation under FreeBSD. vmxnet3: Added makefile entries to compile VMXNET3 driver under FreeBSD. vmxnet3: Added macro adding VMXNET3 to the list of recognized PCI devices. vmxnet3: Updated comments. config/common_bsdapp| 10 ++ lib/librte_eal/bsdapp/nic_uio/nic_uio.c | 1 + lib/librte_eal/common/include/rte_pci_dev_ids.h | 9 + lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 1 - 4 files changed, 16 insertions(+), 5 deletions(-) -- 2.0.0
[dpdk-dev] [PATCH 1/4] vmxnet3: Removed unused include that broke VMXNET3 driver compilation under FreeBSD.
From: Maciej Gajdzica Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c index cb711dc..69e01c1 100644 --- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c @@ -33,7 +33,6 @@ #include -#include #include #include #include -- 2.0.0
[dpdk-dev] [PATCH 3/4] vmxnet3: Added macro adding VMXNET3 to the list of recognized PCI devices.
Signed-off-by: Maciej Gajdzica --- lib/librte_eal/bsdapp/nic_uio/nic_uio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c index 3fe6f1c..00c9a8d 100644 --- a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c +++ b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c @@ -110,6 +110,7 @@ struct pci_bdf { #define RTE_PCI_DEV_ID_DECL_IXGBE(vend, dev) {vend, dev}, #define RTE_PCI_DEV_ID_DECL_IXGBEVF(vend, dev) {vend, dev}, #define RTE_PCI_DEV_ID_DECL_VIRTIO(vend, dev) {vend, dev}, +#define RTE_PCI_DEV_ID_DECL_VMXNET3(vend, dev) {vend, dev}, const struct device devices[] = { #include -- 2.0.0
[dpdk-dev] [PATCH 2/4] vmxnet3: Added makefile entries to compile VMXNET3 driver under FreeBSD.
Signed-off-by: Maciej Gajdzica --- config/common_bsdapp | 10 ++ 1 file changed, 10 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index 578d510..87edada 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -177,6 +177,16 @@ CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_DUMP=n # +# Compile burst-oriented VMXNET3 PMD driver +# +CONFIG_RTE_LIBRTE_VMXNET3_PMD=y +CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_INIT=n +CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_RX=n +CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX=n +CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n +CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_DRIVER=n + +# # Compile example software rings based PMD # CONFIG_RTE_LIBRTE_PMD_RING=y -- 2.0.0
[dpdk-dev] [PATCH v2 3/3] vmxnet3: Added macro adding VMXNET3 to the list of recognized PCI devices.
Signed-off-by: Maciej Gajdzica --- lib/librte_eal/bsdapp/nic_uio/nic_uio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c index 3fe6f1c..00c9a8d 100644 --- a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c +++ b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c @@ -110,6 +110,7 @@ struct pci_bdf { #define RTE_PCI_DEV_ID_DECL_IXGBE(vend, dev) {vend, dev}, #define RTE_PCI_DEV_ID_DECL_IXGBEVF(vend, dev) {vend, dev}, #define RTE_PCI_DEV_ID_DECL_VIRTIO(vend, dev) {vend, dev}, +#define RTE_PCI_DEV_ID_DECL_VMXNET3(vend, dev) {vend, dev}, const struct device devices[] = { #include -- 2.0.0
[dpdk-dev] [PATCH v2 2/3] vmxnet3: Added makefile entries to compile VMXNET3 driver under FreeBSD.
Signed-off-by: Maciej Gajdzica --- config/common_bsdapp | 10 ++ 1 file changed, 10 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index 578d510..87edada 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -177,6 +177,16 @@ CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_DUMP=n # +# Compile burst-oriented VMXNET3 PMD driver +# +CONFIG_RTE_LIBRTE_VMXNET3_PMD=y +CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_INIT=n +CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_RX=n +CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX=n +CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n +CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_DRIVER=n + +# # Compile example software rings based PMD # CONFIG_RTE_LIBRTE_PMD_RING=y -- 2.0.0
[dpdk-dev] [PATCH v2 1/3] vmxnet3: Removed unused include that broke VMXNET3 driver compilation under FreeBSD.
Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c index cb711dc..69e01c1 100644 --- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c @@ -33,7 +33,6 @@ #include -#include #include #include #include -- 2.0.0
[dpdk-dev] [PATCH v2 0/3] VMXNET3 support for FreeBSD.
Enabled VMXNET3 compilation for FreeBSD in the makefiles. Fixed some minor issues to make it run. v2: Removed patch with comments update. Maciej Gajdzica (3): vmxnet3: Removed unused include that broke VMXNET3 driver compilation under FreeBSD. vmxnet3: Added makefile entries to compile VMXNET3 driver under FreeBSD. vmxnet3: Added macro adding VMXNET3 to the list of recognized PCI devices. config/common_bsdapp| 10 ++ lib/librte_eal/bsdapp/nic_uio/nic_uio.c | 1 + lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 1 - 3 files changed, 11 insertions(+), 1 deletion(-) -- 2.0.0
[dpdk-dev] [PATCH v3 0/4] port: add ethdev_writer and ring_writer nodrop ports
When nodrop writer port fails to send data, it retries until reach maximum number of retries. Also added new tx_bulk implementation for ring writer port. Changes in v2: - added missing signoffs Changes in v3: - removed second implementation of tx_bulk functions Maciej Gajdzica (4): port: removed second implementation of tx_bulk from ethdev_writer port port: changed tx_bulk implementation if ring_writer port port: added ethdev_writer_nodrop port port: added ring_writer_nodrop port lib/librte_port/rte_port_ethdev.c | 206 +-- lib/librte_port/rte_port_ethdev.h | 19 lib/librte_port/rte_port_ring.c | 214 +++-- lib/librte_port/rte_port_ring.h | 16 +++ 4 files changed, 409 insertions(+), 46 deletions(-) -- 1.7.9.5
[dpdk-dev] [PATCH 1/1] test_table: added ACL table test to the list
test_table_ACL wasn't invoked when running table_autotest. Added this test to table_tests array to make it run with other table tests. Signed-off-by: Maciej Gajdzica --- app/test/test_table_tables.c |3 +++ app/test/test_table_tables.h |2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/test/test_table_tables.c b/app/test/test_table_tables.c index 88bebf8..a66e277 100644 --- a/app/test/test_table_tables.c +++ b/app/test/test_table_tables.c @@ -46,6 +46,9 @@ table_test table_tests[] = { test_table_lpm_ipv6, test_table_hash_lru, test_table_hash_ext, +#ifdef RTE_LIBRTE_ACL + test_table_ACL, +#endif }; #define PREPARE_PACKET(mbuf, value) do { \ diff --git a/app/test/test_table_tables.h b/app/test/test_table_tables.h index b368623..3d31492 100644 --- a/app/test/test_table_tables.h +++ b/app/test/test_table_tables.h @@ -36,7 +36,7 @@ int test_table_lpm(void); int test_table_lpm_ipv6(void); int test_table_array(void); #ifdef RTE_LIBRTE_ACL -int test_table_acl(void); +int test_table_ACL(void); #endif int test_table_hash_unoptimized(void); int test_table_hash_lru(void); -- 1.7.9.5
[dpdk-dev] [PATCH 1/1] test_table: fixed failing unit tests checking offset
In commit: 1129992baa61d72c5 checking for offset alignment was removed. Unit tests wasn't updated to reflect that change. This patch changes checks with unaligned offsets to make tests pass. Signed-off-by: Maciej Gajdzica --- app/test/test_table_tables.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/test/test_table_tables.c b/app/test/test_table_tables.c index 14add77..88bebf8 100644 --- a/app/test/test_table_tables.c +++ b/app/test/test_table_tables.c @@ -226,7 +226,7 @@ test_table_array(void) array_params.offset = 1; table = rte_table_array_ops.f_create(&array_params, 0, 1); - if (table != NULL) + if (table == NULL) return -4; array_params.offset = 32; @@ -652,14 +652,14 @@ test_table_hash_lru_generic(struct rte_table_ops *ops) hash_params.signature_offset = 1; table = ops->f_create(&hash_params, 0, 1); - if (table != NULL) + if (table == NULL) return -2; hash_params.signature_offset = 0; hash_params.key_offset = 1; table = ops->f_create(&hash_params, 0, 1); - if (table != NULL) + if (table == NULL) return -3; hash_params.key_offset = 32; @@ -765,14 +765,14 @@ test_table_hash_ext_generic(struct rte_table_ops *ops) hash_params.n_entries_ext = 1 << 4; hash_params.signature_offset = 1; table = ops->f_create(&hash_params, 0, 1); - if (table != NULL) + if (table == NULL) return -2; hash_params.signature_offset = 0; hash_params.key_offset = 1; table = ops->f_create(&hash_params, 0, 1); - if (table != NULL) + if (table == NULL) return -3; hash_params.key_offset = 32; -- 1.7.9.5
[dpdk-dev] [PATCH 1/1] table_test: renamed test_table_ACL to lowercase
Renamed function name to comply with coding standard. Signed-off-by: Maciej Gajdzica --- app/test/test_table.c |2 +- app/test/test_table_acl.c |2 +- app/test/test_table_acl.h |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/test/test_table.c b/app/test/test_table.c index de6c27d..676dab2 100644 --- a/app/test/test_table.c +++ b/app/test/test_table.c @@ -192,7 +192,7 @@ test_table(void) #ifdef RTE_LIBRTE_ACL printf("\n\n\n\nACL tests\n"); - if (test_table_ACL() < 0) + if (test_table_acl() < 0) return -1; #endif diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c index e4e9b9c..3a64e47 100644 --- a/app/test/test_table_acl.c +++ b/app/test/test_table_acl.c @@ -579,7 +579,7 @@ fail: } int -test_table_ACL(void) +test_table_acl(void) { diff --git a/app/test/test_table_acl.h b/app/test/test_table_acl.h index f57cb27..a64c3e6 100644 --- a/app/test/test_table_acl.h +++ b/app/test/test_table_acl.h @@ -32,4 +32,4 @@ */ /* Test prototypes */ -int test_table_ACL(void); +int test_table_acl(void); -- 1.7.9.5
[dpdk-dev] [PATCH v4 00/11] ip_pipeline: ip_pipeline application enhancements
This patchset enhances functionality of ip_pipeline application. New config file syntax is introduced, so parser is changed. Changed structure of the application. Now every global variable is stored in app_struct in app.h. Syntax of pipeline cli commands was changed. Implementation of cli commands for every pipeline is moved to the separate file. Changes in v2: - renamed some files - added more config files - reworked flow classification pipeline implementation - fixed some bugs Changes in v3: - fixed checkpatch errors - fixed bug with message queues - fixed bug with application log Changes in v4: - fixed build issue with gcc 5 - fixed bugs in flow classification and firewall pipelines Daniel Mrzyglod (1): ip_pipeline: added new implementation of firewall pipeline Jasvinder Singh (3): ip_pipeline: added config checks ip_pipeline: added master pipeline ip_pipeline: added new implementation of passthrough pipeline Maciej Gajdzica (6): ip_pipeline: modified init to match new params struct ip_pipeline: moved pipelines to separate folder ip_pipeline: added application thread ip_pipeline: moved config files to separate folder ip_pipeline: added new implementation of routing pipeline ip_pipeline: added new implementation of flow classification pipeline Pawel Wodkowski (1): ip_pipeline: add parsing for config files with new syntax examples/ip_pipeline/Makefile | 36 +- examples/ip_pipeline/app.h | 905 examples/ip_pipeline/cmdline.c | 1976 examples/ip_pipeline/config.c | 419 examples/ip_pipeline/config/ip_pipeline.cfg|9 + examples/ip_pipeline/config/ip_pipeline.sh |5 + examples/ip_pipeline/config/tm_profile.cfg | 105 + examples/ip_pipeline/config_check.c| 396 examples/ip_pipeline/config_parse.c| 2456 examples/ip_pipeline/config_parse_tm.c | 446 examples/ip_pipeline/cpu_core_map.c| 492 examples/ip_pipeline/cpu_core_map.h| 69 + examples/ip_pipeline/init.c| 1645 + examples/ip_pipeline/ip_pipeline.cfg | 56 - examples/ip_pipeline/ip_pipeline.sh| 18 - examples/ip_pipeline/main.c| 137 +- examples/ip_pipeline/main.h| 298 --- examples/ip_pipeline/pipeline.h| 87 + examples/ip_pipeline/pipeline/hash_func.h | 351 +++ .../ip_pipeline/pipeline/pipeline_actions_common.h | 119 + examples/ip_pipeline/pipeline/pipeline_common_be.c | 206 ++ examples/ip_pipeline/pipeline/pipeline_common_be.h | 163 ++ examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1324 +++ examples/ip_pipeline/pipeline/pipeline_common_fe.h | 228 ++ examples/ip_pipeline/pipeline/pipeline_firewall.c | 1001 examples/ip_pipeline/pipeline/pipeline_firewall.h | 63 + .../ip_pipeline/pipeline/pipeline_firewall_be.c| 740 ++ .../ip_pipeline/pipeline/pipeline_firewall_be.h| 138 ++ .../pipeline/pipeline_flow_classification.c| 2057 .../pipeline/pipeline_flow_classification.h| 105 + .../pipeline/pipeline_flow_classification_be.c | 589 + .../pipeline/pipeline_flow_classification_be.h | 140 ++ examples/ip_pipeline/pipeline/pipeline_master.c| 47 + examples/ip_pipeline/pipeline/pipeline_master.h| 41 + examples/ip_pipeline/pipeline/pipeline_master_be.c | 150 ++ examples/ip_pipeline/pipeline/pipeline_master_be.h | 41 + .../ip_pipeline/pipeline/pipeline_passthrough.c| 47 + .../ip_pipeline/pipeline/pipeline_passthrough.h| 41 + .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 772 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 41 + examples/ip_pipeline/pipeline/pipeline_routing.c | 1541 examples/ip_pipeline/pipeline/pipeline_routing.h | 99 + .../ip_pipeline/pipeline/pipeline_routing_be.c | 869 +++ .../ip_pipeline/pipeline/pipeline_routing_be.h | 230 ++ examples/ip_pipeline/pipeline_be.h | 256 ++ examples/ip_pipeline/pipeline_firewall.c | 313 --- .../ip_pipeline/pipeline_flow_classification.c | 306 --- examples/ip_pipeline/pipeline_ipv4_frag.c | 184 -- examples/ip_pipeline/pipeline_ipv4_ras.c | 181 -- examples/ip_pipeline/pipeline_passthrough.c| 213 -- examples/ip_pipeline/pipeline_routing.c| 474 examples/ip_pipeline/pipeline_rx.c | 385 --- examples/ip_pipeline/pipeline_tx.c | 283 --- examples/ip_pipeline/thread.c | 110 + 54 files changed, 17732 insertions(+), 5671 deletions(-) create mode 100644 examples/ip_pipeline/app.h delete mode 100644 examples/ip_pipeline/cmdline.c delete mode
[dpdk-dev] [PATCH v4 01/11] ip_pipeline: add parsing for config files with new syntax
From: Pawel Wodkowski New syntax of config files is needed for ip_pipeline example enhancements. Some old files are temporarily disabled in the Makefile. It is part of a bigger change. Signed-off-by: Pawel Wodkowski --- examples/ip_pipeline/Makefile | 17 +- examples/ip_pipeline/app.h | 905 examples/ip_pipeline/config.c | 419 -- examples/ip_pipeline/config_parse.c| 2456 examples/ip_pipeline/config_parse_tm.c | 446 ++ examples/ip_pipeline/cpu_core_map.c| 492 +++ examples/ip_pipeline/cpu_core_map.h| 69 + examples/ip_pipeline/main.c| 130 +- examples/ip_pipeline/main.h| 298 examples/ip_pipeline/pipeline.h| 87 ++ examples/ip_pipeline/pipeline_be.h | 256 11 files changed, 4722 insertions(+), 853 deletions(-) create mode 100644 examples/ip_pipeline/app.h delete mode 100644 examples/ip_pipeline/config.c create mode 100644 examples/ip_pipeline/config_parse.c create mode 100644 examples/ip_pipeline/config_parse_tm.c create mode 100644 examples/ip_pipeline/cpu_core_map.c create mode 100644 examples/ip_pipeline/cpu_core_map.h delete mode 100644 examples/ip_pipeline/main.h create mode 100644 examples/ip_pipeline/pipeline.h create mode 100644 examples/ip_pipeline/pipeline_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index e70fdc7..b0feb4f 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -43,20 +43,9 @@ APP = ip_pipeline # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cmdline.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_rx.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_tx.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_frag.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_ras.c - -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c -endif +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h new file mode 100644 index 000..112473a --- /dev/null +++ b/examples/ip_pipeline/app.h @@ -0,0 +1,905 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __INCLUDE_APP_H__ +#define __INCLUDE_APP_H__ + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "cpu_core_map.h" +#include "pipeline.h" + +#define APP_PARAM_NAME_SIZE PIPELINE_NAME_SIZE + +struct app_mempool_params { + char *name; + uint32_t parsed; + uint32_t buffer_size; + uint32_t pool_size; + uint32_t cache_size; + uint32_t cpu_socket_id; +}; + +struct app_link_params { + char *name; + uint32_t parsed; + uint32_t pmd
[dpdk-dev] [PATCH v4 02/11] ip_pipeline: added config checks
From: Jasvinder Singh After loading configuration from a file, data integrity is checked. Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/config_check.c | 396 +++ examples/ip_pipeline/main.c |2 + 3 files changed, 399 insertions(+) create mode 100644 examples/ip_pipeline/config_check.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index b0feb4f..bc50e71 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -45,6 +45,7 @@ APP = ip_pipeline SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 diff --git a/examples/ip_pipeline/config_check.c b/examples/ip_pipeline/config_check.c new file mode 100644 index 000..2218238 --- /dev/null +++ b/examples/ip_pipeline/config_check.c @@ -0,0 +1,396 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "app.h" + +static void +check_mempools(struct app_params *app) +{ + uint32_t i; + + for (i = 0; i < app->n_mempools; i++) { + struct app_mempool_params *p = &app->mempool_params[i]; + + APP_CHECK((p->pool_size > 0), + "Mempool %s size is 0\n", p->name); + + APP_CHECK((p->cache_size > 0), + "Mempool %s cache size is 0\n", p->name); + + APP_CHECK(rte_is_power_of_2(p->cache_size), + "Mempool %s cache size not a power of 2\n", p->name); + } +} + +static void +check_links(struct app_params *app) +{ + uint32_t i; + + /* Check that number of links matches the port mask */ + APP_CHECK((app->n_links == __builtin_popcountll(app->port_mask)), + "Not enough links provided in the PORT_MASK\n"); + + for (i = 0; i < app->n_links; i++) { + struct app_link_params *link = &app->link_params[i]; + uint32_t rxq_max, n_rxq, n_txq, link_id, i; + + APP_PARAM_GET_ID(link, "LINK", link_id); + + /* Check that link RXQs are contiguous */ + rxq_max = 0; + if (link->arp_q > rxq_max) + rxq_max = link->arp_q; + if (link->tcp_syn_local_q > rxq_max) + rxq_max = link->tcp_syn_local_q; + if (link->ip_local_q > rxq_max) + rxq_max = link->ip_local_q; + if (link->tcp_local_q > rxq_max) + rxq_max = link->tcp_local_q; + if (link->udp_local_q > rxq_max) + rxq_max = link->udp_local_q; + if (link->sctp_local_q > rxq_max) + rxq_max = link->sctp_local_q; + + for (i = 1; i <= rxq_max; i++) + APP_CHECK(((link->arp_q == i) || + (link->tcp_syn_local_q == i) || + (link->ip_local_q == i) || + (link->tcp_local_q == i) || + (link->udp_local_q == i) || +
[dpdk-dev] [PATCH v4 03/11] ip_pipeline: modified init to match new params struct
After changes in config parser, app params struct is changed and requires modifications in initialization procedures. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/init.c | 1632 ++--- examples/ip_pipeline/main.c |3 + 3 files changed, 1203 insertions(+), 433 deletions(-) diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index bc50e71..59bea5b 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -46,6 +46,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index d79762f..8e8b290 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,561 +32,1327 @@ */ #include -#include -#include -#include -#include #include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include - -#include "main.h" - -#define NA APP_SWQ_INVALID - -struct app_params app = { - /* CPU cores */ - .cores = { - {0, APP_CORE_MASTER, {15, 16, 17, NA, NA, NA, NA, NA}, - {12, 13, 14, NA, NA, NA, NA, NA} }, - {0, APP_CORE_RX, {NA, NA, NA, NA, NA, NA, NA, 12}, - { 0, 1, 2, 3, NA, NA, NA, 15} }, - {0, APP_CORE_FC, { 0, 1, 2, 3, NA, NA, NA, 13}, - { 4, 5, 6, 7, NA, NA, NA, 16} }, - {0, APP_CORE_RT, { 4, 5, 6, 7, NA, NA, NA, 14}, - { 8, 9, 10, 11, NA, NA, NA, 17} }, - {0, APP_CORE_TX, { 8, 9, 10, 11, NA, NA, NA, NA}, - {NA, NA, NA, NA, NA, NA, NA, NA} }, - }, - - /* Ports*/ - .n_ports = APP_MAX_PORTS, - .rsz_hwq_rx = 128, - .rsz_hwq_tx = 512, - .bsz_hwq_rd = 64, - .bsz_hwq_wr = 64, - - .port_conf = { - .rxmode = { - .split_hdr_size = 0, - .header_split = 0, /* Header Split disabled */ - .hw_ip_checksum = 1, /* IP checksum offload enabled */ - .hw_vlan_filter = 0, /* VLAN filtering disabled */ - .jumbo_frame= 1, /* Jumbo Frame Support enabled */ - .max_rx_pkt_len = 9000, /* Jumbo Frame MAC pkt length */ - .hw_strip_crc = 0, /* CRC stripped by hardware */ - }, - .rx_adv_conf = { - .rss_conf = { - .rss_key = NULL, - .rss_hf = ETH_RSS_IP, - }, - }, - .txmode = { - .mq_mode = ETH_MQ_TX_NONE, - }, - }, - - .rx_conf = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, - .rx_free_thresh = 64, - .rx_drop_en = 0, - }, - - .tx_conf = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, - }, - - /* SWQs */ - .rsz_swq = 128, - .bsz_swq_rd = 64, - .bsz_swq_wr = 64, - - /* Buffer pool */ - .pool_buffer_size = RTE_MBUF_DEFAULT_BUF_SIZE, - .pool_size = 32 * 1024, - .pool_cache_size = 256, - - /* Message buffer pool */ - .msg_pool_buffer_size = 256, - .msg_pool_size = 1024, - .msg_pool_cache_size = 64, - - /* Rule tables */ - .max_arp_rules = 1 << 10, - .max_firewall_rules = 1 << 5, - .max_routing_rules = 1 << 24, - .max_flow_rules = 1 << 24, - - /* Application processing */ - .ether_hdr_pop_push = 0, -}; - -struct app_core_params * -app_get_core_params(uint32_t core_id) -{ - uint32_t i; +#include +#include - for (i = 0; i < RTE_MAX
[dpdk-dev] [PATCH v4 04/11] ip_pipeline: moved pipelines to separate folder
Moved pipelines to separate folder, removed not needed pipelines and modified Makefile to match that change. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |9 +- examples/ip_pipeline/pipeline/pipeline_firewall.c | 313 + .../pipeline/pipeline_flow_classification.c| 306 + .../ip_pipeline/pipeline/pipeline_passthrough.c| 213 + examples/ip_pipeline/pipeline/pipeline_routing.c | 474 examples/ip_pipeline/pipeline_firewall.c | 313 - .../ip_pipeline/pipeline_flow_classification.c | 306 - examples/ip_pipeline/pipeline_ipv4_frag.c | 184 examples/ip_pipeline/pipeline_ipv4_ras.c | 181 examples/ip_pipeline/pipeline_passthrough.c| 213 - examples/ip_pipeline/pipeline_routing.c| 474 examples/ip_pipeline/pipeline_rx.c | 385 examples/ip_pipeline/pipeline_tx.c | 283 13 files changed, 1314 insertions(+), 2340 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.c delete mode 100644 examples/ip_pipeline/pipeline_firewall.c delete mode 100644 examples/ip_pipeline/pipeline_flow_classification.c delete mode 100644 examples/ip_pipeline/pipeline_ipv4_frag.c delete mode 100644 examples/ip_pipeline/pipeline_ipv4_ras.c delete mode 100644 examples/ip_pipeline/pipeline_passthrough.c delete mode 100644 examples/ip_pipeline/pipeline_routing.c delete mode 100644 examples/ip_pipeline/pipeline_rx.c delete mode 100644 examples/ip_pipeline/pipeline_tx.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 59bea5b..213e879 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -36,11 +36,17 @@ endif # Default target, can be overridden by command line or environment RTE_TARGET ?= x86_64-native-linuxapp-gcc +DIRS-(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline + include $(RTE_SDK)/mk/rte.vars.mk # binary name APP = ip_pipeline +VPATH += $(SRCDIR)/pipeline + +INC += $(wildcard *.h) $(wildcard pipeline/*.h) + # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c @@ -49,7 +55,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c +CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 -CFLAGS += $(WERROR_FLAGS) +CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable include $(RTE_SDK)/mk/rte.extapp.mk diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c b/examples/ip_pipeline/pipeline/pipeline_firewall.c new file mode 100644 index 000..b70260e --- /dev/null +++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c @@ -0,0 +1,313 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include
[dpdk-dev] [PATCH v4 05/11] ip_pipeline: added master pipeline
From: Jasvinder Singh Master pipeline is responsible for command line handling and communicationg with all other pipelines via message queues. Removed cmdline.c file, as its functionality will be split over multiple pipeline files. Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |5 + examples/ip_pipeline/cmdline.c | 1976 examples/ip_pipeline/init.c|5 + examples/ip_pipeline/pipeline/pipeline_common_be.c | 206 ++ examples/ip_pipeline/pipeline/pipeline_common_be.h | 163 ++ examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1324 + examples/ip_pipeline/pipeline/pipeline_common_fe.h | 228 +++ examples/ip_pipeline/pipeline/pipeline_master.c| 47 + examples/ip_pipeline/pipeline/pipeline_master.h| 41 + examples/ip_pipeline/pipeline/pipeline_master_be.c | 150 ++ examples/ip_pipeline/pipeline/pipeline_master_be.h | 41 + 11 files changed, 2210 insertions(+), 1976 deletions(-) delete mode 100644 examples/ip_pipeline/cmdline.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_master.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_master.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 213e879..9ce80a8 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -55,6 +55,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_fe.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c + CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable diff --git a/examples/ip_pipeline/cmdline.c b/examples/ip_pipeline/cmdline.c deleted file mode 100644 index 3173fd0..000 --- a/examples/ip_pipeline/cmdline.c +++ /dev/null @@ -1,1976 +0,0 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "main.h" - -#define IS_RULE_PRESENT(res, rule_key, table, type)\ -do { \ - struct app_rule *it;\ - \ - (res) = NULL; \ - TAILQ_FOREACH(it, &table, entries) {\
[dpdk-dev] [PATCH v4 06/11] ip_pipeline: added application thread
Application thread runs pipelines on assigned cores. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/main.c |6 +++ examples/ip_pipeline/thread.c | 110 + 3 files changed, 117 insertions(+) create mode 100644 examples/ip_pipeline/thread.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 9ce80a8..f255338 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -53,6 +53,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += thread.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c diff --git a/examples/ip_pipeline/main.c b/examples/ip_pipeline/main.c index ef68c86..862e2f2 100644 --- a/examples/ip_pipeline/main.c +++ b/examples/ip_pipeline/main.c @@ -52,5 +52,11 @@ main(int argc, char **argv) /* Init */ app_init(&app); + /* Run-time */ + rte_eal_mp_remote_launch( + app_thread, + (void *) &app, + CALL_MASTER); + return 0; } diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c new file mode 100644 index 000..b2a8656 --- /dev/null +++ b/examples/ip_pipeline/thread.c @@ -0,0 +1,110 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include "pipeline_common_be.h" +#include "app.h" + +int app_thread(void *arg) +{ + struct app_params *app = (struct app_params *) arg; + uint32_t core_id = rte_lcore_id(), i, j; + struct app_thread_data *t = &app->thread_data[core_id]; + uint32_t n_regular = RTE_MIN(t->n_regular, RTE_DIM(t->regular)); + uint32_t n_custom = RTE_MIN(t->n_custom, RTE_DIM(t->custom)); + + for (i = 0; ; i++) { + /* Run regular pipelines */ + for (j = 0; j < n_regular; j++) { + struct app_thread_pipeline_data *data = &t->regular[j]; + struct pipeline *p = data->be; + + rte_pipeline_run(p->p); + } + + /* Run custom pipelines */ + for (j = 0; j < n_custom; j++) { + struct app_thread_pipeline_data *data = &t->custom[j]; + + data->f_run(data->be); + } + + /* Timer */ + if ((i & 0xF) == 0) { + uint64_t time = rte_get_tsc_cycles(); + uint64_t t_deadline = UINT64_MAX; + + if (time < t->deadline) + continue; + + /* Timer for regular pipelines */ + for (j = 0; j < n_regular; j++) { + struct app_thread_pipeline_data *data = + &t->regular[j]; + uint64_t p_deadline = data->deadline; + +
[dpdk-dev] [PATCH v4 07/11] ip_pipeline: moved config files to separate folder
Created new folder for config(.cfg) and script(.sh) files. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/config/ip_pipeline.cfg |9 +++ examples/ip_pipeline/config/ip_pipeline.sh |5 ++ examples/ip_pipeline/config/tm_profile.cfg | 105 +++ examples/ip_pipeline/ip_pipeline.cfg| 56 -- examples/ip_pipeline/ip_pipeline.sh | 18 - 5 files changed, 119 insertions(+), 74 deletions(-) create mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg create mode 100644 examples/ip_pipeline/config/ip_pipeline.sh create mode 100644 examples/ip_pipeline/config/tm_profile.cfg delete mode 100644 examples/ip_pipeline/ip_pipeline.cfg delete mode 100644 examples/ip_pipeline/ip_pipeline.sh diff --git a/examples/ip_pipeline/config/ip_pipeline.cfg b/examples/ip_pipeline/config/ip_pipeline.cfg new file mode 100644 index 000..095ed25 --- /dev/null +++ b/examples/ip_pipeline/config/ip_pipeline.cfg @@ -0,0 +1,9 @@ +[PIPELINE0] +type = MASTER +core = 0 + +[PIPELINE1] +type = PASS-THROUGH +core = 1 +pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0 +pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0 diff --git a/examples/ip_pipeline/config/ip_pipeline.sh b/examples/ip_pipeline/config/ip_pipeline.sh new file mode 100644 index 000..4fca259 --- /dev/null +++ b/examples/ip_pipeline/config/ip_pipeline.sh @@ -0,0 +1,5 @@ +# +#run config/ip_pipeline.sh +# + +p 1 ping diff --git a/examples/ip_pipeline/config/tm_profile.cfg b/examples/ip_pipeline/config/tm_profile.cfg new file mode 100644 index 000..53edb67 --- /dev/null +++ b/examples/ip_pipeline/config/tm_profile.cfg @@ -0,0 +1,105 @@ +; BSD LICENSE +; +; Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +; All rights reserved. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; +; * Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; * Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in +; the documentation and/or other materials provided with the +; distribution. +; * Neither the name of Intel Corporation nor the names of its +; contributors may be used to endorse or promote products derived +; from this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +; This file enables the following hierarchical scheduler configuration for each +; 10GbE output port: +; * Single subport (subport 0): +; - Subport rate set to 100% of port rate +; - Each of the 4 traffic classes has rate set to 100% of port rate +; * 4K pipes per subport 0 (pipes 0 .. 4095) with identical configuration: +; - Pipe rate set to 1/4K of port rate +; - Each of the 4 traffic classes has rate set to 100% of pipe rate +; - Within each traffic class, the byte-level WRR weights for the 4 queues +; are set to 1:1:1:1 +; +; For more details, please refer to chapter "Quality of Service (QoS) Framework" +; of Intel Data Plane Development Kit (Intel DPDK) Programmer's Guide. + +; Port configuration +[port] +frame overhead = 24 ; frame overhead = Preamble (7) + SFD (1) + FCS (4) + IFG (12) +mtu = 1522; mtu = Q-in-Q MTU (FCS not included) +number of subports per port = 1 +number of pipes per subport = 4096 +queue sizes = 64 64 64 64 + +; Subport configuration +[subport 0] +tb rate = 125000 ; Bytes per second +tb size = 100 ; Bytes + +tc 0 rate = 125000 ; Bytes per second +tc 1 rate = 125000 ; Bytes per second +tc 2 rate = 125000 ; Bytes per second +tc 3 rate = 125000 ; Bytes per second +tc period = 10 ; Milliseconds + +pipe 0-4095 = 0; These pipes are configured with pipe profile 0 + +; Pipe configuration +[pipe profile 0] +tb rate = 305175 ; Bytes per second +tb size = 100
[dpdk-dev] [PATCH v4 08/11] ip_pipeline: added new implementation of passthrough pipeline
From: Jasvinder Singh Passthrough pipeline implementation is split to two files. pipeline_passthrough.c file handles front-end functions (cli commands parsing) pipeline_passthrough_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/hash_func.h | 351 + .../ip_pipeline/pipeline/pipeline_actions_common.h | 119 +++ .../ip_pipeline/pipeline/pipeline_passthrough.c| 192 + .../ip_pipeline/pipeline/pipeline_passthrough.h| 41 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 772 .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 41 ++ 8 files changed, 1341 insertions(+), 179 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/hash_func.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_actions_common.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index f255338..930dc61 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -60,6 +60,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_fe.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index fac2e9a..6cffbc6 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -45,6 +45,7 @@ #include "pipeline.h" #include "pipeline_common_fe.h" #include "pipeline_master.h" +#include "pipeline_passthrough.h" #define APP_NAME_SIZE 32 @@ -1270,6 +1271,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); + app_pipeline_type_register(app, &pipeline_passthrough); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/hash_func.h b/examples/ip_pipeline/pipeline/hash_func.h new file mode 100644 index 000..7846300 --- /dev/null +++ b/examples/ip_pipeline/pipeline/hash_func.h @@ -0,0 +1,351 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __INCLUDE_HASH_FUNC_H__ +#define __INCLUDE_HASH_FUNC_H__ + +static inline uint64_t +hash_xor_key8(void *key, __rte_unused uint32_t key_size, uint64_t seed) +{ + uint64_t *k = key; + uint64_t xor0; + + xor0 = seed ^ k[0]; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +hash_xor_key16(void *key, __rte_unused uint32_t key_size, uint64_t seed) +{ + uint64_t *k = key; + uint64_t xor0; + + xor0 = (k[0] ^ seed) ^ k[1]; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +hash_xor_key24(void *
[dpdk-dev] [PATCH v4 09/11] ip_pipeline: added new implementation of firewall pipeline
From: Daniel Mrzyglod Firewall pipeline implementation is split to two files. pipeline_firewall.c file handles front-end functions (cli commands parsing) pipeline_firewall_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Daniel Mrzyglod --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/pipeline_firewall.c | 1162 examples/ip_pipeline/pipeline/pipeline_firewall.h | 63 ++ .../ip_pipeline/pipeline/pipeline_firewall_be.c| 740 + .../ip_pipeline/pipeline/pipeline_firewall_be.h| 138 +++ 6 files changed, 1870 insertions(+), 237 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 930dc61..382fee6 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -62,6 +62,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 6cffbc6..632d429 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -46,6 +46,7 @@ #include "pipeline_common_fe.h" #include "pipeline_master.h" #include "pipeline_passthrough.h" +#include "pipeline_firewall.h" #define APP_NAME_SIZE 32 @@ -1272,6 +1273,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); + app_pipeline_type_register(app, &pipeline_firewall); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c b/examples/ip_pipeline/pipeline/pipeline_firewall.c index b70260e..40fbdc5 100644 --- a/examples/ip_pipeline/pipeline/pipeline_firewall.c +++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,282 +32,970 @@ */ #include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include + +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_firewall.h" + +struct app_pipeline_firewall_rule { + struct pipeline_firewall_key key; + int32_t priority; + uint32_t port_id; + void *entry_ptr; + + TAILQ_ENTRY(app_pipeline_firewall_rule) node; +}; + +struct app_pipeline_firewall { + /* parameters */ + uint32_t n_ports_in; + uint32_t n_ports_out; + + /* rules */ + TAILQ_HEAD(, app_pipeline_firewall_rule) rules; + uint32_t n_rules; + uint32_t default_rule_present; + uint32_t default_rule_port_id; + void *default_rule_entry_ptr; +}; -#include -#include -#include +static void +print_firewall_ipv4_rule(struct app_pipeline_firewall_rule *rule) +{ + printf("Prio = %d (SA = %u.%u.%u.%u/%u, " + "DA = %u.%u.%u.%u/%u, " + "SP = %u-%u, " + "DP = %u-%u, " + "Proto = %u / 0x%x) => " + "Port = %u (entry ptr = %p)\n", + + rule->priority, + + (rule->key.key.ipv4_5tuple.src_ip >> 24) & 0xFF, + (rule->key.key.ipv4_5tuple.src_ip >> 16) & 0xFF, + (rule->key.key.ipv4_5tuple.src_ip >> 8) & 0xFF, + rule->key.key.ipv4_5tuple.src_ip & 0xFF, + rule->key.key.ipv4_5tuple.src_ip_mask, + + (rule->key.key.ipv4_5tuple.dst_ip >> 24) & 0xFF, + (rule->key.key.ipv4_5tuple.dst_ip >> 16) & 0xFF, + (rule->key.key.ipv4_5tuple.dst_ip >> 8) & 0xFF, + rule->key.key.ipv4_5tuple.dst_ip & 0xFF, + rule->key.key.ipv4_5tuple.dst_ip_mask, + + rule->key.key.ipv4_5tuple.src_port_from, + rule->key.key.ipv4_5tuple.src_port_to, + + rule->key.key.ipv4_5tuple.dst_port_from, + rule->key.key.ipv4_5tuple.dst_port_to, + + rule->key.key.ipv4_5tuple.
[dpdk-dev] [PATCH v4 10/11] ip_pipeline: added new implementation of routing pipeline
Routing pipeline implementation is split to two files. pipeline_routing.c file handles front-end functions (cli commands parsing) pipeline_routing_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Pawel Wodkowski --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/pipeline_routing.c | 1783 examples/ip_pipeline/pipeline/pipeline_routing.h | 99 ++ .../ip_pipeline/pipeline/pipeline_routing_be.c | 869 ++ .../ip_pipeline/pipeline/pipeline_routing_be.h | 230 +++ 6 files changed, 2627 insertions(+), 358 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 382fee6..a2881a6 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -64,6 +64,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 632d429..63db23c 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -47,6 +47,7 @@ #include "pipeline_master.h" #include "pipeline_passthrough.h" #include "pipeline_firewall.h" +#include "pipeline_routing.h" #define APP_NAME_SIZE 32 @@ -1274,6 +1275,7 @@ int app_init(struct app_params *app) app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); app_pipeline_type_register(app, &pipeline_firewall); + app_pipeline_type_register(app, &pipeline_routing); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/pipeline_routing.c b/examples/ip_pipeline/pipeline/pipeline_routing.c index b1ce624..2415aa2 100644 --- a/examples/ip_pipeline/pipeline/pipeline_routing.c +++ b/examples/ip_pipeline/pipeline/pipeline_routing.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,444 +31,1511 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include +#include +#include +#include +#include +#include -#include -#include -#include -#include -#include -#include +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_routing.h" -#include -#include -#include -#include +struct app_pipeline_routing_route { + struct pipeline_routing_route_key key; + struct app_pipeline_routing_route_params params; + void *entry_ptr; -#include "main.h" + TAILQ_ENTRY(app_pipeline_routing_route) node; +}; -#include +struct app_pipeline_routing_arp_entry { + struct pipeline_routing_arp_key key; + struct ether_addr macaddr; + void *entry_ptr; -struct app_routing_table_entry { - struct rte_pipeline_table_entry head; - uint32_t nh_ip; - uint32_t nh_iface; + TAILQ_ENTRY(app_pipeline_routing_arp_entry) node; }; -struct app_arp_table_entry { - struct rte_pipeline_table_entry head; - struct ether_addr nh_arp; +struct pipeline_routing { + /* Parameters */ + uint32_t n_ports_in; + uint32_t n_ports_out; + + /* Routes */ + TAILQ_HEAD(, app_pipeline_routing_route) routes; + uint32_t n_routes; + + uint32_t default_route_present; + uint32_t default_route_port_id; + void *default_route_entry_ptr; + + /* ARP entries */ + TAILQ_HEAD(, app_pipeline_routing_arp_entry) arp_entries; + uint32_t n_arp_entries; + + uint32_t default_arp_entry_present; + uint32_t default_arp_entry_port_id; + void *default_arp_entry_ptr; }; -static inline void -app_routing_table_write_metadata( - struct rte_mbuf *pkt, - struct app_routing_table_entry *entry) +static void * +pipeline_routing_init(struct pipeline_params *params, + __rte_unused void *arg) { - struct app_pkt_metadata *c = - (struct app_pkt_metadata *) RTE_MBUF_METADATA_UINT8_PTR(pkt, 0); + struct pipeline_routing *p; + uint32_t size; + + /* Check input arguments */ + if ((params == NULL) || + (params->n_por
[dpdk-dev] [PATCH v4 11/11] ip_pipeline: added new implementation of flow classification pipeline
Flow classification pipeline implementation is split to two files. pipeline_flow_classification.c file handles front-end functions (cli commands parsing) pipeline_flow_classification_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + .../pipeline/pipeline_flow_classification.c| 2205 ++-- .../pipeline/pipeline_flow_classification.h| 105 + .../pipeline/pipeline_flow_classification_be.c | 589 ++ .../pipeline/pipeline_flow_classification_be.h | 140 ++ 6 files changed, 2816 insertions(+), 227 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index a2881a6..f3ff1ec 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -64,6 +64,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 63db23c..431b69e 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -47,6 +47,7 @@ #include "pipeline_master.h" #include "pipeline_passthrough.h" #include "pipeline_firewall.h" +#include "pipeline_flow_classification.h" #include "pipeline_routing.h" #define APP_NAME_SIZE 32 @@ -1274,6 +1275,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); + app_pipeline_type_register(app, &pipeline_flow_classification); app_pipeline_type_register(app, &pipeline_firewall); app_pipeline_type_register(app, &pipeline_routing); diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c index cc0cbf1..c3926fa 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,275 +32,2026 @@ */ #include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -#include -#include -#include +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_flow_classification.h" +#include "hash_func.h" -#include "main.h" +/* + * Key conversion + */ + +struct pkt_key_qinq { + uint16_t ethertype_svlan; + uint16_t svlan; + uint16_t ethertype_cvlan; + uint16_t cvlan; +} __attribute__((__packed__)); + +struct pkt_key_ipv4_5tuple { + uint8_t ttl; + uint8_t proto; + uint16_t checksum; + uint32_t ip_src; + uint32_t ip_dst; + uint16_t port_src; + uint16_t port_dst; +} __attribute__((__packed__)); + +struct pkt_key_ipv6_5tuple { + uint16_t payload_length; + uint8_t proto; + uint8_t hop_limit; + uint8_t ip_src[16]; + uint8_t ip_dst[16]; + uint16_t port_src; + uint16_t port_dst; +} __attribute__((__packed__)); + +static int +app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, + uint8_t *key_out, + uint32_t *signature) +{ + uint8_t buffer[PIPELINE_FC_FLOW_KEY_MAX_SIZE]; + void *key_buffer = (key_out) ? key_out : buffer; + + switch (key_in->type) { + case FLOW_KEY_QINQ: + { + struct pkt_key_qinq *qinq = key_buffer; + + qinq->ethertype_svlan = 0; + qinq->svlan = rte_bswap16(key_in->key.qinq.svlan); + qinq->ethertype_cvlan = 0; + qinq->cvlan = rte_bswap16(key_in->key.qinq.cvlan); + + if (signature) +
[dpdk-dev] [PATCH v5 00/11] ip_pipeline: ip_pipeline application enhancements
This patchset enhances functionality of ip_pipeline application. New config file syntax is introduced, so parser is changed. Changed structure of the application. Now every global variable is stored in app_struct in app.h. Syntax of pipeline cli commands was changed. Implementation of cli commands for every pipeline is moved to the separate file. Changes in v2: - renamed some files - added more config files - reworked flow classification pipeline implementation - fixed some bugs Changes in v3: - fixed checkpatch errors - fixed bug with message queues - fixed bug with application log Changes in v4: - fixed build issue with gcc 5 - fixed bugs in flow classification and firewall pipelines Changes in v5: - fixed build issue with clang 3.6 Daniel Mrzyglod (1): ip_pipeline: added new implementation of firewall pipeline Jasvinder Singh (3): ip_pipeline: added config checks ip_pipeline: added master pipeline ip_pipeline: added new implementation of passthrough pipeline Maciej Gajdzica (6): ip_pipeline: modified init to match new params struct ip_pipeline: moved pipelines to separate folder ip_pipeline: added application thread ip_pipeline: moved config files to separate folder ip_pipeline: added new implementation of routing pipeline ip_pipeline: added new implementation of flow classification pipeline Pawel Wodkowski (1): ip_pipeline: add parsing for config files with new syntax examples/ip_pipeline/Makefile | 36 +- examples/ip_pipeline/app.h | 905 examples/ip_pipeline/cmdline.c | 1976 examples/ip_pipeline/config.c | 419 examples/ip_pipeline/config/ip_pipeline.cfg|9 + examples/ip_pipeline/config/ip_pipeline.sh |5 + examples/ip_pipeline/config/tm_profile.cfg | 105 + examples/ip_pipeline/config_check.c| 397 examples/ip_pipeline/config_parse.c| 2456 examples/ip_pipeline/config_parse_tm.c | 446 examples/ip_pipeline/cpu_core_map.c| 492 examples/ip_pipeline/cpu_core_map.h| 69 + examples/ip_pipeline/init.c| 1612 + examples/ip_pipeline/ip_pipeline.cfg | 56 - examples/ip_pipeline/ip_pipeline.sh| 18 - examples/ip_pipeline/main.c| 137 +- examples/ip_pipeline/main.h| 298 --- examples/ip_pipeline/pipeline.h| 87 + examples/ip_pipeline/pipeline/hash_func.h | 351 +++ .../ip_pipeline/pipeline/pipeline_actions_common.h | 119 + examples/ip_pipeline/pipeline/pipeline_common_be.c | 206 ++ examples/ip_pipeline/pipeline/pipeline_common_be.h | 163 ++ examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1324 +++ examples/ip_pipeline/pipeline/pipeline_common_fe.h | 228 ++ examples/ip_pipeline/pipeline/pipeline_firewall.c | 1001 examples/ip_pipeline/pipeline/pipeline_firewall.h | 63 + .../ip_pipeline/pipeline/pipeline_firewall_be.c| 740 ++ .../ip_pipeline/pipeline/pipeline_firewall_be.h| 138 ++ .../pipeline/pipeline_flow_classification.c| 2057 .../pipeline/pipeline_flow_classification.h| 105 + .../pipeline/pipeline_flow_classification_be.c | 589 + .../pipeline/pipeline_flow_classification_be.h | 140 ++ examples/ip_pipeline/pipeline/pipeline_master.c| 47 + examples/ip_pipeline/pipeline/pipeline_master.h| 41 + examples/ip_pipeline/pipeline/pipeline_master_be.c | 150 ++ examples/ip_pipeline/pipeline/pipeline_master_be.h | 41 + .../ip_pipeline/pipeline/pipeline_passthrough.c| 47 + .../ip_pipeline/pipeline/pipeline_passthrough.h| 41 + .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 772 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 41 + examples/ip_pipeline/pipeline/pipeline_routing.c | 1541 examples/ip_pipeline/pipeline/pipeline_routing.h | 99 + .../ip_pipeline/pipeline/pipeline_routing_be.c | 869 +++ .../ip_pipeline/pipeline/pipeline_routing_be.h | 230 ++ examples/ip_pipeline/pipeline_be.h | 256 ++ examples/ip_pipeline/pipeline_firewall.c | 313 --- .../ip_pipeline/pipeline_flow_classification.c | 306 --- examples/ip_pipeline/pipeline_ipv4_frag.c | 184 -- examples/ip_pipeline/pipeline_ipv4_ras.c | 181 -- examples/ip_pipeline/pipeline_passthrough.c| 213 -- examples/ip_pipeline/pipeline_routing.c| 474 examples/ip_pipeline/pipeline_rx.c | 385 --- examples/ip_pipeline/pipeline_tx.c | 283 --- examples/ip_pipeline/thread.c | 110 + 54 files changed, 17702 insertions(+), 5669 deletions(-) create mode 100644 examples/ip_pipeline/app.h delete mode
[dpdk-dev] [PATCH v5 01/11] ip_pipeline: add parsing for config files with new syntax
From: Pawel Wodkowski New syntax of config files is needed for ip_pipeline example enhancements. Some old files are temporarily disabled in the Makefile. It is part of a bigger change. Signed-off-by: Pawel Wodkowski --- examples/ip_pipeline/Makefile | 17 +- examples/ip_pipeline/app.h | 905 examples/ip_pipeline/config.c | 419 -- examples/ip_pipeline/config_parse.c| 2456 examples/ip_pipeline/config_parse_tm.c | 446 ++ examples/ip_pipeline/cpu_core_map.c| 492 +++ examples/ip_pipeline/cpu_core_map.h| 69 + examples/ip_pipeline/main.c| 130 +- examples/ip_pipeline/main.h| 298 examples/ip_pipeline/pipeline.h| 87 ++ examples/ip_pipeline/pipeline_be.h | 256 11 files changed, 4722 insertions(+), 853 deletions(-) create mode 100644 examples/ip_pipeline/app.h delete mode 100644 examples/ip_pipeline/config.c create mode 100644 examples/ip_pipeline/config_parse.c create mode 100644 examples/ip_pipeline/config_parse_tm.c create mode 100644 examples/ip_pipeline/cpu_core_map.c create mode 100644 examples/ip_pipeline/cpu_core_map.h delete mode 100644 examples/ip_pipeline/main.h create mode 100644 examples/ip_pipeline/pipeline.h create mode 100644 examples/ip_pipeline/pipeline_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index e70fdc7..b0feb4f 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -43,20 +43,9 @@ APP = ip_pipeline # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cmdline.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_rx.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_tx.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_frag.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_ras.c - -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c -endif +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h new file mode 100644 index 000..112473a --- /dev/null +++ b/examples/ip_pipeline/app.h @@ -0,0 +1,905 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __INCLUDE_APP_H__ +#define __INCLUDE_APP_H__ + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "cpu_core_map.h" +#include "pipeline.h" + +#define APP_PARAM_NAME_SIZE PIPELINE_NAME_SIZE + +struct app_mempool_params { + char *name; + uint32_t parsed; + uint32_t buffer_size; + uint32_t pool_size; + uint32_t cache_size; + uint32_t cpu_socket_id; +}; + +struct app_link_params { + char *name; + uint32_t parsed; + uint32_t pmd
[dpdk-dev] [PATCH v5 02/11] ip_pipeline: added config checks
From: Jasvinder Singh After loading configuration from a file, data integrity is checked. Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/config_check.c | 397 +++ examples/ip_pipeline/main.c |2 + 3 files changed, 400 insertions(+) create mode 100644 examples/ip_pipeline/config_check.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index b0feb4f..bc50e71 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -45,6 +45,7 @@ APP = ip_pipeline SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 diff --git a/examples/ip_pipeline/config_check.c b/examples/ip_pipeline/config_check.c new file mode 100644 index 000..b5fb7d8 --- /dev/null +++ b/examples/ip_pipeline/config_check.c @@ -0,0 +1,397 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "app.h" + +static void +check_mempools(struct app_params *app) +{ + uint32_t i; + + for (i = 0; i < app->n_mempools; i++) { + struct app_mempool_params *p = &app->mempool_params[i]; + + APP_CHECK((p->pool_size > 0), + "Mempool %s size is 0\n", p->name); + + APP_CHECK((p->cache_size > 0), + "Mempool %s cache size is 0\n", p->name); + + APP_CHECK(rte_is_power_of_2(p->cache_size), + "Mempool %s cache size not a power of 2\n", p->name); + } +} + +static void +check_links(struct app_params *app) +{ + uint32_t n_links_port_mask = __builtin_popcountll(app->port_mask); + uint32_t i; + + /* Check that number of links matches the port mask */ + APP_CHECK((app->n_links == n_links_port_mask), + "Not enough links provided in the PORT_MASK\n"); + + for (i = 0; i < app->n_links; i++) { + struct app_link_params *link = &app->link_params[i]; + uint32_t rxq_max, n_rxq, n_txq, link_id, i; + + APP_PARAM_GET_ID(link, "LINK", link_id); + + /* Check that link RXQs are contiguous */ + rxq_max = 0; + if (link->arp_q > rxq_max) + rxq_max = link->arp_q; + if (link->tcp_syn_local_q > rxq_max) + rxq_max = link->tcp_syn_local_q; + if (link->ip_local_q > rxq_max) + rxq_max = link->ip_local_q; + if (link->tcp_local_q > rxq_max) + rxq_max = link->tcp_local_q; + if (link->udp_local_q > rxq_max) + rxq_max = link->udp_local_q; + if (link->sctp_local_q > rxq_max) + rxq_max = link->sctp_local_q; + + for (i = 1; i <= rxq_max; i++) + APP_CHECK(((link->arp_q == i) || + (link->tcp_syn_local_q == i) || + (link->ip_local_q == i) || + (link->tcp_local_q == i) || +
[dpdk-dev] [PATCH v5 03/11] ip_pipeline: modified init to match new params struct
After changes in config parser, app params struct is changed and requires modifications in initialization procedures. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/init.c | 1599 ++--- examples/ip_pipeline/main.c |3 + 3 files changed, 1172 insertions(+), 431 deletions(-) diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index bc50e71..59bea5b 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -46,6 +46,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index d79762f..3bf446f 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,561 +32,1298 @@ */ #include -#include -#include -#include -#include #include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include - -#include "main.h" - -#define NA APP_SWQ_INVALID - -struct app_params app = { - /* CPU cores */ - .cores = { - {0, APP_CORE_MASTER, {15, 16, 17, NA, NA, NA, NA, NA}, - {12, 13, 14, NA, NA, NA, NA, NA} }, - {0, APP_CORE_RX, {NA, NA, NA, NA, NA, NA, NA, 12}, - { 0, 1, 2, 3, NA, NA, NA, 15} }, - {0, APP_CORE_FC, { 0, 1, 2, 3, NA, NA, NA, 13}, - { 4, 5, 6, 7, NA, NA, NA, 16} }, - {0, APP_CORE_RT, { 4, 5, 6, 7, NA, NA, NA, 14}, - { 8, 9, 10, 11, NA, NA, NA, 17} }, - {0, APP_CORE_TX, { 8, 9, 10, 11, NA, NA, NA, NA}, - {NA, NA, NA, NA, NA, NA, NA, NA} }, - }, - - /* Ports*/ - .n_ports = APP_MAX_PORTS, - .rsz_hwq_rx = 128, - .rsz_hwq_tx = 512, - .bsz_hwq_rd = 64, - .bsz_hwq_wr = 64, - - .port_conf = { - .rxmode = { - .split_hdr_size = 0, - .header_split = 0, /* Header Split disabled */ - .hw_ip_checksum = 1, /* IP checksum offload enabled */ - .hw_vlan_filter = 0, /* VLAN filtering disabled */ - .jumbo_frame= 1, /* Jumbo Frame Support enabled */ - .max_rx_pkt_len = 9000, /* Jumbo Frame MAC pkt length */ - .hw_strip_crc = 0, /* CRC stripped by hardware */ - }, - .rx_adv_conf = { - .rss_conf = { - .rss_key = NULL, - .rss_hf = ETH_RSS_IP, - }, - }, - .txmode = { - .mq_mode = ETH_MQ_TX_NONE, - }, - }, - - .rx_conf = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, - .rx_free_thresh = 64, - .rx_drop_en = 0, - }, - - .tx_conf = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, - }, - - /* SWQs */ - .rsz_swq = 128, - .bsz_swq_rd = 64, - .bsz_swq_wr = 64, - - /* Buffer pool */ - .pool_buffer_size = RTE_MBUF_DEFAULT_BUF_SIZE, - .pool_size = 32 * 1024, - .pool_cache_size = 256, - - /* Message buffer pool */ - .msg_pool_buffer_size = 256, - .msg_pool_size = 1024, - .msg_pool_cache_size = 64, - - /* Rule tables */ - .max_arp_rules = 1 << 10, - .max_firewall_rules = 1 << 5, - .max_routing_rules = 1 << 24, - .max_flow_rules = 1 << 24, - - /* Application processing */ - .ether_hdr_pop_push = 0, -}; - -struct app_core_params * -app_get_core_params(uint32_t core_id) -{ - uint32_t i; +#include +#include - for (i = 0; i < RTE_MAX
[dpdk-dev] [PATCH v5 04/11] ip_pipeline: moved pipelines to separate folder
Moved pipelines to separate folder, removed not needed pipelines and modified Makefile to match that change. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |9 +- examples/ip_pipeline/pipeline/pipeline_firewall.c | 313 + .../pipeline/pipeline_flow_classification.c| 306 + .../ip_pipeline/pipeline/pipeline_passthrough.c| 213 + examples/ip_pipeline/pipeline/pipeline_routing.c | 474 examples/ip_pipeline/pipeline_firewall.c | 313 - .../ip_pipeline/pipeline_flow_classification.c | 306 - examples/ip_pipeline/pipeline_ipv4_frag.c | 184 examples/ip_pipeline/pipeline_ipv4_ras.c | 181 examples/ip_pipeline/pipeline_passthrough.c| 213 - examples/ip_pipeline/pipeline_routing.c| 474 examples/ip_pipeline/pipeline_rx.c | 385 examples/ip_pipeline/pipeline_tx.c | 283 13 files changed, 1314 insertions(+), 2340 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.c delete mode 100644 examples/ip_pipeline/pipeline_firewall.c delete mode 100644 examples/ip_pipeline/pipeline_flow_classification.c delete mode 100644 examples/ip_pipeline/pipeline_ipv4_frag.c delete mode 100644 examples/ip_pipeline/pipeline_ipv4_ras.c delete mode 100644 examples/ip_pipeline/pipeline_passthrough.c delete mode 100644 examples/ip_pipeline/pipeline_routing.c delete mode 100644 examples/ip_pipeline/pipeline_rx.c delete mode 100644 examples/ip_pipeline/pipeline_tx.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 59bea5b..213e879 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -36,11 +36,17 @@ endif # Default target, can be overridden by command line or environment RTE_TARGET ?= x86_64-native-linuxapp-gcc +DIRS-(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline + include $(RTE_SDK)/mk/rte.vars.mk # binary name APP = ip_pipeline +VPATH += $(SRCDIR)/pipeline + +INC += $(wildcard *.h) $(wildcard pipeline/*.h) + # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c @@ -49,7 +55,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c +CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 -CFLAGS += $(WERROR_FLAGS) +CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable include $(RTE_SDK)/mk/rte.extapp.mk diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c b/examples/ip_pipeline/pipeline/pipeline_firewall.c new file mode 100644 index 000..b70260e --- /dev/null +++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c @@ -0,0 +1,313 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include
[dpdk-dev] [PATCH v5 05/11] ip_pipeline: added master pipeline
From: Jasvinder Singh Master pipeline is responsible for command line handling and communicationg with all other pipelines via message queues. Removed cmdline.c file, as its functionality will be split over multiple pipeline files. Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |5 + examples/ip_pipeline/cmdline.c | 1976 examples/ip_pipeline/init.c|5 + examples/ip_pipeline/pipeline/pipeline_common_be.c | 206 ++ examples/ip_pipeline/pipeline/pipeline_common_be.h | 163 ++ examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1324 + examples/ip_pipeline/pipeline/pipeline_common_fe.h | 228 +++ examples/ip_pipeline/pipeline/pipeline_master.c| 47 + examples/ip_pipeline/pipeline/pipeline_master.h| 41 + examples/ip_pipeline/pipeline/pipeline_master_be.c | 150 ++ examples/ip_pipeline/pipeline/pipeline_master_be.h | 41 + 11 files changed, 2210 insertions(+), 1976 deletions(-) delete mode 100644 examples/ip_pipeline/cmdline.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_master.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_master.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 213e879..9ce80a8 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -55,6 +55,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_fe.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c + CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable diff --git a/examples/ip_pipeline/cmdline.c b/examples/ip_pipeline/cmdline.c deleted file mode 100644 index 3173fd0..000 --- a/examples/ip_pipeline/cmdline.c +++ /dev/null @@ -1,1976 +0,0 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "main.h" - -#define IS_RULE_PRESENT(res, rule_key, table, type)\ -do { \ - struct app_rule *it;\ - \ - (res) = NULL; \ - TAILQ_FOREACH(it, &table, entries) {\
[dpdk-dev] [PATCH v5 06/11] ip_pipeline: added application thread
Application thread runs pipelines on assigned cores. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/main.c |6 +++ examples/ip_pipeline/thread.c | 110 + 3 files changed, 117 insertions(+) create mode 100644 examples/ip_pipeline/thread.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 9ce80a8..f255338 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -53,6 +53,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += thread.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c diff --git a/examples/ip_pipeline/main.c b/examples/ip_pipeline/main.c index ef68c86..862e2f2 100644 --- a/examples/ip_pipeline/main.c +++ b/examples/ip_pipeline/main.c @@ -52,5 +52,11 @@ main(int argc, char **argv) /* Init */ app_init(&app); + /* Run-time */ + rte_eal_mp_remote_launch( + app_thread, + (void *) &app, + CALL_MASTER); + return 0; } diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c new file mode 100644 index 000..b2a8656 --- /dev/null +++ b/examples/ip_pipeline/thread.c @@ -0,0 +1,110 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include "pipeline_common_be.h" +#include "app.h" + +int app_thread(void *arg) +{ + struct app_params *app = (struct app_params *) arg; + uint32_t core_id = rte_lcore_id(), i, j; + struct app_thread_data *t = &app->thread_data[core_id]; + uint32_t n_regular = RTE_MIN(t->n_regular, RTE_DIM(t->regular)); + uint32_t n_custom = RTE_MIN(t->n_custom, RTE_DIM(t->custom)); + + for (i = 0; ; i++) { + /* Run regular pipelines */ + for (j = 0; j < n_regular; j++) { + struct app_thread_pipeline_data *data = &t->regular[j]; + struct pipeline *p = data->be; + + rte_pipeline_run(p->p); + } + + /* Run custom pipelines */ + for (j = 0; j < n_custom; j++) { + struct app_thread_pipeline_data *data = &t->custom[j]; + + data->f_run(data->be); + } + + /* Timer */ + if ((i & 0xF) == 0) { + uint64_t time = rte_get_tsc_cycles(); + uint64_t t_deadline = UINT64_MAX; + + if (time < t->deadline) + continue; + + /* Timer for regular pipelines */ + for (j = 0; j < n_regular; j++) { + struct app_thread_pipeline_data *data = + &t->regular[j]; + uint64_t p_deadline = data->deadline; + +
[dpdk-dev] [PATCH v5 07/11] ip_pipeline: moved config files to separate folder
Created new folder for config(.cfg) and script(.sh) files. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/config/ip_pipeline.cfg |9 +++ examples/ip_pipeline/config/ip_pipeline.sh |5 ++ examples/ip_pipeline/config/tm_profile.cfg | 105 +++ examples/ip_pipeline/ip_pipeline.cfg| 56 -- examples/ip_pipeline/ip_pipeline.sh | 18 - 5 files changed, 119 insertions(+), 74 deletions(-) create mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg create mode 100644 examples/ip_pipeline/config/ip_pipeline.sh create mode 100644 examples/ip_pipeline/config/tm_profile.cfg delete mode 100644 examples/ip_pipeline/ip_pipeline.cfg delete mode 100644 examples/ip_pipeline/ip_pipeline.sh diff --git a/examples/ip_pipeline/config/ip_pipeline.cfg b/examples/ip_pipeline/config/ip_pipeline.cfg new file mode 100644 index 000..095ed25 --- /dev/null +++ b/examples/ip_pipeline/config/ip_pipeline.cfg @@ -0,0 +1,9 @@ +[PIPELINE0] +type = MASTER +core = 0 + +[PIPELINE1] +type = PASS-THROUGH +core = 1 +pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0 +pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0 diff --git a/examples/ip_pipeline/config/ip_pipeline.sh b/examples/ip_pipeline/config/ip_pipeline.sh new file mode 100644 index 000..4fca259 --- /dev/null +++ b/examples/ip_pipeline/config/ip_pipeline.sh @@ -0,0 +1,5 @@ +# +#run config/ip_pipeline.sh +# + +p 1 ping diff --git a/examples/ip_pipeline/config/tm_profile.cfg b/examples/ip_pipeline/config/tm_profile.cfg new file mode 100644 index 000..53edb67 --- /dev/null +++ b/examples/ip_pipeline/config/tm_profile.cfg @@ -0,0 +1,105 @@ +; BSD LICENSE +; +; Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +; All rights reserved. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; +; * Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; * Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in +; the documentation and/or other materials provided with the +; distribution. +; * Neither the name of Intel Corporation nor the names of its +; contributors may be used to endorse or promote products derived +; from this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +; This file enables the following hierarchical scheduler configuration for each +; 10GbE output port: +; * Single subport (subport 0): +; - Subport rate set to 100% of port rate +; - Each of the 4 traffic classes has rate set to 100% of port rate +; * 4K pipes per subport 0 (pipes 0 .. 4095) with identical configuration: +; - Pipe rate set to 1/4K of port rate +; - Each of the 4 traffic classes has rate set to 100% of pipe rate +; - Within each traffic class, the byte-level WRR weights for the 4 queues +; are set to 1:1:1:1 +; +; For more details, please refer to chapter "Quality of Service (QoS) Framework" +; of Intel Data Plane Development Kit (Intel DPDK) Programmer's Guide. + +; Port configuration +[port] +frame overhead = 24 ; frame overhead = Preamble (7) + SFD (1) + FCS (4) + IFG (12) +mtu = 1522; mtu = Q-in-Q MTU (FCS not included) +number of subports per port = 1 +number of pipes per subport = 4096 +queue sizes = 64 64 64 64 + +; Subport configuration +[subport 0] +tb rate = 125000 ; Bytes per second +tb size = 100 ; Bytes + +tc 0 rate = 125000 ; Bytes per second +tc 1 rate = 125000 ; Bytes per second +tc 2 rate = 125000 ; Bytes per second +tc 3 rate = 125000 ; Bytes per second +tc period = 10 ; Milliseconds + +pipe 0-4095 = 0; These pipes are configured with pipe profile 0 + +; Pipe configuration +[pipe profile 0] +tb rate = 305175 ; Bytes per second +tb size = 100
[dpdk-dev] [PATCH v5 08/11] ip_pipeline: added new implementation of passthrough pipeline
From: Jasvinder Singh Passthrough pipeline implementation is split to two files. pipeline_passthrough.c file handles front-end functions (cli commands parsing) pipeline_passthrough_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/hash_func.h | 351 + .../ip_pipeline/pipeline/pipeline_actions_common.h | 119 +++ .../ip_pipeline/pipeline/pipeline_passthrough.c| 192 + .../ip_pipeline/pipeline/pipeline_passthrough.h| 41 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 772 .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 41 ++ 8 files changed, 1341 insertions(+), 179 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/hash_func.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_actions_common.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index f255338..930dc61 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -60,6 +60,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_fe.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 807993f..d80bede 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -45,6 +45,7 @@ #include "pipeline.h" #include "pipeline_common_fe.h" #include "pipeline_master.h" +#include "pipeline_passthrough.h" #define APP_NAME_SIZE 32 @@ -1241,6 +1242,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); + app_pipeline_type_register(app, &pipeline_passthrough); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/hash_func.h b/examples/ip_pipeline/pipeline/hash_func.h new file mode 100644 index 000..7846300 --- /dev/null +++ b/examples/ip_pipeline/pipeline/hash_func.h @@ -0,0 +1,351 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __INCLUDE_HASH_FUNC_H__ +#define __INCLUDE_HASH_FUNC_H__ + +static inline uint64_t +hash_xor_key8(void *key, __rte_unused uint32_t key_size, uint64_t seed) +{ + uint64_t *k = key; + uint64_t xor0; + + xor0 = seed ^ k[0]; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +hash_xor_key16(void *key, __rte_unused uint32_t key_size, uint64_t seed) +{ + uint64_t *k = key; + uint64_t xor0; + + xor0 = (k[0] ^ seed) ^ k[1]; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +hash_xor_key24(void *
[dpdk-dev] [PATCH v5 09/11] ip_pipeline: added new implementation of firewall pipeline
From: Daniel Mrzyglod Firewall pipeline implementation is split to two files. pipeline_firewall.c file handles front-end functions (cli commands parsing) pipeline_firewall_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Daniel Mrzyglod --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/pipeline_firewall.c | 1162 examples/ip_pipeline/pipeline/pipeline_firewall.h | 63 ++ .../ip_pipeline/pipeline/pipeline_firewall_be.c| 740 + .../ip_pipeline/pipeline/pipeline_firewall_be.h| 138 +++ 6 files changed, 1870 insertions(+), 237 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 930dc61..382fee6 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -62,6 +62,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index d80bede..e8d33c7 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -46,6 +46,7 @@ #include "pipeline_common_fe.h" #include "pipeline_master.h" #include "pipeline_passthrough.h" +#include "pipeline_firewall.h" #define APP_NAME_SIZE 32 @@ -1243,6 +1244,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); + app_pipeline_type_register(app, &pipeline_firewall); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c b/examples/ip_pipeline/pipeline/pipeline_firewall.c index b70260e..40fbdc5 100644 --- a/examples/ip_pipeline/pipeline/pipeline_firewall.c +++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,282 +32,970 @@ */ #include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include + +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_firewall.h" + +struct app_pipeline_firewall_rule { + struct pipeline_firewall_key key; + int32_t priority; + uint32_t port_id; + void *entry_ptr; + + TAILQ_ENTRY(app_pipeline_firewall_rule) node; +}; + +struct app_pipeline_firewall { + /* parameters */ + uint32_t n_ports_in; + uint32_t n_ports_out; + + /* rules */ + TAILQ_HEAD(, app_pipeline_firewall_rule) rules; + uint32_t n_rules; + uint32_t default_rule_present; + uint32_t default_rule_port_id; + void *default_rule_entry_ptr; +}; -#include -#include -#include +static void +print_firewall_ipv4_rule(struct app_pipeline_firewall_rule *rule) +{ + printf("Prio = %d (SA = %u.%u.%u.%u/%u, " + "DA = %u.%u.%u.%u/%u, " + "SP = %u-%u, " + "DP = %u-%u, " + "Proto = %u / 0x%x) => " + "Port = %u (entry ptr = %p)\n", + + rule->priority, + + (rule->key.key.ipv4_5tuple.src_ip >> 24) & 0xFF, + (rule->key.key.ipv4_5tuple.src_ip >> 16) & 0xFF, + (rule->key.key.ipv4_5tuple.src_ip >> 8) & 0xFF, + rule->key.key.ipv4_5tuple.src_ip & 0xFF, + rule->key.key.ipv4_5tuple.src_ip_mask, + + (rule->key.key.ipv4_5tuple.dst_ip >> 24) & 0xFF, + (rule->key.key.ipv4_5tuple.dst_ip >> 16) & 0xFF, + (rule->key.key.ipv4_5tuple.dst_ip >> 8) & 0xFF, + rule->key.key.ipv4_5tuple.dst_ip & 0xFF, + rule->key.key.ipv4_5tuple.dst_ip_mask, + + rule->key.key.ipv4_5tuple.src_port_from, + rule->key.key.ipv4_5tuple.src_port_to, + + rule->key.key.ipv4_5tuple.dst_port_from, + rule->key.key.ipv4_5tuple.dst_port_to, + + rule->key.key.ipv4_5tuple.
[dpdk-dev] [PATCH v5 10/11] ip_pipeline: added new implementation of routing pipeline
Routing pipeline implementation is split to two files. pipeline_routing.c file handles front-end functions (cli commands parsing) pipeline_routing_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Pawel Wodkowski --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/pipeline_routing.c | 1783 examples/ip_pipeline/pipeline/pipeline_routing.h | 99 ++ .../ip_pipeline/pipeline/pipeline_routing_be.c | 869 ++ .../ip_pipeline/pipeline/pipeline_routing_be.h | 230 +++ 6 files changed, 2627 insertions(+), 358 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 382fee6..a2881a6 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -64,6 +64,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index e8d33c7..88e1aa5 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -47,6 +47,7 @@ #include "pipeline_master.h" #include "pipeline_passthrough.h" #include "pipeline_firewall.h" +#include "pipeline_routing.h" #define APP_NAME_SIZE 32 @@ -1245,6 +1246,7 @@ int app_init(struct app_params *app) app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); app_pipeline_type_register(app, &pipeline_firewall); + app_pipeline_type_register(app, &pipeline_routing); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/pipeline_routing.c b/examples/ip_pipeline/pipeline/pipeline_routing.c index b1ce624..2415aa2 100644 --- a/examples/ip_pipeline/pipeline/pipeline_routing.c +++ b/examples/ip_pipeline/pipeline/pipeline_routing.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,444 +31,1511 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include +#include +#include +#include +#include +#include -#include -#include -#include -#include -#include -#include +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_routing.h" -#include -#include -#include -#include +struct app_pipeline_routing_route { + struct pipeline_routing_route_key key; + struct app_pipeline_routing_route_params params; + void *entry_ptr; -#include "main.h" + TAILQ_ENTRY(app_pipeline_routing_route) node; +}; -#include +struct app_pipeline_routing_arp_entry { + struct pipeline_routing_arp_key key; + struct ether_addr macaddr; + void *entry_ptr; -struct app_routing_table_entry { - struct rte_pipeline_table_entry head; - uint32_t nh_ip; - uint32_t nh_iface; + TAILQ_ENTRY(app_pipeline_routing_arp_entry) node; }; -struct app_arp_table_entry { - struct rte_pipeline_table_entry head; - struct ether_addr nh_arp; +struct pipeline_routing { + /* Parameters */ + uint32_t n_ports_in; + uint32_t n_ports_out; + + /* Routes */ + TAILQ_HEAD(, app_pipeline_routing_route) routes; + uint32_t n_routes; + + uint32_t default_route_present; + uint32_t default_route_port_id; + void *default_route_entry_ptr; + + /* ARP entries */ + TAILQ_HEAD(, app_pipeline_routing_arp_entry) arp_entries; + uint32_t n_arp_entries; + + uint32_t default_arp_entry_present; + uint32_t default_arp_entry_port_id; + void *default_arp_entry_ptr; }; -static inline void -app_routing_table_write_metadata( - struct rte_mbuf *pkt, - struct app_routing_table_entry *entry) +static void * +pipeline_routing_init(struct pipeline_params *params, + __rte_unused void *arg) { - struct app_pkt_metadata *c = - (struct app_pkt_metadata *) RTE_MBUF_METADATA_UINT8_PTR(pkt, 0); + struct pipeline_routing *p; + uint32_t size; + + /* Check input arguments */ + if ((params == NULL) || + (params->n_por
[dpdk-dev] [PATCH v5 11/11] ip_pipeline: added new implementation of flow classification pipeline
Flow classification pipeline implementation is split to two files. pipeline_flow_classification.c file handles front-end functions (cli commands parsing) pipeline_flow_classification_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + .../pipeline/pipeline_flow_classification.c| 2205 ++-- .../pipeline/pipeline_flow_classification.h| 105 + .../pipeline/pipeline_flow_classification_be.c | 589 ++ .../pipeline/pipeline_flow_classification_be.h | 140 ++ 6 files changed, 2816 insertions(+), 227 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index a2881a6..f3ff1ec 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -64,6 +64,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 88e1aa5..dd7bee4 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -47,6 +47,7 @@ #include "pipeline_master.h" #include "pipeline_passthrough.h" #include "pipeline_firewall.h" +#include "pipeline_flow_classification.h" #include "pipeline_routing.h" #define APP_NAME_SIZE 32 @@ -1245,6 +1246,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); + app_pipeline_type_register(app, &pipeline_flow_classification); app_pipeline_type_register(app, &pipeline_firewall); app_pipeline_type_register(app, &pipeline_routing); diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c index cc0cbf1..c3926fa 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,275 +32,2026 @@ */ #include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -#include -#include -#include +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_flow_classification.h" +#include "hash_func.h" -#include "main.h" +/* + * Key conversion + */ + +struct pkt_key_qinq { + uint16_t ethertype_svlan; + uint16_t svlan; + uint16_t ethertype_cvlan; + uint16_t cvlan; +} __attribute__((__packed__)); + +struct pkt_key_ipv4_5tuple { + uint8_t ttl; + uint8_t proto; + uint16_t checksum; + uint32_t ip_src; + uint32_t ip_dst; + uint16_t port_src; + uint16_t port_dst; +} __attribute__((__packed__)); + +struct pkt_key_ipv6_5tuple { + uint16_t payload_length; + uint8_t proto; + uint8_t hop_limit; + uint8_t ip_src[16]; + uint8_t ip_dst[16]; + uint16_t port_src; + uint16_t port_dst; +} __attribute__((__packed__)); + +static int +app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, + uint8_t *key_out, + uint32_t *signature) +{ + uint8_t buffer[PIPELINE_FC_FLOW_KEY_MAX_SIZE]; + void *key_buffer = (key_out) ? key_out : buffer; + + switch (key_in->type) { + case FLOW_KEY_QINQ: + { + struct pkt_key_qinq *qinq = key_buffer; + + qinq->ethertype_svlan = 0; + qinq->svlan = rte_bswap16(key_in->key.qinq.svlan); + qinq->ethertype_cvlan = 0; + qinq->cvlan = rte_bswap16(key_in->key.qinq.cvlan); + + if (signature) +
[dpdk-dev] [PATCH v6 00/11] ip_pipeline: ip_pipeline application enhancements
This patchset enhances functionality of ip_pipeline application. New config file syntax is introduced, so parser is changed. Changed structure of the application. Now every global variable is stored in app_struct in app.h. Syntax of pipeline cli commands was changed. Implementation of cli commands for every pipeline is moved to the separate file. Changes in v2: - renamed some files - added more config files - reworked flow classification pipeline implementation - fixed some bugs Changes in v3: - fixed checkpatch errors - fixed bug with message queues - fixed bug with application log Changes in v4: - fixed build issue with gcc 5 - fixed bugs in flow classification and firewall pipelines Changes in v5: - fixed build issue with clang 3.6 Changes in v6: - fixed build issues with icc 15 - fixed build issues with gcc 32bit Daniel Mrzyglod (1): ip_pipeline: added new implementation of firewall pipeline Jasvinder Singh (3): ip_pipeline: added config checks ip_pipeline: added master pipeline ip_pipeline: added new implementation of passthrough pipeline Maciej Gajdzica (6): ip_pipeline: modified init to match new params struct ip_pipeline: moved pipelines to separate folder ip_pipeline: added application thread ip_pipeline: moved config files to separate folder ip_pipeline: added new implementation of routing pipeline ip_pipeline: added new implementation of flow classification pipeline Pawel Wodkowski (1): ip_pipeline: add parsing for config files with new syntax examples/ip_pipeline/Makefile | 36 +- examples/ip_pipeline/app.h | 909 examples/ip_pipeline/cmdline.c | 1976 examples/ip_pipeline/config.c | 419 examples/ip_pipeline/config/ip_pipeline.cfg|9 + examples/ip_pipeline/config/ip_pipeline.sh |5 + examples/ip_pipeline/config/tm_profile.cfg | 105 + examples/ip_pipeline/config_check.c| 399 examples/ip_pipeline/config_parse.c| 2457 examples/ip_pipeline/config_parse_tm.c | 448 examples/ip_pipeline/cpu_core_map.c| 493 examples/ip_pipeline/cpu_core_map.h| 69 + examples/ip_pipeline/init.c| 1656 + examples/ip_pipeline/ip_pipeline.cfg | 56 - examples/ip_pipeline/ip_pipeline.sh| 18 - examples/ip_pipeline/main.c| 137 +- examples/ip_pipeline/main.h| 298 --- examples/ip_pipeline/pipeline.h| 87 + examples/ip_pipeline/pipeline/hash_func.h | 351 +++ .../ip_pipeline/pipeline/pipeline_actions_common.h | 119 + examples/ip_pipeline/pipeline/pipeline_common_be.c | 206 ++ examples/ip_pipeline/pipeline/pipeline_common_be.h | 163 ++ examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1333 +++ examples/ip_pipeline/pipeline/pipeline_common_fe.h | 228 ++ examples/ip_pipeline/pipeline/pipeline_firewall.c | 1003 examples/ip_pipeline/pipeline/pipeline_firewall.h | 63 + .../ip_pipeline/pipeline/pipeline_firewall_be.c| 740 ++ .../ip_pipeline/pipeline/pipeline_firewall_be.h| 138 ++ .../pipeline/pipeline_flow_classification.c| 2061 .../pipeline/pipeline_flow_classification.h| 105 + .../pipeline/pipeline_flow_classification_be.c | 589 + .../pipeline/pipeline_flow_classification_be.h | 140 ++ examples/ip_pipeline/pipeline/pipeline_master.c| 47 + examples/ip_pipeline/pipeline/pipeline_master.h| 41 + examples/ip_pipeline/pipeline/pipeline_master_be.c | 150 ++ examples/ip_pipeline/pipeline/pipeline_master_be.h | 41 + .../ip_pipeline/pipeline/pipeline_passthrough.c| 47 + .../ip_pipeline/pipeline/pipeline_passthrough.h| 41 + .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 772 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 41 + examples/ip_pipeline/pipeline/pipeline_routing.c | 1545 examples/ip_pipeline/pipeline/pipeline_routing.h | 99 + .../ip_pipeline/pipeline/pipeline_routing_be.c | 869 +++ .../ip_pipeline/pipeline/pipeline_routing_be.h | 230 ++ examples/ip_pipeline/pipeline_be.h | 256 ++ examples/ip_pipeline/pipeline_firewall.c | 313 --- .../ip_pipeline/pipeline_flow_classification.c | 306 --- examples/ip_pipeline/pipeline_ipv4_frag.c | 184 -- examples/ip_pipeline/pipeline_ipv4_ras.c | 181 -- examples/ip_pipeline/pipeline_passthrough.c| 213 -- examples/ip_pipeline/pipeline_routing.c| 474 examples/ip_pipeline/pipeline_rx.c | 385 --- examples/ip_pipeline/pipeline_tx.c | 283 --- examples/ip_pipeline/thread.c | 110 + 54 files changed, 17775
[dpdk-dev] [PATCH v6 01/11] ip_pipeline: add parsing for config files with new syntax
From: Pawel Wodkowski New syntax of config files is needed for ip_pipeline example enhancements. Some old files are temporarily disabled in the Makefile. It is part of a bigger change. Signed-off-by: Pawel Wodkowski --- examples/ip_pipeline/Makefile | 17 +- examples/ip_pipeline/app.h | 909 examples/ip_pipeline/config.c | 419 -- examples/ip_pipeline/config_parse.c| 2457 examples/ip_pipeline/config_parse_tm.c | 448 ++ examples/ip_pipeline/cpu_core_map.c| 493 +++ examples/ip_pipeline/cpu_core_map.h| 69 + examples/ip_pipeline/main.c| 130 +- examples/ip_pipeline/main.h| 298 examples/ip_pipeline/pipeline.h| 87 ++ examples/ip_pipeline/pipeline_be.h | 256 11 files changed, 4730 insertions(+), 853 deletions(-) create mode 100644 examples/ip_pipeline/app.h delete mode 100644 examples/ip_pipeline/config.c create mode 100644 examples/ip_pipeline/config_parse.c create mode 100644 examples/ip_pipeline/config_parse_tm.c create mode 100644 examples/ip_pipeline/cpu_core_map.c create mode 100644 examples/ip_pipeline/cpu_core_map.h delete mode 100644 examples/ip_pipeline/main.h create mode 100644 examples/ip_pipeline/pipeline.h create mode 100644 examples/ip_pipeline/pipeline_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index e70fdc7..b0feb4f 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -43,20 +43,9 @@ APP = ip_pipeline # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cmdline.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_rx.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_tx.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_frag.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_ras.c - -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c -endif +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h new file mode 100644 index 000..521e3a0 --- /dev/null +++ b/examples/ip_pipeline/app.h @@ -0,0 +1,909 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __INCLUDE_APP_H__ +#define __INCLUDE_APP_H__ + +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "cpu_core_map.h" +#include "pipeline.h" + +#define APP_PARAM_NAME_SIZE PIPELINE_NAME_SIZE + +struct app_mempool_params { + char *name; + uint32_t parsed; + uint32_t buffer_size; + uint32_t pool_size; + uint32_t cache_size; + uint32_t cpu_socket_id; +}; + +struct app_link_params { + char *name; + uint32_t parsed; + uint32_t pmd
[dpdk-dev] [PATCH v6 02/11] ip_pipeline: added config checks
From: Jasvinder Singh After loading configuration from a file, data integrity is checked. Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/config_check.c | 399 +++ examples/ip_pipeline/main.c |2 + 3 files changed, 402 insertions(+) create mode 100644 examples/ip_pipeline/config_check.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index b0feb4f..bc50e71 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -45,6 +45,7 @@ APP = ip_pipeline SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 diff --git a/examples/ip_pipeline/config_check.c b/examples/ip_pipeline/config_check.c new file mode 100644 index 000..07f4c8b --- /dev/null +++ b/examples/ip_pipeline/config_check.c @@ -0,0 +1,399 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "app.h" + +static void +check_mempools(struct app_params *app) +{ + uint32_t i; + + for (i = 0; i < app->n_mempools; i++) { + struct app_mempool_params *p = &app->mempool_params[i]; + + APP_CHECK((p->pool_size > 0), + "Mempool %s size is 0\n", p->name); + + APP_CHECK((p->cache_size > 0), + "Mempool %s cache size is 0\n", p->name); + + APP_CHECK(rte_is_power_of_2(p->cache_size), + "Mempool %s cache size not a power of 2\n", p->name); + } +} + +static void +check_links(struct app_params *app) +{ + uint32_t n_links_port_mask = __builtin_popcountll(app->port_mask); + uint32_t i; + + /* Check that number of links matches the port mask */ + APP_CHECK((app->n_links == n_links_port_mask), + "Not enough links provided in the PORT_MASK\n"); + + for (i = 0; i < app->n_links; i++) { + struct app_link_params *link = &app->link_params[i]; + uint32_t rxq_max, n_rxq, n_txq, link_id, i; + + APP_PARAM_GET_ID(link, "LINK", link_id); + + /* Check that link RXQs are contiguous */ + rxq_max = 0; + if (link->arp_q > rxq_max) + rxq_max = link->arp_q; + if (link->tcp_syn_local_q > rxq_max) + rxq_max = link->tcp_syn_local_q; + if (link->ip_local_q > rxq_max) + rxq_max = link->ip_local_q; + if (link->tcp_local_q > rxq_max) + rxq_max = link->tcp_local_q; + if (link->udp_local_q > rxq_max) + rxq_max = link->udp_local_q; + if (link->sctp_local_q > rxq_max) + rxq_max = link->sctp_local_q; + + for (i = 1; i <= rxq_max; i++) + APP_CHECK(((link->arp_q == i) || + (link->tcp_syn_local_q == i) || + (link->ip_local_q == i) || + (link->tcp_local_q == i) || +
[dpdk-dev] [PATCH v6 03/11] ip_pipeline: modified init to match new params struct
After changes in config parser, app params struct is changed and requires modifications in initialization procedures. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/init.c | 1643 ++--- examples/ip_pipeline/main.c |3 + 3 files changed, 1216 insertions(+), 431 deletions(-) diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index bc50e71..59bea5b 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -46,6 +46,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index d79762f..01e13d2 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,562 +31,1343 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include #include -#include +#include #include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include - -#include "main.h" - -#define NA APP_SWQ_INVALID - -struct app_params app = { - /* CPU cores */ - .cores = { - {0, APP_CORE_MASTER, {15, 16, 17, NA, NA, NA, NA, NA}, - {12, 13, 14, NA, NA, NA, NA, NA} }, - {0, APP_CORE_RX, {NA, NA, NA, NA, NA, NA, NA, 12}, - { 0, 1, 2, 3, NA, NA, NA, 15} }, - {0, APP_CORE_FC, { 0, 1, 2, 3, NA, NA, NA, 13}, - { 4, 5, 6, 7, NA, NA, NA, 16} }, - {0, APP_CORE_RT, { 4, 5, 6, 7, NA, NA, NA, 14}, - { 8, 9, 10, 11, NA, NA, NA, 17} }, - {0, APP_CORE_TX, { 8, 9, 10, 11, NA, NA, NA, NA}, - {NA, NA, NA, NA, NA, NA, NA, NA} }, - }, - - /* Ports*/ - .n_ports = APP_MAX_PORTS, - .rsz_hwq_rx = 128, - .rsz_hwq_tx = 512, - .bsz_hwq_rd = 64, - .bsz_hwq_wr = 64, - - .port_conf = { - .rxmode = { - .split_hdr_size = 0, - .header_split = 0, /* Header Split disabled */ - .hw_ip_checksum = 1, /* IP checksum offload enabled */ - .hw_vlan_filter = 0, /* VLAN filtering disabled */ - .jumbo_frame= 1, /* Jumbo Frame Support enabled */ - .max_rx_pkt_len = 9000, /* Jumbo Frame MAC pkt length */ - .hw_strip_crc = 0, /* CRC stripped by hardware */ - }, - .rx_adv_conf = { - .rss_conf = { - .rss_key = NULL, - .rss_hf = ETH_RSS_IP, - }, - }, - .txmode = { - .mq_mode = ETH_MQ_TX_NONE, - }, - }, - - .rx_conf = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, - .rx_free_thresh = 64, - .rx_drop_en = 0, - }, - - .tx_conf = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, - }, - - /* SWQs */ - .rsz_swq = 128, - .bsz_swq_rd = 64, - .bsz_swq_wr = 64, - - /* Buffer pool */ - .pool_buffer_size = RTE_MBUF_DEFAULT_BUF_SIZE, - .pool_size = 32 * 1024, - .pool_cache_size = 256, - - /* Message buffer pool */ - .msg_pool_buffer_size = 256, - .msg_pool_size = 1024, - .msg_pool_cache_size = 64, - - /* Rule tables */ - .max_arp_rules = 1 << 10, - .max_firewall_rules = 1 << 5, - .max_routing_rules = 1 << 24, - .max_flow_rules = 1 << 24, - - /* Application processing */ - .ether_hdr_pop_push = 0, -}; - -struct app_core_params * -app_get_core_params(uint32_t core_id
[dpdk-dev] [PATCH v6 04/11] ip_pipeline: moved pipelines to separate folder
Moved pipelines to separate folder, removed not needed pipelines and modified Makefile to match that change. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |9 +- examples/ip_pipeline/pipeline/pipeline_firewall.c | 313 + .../pipeline/pipeline_flow_classification.c| 306 + .../ip_pipeline/pipeline/pipeline_passthrough.c| 213 + examples/ip_pipeline/pipeline/pipeline_routing.c | 474 examples/ip_pipeline/pipeline_firewall.c | 313 - .../ip_pipeline/pipeline_flow_classification.c | 306 - examples/ip_pipeline/pipeline_ipv4_frag.c | 184 examples/ip_pipeline/pipeline_ipv4_ras.c | 181 examples/ip_pipeline/pipeline_passthrough.c| 213 - examples/ip_pipeline/pipeline_routing.c| 474 examples/ip_pipeline/pipeline_rx.c | 385 examples/ip_pipeline/pipeline_tx.c | 283 13 files changed, 1314 insertions(+), 2340 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.c delete mode 100644 examples/ip_pipeline/pipeline_firewall.c delete mode 100644 examples/ip_pipeline/pipeline_flow_classification.c delete mode 100644 examples/ip_pipeline/pipeline_ipv4_frag.c delete mode 100644 examples/ip_pipeline/pipeline_ipv4_ras.c delete mode 100644 examples/ip_pipeline/pipeline_passthrough.c delete mode 100644 examples/ip_pipeline/pipeline_routing.c delete mode 100644 examples/ip_pipeline/pipeline_rx.c delete mode 100644 examples/ip_pipeline/pipeline_tx.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 59bea5b..213e879 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -36,11 +36,17 @@ endif # Default target, can be overridden by command line or environment RTE_TARGET ?= x86_64-native-linuxapp-gcc +DIRS-(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline + include $(RTE_SDK)/mk/rte.vars.mk # binary name APP = ip_pipeline +VPATH += $(SRCDIR)/pipeline + +INC += $(wildcard *.h) $(wildcard pipeline/*.h) + # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c @@ -49,7 +55,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c +CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 -CFLAGS += $(WERROR_FLAGS) +CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable include $(RTE_SDK)/mk/rte.extapp.mk diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c b/examples/ip_pipeline/pipeline/pipeline_firewall.c new file mode 100644 index 000..b70260e --- /dev/null +++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c @@ -0,0 +1,313 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include
[dpdk-dev] [PATCH v6 05/11] ip_pipeline: added master pipeline
From: Jasvinder Singh Master pipeline is responsible for command line handling and communicationg with all other pipelines via message queues. Removed cmdline.c file, as its functionality will be split over multiple pipeline files. Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |5 + examples/ip_pipeline/cmdline.c | 1976 examples/ip_pipeline/init.c|5 + examples/ip_pipeline/pipeline/pipeline_common_be.c | 206 ++ examples/ip_pipeline/pipeline/pipeline_common_be.h | 163 ++ examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1333 + examples/ip_pipeline/pipeline/pipeline_common_fe.h | 228 +++ examples/ip_pipeline/pipeline/pipeline_master.c| 47 + examples/ip_pipeline/pipeline/pipeline_master.h| 41 + examples/ip_pipeline/pipeline/pipeline_master_be.c | 150 ++ examples/ip_pipeline/pipeline/pipeline_master_be.h | 41 + 11 files changed, 2219 insertions(+), 1976 deletions(-) delete mode 100644 examples/ip_pipeline/cmdline.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_master.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_master.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 213e879..9ce80a8 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -55,6 +55,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_fe.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c + CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable diff --git a/examples/ip_pipeline/cmdline.c b/examples/ip_pipeline/cmdline.c deleted file mode 100644 index 3173fd0..000 --- a/examples/ip_pipeline/cmdline.c +++ /dev/null @@ -1,1976 +0,0 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "main.h" - -#define IS_RULE_PRESENT(res, rule_key, table, type)\ -do { \ - struct app_rule *it;\ - \ - (res) = NULL; \ - TAILQ_FOREACH(it, &table, entries) {\
[dpdk-dev] [PATCH v6 06/11] ip_pipeline: added application thread
Application thread runs pipelines on assigned cores. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/main.c |6 +++ examples/ip_pipeline/thread.c | 110 + 3 files changed, 117 insertions(+) create mode 100644 examples/ip_pipeline/thread.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 9ce80a8..f255338 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -53,6 +53,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += thread.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c diff --git a/examples/ip_pipeline/main.c b/examples/ip_pipeline/main.c index ef68c86..862e2f2 100644 --- a/examples/ip_pipeline/main.c +++ b/examples/ip_pipeline/main.c @@ -52,5 +52,11 @@ main(int argc, char **argv) /* Init */ app_init(&app); + /* Run-time */ + rte_eal_mp_remote_launch( + app_thread, + (void *) &app, + CALL_MASTER); + return 0; } diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c new file mode 100644 index 000..b2a8656 --- /dev/null +++ b/examples/ip_pipeline/thread.c @@ -0,0 +1,110 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include "pipeline_common_be.h" +#include "app.h" + +int app_thread(void *arg) +{ + struct app_params *app = (struct app_params *) arg; + uint32_t core_id = rte_lcore_id(), i, j; + struct app_thread_data *t = &app->thread_data[core_id]; + uint32_t n_regular = RTE_MIN(t->n_regular, RTE_DIM(t->regular)); + uint32_t n_custom = RTE_MIN(t->n_custom, RTE_DIM(t->custom)); + + for (i = 0; ; i++) { + /* Run regular pipelines */ + for (j = 0; j < n_regular; j++) { + struct app_thread_pipeline_data *data = &t->regular[j]; + struct pipeline *p = data->be; + + rte_pipeline_run(p->p); + } + + /* Run custom pipelines */ + for (j = 0; j < n_custom; j++) { + struct app_thread_pipeline_data *data = &t->custom[j]; + + data->f_run(data->be); + } + + /* Timer */ + if ((i & 0xF) == 0) { + uint64_t time = rte_get_tsc_cycles(); + uint64_t t_deadline = UINT64_MAX; + + if (time < t->deadline) + continue; + + /* Timer for regular pipelines */ + for (j = 0; j < n_regular; j++) { + struct app_thread_pipeline_data *data = + &t->regular[j]; + uint64_t p_deadline = data->deadline; + +
[dpdk-dev] [PATCH v6 07/11] ip_pipeline: moved config files to separate folder
Created new folder for config(.cfg) and script(.sh) files. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/config/ip_pipeline.cfg |9 +++ examples/ip_pipeline/config/ip_pipeline.sh |5 ++ examples/ip_pipeline/config/tm_profile.cfg | 105 +++ examples/ip_pipeline/ip_pipeline.cfg| 56 -- examples/ip_pipeline/ip_pipeline.sh | 18 - 5 files changed, 119 insertions(+), 74 deletions(-) create mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg create mode 100644 examples/ip_pipeline/config/ip_pipeline.sh create mode 100644 examples/ip_pipeline/config/tm_profile.cfg delete mode 100644 examples/ip_pipeline/ip_pipeline.cfg delete mode 100644 examples/ip_pipeline/ip_pipeline.sh diff --git a/examples/ip_pipeline/config/ip_pipeline.cfg b/examples/ip_pipeline/config/ip_pipeline.cfg new file mode 100644 index 000..095ed25 --- /dev/null +++ b/examples/ip_pipeline/config/ip_pipeline.cfg @@ -0,0 +1,9 @@ +[PIPELINE0] +type = MASTER +core = 0 + +[PIPELINE1] +type = PASS-THROUGH +core = 1 +pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0 +pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0 diff --git a/examples/ip_pipeline/config/ip_pipeline.sh b/examples/ip_pipeline/config/ip_pipeline.sh new file mode 100644 index 000..4fca259 --- /dev/null +++ b/examples/ip_pipeline/config/ip_pipeline.sh @@ -0,0 +1,5 @@ +# +#run config/ip_pipeline.sh +# + +p 1 ping diff --git a/examples/ip_pipeline/config/tm_profile.cfg b/examples/ip_pipeline/config/tm_profile.cfg new file mode 100644 index 000..53edb67 --- /dev/null +++ b/examples/ip_pipeline/config/tm_profile.cfg @@ -0,0 +1,105 @@ +; BSD LICENSE +; +; Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +; All rights reserved. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; +; * Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; * Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in +; the documentation and/or other materials provided with the +; distribution. +; * Neither the name of Intel Corporation nor the names of its +; contributors may be used to endorse or promote products derived +; from this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +; This file enables the following hierarchical scheduler configuration for each +; 10GbE output port: +; * Single subport (subport 0): +; - Subport rate set to 100% of port rate +; - Each of the 4 traffic classes has rate set to 100% of port rate +; * 4K pipes per subport 0 (pipes 0 .. 4095) with identical configuration: +; - Pipe rate set to 1/4K of port rate +; - Each of the 4 traffic classes has rate set to 100% of pipe rate +; - Within each traffic class, the byte-level WRR weights for the 4 queues +; are set to 1:1:1:1 +; +; For more details, please refer to chapter "Quality of Service (QoS) Framework" +; of Intel Data Plane Development Kit (Intel DPDK) Programmer's Guide. + +; Port configuration +[port] +frame overhead = 24 ; frame overhead = Preamble (7) + SFD (1) + FCS (4) + IFG (12) +mtu = 1522; mtu = Q-in-Q MTU (FCS not included) +number of subports per port = 1 +number of pipes per subport = 4096 +queue sizes = 64 64 64 64 + +; Subport configuration +[subport 0] +tb rate = 125000 ; Bytes per second +tb size = 100 ; Bytes + +tc 0 rate = 125000 ; Bytes per second +tc 1 rate = 125000 ; Bytes per second +tc 2 rate = 125000 ; Bytes per second +tc 3 rate = 125000 ; Bytes per second +tc period = 10 ; Milliseconds + +pipe 0-4095 = 0; These pipes are configured with pipe profile 0 + +; Pipe configuration +[pipe profile 0] +tb rate = 305175 ; Bytes per second +tb size = 100
[dpdk-dev] [PATCH v6 08/11] ip_pipeline: added new implementation of passthrough pipeline
From: Jasvinder Singh Passthrough pipeline implementation is split to two files. pipeline_passthrough.c file handles front-end functions (cli commands parsing) pipeline_passthrough_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/hash_func.h | 351 + .../ip_pipeline/pipeline/pipeline_actions_common.h | 119 +++ .../ip_pipeline/pipeline/pipeline_passthrough.c| 192 + .../ip_pipeline/pipeline/pipeline_passthrough.h| 41 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 772 .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 41 ++ 8 files changed, 1341 insertions(+), 179 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/hash_func.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_actions_common.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index f255338..930dc61 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -60,6 +60,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_fe.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 036b316..0f3bf0b 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -46,6 +46,7 @@ #include "pipeline.h" #include "pipeline_common_fe.h" #include "pipeline_master.h" +#include "pipeline_passthrough.h" #define APP_NAME_SIZE 32 @@ -1285,6 +1286,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); + app_pipeline_type_register(app, &pipeline_passthrough); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/hash_func.h b/examples/ip_pipeline/pipeline/hash_func.h new file mode 100644 index 000..7846300 --- /dev/null +++ b/examples/ip_pipeline/pipeline/hash_func.h @@ -0,0 +1,351 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __INCLUDE_HASH_FUNC_H__ +#define __INCLUDE_HASH_FUNC_H__ + +static inline uint64_t +hash_xor_key8(void *key, __rte_unused uint32_t key_size, uint64_t seed) +{ + uint64_t *k = key; + uint64_t xor0; + + xor0 = seed ^ k[0]; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +hash_xor_key16(void *key, __rte_unused uint32_t key_size, uint64_t seed) +{ + uint64_t *k = key; + uint64_t xor0; + + xor0 = (k[0] ^ seed) ^ k[1]; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +hash_xor_key24(void *
[dpdk-dev] [PATCH v6 09/11] ip_pipeline: added new implementation of firewall pipeline
From: Daniel Mrzyglod Firewall pipeline implementation is split to two files. pipeline_firewall.c file handles front-end functions (cli commands parsing) pipeline_firewall_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Daniel Mrzyglod --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/pipeline_firewall.c | 1164 examples/ip_pipeline/pipeline/pipeline_firewall.h | 63 ++ .../ip_pipeline/pipeline/pipeline_firewall_be.c| 740 + .../ip_pipeline/pipeline/pipeline_firewall_be.h| 138 +++ 6 files changed, 1872 insertions(+), 237 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 930dc61..382fee6 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -62,6 +62,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 0f3bf0b..6ba14da 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -47,6 +47,7 @@ #include "pipeline_common_fe.h" #include "pipeline_master.h" #include "pipeline_passthrough.h" +#include "pipeline_firewall.h" #define APP_NAME_SIZE 32 @@ -1287,6 +1288,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); + app_pipeline_type_register(app, &pipeline_firewall); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c b/examples/ip_pipeline/pipeline/pipeline_firewall.c index b70260e..f6924ab 100644 --- a/examples/ip_pipeline/pipeline/pipeline_firewall.c +++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,282 +32,972 @@ */ #include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include + +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_firewall.h" + +struct app_pipeline_firewall_rule { + struct pipeline_firewall_key key; + int32_t priority; + uint32_t port_id; + void *entry_ptr; + + TAILQ_ENTRY(app_pipeline_firewall_rule) node; +}; + +struct app_pipeline_firewall { + /* parameters */ + uint32_t n_ports_in; + uint32_t n_ports_out; + + /* rules */ + TAILQ_HEAD(, app_pipeline_firewall_rule) rules; + uint32_t n_rules; + uint32_t default_rule_present; + uint32_t default_rule_port_id; + void *default_rule_entry_ptr; +}; -#include -#include -#include +static void +print_firewall_ipv4_rule(struct app_pipeline_firewall_rule *rule) +{ + printf("Prio = %" PRId32 " (SA = %" PRIu32 ".%" PRIu32 + ".%" PRIu32 ".%" PRIu32 "/%" PRIu32 ", " + "DA = %" PRIu32 ".%" PRIu32 + ".%"PRIu32 ".%" PRIu32 "/%" PRIu32 ", " + "SP = %" PRIu32 "-%" PRIu32 ", " + "DP = %" PRIu32 "-%" PRIu32 ", " + "Proto = %" PRIu32 " / 0x%" PRIx32 ") => " + "Port = %" PRIu32 " (entry ptr = %p)\n", + + rule->priority, + + (rule->key.key.ipv4_5tuple.src_ip >> 24) & 0xFF, + (rule->key.key.ipv4_5tuple.src_ip >> 16) & 0xFF, + (rule->key.key.ipv4_5tuple.src_ip >> 8) & 0xFF, + rule->key.key.ipv4_5tuple.src_ip & 0xFF, + rule->key.key.ipv4_5tuple.src_ip_mask, + + (rule->key.key.ipv4_5tuple.dst_ip >> 24) & 0xFF, + (rule->key.key.ipv4_5tuple.dst_ip >> 16) & 0xFF, + (rule->key.key.ipv4_5tuple.dst_ip >> 8) & 0xFF, + rule->key.key.ipv4_5tuple.dst_ip & 0xFF, + rule->key.key.ipv4_5tuple.dst_ip_mask, + + rule->key.key.ipv4_5tuple.src_port_from, + rule
[dpdk-dev] [PATCH v6 10/11] ip_pipeline: added new implementation of routing pipeline
Routing pipeline implementation is split to two files. pipeline_routing.c file handles front-end functions (cli commands parsing) pipeline_routing_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Pawel Wodkowski --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/pipeline_routing.c | 1787 examples/ip_pipeline/pipeline/pipeline_routing.h | 99 ++ .../ip_pipeline/pipeline/pipeline_routing_be.c | 869 ++ .../ip_pipeline/pipeline/pipeline_routing_be.h | 230 +++ 6 files changed, 2631 insertions(+), 358 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 382fee6..a2881a6 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -64,6 +64,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 6ba14da..728ce9a 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -48,6 +48,7 @@ #include "pipeline_master.h" #include "pipeline_passthrough.h" #include "pipeline_firewall.h" +#include "pipeline_routing.h" #define APP_NAME_SIZE 32 @@ -1289,6 +1290,7 @@ int app_init(struct app_params *app) app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); app_pipeline_type_register(app, &pipeline_firewall); + app_pipeline_type_register(app, &pipeline_routing); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/pipeline_routing.c b/examples/ip_pipeline/pipeline/pipeline_routing.c index b1ce624..beec982 100644 --- a/examples/ip_pipeline/pipeline/pipeline_routing.c +++ b/examples/ip_pipeline/pipeline/pipeline_routing.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,444 +31,1515 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include +#include +#include +#include +#include +#include -#include -#include -#include -#include -#include -#include +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_routing.h" -#include -#include -#include -#include +struct app_pipeline_routing_route { + struct pipeline_routing_route_key key; + struct app_pipeline_routing_route_params params; + void *entry_ptr; -#include "main.h" + TAILQ_ENTRY(app_pipeline_routing_route) node; +}; -#include +struct app_pipeline_routing_arp_entry { + struct pipeline_routing_arp_key key; + struct ether_addr macaddr; + void *entry_ptr; -struct app_routing_table_entry { - struct rte_pipeline_table_entry head; - uint32_t nh_ip; - uint32_t nh_iface; + TAILQ_ENTRY(app_pipeline_routing_arp_entry) node; }; -struct app_arp_table_entry { - struct rte_pipeline_table_entry head; - struct ether_addr nh_arp; +struct pipeline_routing { + /* Parameters */ + uint32_t n_ports_in; + uint32_t n_ports_out; + + /* Routes */ + TAILQ_HEAD(, app_pipeline_routing_route) routes; + uint32_t n_routes; + + uint32_t default_route_present; + uint32_t default_route_port_id; + void *default_route_entry_ptr; + + /* ARP entries */ + TAILQ_HEAD(, app_pipeline_routing_arp_entry) arp_entries; + uint32_t n_arp_entries; + + uint32_t default_arp_entry_present; + uint32_t default_arp_entry_port_id; + void *default_arp_entry_ptr; }; -static inline void -app_routing_table_write_metadata( - struct rte_mbuf *pkt, - struct app_routing_table_entry *entry) +static void * +pipeline_routing_init(struct pipeline_params *params, + __rte_unused void *arg) { - struct app_pkt_metadata *c = - (struct app_pkt_metadata *) RTE_MBUF_METADATA_UINT8_PTR(pkt, 0); + struct pipeline_routing *p; + uint32_t size; + + /* Check input arguments */ + if ((params == NULL) || + (params->n_por
[dpdk-dev] [PATCH v6 11/11] ip_pipeline: added new implementation of flow classification pipeline
Flow classification pipeline implementation is split to two files. pipeline_flow_classification.c file handles front-end functions (cli commands parsing) pipeline_flow_classification_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + .../pipeline/pipeline_flow_classification.c| 2209 ++-- .../pipeline/pipeline_flow_classification.h| 105 + .../pipeline/pipeline_flow_classification_be.c | 589 ++ .../pipeline/pipeline_flow_classification_be.h | 140 ++ 6 files changed, 2820 insertions(+), 227 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index a2881a6..f3ff1ec 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -64,6 +64,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 728ce9a..3f9c68d 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -48,6 +48,7 @@ #include "pipeline_master.h" #include "pipeline_passthrough.h" #include "pipeline_firewall.h" +#include "pipeline_flow_classification.h" #include "pipeline_routing.h" #define APP_NAME_SIZE 32 @@ -1289,6 +1290,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); + app_pipeline_type_register(app, &pipeline_flow_classification); app_pipeline_type_register(app, &pipeline_firewall); app_pipeline_type_register(app, &pipeline_routing); diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c index cc0cbf1..4b82180 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,275 +32,2030 @@ */ #include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -#include -#include -#include +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_flow_classification.h" +#include "hash_func.h" -#include "main.h" +/* + * Key conversion + */ + +struct pkt_key_qinq { + uint16_t ethertype_svlan; + uint16_t svlan; + uint16_t ethertype_cvlan; + uint16_t cvlan; +} __attribute__((__packed__)); + +struct pkt_key_ipv4_5tuple { + uint8_t ttl; + uint8_t proto; + uint16_t checksum; + uint32_t ip_src; + uint32_t ip_dst; + uint16_t port_src; + uint16_t port_dst; +} __attribute__((__packed__)); + +struct pkt_key_ipv6_5tuple { + uint16_t payload_length; + uint8_t proto; + uint8_t hop_limit; + uint8_t ip_src[16]; + uint8_t ip_dst[16]; + uint16_t port_src; + uint16_t port_dst; +} __attribute__((__packed__)); + +static int +app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, + uint8_t *key_out, + uint32_t *signature) +{ + uint8_t buffer[PIPELINE_FC_FLOW_KEY_MAX_SIZE]; + void *key_buffer = (key_out) ? key_out : buffer; + + switch (key_in->type) { + case FLOW_KEY_QINQ: + { + struct pkt_key_qinq *qinq = key_buffer; + + qinq->ethertype_svlan = 0; + qinq->svlan = rte_bswap16(key_in->key.qinq.svlan); + qinq->ethertype_cvlan = 0; + qinq->cvlan = rte_bswap16(key_in->key.qinq.cvlan); + + if (signature) +
[dpdk-dev] [PATCH] bond: changed port_id type to uint8_t to prevent data loss.
In some places port_id is declared as int, which causes data loss when using functions expecting port_id as uint8_t. Issue found with static code analysis tool. Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_bond/rte_eth_bond_pmd.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c index a8df699..3ddba25 100644 --- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c +++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c @@ -417,7 +417,7 @@ bandwidth_cmp(const void *a, const void *b) } static void -bandwidth_left(int port_id, uint64_t load, uint8_t update_idx, +bandwidth_left(uint8_t port_id, uint64_t load, uint8_t update_idx, struct bwg_slave *bwg_slave) { struct rte_eth_link link_status; @@ -1681,7 +1681,8 @@ bond_ethdev_configure(struct rte_eth_dev *dev) char *name = dev->data->name; struct bond_dev_private *internals = dev->data->dev_private; struct rte_kvargs *kvlist = internals->kvlist; - int arg_count, port_id = dev - rte_eth_devices; + int arg_count; + uint8_t port_id = dev - rte_eth_devices; /* * if no kvlist, it means that this bonded device has been created -- 1.7.9.5
[dpdk-dev] [PATCH] bond: changed slave_id to uint8_t to prevent data loss
In some places slave_id is declared as uint16_t, which causes data loss when using functions expecting port_id as uint8_t. Issue found with static code analysis tool. Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_bond/rte_eth_bond_8023ad.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_pmd_bond/rte_eth_bond_8023ad.c b/lib/librte_pmd_bond/rte_eth_bond_8023ad.c index f1cf81a..97a828e 100644 --- a/lib/librte_pmd_bond/rte_eth_bond_8023ad.c +++ b/lib/librte_pmd_bond/rte_eth_bond_8023ad.c @@ -747,7 +747,7 @@ bond_mode_8023ad_periodic_cb(void *arg) struct ether_addr slave_addr; void *pkt = NULL; - uint16_t i, slave_id; + uint8_t i, slave_id; /* Update link status on each port */ @@ -1050,7 +1050,7 @@ int bond_mode_8023ad_enable(struct rte_eth_dev *bond_dev) { struct bond_dev_private *internals = bond_dev->data->dev_private; - uint16_t i; + uint8_t i; for (i = 0; i < internals->active_slave_count; i++) bond_mode_8023ad_activate_slave(bond_dev, i); -- 1.7.9.5
[dpdk-dev] [PATCH] bond: changed rx and tx queue_id field type to prevent data loss.
Previous type of rx and tx queue_id field was int, which caused possible data loss when calling functions expecting uint16_t as an argument. Issue found with static code analysis tool. Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_bond/rte_eth_bond_pmd.c |3 ++- lib/librte_pmd_bond/rte_eth_bond_private.h |4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c index 7a17f53..a8df699 100644 --- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c +++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c @@ -937,7 +937,8 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, struct bond_rx_queue *bd_rx_q; struct bond_tx_queue *bd_tx_q; - int errval, q_id; + int errval; + uint16_t q_id; /* Stop slave */ rte_eth_dev_stop(slave_eth_dev->data->port_id); diff --git a/lib/librte_pmd_bond/rte_eth_bond_private.h b/lib/librte_pmd_bond/rte_eth_bond_private.h index 3da5a9e..65697bd 100644 --- a/lib/librte_pmd_bond/rte_eth_bond_private.h +++ b/lib/librte_pmd_bond/rte_eth_bond_private.h @@ -65,7 +65,7 @@ extern const char *driver_name; /** Port Queue Mapping Structure */ struct bond_rx_queue { - int queue_id; + uint16_t queue_id; /**< Queue Id */ struct bond_dev_private *dev_private; /**< Reference to eth_dev private structure */ @@ -78,7 +78,7 @@ struct bond_rx_queue { }; struct bond_tx_queue { - int queue_id; + uint16_t queue_id; /**< Queue Id */ struct bond_dev_private *dev_private; /**< Reference to dev private structure */ -- 1.7.9.5
[dpdk-dev] [PATCH] virtio: Changed variable types to prevent possible data loss in virtio_ethdev.c, virtio_ethdev.h and virtio_rxtx.c
Changed vtpci_queue_idx type in function virtio_dev_queue_setup from uint8_t to uint16_t to prevent possible data loss. Also changed type of head variable in function virtio_send_command from uint32_t to uint16_t. Issues found with static code analysis tool. Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_virtio/virtio_ethdev.c |4 ++-- lib/librte_pmd_virtio/virtio_ethdev.h |2 +- lib/librte_pmd_virtio/virtio_rxtx.c |4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c index b3b5bb6..6624916 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.c +++ b/lib/librte_pmd_virtio/virtio_ethdev.c @@ -106,7 +106,7 @@ static int virtio_send_command(struct virtqueue *vq, struct virtio_pmd_ctrl *ctrl, int *dlen, int pkt_num) { - uint32_t head = vq->vq_desc_head_idx, i; + uint16_t head = vq->vq_desc_head_idx, i; int k, sum = 0; virtio_net_ctrl_ack status = ~0; struct virtio_pmd_ctrl result; @@ -233,7 +233,7 @@ virtio_set_multiple_queues(struct rte_eth_dev *dev, uint16_t nb_queues) int virtio_dev_queue_setup(struct rte_eth_dev *dev, int queue_type, uint16_t queue_idx, - uint8_t vtpci_queue_idx, + uint16_t vtpci_queue_idx, uint16_t nb_desc, unsigned int socket_id, struct virtqueue **pvq) diff --git a/lib/librte_pmd_virtio/virtio_ethdev.h b/lib/librte_pmd_virtio/virtio_ethdev.h index 1da3c62..1c463b1 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.h +++ b/lib/librte_pmd_virtio/virtio_ethdev.h @@ -87,7 +87,7 @@ void virtio_dev_rxtx_start(struct rte_eth_dev *dev); int virtio_dev_queue_setup(struct rte_eth_dev *dev, int queue_type, uint16_t queue_idx, - uint8_t vtpci_queue_idx, + uint16_t vtpci_queue_idx, uint16_t nb_desc, unsigned int socket_id, struct virtqueue **pvq); diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c index c013f97..468e978 100644 --- a/lib/librte_pmd_virtio/virtio_rxtx.c +++ b/lib/librte_pmd_virtio/virtio_rxtx.c @@ -369,7 +369,7 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev, __rte_unused const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp) { - uint8_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_RQ_QUEUE_IDX; + uint16_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_RQ_QUEUE_IDX; struct virtqueue *vq; int ret; @@ -402,7 +402,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev, unsigned int socket_id, const struct rte_eth_txconf *tx_conf) { - uint8_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX; + uint16_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX; struct virtqueue *vq; int ret; -- 1.7.9.5
[dpdk-dev] [PATCH] virtio: fixed possible data loss in function virtio_recv_mergeable_pkts
Variable rcv_cnt declared in function virtio_recv_mergeable_pkts was of type uint32_t. It was used by virtqueue_dequeue_burst_rx function, which expects argument of type uint16_t. Changed rcv_cnt variable type to uint16_t to prevent possible data loss. Issue found with static code analysis tool. Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_virtio/virtio_rxtx.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c index 468e978..8fcad9b 100644 --- a/lib/librte_pmd_virtio/virtio_rxtx.c +++ b/lib/librte_pmd_virtio/virtio_rxtx.c @@ -602,7 +602,7 @@ virtio_recv_mergeable_pkts(void *rx_queue, /* * Get extra segments for current uncompleted packet. */ - uint32_t rcv_cnt = + uint16_t rcv_cnt = RTE_MIN(seg_res, RTE_DIM(rcv_pkts)); if (likely(VIRTQUEUE_NUSED(rxvq) >= rcv_cnt)) { uint32_t rx_num = -- 1.7.9.5
[dpdk-dev] [PATCH] enic: changed type of field ig_vlan_strip_en in struct enic to prevent possible data loss
Field ig_vlan_strip_en in struct enic type is int. It is used only by function enic_set_nic_cfg which expects uint_8 as argument. Changed type of the field to prevent possible loss of precision. Issue found with static code analysis tool. Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_enic/enic.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h index c43417c..1d16a29 100644 --- a/lib/librte_pmd_enic/enic.h +++ b/lib/librte_pmd_enic/enic.h @@ -110,7 +110,7 @@ struct enic { pthread_t err_intr_thread; int promisc; int allmulti; - int ig_vlan_strip_en; + uint8_t ig_vlan_strip_en; int link_status; u8 hw_ip_checksum; -- 1.7.9.5
[dpdk-dev] [PATCH] enic: Changed ENIC_ALIGN to unisgned long to prevent possible data loss
Define ENIC_ALIGN is used only by function rte_memzone_reserve_aligned, which expects argument of type unsigned. Defined constant is of type unsigned long long. Changed type to unsigned long to prevent possible loss of precision. Issue found with static code analysis tool. Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_enic/enic_compat.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_pmd_enic/enic_compat.h b/lib/librte_pmd_enic/enic_compat.h index b1af838..bf2f1af 100644 --- a/lib/librte_pmd_enic/enic_compat.h +++ b/lib/librte_pmd_enic/enic_compat.h @@ -42,7 +42,7 @@ #include #include -#define ENIC_PAGE_ALIGN 4096ULL +#define ENIC_PAGE_ALIGN 4096UL #define ENIC_ALIGN ENIC_PAGE_ALIGN #define NAME_MAX255 #define ETH_ALEN6 -- 1.7.9.5
[dpdk-dev] [PATCH] enic: fixed possible data loss in vnic_dev.h
In function writeq is written in two 32-bit long registers with writel function. When trying to write val >> 32, static code analysis tool reports that 64-bit value is passed to function expecting 32-bit value. Added cast to clear this warning. Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_enic/vnic/vnic_dev.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.h b/lib/librte_pmd_enic/vnic/vnic_dev.h index d1373a5..ca1174f 100644 --- a/lib/librte_pmd_enic/vnic/vnic_dev.h +++ b/lib/librte_pmd_enic/vnic/vnic_dev.h @@ -55,7 +55,7 @@ static inline u64 readq(void __iomem *reg) static inline void writeq(u64 val, void __iomem *reg) { writel(val & 0x, reg); - writel(val >> 32, (char *)reg + 0x4UL); + writel((u32)(val >> 32), (char *)reg + 0x4UL); } #endif -- 1.7.9.5
[dpdk-dev] [PATCH] enic: Fixed possible data loss in vnic_dev.c
Macro GET_CONFIG passes result of sizeof operation to the function vnic_dev_spec. This function expects parameter of type unsigned int. Changed that parameter type to size_t in function declaration to prevent possible data loss. Issue found with static code analysis tool. Signed-off-by: Maciej Gajdzica --- lib/librte_pmd_enic/vnic/vnic_dev.c |2 +- lib/librte_pmd_enic/vnic/vnic_dev.h |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.c b/lib/librte_pmd_enic/vnic/vnic_dev.c index 6407994..917eb67 100644 --- a/lib/librte_pmd_enic/vnic/vnic_dev.c +++ b/lib/librte_pmd_enic/vnic/vnic_dev.c @@ -474,7 +474,7 @@ static int vnic_dev_capable(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd) return !(err || a0); } -int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size, +int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, size_t size, void *value) { u64 a0, a1; diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.h b/lib/librte_pmd_enic/vnic/vnic_dev.h index ca1174f..f583357 100644 --- a/lib/librte_pmd_enic/vnic/vnic_dev.h +++ b/lib/librte_pmd_enic/vnic/vnic_dev.h @@ -136,7 +136,7 @@ void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev); int vnic_dev_fw_info(struct vnic_dev *vdev, struct vnic_devcmd_fw_info **fw_info); int vnic_dev_asic_info(struct vnic_dev *vdev, u16 *asic_type, u16 *asic_rev); -int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, unsigned int size, +int vnic_dev_spec(struct vnic_dev *vdev, unsigned int offset, size_t size, void *value); int vnic_dev_stats_clear(struct vnic_dev *vdev); int vnic_dev_stats_dump(struct vnic_dev *vdev, struct vnic_stats **stats); -- 1.7.9.5
[dpdk-dev] [PATCH v3 00/11] ip_pipeline: ip_pipeline application enhancements
This patchset enhances functionality of ip_pipeline application. New config file syntax is introduced, so parser is changed. Changed structure of the application. Now every global variable is stored in app_struct in app.h. Syntax of pipeline cli commands was changed. Implementation of cli commands for every pipeline is moved to the separate file. Changes in v2: - renamed some files - added more config files - reworked flow classification pipeline implementation - fixed some bugs Changes in v3: - fixed checkpatch errors - fixed bug with message queues - fixed bug with application log Daniel Mrzyglod (1): ip_pipeline: added new implementation of firewall pipeline Jasvinder Singh (3): ip_pipeline: added config checks ip_pipeline: added master pipeline ip_pipeline: added new implementation of passthrough pipeline Maciej Gajdzica (5): ip_pipeline: modified init to match new params struct ip_pipeline: moved pipelines to separate folder ip_pipeline: added application thread ip_pipeline: moved config files to separate folder ip_pipeline: added new implementation of flow classification pipeline Pawel Wodkowski (2): ip_pipeline: add parsing for config files with new syntax ip_pipeline: added new implementation of routing pipeline examples/ip_pipeline/Makefile | 36 +- examples/ip_pipeline/app.h | 868 +++ examples/ip_pipeline/cmdline.c | 1976 examples/ip_pipeline/config.c | 419 examples/ip_pipeline/config/ip_pipeline.cfg|9 + examples/ip_pipeline/config/ip_pipeline.sh |5 + examples/ip_pipeline/config/tm_profile.cfg | 105 + examples/ip_pipeline/config_check.c| 396 examples/ip_pipeline/config_parse.c| 2472 examples/ip_pipeline/config_parse_tm.c | 424 examples/ip_pipeline/cpu_core_map.c| 492 examples/ip_pipeline/cpu_core_map.h| 69 + examples/ip_pipeline/init.c| 1645 + examples/ip_pipeline/ip_pipeline.cfg | 56 - examples/ip_pipeline/ip_pipeline.sh| 18 - examples/ip_pipeline/main.c| 137 +- examples/ip_pipeline/main.h| 298 --- examples/ip_pipeline/pipeline.h| 88 + examples/ip_pipeline/pipeline/hash_func.h | 351 +++ .../ip_pipeline/pipeline/pipeline_actions_common.h | 119 + examples/ip_pipeline/pipeline/pipeline_common_be.c | 206 ++ examples/ip_pipeline/pipeline/pipeline_common_be.h | 163 ++ examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1324 +++ examples/ip_pipeline/pipeline/pipeline_common_fe.h | 228 ++ examples/ip_pipeline/pipeline/pipeline_firewall.c | 1001 examples/ip_pipeline/pipeline/pipeline_firewall.h | 63 + .../ip_pipeline/pipeline/pipeline_firewall_be.c| 740 ++ .../ip_pipeline/pipeline/pipeline_firewall_be.h| 138 ++ .../pipeline/pipeline_flow_classification.c| 2057 .../pipeline/pipeline_flow_classification.h| 105 + .../pipeline/pipeline_flow_classification_be.c | 589 + .../pipeline/pipeline_flow_classification_be.h | 140 ++ examples/ip_pipeline/pipeline/pipeline_master.c| 47 + examples/ip_pipeline/pipeline/pipeline_master.h| 41 + examples/ip_pipeline/pipeline/pipeline_master_be.c | 150 ++ examples/ip_pipeline/pipeline/pipeline_master_be.h | 41 + .../ip_pipeline/pipeline/pipeline_passthrough.c| 47 + .../ip_pipeline/pipeline/pipeline_passthrough.h| 41 + .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 772 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 41 + examples/ip_pipeline/pipeline/pipeline_routing.c | 1541 examples/ip_pipeline/pipeline/pipeline_routing.h | 99 + .../ip_pipeline/pipeline/pipeline_routing_be.c | 869 +++ .../ip_pipeline/pipeline/pipeline_routing_be.h | 230 ++ examples/ip_pipeline/pipeline_be.h | 256 ++ examples/ip_pipeline/pipeline_firewall.c | 313 --- .../ip_pipeline/pipeline_flow_classification.c | 306 --- examples/ip_pipeline/pipeline_ipv4_frag.c | 184 -- examples/ip_pipeline/pipeline_ipv4_ras.c | 181 -- examples/ip_pipeline/pipeline_passthrough.c| 213 -- examples/ip_pipeline/pipeline_routing.c| 474 examples/ip_pipeline/pipeline_rx.c | 385 --- examples/ip_pipeline/pipeline_tx.c | 283 --- examples/ip_pipeline/thread.c | 107 + 54 files changed, 17687 insertions(+), 5671 deletions(-) create mode 100644 examples/ip_pipeline/app.h delete mode 100644 examples/ip_pipeline/cmdline.c delete mode 100644 examples/ip_pipeline/config.c create mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg
[dpdk-dev] [PATCH v3 01/11] ip_pipeline: add parsing for config files with new syntax
From: Pawel Wodkowski New syntax of config files is needed for ip_pipeline example enhancements. Some old files are temporarily disabled in the Makefile. It is part of a bigger change. Signed-off-by: Pawel Wodkowski --- examples/ip_pipeline/Makefile | 17 +- examples/ip_pipeline/app.h | 868 +++ examples/ip_pipeline/config.c | 419 -- examples/ip_pipeline/config_parse.c| 2472 examples/ip_pipeline/config_parse_tm.c | 424 ++ examples/ip_pipeline/cpu_core_map.c| 492 +++ examples/ip_pipeline/cpu_core_map.h| 69 + examples/ip_pipeline/main.c| 130 +- examples/ip_pipeline/main.h| 298 examples/ip_pipeline/pipeline.h| 88 ++ examples/ip_pipeline/pipeline_be.h | 256 11 files changed, 4680 insertions(+), 853 deletions(-) create mode 100644 examples/ip_pipeline/app.h delete mode 100644 examples/ip_pipeline/config.c create mode 100644 examples/ip_pipeline/config_parse.c create mode 100644 examples/ip_pipeline/config_parse_tm.c create mode 100644 examples/ip_pipeline/cpu_core_map.c create mode 100644 examples/ip_pipeline/cpu_core_map.h delete mode 100644 examples/ip_pipeline/main.h create mode 100644 examples/ip_pipeline/pipeline.h create mode 100644 examples/ip_pipeline/pipeline_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index e70fdc7..b0feb4f 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -43,20 +43,9 @@ APP = ip_pipeline # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cmdline.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_rx.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_tx.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_frag.c -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_ipv4_ras.c - -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) -SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c -endif +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h new file mode 100644 index 000..be4c63f --- /dev/null +++ b/examples/ip_pipeline/app.h @@ -0,0 +1,868 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __INCLUDE_APP_H__ +#define __INCLUDE_APP_H__ + +#include +#include + +#include +#include +#include +#include + +#include + +#include "cpu_core_map.h" +#include "pipeline.h" + +#define APP_PARAM_NAME_SIZE PIPELINE_NAME_SIZE + +struct app_mempool_params { + char name[APP_PARAM_NAME_SIZE]; + uint32_t parsed; + uint32_t buffer_size; + uint32_t pool_size; + uint32_t cache_size; + uint32_t cpu_socket_id; +}; + +struct app_link_params { + char name[APP_PARAM_NAME_SIZE]; + uint32_t
[dpdk-dev] [PATCH v3 02/11] ip_pipeline: added config checks
From: Jasvinder Singh After loading configuration from a file, data integrity is checked. Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/config_check.c | 396 +++ examples/ip_pipeline/main.c |2 + 3 files changed, 399 insertions(+) create mode 100644 examples/ip_pipeline/config_check.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index b0feb4f..bc50e71 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -45,6 +45,7 @@ APP = ip_pipeline SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 diff --git a/examples/ip_pipeline/config_check.c b/examples/ip_pipeline/config_check.c new file mode 100644 index 000..2218238 --- /dev/null +++ b/examples/ip_pipeline/config_check.c @@ -0,0 +1,396 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "app.h" + +static void +check_mempools(struct app_params *app) +{ + uint32_t i; + + for (i = 0; i < app->n_mempools; i++) { + struct app_mempool_params *p = &app->mempool_params[i]; + + APP_CHECK((p->pool_size > 0), + "Mempool %s size is 0\n", p->name); + + APP_CHECK((p->cache_size > 0), + "Mempool %s cache size is 0\n", p->name); + + APP_CHECK(rte_is_power_of_2(p->cache_size), + "Mempool %s cache size not a power of 2\n", p->name); + } +} + +static void +check_links(struct app_params *app) +{ + uint32_t i; + + /* Check that number of links matches the port mask */ + APP_CHECK((app->n_links == __builtin_popcountll(app->port_mask)), + "Not enough links provided in the PORT_MASK\n"); + + for (i = 0; i < app->n_links; i++) { + struct app_link_params *link = &app->link_params[i]; + uint32_t rxq_max, n_rxq, n_txq, link_id, i; + + APP_PARAM_GET_ID(link, "LINK", link_id); + + /* Check that link RXQs are contiguous */ + rxq_max = 0; + if (link->arp_q > rxq_max) + rxq_max = link->arp_q; + if (link->tcp_syn_local_q > rxq_max) + rxq_max = link->tcp_syn_local_q; + if (link->ip_local_q > rxq_max) + rxq_max = link->ip_local_q; + if (link->tcp_local_q > rxq_max) + rxq_max = link->tcp_local_q; + if (link->udp_local_q > rxq_max) + rxq_max = link->udp_local_q; + if (link->sctp_local_q > rxq_max) + rxq_max = link->sctp_local_q; + + for (i = 1; i <= rxq_max; i++) + APP_CHECK(((link->arp_q == i) || + (link->tcp_syn_local_q == i) || + (link->ip_local_q == i) || + (link->tcp_local_q == i) || + (link->udp_local_q == i) || +
[dpdk-dev] [PATCH v3 03/11] ip_pipeline: modified init to match new params struct
After changes in config parser, app params struct is changed and requires modifications in initialization procedures. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/init.c | 1632 ++--- examples/ip_pipeline/main.c |3 + 3 files changed, 1203 insertions(+), 433 deletions(-) diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index bc50e71..59bea5b 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -46,6 +46,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index d79762f..8e8b290 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,561 +32,1327 @@ */ #include -#include -#include -#include -#include #include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include - -#include "main.h" - -#define NA APP_SWQ_INVALID - -struct app_params app = { - /* CPU cores */ - .cores = { - {0, APP_CORE_MASTER, {15, 16, 17, NA, NA, NA, NA, NA}, - {12, 13, 14, NA, NA, NA, NA, NA} }, - {0, APP_CORE_RX, {NA, NA, NA, NA, NA, NA, NA, 12}, - { 0, 1, 2, 3, NA, NA, NA, 15} }, - {0, APP_CORE_FC, { 0, 1, 2, 3, NA, NA, NA, 13}, - { 4, 5, 6, 7, NA, NA, NA, 16} }, - {0, APP_CORE_RT, { 4, 5, 6, 7, NA, NA, NA, 14}, - { 8, 9, 10, 11, NA, NA, NA, 17} }, - {0, APP_CORE_TX, { 8, 9, 10, 11, NA, NA, NA, NA}, - {NA, NA, NA, NA, NA, NA, NA, NA} }, - }, - - /* Ports*/ - .n_ports = APP_MAX_PORTS, - .rsz_hwq_rx = 128, - .rsz_hwq_tx = 512, - .bsz_hwq_rd = 64, - .bsz_hwq_wr = 64, - - .port_conf = { - .rxmode = { - .split_hdr_size = 0, - .header_split = 0, /* Header Split disabled */ - .hw_ip_checksum = 1, /* IP checksum offload enabled */ - .hw_vlan_filter = 0, /* VLAN filtering disabled */ - .jumbo_frame= 1, /* Jumbo Frame Support enabled */ - .max_rx_pkt_len = 9000, /* Jumbo Frame MAC pkt length */ - .hw_strip_crc = 0, /* CRC stripped by hardware */ - }, - .rx_adv_conf = { - .rss_conf = { - .rss_key = NULL, - .rss_hf = ETH_RSS_IP, - }, - }, - .txmode = { - .mq_mode = ETH_MQ_TX_NONE, - }, - }, - - .rx_conf = { - .rx_thresh = { - .pthresh = 8, - .hthresh = 8, - .wthresh = 4, - }, - .rx_free_thresh = 64, - .rx_drop_en = 0, - }, - - .tx_conf = { - .tx_thresh = { - .pthresh = 36, - .hthresh = 0, - .wthresh = 0, - }, - .tx_free_thresh = 0, - .tx_rs_thresh = 0, - }, - - /* SWQs */ - .rsz_swq = 128, - .bsz_swq_rd = 64, - .bsz_swq_wr = 64, - - /* Buffer pool */ - .pool_buffer_size = RTE_MBUF_DEFAULT_BUF_SIZE, - .pool_size = 32 * 1024, - .pool_cache_size = 256, - - /* Message buffer pool */ - .msg_pool_buffer_size = 256, - .msg_pool_size = 1024, - .msg_pool_cache_size = 64, - - /* Rule tables */ - .max_arp_rules = 1 << 10, - .max_firewall_rules = 1 << 5, - .max_routing_rules = 1 << 24, - .max_flow_rules = 1 << 24, - - /* Application processing */ - .ether_hdr_pop_push = 0, -}; - -struct app_core_params * -app_get_core_params(uint32_t core_id) -{ - uint32_t i; +#include +#include - for (i = 0; i < RTE_MAX
[dpdk-dev] [PATCH v3 04/11] ip_pipeline: moved pipelines to separate folder
Moved pipelines to separate folder, removed not needed pipelines and modified Makefile to match that change. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |9 +- examples/ip_pipeline/pipeline/pipeline_firewall.c | 313 + .../pipeline/pipeline_flow_classification.c| 306 + .../ip_pipeline/pipeline/pipeline_passthrough.c| 213 + examples/ip_pipeline/pipeline/pipeline_routing.c | 474 examples/ip_pipeline/pipeline_firewall.c | 313 - .../ip_pipeline/pipeline_flow_classification.c | 306 - examples/ip_pipeline/pipeline_ipv4_frag.c | 184 examples/ip_pipeline/pipeline_ipv4_ras.c | 181 examples/ip_pipeline/pipeline_passthrough.c| 213 - examples/ip_pipeline/pipeline_routing.c| 474 examples/ip_pipeline/pipeline_rx.c | 385 examples/ip_pipeline/pipeline_tx.c | 283 13 files changed, 1314 insertions(+), 2340 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.c delete mode 100644 examples/ip_pipeline/pipeline_firewall.c delete mode 100644 examples/ip_pipeline/pipeline_flow_classification.c delete mode 100644 examples/ip_pipeline/pipeline_ipv4_frag.c delete mode 100644 examples/ip_pipeline/pipeline_ipv4_ras.c delete mode 100644 examples/ip_pipeline/pipeline_passthrough.c delete mode 100644 examples/ip_pipeline/pipeline_routing.c delete mode 100644 examples/ip_pipeline/pipeline_rx.c delete mode 100644 examples/ip_pipeline/pipeline_tx.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 59bea5b..213e879 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -36,11 +36,17 @@ endif # Default target, can be overridden by command line or environment RTE_TARGET ?= x86_64-native-linuxapp-gcc +DIRS-(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline + include $(RTE_SDK)/mk/rte.vars.mk # binary name APP = ip_pipeline +VPATH += $(SRCDIR)/pipeline + +INC += $(wildcard *.h) $(wildcard pipeline/*.h) + # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c @@ -49,7 +55,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c +CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 -CFLAGS += $(WERROR_FLAGS) +CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable include $(RTE_SDK)/mk/rte.extapp.mk diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c b/examples/ip_pipeline/pipeline/pipeline_firewall.c new file mode 100644 index 000..b70260e --- /dev/null +++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c @@ -0,0 +1,313 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include
[dpdk-dev] [PATCH v3 05/11] ip_pipeline: added master pipeline
From: Jasvinder Singh Master pipeline is responsible for command line handling and communicationg with all other pipelines via message queues. Removed cmdline.c file, as its functionality will be split over multiple pipeline files. Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |5 + examples/ip_pipeline/cmdline.c | 1976 examples/ip_pipeline/init.c|5 + examples/ip_pipeline/pipeline/pipeline_common_be.c | 206 ++ examples/ip_pipeline/pipeline/pipeline_common_be.h | 163 ++ examples/ip_pipeline/pipeline/pipeline_common_fe.c | 1324 + examples/ip_pipeline/pipeline/pipeline_common_fe.h | 228 +++ examples/ip_pipeline/pipeline/pipeline_master.c| 47 + examples/ip_pipeline/pipeline/pipeline_master.h| 41 + examples/ip_pipeline/pipeline/pipeline_master_be.c | 150 ++ examples/ip_pipeline/pipeline/pipeline_master_be.h | 41 + 11 files changed, 2210 insertions(+), 1976 deletions(-) delete mode 100644 examples/ip_pipeline/cmdline.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_be.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_common_fe.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_master.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_master.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_master_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 213e879..9ce80a8 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -55,6 +55,11 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_fe.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c + CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) -Wno-error=unused-function -Wno-error=unused-variable diff --git a/examples/ip_pipeline/cmdline.c b/examples/ip_pipeline/cmdline.c deleted file mode 100644 index 3173fd0..000 --- a/examples/ip_pipeline/cmdline.c +++ /dev/null @@ -1,1976 +0,0 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "main.h" - -#define IS_RULE_PRESENT(res, rule_key, table, type)\ -do { \ - struct app_rule *it;\ - \ - (res) = NULL; \ - TAILQ_FOREACH(it, &table, entries) {\
[dpdk-dev] [PATCH v3 06/11] ip_pipeline: added application thread
Application thread runs pipelines on assigned cores. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |1 + examples/ip_pipeline/main.c |6 +++ examples/ip_pipeline/thread.c | 107 + 3 files changed, 114 insertions(+) create mode 100644 examples/ip_pipeline/thread.c diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 9ce80a8..f255338 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -53,6 +53,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_parse_tm.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += config_check.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += init.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += thread.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += cpu_core_map.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c diff --git a/examples/ip_pipeline/main.c b/examples/ip_pipeline/main.c index ef68c86..862e2f2 100644 --- a/examples/ip_pipeline/main.c +++ b/examples/ip_pipeline/main.c @@ -52,5 +52,11 @@ main(int argc, char **argv) /* Init */ app_init(&app); + /* Run-time */ + rte_eal_mp_remote_launch( + app_thread, + (void *) &app, + CALL_MASTER); + return 0; } diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c new file mode 100644 index 000..28dc1d6 --- /dev/null +++ b/examples/ip_pipeline/thread.c @@ -0,0 +1,107 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include "pipeline_common_be.h" +#include "app.h" + +int app_thread(void *arg) +{ + struct app_params *app = (struct app_params *) arg; + uint32_t core_id = rte_lcore_id(), i, j; + struct app_thread_data *t = &app->thread_data[core_id]; + + for (i = 0; ; i++) { + /* Run regular pipelines */ + for (j = 0; j < t->n_regular; j++) { + struct app_thread_pipeline_data *data = &t->regular[j]; + struct pipeline *p = data->be; + + rte_pipeline_run(p->p); + } + + /* Run custom pipelines */ + for (j = 0; j < t->n_custom; j++) { + struct app_thread_pipeline_data *data = &t->custom[j]; + + data->f_run(data->be); + } + + /* Timer */ + if ((i & 0xF) == 0) { + uint64_t time = rte_get_tsc_cycles(); + uint64_t t_deadline = UINT64_MAX; + + if (time < t->deadline) + continue; + + /* Timer for regular pipelines */ + for (j = 0; j < t->n_regular; j++) { + struct app_thread_pipeline_data *data = + &t->regular[j]; + uint64_t p_deadline = data->deadline; + + if (p_deadline <= time) { + data->f_timer(data->be); +
[dpdk-dev] [PATCH v3 07/11] ip_pipeline: moved config files to separate folder
Created new folder for config(.cfg) and script(.sh) files. Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/config/ip_pipeline.cfg |9 +++ examples/ip_pipeline/config/ip_pipeline.sh |5 ++ examples/ip_pipeline/config/tm_profile.cfg | 105 +++ examples/ip_pipeline/ip_pipeline.cfg| 56 -- examples/ip_pipeline/ip_pipeline.sh | 18 - 5 files changed, 119 insertions(+), 74 deletions(-) create mode 100644 examples/ip_pipeline/config/ip_pipeline.cfg create mode 100644 examples/ip_pipeline/config/ip_pipeline.sh create mode 100644 examples/ip_pipeline/config/tm_profile.cfg delete mode 100644 examples/ip_pipeline/ip_pipeline.cfg delete mode 100644 examples/ip_pipeline/ip_pipeline.sh diff --git a/examples/ip_pipeline/config/ip_pipeline.cfg b/examples/ip_pipeline/config/ip_pipeline.cfg new file mode 100644 index 000..095ed25 --- /dev/null +++ b/examples/ip_pipeline/config/ip_pipeline.cfg @@ -0,0 +1,9 @@ +[PIPELINE0] +type = MASTER +core = 0 + +[PIPELINE1] +type = PASS-THROUGH +core = 1 +pktq_in = RXQ0.0 RXQ1.0 RXQ2.0 RXQ3.0 +pktq_out = TXQ0.0 TXQ1.0 TXQ2.0 TXQ3.0 diff --git a/examples/ip_pipeline/config/ip_pipeline.sh b/examples/ip_pipeline/config/ip_pipeline.sh new file mode 100644 index 000..4fca259 --- /dev/null +++ b/examples/ip_pipeline/config/ip_pipeline.sh @@ -0,0 +1,5 @@ +# +#run config/ip_pipeline.sh +# + +p 1 ping diff --git a/examples/ip_pipeline/config/tm_profile.cfg b/examples/ip_pipeline/config/tm_profile.cfg new file mode 100644 index 000..53edb67 --- /dev/null +++ b/examples/ip_pipeline/config/tm_profile.cfg @@ -0,0 +1,105 @@ +; BSD LICENSE +; +; Copyright(c) 2010-2014 Intel Corporation. All rights reserved. +; All rights reserved. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; +; * Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; * Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in +; the documentation and/or other materials provided with the +; distribution. +; * Neither the name of Intel Corporation nor the names of its +; contributors may be used to endorse or promote products derived +; from this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +; This file enables the following hierarchical scheduler configuration for each +; 10GbE output port: +; * Single subport (subport 0): +; - Subport rate set to 100% of port rate +; - Each of the 4 traffic classes has rate set to 100% of port rate +; * 4K pipes per subport 0 (pipes 0 .. 4095) with identical configuration: +; - Pipe rate set to 1/4K of port rate +; - Each of the 4 traffic classes has rate set to 100% of pipe rate +; - Within each traffic class, the byte-level WRR weights for the 4 queues +; are set to 1:1:1:1 +; +; For more details, please refer to chapter "Quality of Service (QoS) Framework" +; of Intel Data Plane Development Kit (Intel DPDK) Programmer's Guide. + +; Port configuration +[port] +frame overhead = 24 ; frame overhead = Preamble (7) + SFD (1) + FCS (4) + IFG (12) +mtu = 1522; mtu = Q-in-Q MTU (FCS not included) +number of subports per port = 1 +number of pipes per subport = 4096 +queue sizes = 64 64 64 64 + +; Subport configuration +[subport 0] +tb rate = 125000 ; Bytes per second +tb size = 100 ; Bytes + +tc 0 rate = 125000 ; Bytes per second +tc 1 rate = 125000 ; Bytes per second +tc 2 rate = 125000 ; Bytes per second +tc 3 rate = 125000 ; Bytes per second +tc period = 10 ; Milliseconds + +pipe 0-4095 = 0; These pipes are configured with pipe profile 0 + +; Pipe configuration +[pipe profile 0] +tb rate = 305175 ; Bytes per second +tb size = 100
[dpdk-dev] [PATCH v3 08/11] ip_pipeline: added new implementation of passthrough pipeline
From: Jasvinder Singh Passthrough pipeline implementation is split to two files. pipeline_passthrough.c file handles front-end functions (cli commands parsing) pipeline_passthrough_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Jasvinder Singh --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/hash_func.h | 351 + .../ip_pipeline/pipeline/pipeline_actions_common.h | 119 +++ .../ip_pipeline/pipeline/pipeline_passthrough.c| 192 + .../ip_pipeline/pipeline/pipeline_passthrough.h| 41 ++ .../ip_pipeline/pipeline/pipeline_passthrough_be.c | 772 .../ip_pipeline/pipeline/pipeline_passthrough_be.h | 41 ++ 8 files changed, 1341 insertions(+), 179 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/hash_func.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_actions_common.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_passthrough_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index f255338..930dc61 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -60,6 +60,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_common_fe.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index fac2e9a..6cffbc6 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -45,6 +45,7 @@ #include "pipeline.h" #include "pipeline_common_fe.h" #include "pipeline_master.h" +#include "pipeline_passthrough.h" #define APP_NAME_SIZE 32 @@ -1270,6 +1271,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); + app_pipeline_type_register(app, &pipeline_passthrough); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/hash_func.h b/examples/ip_pipeline/pipeline/hash_func.h new file mode 100644 index 000..7846300 --- /dev/null +++ b/examples/ip_pipeline/pipeline/hash_func.h @@ -0,0 +1,351 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef __INCLUDE_HASH_FUNC_H__ +#define __INCLUDE_HASH_FUNC_H__ + +static inline uint64_t +hash_xor_key8(void *key, __rte_unused uint32_t key_size, uint64_t seed) +{ + uint64_t *k = key; + uint64_t xor0; + + xor0 = seed ^ k[0]; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +hash_xor_key16(void *key, __rte_unused uint32_t key_size, uint64_t seed) +{ + uint64_t *k = key; + uint64_t xor0; + + xor0 = (k[0] ^ seed) ^ k[1]; + + return (xor0 >> 32) ^ xor0; +} + +static inline uint64_t +hash_xor_key24(void *
[dpdk-dev] [PATCH v3 09/11] ip_pipeline: added new implementation of firewall pipeline
From: Daniel Mrzyglod Firewall pipeline implementation is split to two files. pipeline_firewall.c file handles front-end functions (cli commands parsing) pipeline_firewall_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Daniel Mrzyglod --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/pipeline_firewall.c | 1162 examples/ip_pipeline/pipeline/pipeline_firewall.h | 63 ++ .../ip_pipeline/pipeline/pipeline_firewall_be.c| 740 + .../ip_pipeline/pipeline/pipeline_firewall_be.h| 138 +++ 6 files changed, 1870 insertions(+), 237 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_firewall_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 930dc61..382fee6 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -62,6 +62,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_master.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 6cffbc6..632d429 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -46,6 +46,7 @@ #include "pipeline_common_fe.h" #include "pipeline_master.h" #include "pipeline_passthrough.h" +#include "pipeline_firewall.h" #define APP_NAME_SIZE 32 @@ -1272,6 +1273,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); + app_pipeline_type_register(app, &pipeline_firewall); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c b/examples/ip_pipeline/pipeline/pipeline_firewall.c index b70260e..a4beede 100644 --- a/examples/ip_pipeline/pipeline/pipeline_firewall.c +++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,282 +32,970 @@ */ #include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include + +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_firewall.h" + +struct app_pipeline_firewall_rule { + struct pipeline_firewall_key key; + int32_t priority; + uint32_t port_id; + void *entry_ptr; + + TAILQ_ENTRY(app_pipeline_firewall_rule) node; +}; + +struct app_pipeline_firewall { + /* parameters */ + uint32_t n_ports_in; + uint32_t n_ports_out; + + /* rules */ + TAILQ_HEAD(, app_pipeline_firewall_rule) rules; + uint32_t n_rules; + uint32_t default_rule_present; + uint32_t default_rule_port_id; + void *default_rule_entry_ptr; +}; -#include -#include -#include +static void +print_firewall_ipv4_rule(struct app_pipeline_firewall_rule *rule) +{ + printf("Prio = %d (SA = %u.%u.%u.%u/%u, " + "DA = %u.%u.%u.%u/%u, " + "SP = %u-%u, " + "DP = %u-%u, " + "Proto = %u / 0x%x) => " + "Port = %u (entry ptr = %p)\n", + + rule->priority, + + (rule->key.key.ipv4_5tuple.src_ip >> 24) & 0xFF, + (rule->key.key.ipv4_5tuple.src_ip >> 16) & 0xFF, + (rule->key.key.ipv4_5tuple.src_ip >> 8) & 0xFF, + rule->key.key.ipv4_5tuple.src_ip & 0xFF, + rule->key.key.ipv4_5tuple.src_ip_mask, + + (rule->key.key.ipv4_5tuple.dst_ip >> 24) & 0xFF, + (rule->key.key.ipv4_5tuple.dst_ip >> 16) & 0xFF, + (rule->key.key.ipv4_5tuple.dst_ip >> 8) & 0xFF, + rule->key.key.ipv4_5tuple.dst_ip & 0xFF, + rule->key.key.ipv4_5tuple.dst_ip_mask, + + rule->key.key.ipv4_5tuple.src_port_from, + rule->key.key.ipv4_5tuple.src_port_to, + + rule->key.key.ipv4_5tuple.dst_port_from, + rule->key.key.ipv4_5tuple.dst_port_to, + + rule->key.key.ipv4_5tuple.
[dpdk-dev] [PATCH v3 10/11] ip_pipeline: added new implementation of routing pipeline
From: Pawel Wodkowski Routing pipeline implementation is split to two files. pipeline_routing.c file handles front-end functions (cli commands parsing) pipeline_routing_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Pawel Wodkowski --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + examples/ip_pipeline/pipeline/pipeline_routing.c | 1783 examples/ip_pipeline/pipeline/pipeline_routing.h | 99 ++ .../ip_pipeline/pipeline/pipeline_routing_be.c | 869 ++ .../ip_pipeline/pipeline/pipeline_routing_be.h | 230 +++ 6 files changed, 2627 insertions(+), 358 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_routing_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index 382fee6..a2881a6 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -64,6 +64,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/pipeline CFLAGS += -O3 diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 632d429..63db23c 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -47,6 +47,7 @@ #include "pipeline_master.h" #include "pipeline_passthrough.h" #include "pipeline_firewall.h" +#include "pipeline_routing.h" #define APP_NAME_SIZE 32 @@ -1274,6 +1275,7 @@ int app_init(struct app_params *app) app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); app_pipeline_type_register(app, &pipeline_firewall); + app_pipeline_type_register(app, &pipeline_routing); app_init_pipelines(app); app_init_threads(app); diff --git a/examples/ip_pipeline/pipeline/pipeline_routing.c b/examples/ip_pipeline/pipeline/pipeline_routing.c index b1ce624..2415aa2 100644 --- a/examples/ip_pipeline/pipeline/pipeline_routing.c +++ b/examples/ip_pipeline/pipeline/pipeline_routing.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,444 +31,1511 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include +#include +#include +#include +#include +#include -#include -#include -#include -#include -#include -#include +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_routing.h" -#include -#include -#include -#include +struct app_pipeline_routing_route { + struct pipeline_routing_route_key key; + struct app_pipeline_routing_route_params params; + void *entry_ptr; -#include "main.h" + TAILQ_ENTRY(app_pipeline_routing_route) node; +}; -#include +struct app_pipeline_routing_arp_entry { + struct pipeline_routing_arp_key key; + struct ether_addr macaddr; + void *entry_ptr; -struct app_routing_table_entry { - struct rte_pipeline_table_entry head; - uint32_t nh_ip; - uint32_t nh_iface; + TAILQ_ENTRY(app_pipeline_routing_arp_entry) node; }; -struct app_arp_table_entry { - struct rte_pipeline_table_entry head; - struct ether_addr nh_arp; +struct pipeline_routing { + /* Parameters */ + uint32_t n_ports_in; + uint32_t n_ports_out; + + /* Routes */ + TAILQ_HEAD(, app_pipeline_routing_route) routes; + uint32_t n_routes; + + uint32_t default_route_present; + uint32_t default_route_port_id; + void *default_route_entry_ptr; + + /* ARP entries */ + TAILQ_HEAD(, app_pipeline_routing_arp_entry) arp_entries; + uint32_t n_arp_entries; + + uint32_t default_arp_entry_present; + uint32_t default_arp_entry_port_id; + void *default_arp_entry_ptr; }; -static inline void -app_routing_table_write_metadata( - struct rte_mbuf *pkt, - struct app_routing_table_entry *entry) +static void * +pipeline_routing_init(struct pipeline_params *params, + __rte_unused void *arg) { - struct app_pkt_metadata *c = - (struct app_pkt_metadata *) RTE_MBUF_METADATA_UINT8_PTR(pkt, 0); + struct pipeline_routing *p; + uint32_t size; + + /* Check input arguments */ + if ((params == NULL) || +
[dpdk-dev] [PATCH v3 11/11] ip_pipeline: added new implementation of flow classification pipeline
Flow classification pipeline implementation is split to two files. pipeline_flow_classification.c file handles front-end functions (cli commands parsing) pipeline_flow_classification_ops.c contains implementation of functions done by pipeline (back-end). Signed-off-by: Maciej Gajdzica --- examples/ip_pipeline/Makefile |2 + examples/ip_pipeline/init.c|2 + .../pipeline/pipeline_flow_classification.c| 2205 ++-- .../pipeline/pipeline_flow_classification.h| 105 + .../pipeline/pipeline_flow_classification_be.c | 589 ++ .../pipeline/pipeline_flow_classification_be.h | 140 ++ 6 files changed, 2816 insertions(+), 227 deletions(-) create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification.h create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c create mode 100644 examples/ip_pipeline/pipeline/pipeline_flow_classification_be.h diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile index a2881a6..f3ff1ec 100644 --- a/examples/ip_pipeline/Makefile +++ b/examples/ip_pipeline/Makefile @@ -64,6 +64,8 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_passthrough.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_firewall.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification_be.c +SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_flow_classification.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing_be.c SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) += pipeline_routing.c diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 63db23c..431b69e 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -47,6 +47,7 @@ #include "pipeline_master.h" #include "pipeline_passthrough.h" #include "pipeline_firewall.h" +#include "pipeline_flow_classification.h" #include "pipeline_routing.h" #define APP_NAME_SIZE 32 @@ -1274,6 +1275,7 @@ int app_init(struct app_params *app) app_pipeline_common_cmd_push(app); app_pipeline_type_register(app, &pipeline_master); app_pipeline_type_register(app, &pipeline_passthrough); + app_pipeline_type_register(app, &pipeline_flow_classification); app_pipeline_type_register(app, &pipeline_firewall); app_pipeline_type_register(app, &pipeline_routing); diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c index cc0cbf1..abbd3be 100644 --- a/examples/ip_pipeline/pipeline/pipeline_flow_classification.c +++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,275 +32,2026 @@ */ #include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -#include -#include -#include +#include "app.h" +#include "pipeline_common_fe.h" +#include "pipeline_flow_classification.h" +#include "hash_func.h" -#include "main.h" +/* + * Key conversion + */ + +struct pkt_key_qinq { + uint16_t ethertype_svlan; + uint16_t svlan; + uint16_t ethertype_cvlan; + uint16_t cvlan; +} __attribute__((__packed__)); + +struct pkt_key_ipv4_5tuple { + uint8_t ttl; + uint8_t proto; + uint16_t checksum; + uint32_t ip_src; + uint32_t ip_dst; + uint16_t port_src; + uint16_t port_dst; +} __attribute__((__packed__)); + +struct pkt_key_ipv6_5tuple { + uint16_t payload_length; + uint8_t proto; + uint8_t hop_limit; + uint8_t ip_src[16]; + uint8_t ip_dst[16]; + uint16_t port_src; + uint16_t port_dst; +} __attribute__((__packed__)); + +static int +app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in, + uint8_t *key_out, + uint32_t *signature) +{ + uint8_t buffer[PIPELINE_FC_FLOW_KEY_MAX_SIZE]; + void *key_buffer = (key_out) ? key_out : buffer; + + switch (key_in->type) { + case FLOW_KEY_QINQ: + { + struct pkt_key_qinq *qinq = key_buffer; + + qinq->ethertype_svlan = 0; + qinq->svlan = rte_bswap16(key_in->key.qinq.svlan); + qinq->ethertype_cvlan = 0; + qinq->cvlan = rte_bswap16(key_in->key.qinq.cvlan); + + if (signature) +
[dpdk-dev] [PATCH] table: fix a crash during key8 and key32 overload
hash_key8_ext and hash_key32_ext tables allocate cache entries to support table overload cases. The crash can occur when cache entry is free after use. The problem is with computing the index of the free cache entry. The same case for key16 was fixed with earlier patch. Signed-off-by: Maciej Gajdzica --- lib/librte_table/rte_table_hash_key32.c |5 ++--- lib/librte_table/rte_table_hash_key8.c |5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/librte_table/rte_table_hash_key32.c b/lib/librte_table/rte_table_hash_key32.c index da0ce6a..6790594 100644 --- a/lib/librte_table/rte_table_hash_key32.c +++ b/lib/librte_table/rte_table_hash_key32.c @@ -540,9 +540,8 @@ rte_table_hash_entry_delete_key32_ext( memset(bucket, 0, sizeof(struct rte_bucket_4_32)); - bucket_index = (bucket - - ((struct rte_bucket_4_32 *) - f->memory)) - f->n_buckets; + bucket_index = (((uint8_t *)bucket - + (uint8_t *)f->memory)/f->bucket_size) - f->n_buckets; f->stack[f->stack_pos++] = bucket_index; } diff --git a/lib/librte_table/rte_table_hash_key8.c b/lib/librte_table/rte_table_hash_key8.c index 443ca7d..6803eb2 100644 --- a/lib/librte_table/rte_table_hash_key8.c +++ b/lib/librte_table/rte_table_hash_key8.c @@ -528,9 +528,8 @@ rte_table_hash_entry_delete_key8_ext( memset(bucket, 0, sizeof(struct rte_bucket_4_8)); - bucket_index = (bucket - - ((struct rte_bucket_4_8 *) - f->memory)) - f->n_buckets; + bucket_index = (((uint8_t *)bucket - + (uint8_t *)f->memory)/f->bucket_size) - f->n_buckets; f->stack[f->stack_pos++] = bucket_index; } -- 1.7.9.5
[dpdk-dev] [PATCH] table: fix a crash during key8 and key32 overload
hash_key8_ext and hash_key32_ext tables allocate cache entries to support table overload cases. The crash can occur when cache entry is free after use. The problem is with computing the index of the free cache entry. The same case for key16 was fixed with earlier patch. Signed-off-by: Maciej Gajdzica --- lib/librte_table/rte_table_hash_key32.c |5 ++--- lib/librte_table/rte_table_hash_key8.c |5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/librte_table/rte_table_hash_key32.c b/lib/librte_table/rte_table_hash_key32.c index da0ce6a..6790594 100644 --- a/lib/librte_table/rte_table_hash_key32.c +++ b/lib/librte_table/rte_table_hash_key32.c @@ -540,9 +540,8 @@ rte_table_hash_entry_delete_key32_ext( memset(bucket, 0, sizeof(struct rte_bucket_4_32)); - bucket_index = (bucket - - ((struct rte_bucket_4_32 *) - f->memory)) - f->n_buckets; + bucket_index = (((uint8_t *)bucket - + (uint8_t *)f->memory)/f->bucket_size) - f->n_buckets; f->stack[f->stack_pos++] = bucket_index; } diff --git a/lib/librte_table/rte_table_hash_key8.c b/lib/librte_table/rte_table_hash_key8.c index 443ca7d..6803eb2 100644 --- a/lib/librte_table/rte_table_hash_key8.c +++ b/lib/librte_table/rte_table_hash_key8.c @@ -528,9 +528,8 @@ rte_table_hash_entry_delete_key8_ext( memset(bucket, 0, sizeof(struct rte_bucket_4_8)); - bucket_index = (bucket - - ((struct rte_bucket_4_8 *) - f->memory)) - f->n_buckets; + bucket_index = (((uint8_t *)bucket - + (uint8_t *)f->memory)/f->bucket_size) - f->n_buckets; f->stack[f->stack_pos++] = bucket_index; } -- 1.7.9.5
[dpdk-dev] [PATCH 0/3] port: added ethdev_writer_nodrop and ring_writer_nodrop ports
When nodrop writer port fails to send data, it retries until reach maximum number of retries. Also added new tx_bulk implementation for ring writer port. Maciej Gajdzica (3): port: added WRITER_APPROACH == 1 implementation to ring port port: added ethdev_writer_nodrop port port: added ring_writer_nodrop port lib/librte_port/rte_port_ethdev.c | 230 ++ lib/librte_port/rte_port_ethdev.h | 19 +++ lib/librte_port/rte_port_ring.c | 285 + lib/librte_port/rte_port_ring.h | 16 +++ 4 files changed, 550 insertions(+) -- 1.7.9.5
[dpdk-dev] [PATCH 1/3] port: added WRITER_APPROACH == 1 implementation to ring port
Added better optimized implementation of tx_bulk for ring writer port based on similar solution in ethdev_writer port. New implementation sends burst without copying data to internal buffer if it is possible. --- lib/librte_port/rte_port_ring.c | 59 +++ 1 file changed, 59 insertions(+) diff --git a/lib/librte_port/rte_port_ring.c b/lib/librte_port/rte_port_ring.c index fa3d77b..ba2eeb3 100644 --- a/lib/librte_port/rte_port_ring.c +++ b/lib/librte_port/rte_port_ring.c @@ -96,11 +96,14 @@ rte_port_ring_reader_free(void *port) /* * Port RING Writer */ +#define RTE_PORT_RING_WRITER_APPROACH 1 + struct rte_port_ring_writer { struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX]; struct rte_ring *ring; uint32_t tx_burst_sz; uint32_t tx_buf_count; + uint64_t bsz_mask; }; static void * @@ -130,6 +133,7 @@ rte_port_ring_writer_create(void *params, int socket_id) port->ring = conf->ring; port->tx_burst_sz = conf->tx_burst_sz; port->tx_buf_count = 0; + port->bsz_mask = 1LLU << (conf->tx_burst_sz - 1); return port; } @@ -160,6 +164,8 @@ rte_port_ring_writer_tx(void *port, struct rte_mbuf *pkt) return 0; } +#if RTE_PORT_RING_WRITER_APPROACH == 0 + static int rte_port_ring_writer_tx_bulk(void *port, struct rte_mbuf **pkts, @@ -194,6 +200,59 @@ rte_port_ring_writer_tx_bulk(void *port, return 0; } +#elif RTE_PORT_RING_WRITER_APPROACH == 1 + +static int +rte_port_ring_writer_tx_bulk(void *port, + struct rte_mbuf **pkts, + uint64_t pkts_mask) +{ + struct rte_port_ring_writer *p = + (struct rte_port_ring_writer *) port; + + uint32_t bsz_mask = p->bsz_mask; + uint32_t tx_buf_count = p->tx_buf_count; + uint64_t expr = (pkts_mask & (pkts_mask + 1)) | + ((pkts_mask & bsz_mask) ^ bsz_mask); + + if (expr == 0) { + uint64_t n_pkts = __builtin_popcountll(pkts_mask); + uint32_t n_pkts_ok; + + if (tx_buf_count) + send_burst(p); + + n_pkts_ok = rte_ring_sp_enqueue_burst(p->ring, (void **)pkts, n_pkts); + + for ( ; n_pkts_ok < n_pkts; n_pkts_ok++) { + struct rte_mbuf *pkt = pkts[n_pkts_ok]; + + rte_pktmbuf_free(pkt); + } + } else { + for ( ; pkts_mask; ) { + uint32_t pkt_index = __builtin_ctzll(pkts_mask); + uint64_t pkt_mask = 1LLU << pkt_index; + struct rte_mbuf *pkt = pkts[pkt_index]; + + p->tx_buf[tx_buf_count++] = pkt; + pkts_mask &= ~pkt_mask; + } + + p->tx_buf_count = tx_buf_count; + if (tx_buf_count >= p->tx_burst_sz) + send_burst(p); + } + + return 0; +} + +#else + +#error Invalid value for RTE_PORT_RING_WRITER_APPROACH + +#endif + static int rte_port_ring_writer_flush(void *port) { -- 1.7.9.5
[dpdk-dev] [PATCH 2/3] port: added ethdev_writer_nodrop port
When ethdev_writer_nodrop port fails to send data, it tries to resend. Operation is aborted when maximum number of retries is reached. --- lib/librte_port/rte_port_ethdev.c | 230 + lib/librte_port/rte_port_ethdev.h | 19 +++ 2 files changed, 249 insertions(+) diff --git a/lib/librte_port/rte_port_ethdev.c b/lib/librte_port/rte_port_ethdev.c index d014913..1f77cb5 100644 --- a/lib/librte_port/rte_port_ethdev.c +++ b/lib/librte_port/rte_port_ethdev.c @@ -31,6 +31,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include +#include #include #include @@ -288,6 +289,227 @@ rte_port_ethdev_writer_free(void *port) } /* + * Port ETHDEV Writer Nodrop + */ +#define RTE_PORT_ETHDEV_WRITER_NODROP_APPROACH 1 + +struct rte_port_ethdev_writer_nodrop { + struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX]; + uint32_t tx_burst_sz; + uint16_t tx_buf_count; + uint64_t bsz_mask; + uint64_t n_retries; + uint16_t queue_id; + uint8_t port_id; +}; + +static void * +rte_port_ethdev_writer_nodrop_create(void *params, int socket_id) +{ + struct rte_port_ethdev_writer_nodrop_params *conf = + (struct rte_port_ethdev_writer_nodrop_params *) params; + struct rte_port_ethdev_writer_nodrop *port; + + /* Check input parameters */ + if ((conf == NULL) || + (conf->tx_burst_sz == 0) || + (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX) || + (!rte_is_power_of_2(conf->tx_burst_sz))) { + RTE_LOG(ERR, PORT, "%s: Invalid input parameters\n", __func__); + return NULL; + } + + /* Memory allocation */ + port = rte_zmalloc_socket("PORT", sizeof(*port), + RTE_CACHE_LINE_SIZE, socket_id); + if (port == NULL) { + RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__); + return NULL; + } + + /* Initialization */ + port->port_id = conf->port_id; + port->queue_id = conf->queue_id; + port->tx_burst_sz = conf->tx_burst_sz; + port->tx_buf_count = 0; + port->bsz_mask = 1LLU << (conf->tx_burst_sz - 1); + + /* +* When n_retries is 0 it means that we should wait for every packet to +* send no matter how many retries should it take. To limit number of +* branches in fast path, we use UINT64_MAX instead of branching. +*/ + port->n_retries = (conf->n_retries == 0) ? UINT64_MAX : conf->n_retries; + + return port; +} + +static inline void +send_burst_nodrop(struct rte_port_ethdev_writer_nodrop *p) +{ + uint32_t nb_tx = 0, i; + + nb_tx = rte_eth_tx_burst(p->port_id, p->queue_id, p->tx_buf, + p->tx_buf_count); + + /* We sent all the packets in a first try */ + if (nb_tx >= p->tx_buf_count) + return; + + for (i = 0; i < p->n_retries; i++) { + nb_tx += rte_eth_tx_burst(p->port_id, p->queue_id, +p->tx_buf + nb_tx, p->tx_buf_count - nb_tx); + + /* We sent all the packets in more than one try */ + if (nb_tx >= p->tx_buf_count) + return; + } + + /* We didn't send the packets in maximum allowed attempts */ + for ( ; nb_tx < p->tx_buf_count; nb_tx++) + rte_pktmbuf_free(p->tx_buf[nb_tx]); + + p->tx_buf_count = 0; +} + +static int +rte_port_ethdev_writer_nodrop_tx(void *port, struct rte_mbuf *pkt) +{ + struct rte_port_ethdev_writer_nodrop *p = + (struct rte_port_ethdev_writer_nodrop *) port; + + p->tx_buf[p->tx_buf_count++] = pkt; + if (p->tx_buf_count >= p->tx_burst_sz) + send_burst_nodrop(p); + + return 0; +} + +#if RTE_PORT_ETHDEV_WRITER_NODROP_APPROACH == 0 + +static int +rte_port_ethdev_writer_nodrop_tx_bulk(void *port, + struct rte_mbuf **pkts, + uint64_t pkts_mask) +{ + struct rte_port_ethdev_writer_nodrop *p = + (struct rte_port_ethdev_writer_nodrop *) port; + + if ((pkts_mask & (pkts_mask + 1)) == 0) { + uint64_t n_pkts = __builtin_popcountll(pkts_mask); + uint32_t i; + + for (i = 0; i < n_pkts; i++) { + struct rte_mbuf *pkt = pkts[i]; + + p->tx_buf[p->tx_buf_count++] = pkt; + if (p->tx_buf_count >= p->tx_burst_sz) + send_burst_nodrop(p); + } + } else { + for ( ; pkts_mask; ) { + uint32_t pkt_index = __builtin_ctzll(pkts_mask); + uint64_t pkt_mask = 1LLU << pkt_index; + struct rte_mbuf *pkt = pkts[pkt_index]; + + p->tx_buf[p->tx_buf_count++] = pkt; +
[dpdk-dev] [PATCH 3/3] port: added ring_writer_nodrop port
When ethdev_writer_nodrop port fails to send data, it tries to resend. Operation is aborted when maximum number of retries is reached. --- lib/librte_port/rte_port_ring.c | 226 +++ lib/librte_port/rte_port_ring.h | 16 +++ 2 files changed, 242 insertions(+) diff --git a/lib/librte_port/rte_port_ring.c b/lib/librte_port/rte_port_ring.c index ba2eeb3..371bb1e 100644 --- a/lib/librte_port/rte_port_ring.c +++ b/lib/librte_port/rte_port_ring.c @@ -31,6 +31,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include +#include #include #include @@ -279,6 +280,223 @@ rte_port_ring_writer_free(void *port) } /* + * Port RING Writer Nodrop + */ +#define RTE_PORT_RING_WRITER_NODROP_APPROACH 1 + +struct rte_port_ring_writer_nodrop { + struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX]; + struct rte_ring *ring; + uint32_t tx_burst_sz; + uint32_t tx_buf_count; + uint64_t bsz_mask; + uint64_t n_retries; +}; + +static void * +rte_port_ring_writer_nodrop_create(void *params, int socket_id) +{ + struct rte_port_ring_writer_nodrop_params *conf = + (struct rte_port_ring_writer_nodrop_params *) params; + struct rte_port_ring_writer_nodrop *port; + + /* Check input parameters */ + if ((conf == NULL) || + (conf->ring == NULL) || + (conf->tx_burst_sz > RTE_PORT_IN_BURST_SIZE_MAX)) { + RTE_LOG(ERR, PORT, "%s: Invalid Parameters\n", __func__); + return NULL; + } + + /* Memory allocation */ + port = rte_zmalloc_socket("PORT", sizeof(*port), + RTE_CACHE_LINE_SIZE, socket_id); + if (port == NULL) { + RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__); + return NULL; + } + + /* Initialization */ + port->ring = conf->ring; + port->tx_burst_sz = conf->tx_burst_sz; + port->tx_buf_count = 0; + port->bsz_mask = 1LLU << (conf->tx_burst_sz - 1); + + /* +* When n_retries is 0 it means that we should wait for every packet to +* send no matter how many retries should it take. To limit number of +* branches in fast path, we use UINT64_MAX instead of branching. +*/ + port->n_retries = (conf->n_retries == 0) ? UINT64_MAX : conf->n_retries; + + return port; +} + +static inline void +send_burst_nodrop(struct rte_port_ring_writer_nodrop *p) +{ + uint32_t nb_tx = 0, i; + + nb_tx = rte_ring_sp_enqueue_burst(p->ring, (void **)p->tx_buf, + p->tx_buf_count); + + /* We sent all the packets in a first try */ + if (nb_tx >= p->tx_buf_count) + return; + + for (i = 0; i < p->n_retries; i++) { + nb_tx += rte_ring_sp_enqueue_burst(p->ring, + (void **) (p->tx_buf + nb_tx), p->tx_buf_count - nb_tx); + + /* We sent all the packets in more than one try */ + if (nb_tx >= p->tx_buf_count) + return; + } + + /* We didn't send the packets in maximum allowed attempts */ + for ( ; nb_tx < p->tx_buf_count; nb_tx++) + rte_pktmbuf_free(p->tx_buf[nb_tx]); + + p->tx_buf_count = 0; +} + +static int +rte_port_ring_writer_nodrop_tx(void *port, struct rte_mbuf *pkt) +{ + struct rte_port_ring_writer_nodrop *p = + (struct rte_port_ring_writer_nodrop *) port; + + p->tx_buf[p->tx_buf_count++] = pkt; + if (p->tx_buf_count >= p->tx_burst_sz) + send_burst_nodrop(p); + + return 0; +} + +#if RTE_PORT_RING_WRITER_NODROP_APPROACH == 0 + +static int +rte_port_ring_writer_nodrop_tx_bulk(void *port, + struct rte_mbuf **pkts, + uint64_t pkts_mask) +{ + struct rte_port_ring_writer_nodrop *p = + (struct rte_port_ring_writer_nodrop *) port; + + if ((pkts_mask & (pkts_mask + 1)) == 0) { + uint64_t n_pkts = __builtin_popcountll(pkts_mask); + uint32_t i; + + for (i = 0; i < n_pkts; i++) { + struct rte_mbuf *pkt = pkts[i]; + + p->tx_buf[p->tx_buf_count++] = pkt; + if (p->tx_buf_count >= p->tx_burst_sz) + send_burst_nodrop(p); + } + } else { + for ( ; pkts_mask; ) { + uint32_t pkt_index = __builtin_ctzll(pkts_mask); + uint64_t pkt_mask = 1LLU << pkt_index; + struct rte_mbuf *pkt = pkts[pkt_index]; + + p->tx_buf[p->tx_buf_count++] = pkt; + if (p->tx_buf_count >= p->tx_burst_sz) + send_burst_nodrop(p); + pkts_mask &= ~pkt_mask; + } + }
[dpdk-dev] [PATCH 0/3] port: added frag_ipv6 and ras_ipv6 ports
Added ipv6 versions of ip fragmentation and ip reassembly ports. Maciej Gajdzica (3): port: removed IPV4_MTU_DEFAULT define port: added ipv6 fragmentation port port: added ipv6 reassembly port lib/librte_port/rte_port_frag.c | 67 -- lib/librte_port/rte_port_frag.h |9 ++- lib/librte_port/rte_port_ras.c | 142 --- lib/librte_port/rte_port_ras.h |9 ++- 4 files changed, 167 insertions(+), 60 deletions(-) -- 1.7.9.5
[dpdk-dev] [PATCH 1/3] port: removed IPV4_MTU_DEFAULT define
p->mtu field should be used instead. --- lib/librte_port/rte_port_frag.c |6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/librte_port/rte_port_frag.c b/lib/librte_port/rte_port_frag.c index ff0ab9b..dce33d5 100644 --- a/lib/librte_port/rte_port_frag.c +++ b/lib/librte_port/rte_port_frag.c @@ -38,10 +38,6 @@ #include "rte_port_frag.h" -/* Default byte size for the IPv4 Maximum Transfer Unit (MTU). - * This value includes the size of IPv4 header. */ -#defineIPV4_MTU_DEFAULT ETHER_MTU - /* Max number of fragments per packet allowed */ #defineIPV4_MAX_FRAGS_PER_PACKET 0x80 @@ -160,7 +156,7 @@ rte_port_ring_reader_ipv4_frag_rx(void *port, p->n_pkts--; /* If not jumbo, pass current packet to output */ - if (pkt->pkt_len <= IPV4_MTU_DEFAULT) { + if (pkt->pkt_len <= p->mtu) { pkts[n_pkts_out++] = pkt; n_pkts_to_provide = n_pkts - n_pkts_out; -- 1.7.9.5
[dpdk-dev] [PATCH 2/3] port: added ipv6 fragmentation port
--- lib/librte_port/rte_port_frag.c | 61 +-- lib/librte_port/rte_port_frag.h |9 +- 2 files changed, 54 insertions(+), 16 deletions(-) diff --git a/lib/librte_port/rte_port_frag.c b/lib/librte_port/rte_port_frag.c index dce33d5..c4c05dc 100644 --- a/lib/librte_port/rte_port_frag.c +++ b/lib/librte_port/rte_port_frag.c @@ -39,9 +39,17 @@ #include "rte_port_frag.h" /* Max number of fragments per packet allowed */ -#defineIPV4_MAX_FRAGS_PER_PACKET 0x80 +#defineRTE_PORT_FRAG_MAX_FRAGS_PER_PACKET 0x80 -struct rte_port_ring_reader_ipv4_frag { +typedef int32_t + (*frag_op)(struct rte_mbuf *pkt_in, + struct rte_mbuf **pkts_out, + uint16_t nb_pkts_out, + uint16_t mtu_size, + struct rte_mempool *pool_direct, + struct rte_mempool *pool_indirect); + +struct rte_port_ring_reader_frag { /* Input parameters */ struct rte_ring *ring; uint32_t mtu; @@ -51,19 +59,21 @@ struct rte_port_ring_reader_ipv4_frag { /* Internal buffers */ struct rte_mbuf *pkts[RTE_PORT_IN_BURST_SIZE_MAX]; - struct rte_mbuf *frags[IPV4_MAX_FRAGS_PER_PACKET]; + struct rte_mbuf *frags[RTE_PORT_FRAG_MAX_FRAGS_PER_PACKET]; uint32_t n_pkts; uint32_t pos_pkts; uint32_t n_frags; uint32_t pos_frags; + + frag_op f_frag; } __rte_cache_aligned; static void * -rte_port_ring_reader_ipv4_frag_create(void *params, int socket_id) +rte_port_ring_reader_frag_create(void *params, int socket_id, int is_ipv4) { - struct rte_port_ring_reader_ipv4_frag_params *conf = - (struct rte_port_ring_reader_ipv4_frag_params *) params; - struct rte_port_ring_reader_ipv4_frag *port; + struct rte_port_ring_reader_frag_params *conf = + (struct rte_port_ring_reader_frag_params *) params; + struct rte_port_ring_reader_frag *port; /* Check input parameters */ if (conf == NULL) { @@ -109,16 +119,31 @@ rte_port_ring_reader_ipv4_frag_create(void *params, int socket_id) port->n_frags = 0; port->pos_frags = 0; + port->f_frag = (is_ipv4) ? + rte_ipv4_fragment_packet : rte_ipv6_fragment_packet; + return port; } +static void * +rte_port_ring_reader_ipv4_frag_create(void *params, int socket_id) +{ + return rte_port_ring_reader_frag_create(params, socket_id, 1); +} + +static void * +rte_port_ring_reader_ipv6_frag_create(void *params, int socket_id) +{ + return rte_port_ring_reader_frag_create(params, socket_id, 0); +} + static int -rte_port_ring_reader_ipv4_frag_rx(void *port, +rte_port_ring_reader_frag_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts) { - struct rte_port_ring_reader_ipv4_frag *p = - (struct rte_port_ring_reader_ipv4_frag *) port; + struct rte_port_ring_reader_frag *p = + (struct rte_port_ring_reader_frag *) port; uint32_t n_pkts_out; n_pkts_out = 0; @@ -167,10 +192,10 @@ rte_port_ring_reader_ipv4_frag_rx(void *port, } /* Fragment current packet into the "frags" buffer */ - status = rte_ipv4_fragment_packet( + status = p->f_frag( pkt, p->frags, - IPV4_MAX_FRAGS_PER_PACKET, + RTE_PORT_FRAG_MAX_FRAGS_PER_PACKET, p->mtu, p->pool_direct, p->pool_indirect @@ -215,7 +240,7 @@ rte_port_ring_reader_ipv4_frag_rx(void *port, } static int -rte_port_ring_reader_ipv4_frag_free(void *port) +rte_port_ring_reader_frag_free(void *port) { if (port == NULL) { RTE_LOG(ERR, PORT, "%s: Parameter port is NULL\n", __func__); @@ -232,6 +257,12 @@ rte_port_ring_reader_ipv4_frag_free(void *port) */ struct rte_port_in_ops rte_port_ring_reader_ipv4_frag_ops = { .f_create = rte_port_ring_reader_ipv4_frag_create, - .f_free = rte_port_ring_reader_ipv4_frag_free, - .f_rx = rte_port_ring_reader_ipv4_frag_rx, + .f_free = rte_port_ring_reader_frag_free, + .f_rx = rte_port_ring_reader_frag_rx, +}; + +struct rte_port_in_ops rte_port_ring_reader_ipv6_frag_ops = { + .f_create = rte_port_ring_reader_ipv6_frag_create, + .f_free = rte_port_ring_reader_frag_free, + .f_rx = rte_port_ring_reader_frag_rx, }; diff --git a/lib/librte_port/rte_port_frag.h b/lib/librte_port/rte_port_frag.h index dfd70c0..0085ff7 100644 --- a/lib/librte_port/rte_port_frag.h +++ b/lib/librte_port/rte_port_frag.h @@ -63,7 +63,7 @@ extern "C" { #include "rte_port.h" /** ring_reader_ipv4_frag port parameters */ -struct rte_port_ring_reader_ipv4_frag_params { +struct rte_port_ring_reader_frag_params {
[dpdk-dev] [PATCH 3/3] port: added ipv6 reassembly port
--- lib/librte_port/rte_port_ras.c | 142 +--- lib/librte_port/rte_port_ras.h |9 ++- 2 files changed, 112 insertions(+), 39 deletions(-) diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index b6ab67a..5eb627a 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -39,33 +39,46 @@ #include "rte_port_ras.h" -#ifndef IPV4_RAS_N_BUCKETS -#define IPV4_RAS_N_BUCKETS 4094 +#ifndef RTE_PORT_RAS_N_BUCKETS +#define RTE_PORT_RAS_N_BUCKETS 4094 #endif -#ifndef IPV4_RAS_N_ENTRIES_PER_BUCKET -#define IPV4_RAS_N_ENTRIES_PER_BUCKET 8 +#ifndef RTE_PORT_RAS_N_ENTRIES_PER_BUCKET +#define RTE_PORT_RAS_N_ENTRIES_PER_BUCKET 8 #endif -#ifndef IPV4_RAS_N_ENTRIES -#define IPV4_RAS_N_ENTRIES (IPV4_RAS_N_BUCKETS * IPV4_RAS_N_ENTRIES_PER_BUCKET) +#ifndef RTE_PORT_RAS_N_ENTRIES +#define RTE_PORT_RAS_N_ENTRIES (RTE_PORT_RAS_N_BUCKETS * RTE_PORT_RAS_N_ENTRIES_PER_BUCKET) #endif -struct rte_port_ring_writer_ipv4_ras { +struct rte_port_ring_writer_ras; + +typedef void (*ras_op)( + struct rte_port_ring_writer_ras *p, + struct rte_mbuf *pkt); + +static void +process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt); +static void +process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt); + +struct rte_port_ring_writer_ras { struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX]; struct rte_ring *ring; uint32_t tx_burst_sz; uint32_t tx_buf_count; struct rte_ip_frag_tbl *frag_tbl; struct rte_ip_frag_death_row death_row; + + ras_op f_ras; }; static void * -rte_port_ring_writer_ipv4_ras_create(void *params, int socket_id) +rte_port_ring_writer_ras_create(void *params, int socket_id, int is_ipv4) { - struct rte_port_ring_writer_ipv4_ras_params *conf = - (struct rte_port_ring_writer_ipv4_ras_params *) params; - struct rte_port_ring_writer_ipv4_ras *port; + struct rte_port_ring_writer_ras_params *conf = + (struct rte_port_ring_writer_ras_params *) params; + struct rte_port_ring_writer_ras *port; uint64_t frag_cycles; /* Check input parameters */ @@ -97,9 +110,9 @@ rte_port_ring_writer_ipv4_ras_create(void *params, int socket_id) frag_cycles *= 100; port->frag_tbl = rte_ip_frag_table_create( - IPV4_RAS_N_BUCKETS, - IPV4_RAS_N_ENTRIES_PER_BUCKET, - IPV4_RAS_N_ENTRIES, + RTE_PORT_RAS_N_BUCKETS, + RTE_PORT_RAS_N_ENTRIES_PER_BUCKET, + RTE_PORT_RAS_N_ENTRIES, frag_cycles, socket_id); @@ -115,11 +128,25 @@ rte_port_ring_writer_ipv4_ras_create(void *params, int socket_id) port->tx_burst_sz = conf->tx_burst_sz; port->tx_buf_count = 0; + port->f_ras = (is_ipv4 == 0) ? process_ipv4 : process_ipv6; + return port; } +static void * +rte_port_ring_writer_ipv4_ras_create(void *params, int socket_id) +{ + return rte_port_ring_writer_ras_create(params, socket_id, 1); +} + +static void * +rte_port_ring_writer_ipv6_ras_create(void *params, int socket_id) +{ + return rte_port_ring_writer_ras_create(params, socket_id, 0); +} + static inline void -send_burst(struct rte_port_ring_writer_ipv4_ras *p) +send_burst(struct rte_port_ring_writer_ras *p) { uint32_t nb_tx; @@ -132,8 +159,8 @@ send_burst(struct rte_port_ring_writer_ipv4_ras *p) p->tx_buf_count = 0; } -static inline void -process_one(struct rte_port_ring_writer_ipv4_ras *p, struct rte_mbuf *pkt) +static void +process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) { /* Assume there is no ethernet header */ struct ipv4_hdr *pkt_hdr = (struct ipv4_hdr *) @@ -153,7 +180,38 @@ process_one(struct rte_port_ring_writer_ipv4_ras *p, struct rte_mbuf *pkt) struct rte_ip_frag_death_row *dr = &p->death_row; /* Process this fragment */ - mo = rte_ipv4_frag_reassemble_packet(tbl, dr, pkt, rte_rdtsc(), pkt_hdr); + mo = rte_ipv4_frag_reassemble_packet(tbl, dr, pkt, rte_rdtsc(), + pkt_hdr); + if (mo != NULL) + p->tx_buf[p->tx_buf_count++] = mo; + + rte_ip_frag_free_death_row(&p->death_row, 3); + } +} + +static void +process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) +{ + /* Assume there is no ethernet header */ + struct ipv6_hdr *pkt_hdr = (struct ipv6_hdr *) + (rte_pktmbuf_mtod(pkt, unsigned char *)); + + struct ipv6_extension_fragment *frag_hdr; + frag_hdr = rte_ipv6_frag_get_ipv6_fragment_header(pkt_hdr); + uint16_t frag_offset = frag_hdr->frag_offset; + uint16_t frag_flag
[dpdk-dev] [PATCH 00/13] port: added port statistics
Added statistics for every type of port. By default all port statistics are disabled, user must activate them in config file. This patchset depends on two patchsets: port: added ethdev_writer_nodrop and ring_writer_nodrop ports port: added frag_ipv6 and ras_ipv6 ports Maciej Gajdzica (13): port: added structures for port stats port: added port_ethdev_reader stats port: added port_ethdev_writer stats port: added port_ethdev_writer_nodrop stats port: added port_frag stats port: added port_ras stats port: added port_ring_reader stats port: added port_ring_writer stats port: added port_ring_writer_nodrop stats port: added port_sched_reader stats port: added port_sched_writer stats port: added port_source stats port: added port_sink stats config/common_bsdapp | 12 config/common_linuxapp | 12 lib/librte_port/rte_port.h | 60 ++-- lib/librte_port/rte_port_ethdev.c | 113 +- lib/librte_port/rte_port_frag.c| 36 ++ lib/librte_port/rte_port_ras.c | 38 ++ lib/librte_port/rte_port_ring.c| 118 +++- lib/librte_port/rte_port_sched.c | 96 -- lib/librte_port/rte_port_source_sink.c | 98 -- 9 files changed, 566 insertions(+), 17 deletions(-) -- 1.7.9.5
[dpdk-dev] [PATCH 01/13] port: added structures for port stats
--- lib/librte_port/rte_port.h | 60 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/lib/librte_port/rte_port.h b/lib/librte_port/rte_port.h index d84e5a1..ab433e5 100644 --- a/lib/librte_port/rte_port.h +++ b/lib/librte_port/rte_port.h @@ -81,6 +81,12 @@ extern "C" { Cannot be changed. */ #define RTE_PORT_IN_BURST_SIZE_MAX 64 +/** Input port statistics */ +struct rte_port_in_stats { + uint64_t n_pkts_in; + uint64_t n_pkts_drop; +}; + /** * Input port create * @@ -120,17 +126,42 @@ typedef int (*rte_port_in_op_rx)( struct rte_mbuf **pkts, uint32_t n_pkts); +/** + * Input port stats get + * + * @param port + * Handle to output port instance + * @param stats + * Handle to port_in stats struct to copy data + * @param clear + * Flag indicating that stats should be cleared after read + * + * @return + * Error code or 0 on success. + */ +typedef int (*rte_port_in_op_stats_read)( + void *port, + struct rte_port_in_stats *stats, + int clear); + /** Input port interface defining the input port operation */ struct rte_port_in_ops { rte_port_in_op_create f_create; /**< Create */ rte_port_in_op_free f_free; /**< Free */ rte_port_in_op_rx f_rx; /**< Packet RX (packet burst) */ + rte_port_in_op_stats_read f_stats; /**< Stats */ }; /* * Port OUT * */ +/** Output port statistics */ +struct rte_port_out_stats { + uint64_t n_pkts_in; + uint64_t n_pkts_drop; +}; + /** * Output port create * @@ -197,13 +228,32 @@ typedef int (*rte_port_out_op_tx_bulk)( */ typedef int (*rte_port_out_op_flush)(void *port); +/** + * Output port stats read + * + * @param port + * Handle to output port instance + * @param stats + * Handle to port_out stats struct to copy data + * @param clear + * Flag indicating that stats should be cleared after read + * + * @return + * Error code or 0 on success. + */ +typedef int (*rte_port_out_op_stats_read)( + void *port, + struct rte_port_out_stats *stats, + int clear); + /** Output port interface defining the output port operation */ struct rte_port_out_ops { - rte_port_out_op_create f_create; /**< Create */ - rte_port_out_op_free f_free; /**< Free */ - rte_port_out_op_tx f_tx; /**< Packet TX (single packet) */ - rte_port_out_op_tx_bulk f_tx_bulk; /**< Packet TX (packet burst) */ - rte_port_out_op_flush f_flush; /**< Flush */ + rte_port_out_op_create f_create;/**< Create */ + rte_port_out_op_free f_free;/**< Free */ + rte_port_out_op_tx f_tx;/**< Packet TX (single packet) */ + rte_port_out_op_tx_bulk f_tx_bulk; /**< Packet TX (packet burst) */ + rte_port_out_op_flush f_flush; /**< Flush */ + rte_port_out_op_stats_read f_stats; /**< Stats */ }; #ifdef __cplusplus -- 1.7.9.5
[dpdk-dev] [PATCH 02/13] port: added port_ethdev_reader stats
--- config/common_bsdapp |1 + config/common_linuxapp|1 + lib/librte_port/rte_port_ethdev.c | 37 - 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/config/common_bsdapp b/config/common_bsdapp index 8ff4dc2..823e295 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -382,6 +382,7 @@ CONFIG_RTE_LIBRTE_REORDER=y # Compile librte_port # CONFIG_RTE_LIBRTE_PORT=y +CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index 09a58ac..0c3b4e2 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -389,6 +389,7 @@ CONFIG_RTE_LIBRTE_REORDER=y # Compile librte_port # CONFIG_RTE_LIBRTE_PORT=y +CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_ethdev.c b/lib/librte_port/rte_port_ethdev.c index 1f77cb5..05bc077 100644 --- a/lib/librte_port/rte_port_ethdev.c +++ b/lib/librte_port/rte_port_ethdev.c @@ -42,7 +42,23 @@ /* * Port ETHDEV Reader */ +#ifdef RTE_PORT_ETHDEV_READER_STATS_COLLECT + +#define RTE_PORT_ETHDEV_READER_STATS_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_ETHDEV_READER_STATS_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_ETHDEV_READER_STATS_PKTS_IN_ADD(port, val) +#define RTE_PORT_ETHDEV_READER_STATS_PKTS_DROP_ADD(port, val) + +#endif + struct rte_port_ethdev_reader { + struct rte_port_in_stats stats; + uint16_t queue_id; uint8_t port_id; }; @@ -80,8 +96,11 @@ rte_port_ethdev_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts) { struct rte_port_ethdev_reader *p = (struct rte_port_ethdev_reader *) port; + uint16_t rx_pkt_cnt; - return rte_eth_rx_burst(p->port_id, p->queue_id, pkts, n_pkts); + rx_pkt_cnt = rte_eth_rx_burst(p->port_id, p->queue_id, pkts, n_pkts); + RTE_PORT_ETHDEV_READER_STATS_PKTS_IN_ADD(p, rx_pkt_cnt); + return rx_pkt_cnt; } static int @@ -97,6 +116,21 @@ rte_port_ethdev_reader_free(void *port) return 0; } +static int rte_port_ethdev_reader_stats_read(void *port, + struct rte_port_in_stats * stats, int clear) +{ + struct rte_port_ethdev_reader *p = + (struct rte_port_ethdev_reader *) port; + + if (stats != NULL) + memcpy(stats, &p->stats, sizeof(p->stats)); + + if (clear) + memset(&p->stats, 0, sizeof(p->stats)); + + return 0; +} + /* * Port ETHDEV Writer */ @@ -516,6 +550,7 @@ struct rte_port_in_ops rte_port_ethdev_reader_ops = { .f_create = rte_port_ethdev_reader_create, .f_free = rte_port_ethdev_reader_free, .f_rx = rte_port_ethdev_reader_rx, + .f_stats = rte_port_ethdev_reader_stats_read, }; struct rte_port_out_ops rte_port_ethdev_writer_ops = { -- 1.7.9.5
[dpdk-dev] [PATCH 03/13] port: added port_ethdev_writer stats
--- config/common_bsdapp |1 + config/common_linuxapp|1 + lib/librte_port/rte_port_ethdev.c | 38 + 3 files changed, 40 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index 823e295..d62e6d9 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -383,6 +383,7 @@ CONFIG_RTE_LIBRTE_REORDER=y # CONFIG_RTE_LIBRTE_PORT=y CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n +CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index 0c3b4e2..41a00a5 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -390,6 +390,7 @@ CONFIG_RTE_LIBRTE_REORDER=y # CONFIG_RTE_LIBRTE_PORT=y CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n +CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_ethdev.c b/lib/librte_port/rte_port_ethdev.c index 05bc077..e9e549a 100644 --- a/lib/librte_port/rte_port_ethdev.c +++ b/lib/librte_port/rte_port_ethdev.c @@ -136,7 +136,23 @@ static int rte_port_ethdev_reader_stats_read(void *port, */ #define RTE_PORT_ETHDEV_WRITER_APPROACH 1 +#ifdef RTE_PORT_ETHDEV_WRITER_STATS_COLLECT + +#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(port, val) +#define RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(port, val) + +#endif + struct rte_port_ethdev_writer { + struct rte_port_out_stats stats; + struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX]; uint32_t tx_burst_sz; uint16_t tx_buf_count; @@ -187,6 +203,7 @@ send_burst(struct rte_port_ethdev_writer *p) nb_tx = rte_eth_tx_burst(p->port_id, p->queue_id, p->tx_buf, p->tx_buf_count); + RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx); for ( ; nb_tx < p->tx_buf_count; nb_tx++) rte_pktmbuf_free(p->tx_buf[nb_tx]); @@ -220,6 +237,7 @@ rte_port_ethdev_writer_tx_bulk(void *port, uint64_t n_pkts = __builtin_popcountll(pkts_mask); uint32_t i; + RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, n_pkts); for (i = 0; i < n_pkts; i++) { struct rte_mbuf *pkt = pkts[i]; @@ -234,6 +252,7 @@ rte_port_ethdev_writer_tx_bulk(void *port, struct rte_mbuf *pkt = pkts[pkt_index]; p->tx_buf[p->tx_buf_count++] = pkt; + RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, 1); if (p->tx_buf_count >= p->tx_burst_sz) send_burst(p); pkts_mask &= ~pkt_mask; @@ -264,9 +283,11 @@ rte_port_ethdev_writer_tx_bulk(void *port, if (tx_buf_count) send_burst(p); + RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, n_pkts); n_pkts_ok = rte_eth_tx_burst(p->port_id, p->queue_id, pkts, n_pkts); + RTE_PORT_ETHDEV_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - n_pkts_ok); for ( ; n_pkts_ok < n_pkts; n_pkts_ok++) { struct rte_mbuf *pkt = pkts[n_pkts_ok]; @@ -279,6 +300,7 @@ rte_port_ethdev_writer_tx_bulk(void *port, struct rte_mbuf *pkt = pkts[pkt_index]; p->tx_buf[tx_buf_count++] = pkt; + RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, 1); pkts_mask &= ~pkt_mask; } @@ -322,6 +344,21 @@ rte_port_ethdev_writer_free(void *port) return 0; } +static int rte_port_ethdev_writer_stats_read(void *port, + struct rte_port_out_stats *stats, int clear) +{ + struct rte_port_ethdev_writer *p = + (struct rte_port_ethdev_writer *) port; + + if (stats != NULL) + memcpy(stats, &p->stats, sizeof(p->stats)); + + if (clear) + memset(&p->stats, 0, sizeof(p->stats)); + + return 0; +} + /* * Port ETHDEV Writer Nodrop */ @@ -559,6 +596,7 @@ struct rte_port_out_ops rte_port_ethdev_writer_ops = { .f_tx = rte_port_ethdev_writer_tx, .f_tx_bulk = rte_port_ethdev_writer_tx_bulk, .f_flush = rte_port_ethdev_writer_flush, + .f_stats = rte_port_ethdev_writer_stats_read, }; struct rte_port_out_ops rte_port_ethdev_writer_nodrop_ops = { -- 1.7.9.5
[dpdk-dev] [PATCH 04/13] port: added port_ethdev_writer_nodrop stats
--- config/common_bsdapp |1 + config/common_linuxapp|1 + lib/librte_port/rte_port_ethdev.c | 38 + 3 files changed, 40 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index d62e6d9..ed01d2d 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -384,6 +384,7 @@ CONFIG_RTE_LIBRTE_REORDER=y CONFIG_RTE_LIBRTE_PORT=y CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n +CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index 41a00a5..6a7c5ac 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -391,6 +391,7 @@ CONFIG_RTE_LIBRTE_REORDER=y CONFIG_RTE_LIBRTE_PORT=y CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n +CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_ethdev.c b/lib/librte_port/rte_port_ethdev.c index e9e549a..7a0c14e 100644 --- a/lib/librte_port/rte_port_ethdev.c +++ b/lib/librte_port/rte_port_ethdev.c @@ -364,7 +364,23 @@ static int rte_port_ethdev_writer_stats_read(void *port, */ #define RTE_PORT_ETHDEV_WRITER_NODROP_APPROACH 1 +#ifdef RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT + +#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val) +#define RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val) + +#endif + struct rte_port_ethdev_writer_nodrop { + struct rte_port_out_stats stats; + struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX]; uint32_t tx_burst_sz; uint16_t tx_buf_count; @@ -437,6 +453,7 @@ send_burst_nodrop(struct rte_port_ethdev_writer_nodrop *p) } /* We didn't send the packets in maximum allowed attempts */ + RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx); for ( ; nb_tx < p->tx_buf_count; nb_tx++) rte_pktmbuf_free(p->tx_buf[nb_tx]); @@ -450,6 +467,7 @@ rte_port_ethdev_writer_nodrop_tx(void *port, struct rte_mbuf *pkt) (struct rte_port_ethdev_writer_nodrop *) port; p->tx_buf[p->tx_buf_count++] = pkt; + RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1); if (p->tx_buf_count >= p->tx_burst_sz) send_burst_nodrop(p); @@ -470,6 +488,7 @@ rte_port_ethdev_writer_nodrop_tx_bulk(void *port, uint64_t n_pkts = __builtin_popcountll(pkts_mask); uint32_t i; + RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts); for (i = 0; i < n_pkts; i++) { struct rte_mbuf *pkt = pkts[i]; @@ -484,6 +503,7 @@ rte_port_ethdev_writer_nodrop_tx_bulk(void *port, struct rte_mbuf *pkt = pkts[pkt_index]; p->tx_buf[p->tx_buf_count++] = pkt; + RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1); if (p->tx_buf_count >= p->tx_burst_sz) send_burst_nodrop(p); pkts_mask &= ~pkt_mask; @@ -515,6 +535,7 @@ rte_port_ethdev_writer_nodrop_tx_bulk(void *port, if (tx_buf_count) send_burst_nodrop(p); + RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts); n_pkts_ok = rte_eth_tx_burst(p->port_id, p->queue_id, pkts, n_pkts); @@ -537,6 +558,7 @@ rte_port_ethdev_writer_nodrop_tx_bulk(void *port, struct rte_mbuf *pkt = pkts[pkt_index]; p->tx_buf[tx_buf_count++] = pkt; + RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1); pkts_mask &= ~pkt_mask; } @@ -580,6 +602,21 @@ rte_port_ethdev_writer_nodrop_free(void *port) return 0; } +static int rte_port_ethdev_writer_nodrop_stats_read(void *port, + struct rte_port_out_stats *stats, int clear) +{ + struct rte_port_ethdev_writer_nodrop *p = + (struct rte_port_ethdev_writer_nodrop *) port; + + if (stats != NULL) + memcpy(stats, &p->stats, sizeof(p->stats)); + + if (clear) + memset(&p->stats, 0, sizeof(p->stats)); + + return 0; +} + /* * Summary of port operations */ @@ -605,4 +642,5 @@ struct rte_port_out_ops rte_port_ethdev_writer_nodrop_ops = { .f_tx = rte_port_ethdev_writer_nodrop_tx, .f_tx_bulk = rte_port_ethdev_writer_nodrop_tx_bulk, .f_flush = rte_port_ethdev_writer_nodrop_flush, + .f_stats = rte_port_ethdev_writer_nodro
[dpdk-dev] [PATCH 05/13] port: added port_frag stats
--- config/common_bsdapp|1 + config/common_linuxapp |1 + lib/librte_port/rte_port_frag.c | 36 3 files changed, 38 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index ed01d2d..523b9e9 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -385,6 +385,7 @@ CONFIG_RTE_LIBRTE_PORT=y CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n +CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index 6a7c5ac..e4baf41 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -392,6 +392,7 @@ CONFIG_RTE_LIBRTE_PORT=y CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n +CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_frag.c b/lib/librte_port/rte_port_frag.c index c4c05dc..c42b182 100644 --- a/lib/librte_port/rte_port_frag.c +++ b/lib/librte_port/rte_port_frag.c @@ -41,6 +41,20 @@ /* Max number of fragments per packet allowed */ #defineRTE_PORT_FRAG_MAX_FRAGS_PER_PACKET 0x80 +#ifdef RTE_PORT_RING_READER_FRAG_STATS_COLLECT + +#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_IN_ADD(port, val) +#define RTE_PORT_RING_READER_FRAG_STATS_PKTS_DROP_ADD(port, val) + +#endif + typedef int32_t (*frag_op)(struct rte_mbuf *pkt_in, struct rte_mbuf **pkts_out, @@ -50,6 +64,8 @@ typedef int32_t struct rte_mempool *pool_indirect); struct rte_port_ring_reader_frag { + struct rte_port_in_stats stats; + /* Input parameters */ struct rte_ring *ring; uint32_t mtu; @@ -171,6 +187,7 @@ rte_port_ring_reader_frag_rx(void *port, if (p->n_pkts == 0) { p->n_pkts = rte_ring_sc_dequeue_burst(p->ring, (void **) p->pkts, RTE_PORT_IN_BURST_SIZE_MAX); + RTE_PORT_RING_READER_FRAG_STATS_PKTS_IN_ADD(p, p->n_pkts); if (p->n_pkts == 0) return n_pkts_out; p->pos_pkts = 0; @@ -203,6 +220,7 @@ rte_port_ring_reader_frag_rx(void *port, if (status < 0) { rte_pktmbuf_free(pkt); + RTE_PORT_RING_READER_FRAG_STATS_PKTS_DROP_ADD(p, 1); continue; } @@ -252,6 +270,22 @@ rte_port_ring_reader_frag_free(void *port) return 0; } +static int +rte_port_frag_reader_stats_read(void *port, + struct rte_port_in_stats *stats, int clear) +{ + struct rte_port_ring_reader_frag *p = + (struct rte_port_ring_reader_frag *) port; + + if (stats != NULL) + memcpy(stats, &p->stats, sizeof(p->stats)); + + if (clear) + memset(&p->stats, 0, sizeof(p->stats)); + + return 0; +} + /* * Summary of port operations */ @@ -259,10 +293,12 @@ struct rte_port_in_ops rte_port_ring_reader_ipv4_frag_ops = { .f_create = rte_port_ring_reader_ipv4_frag_create, .f_free = rte_port_ring_reader_frag_free, .f_rx = rte_port_ring_reader_frag_rx, + .f_stats = rte_port_frag_reader_stats_read, }; struct rte_port_in_ops rte_port_ring_reader_ipv6_frag_ops = { .f_create = rte_port_ring_reader_ipv6_frag_create, .f_free = rte_port_ring_reader_frag_free, .f_rx = rte_port_ring_reader_frag_rx, + .f_stats = rte_port_frag_reader_stats_read, }; -- 1.7.9.5
[dpdk-dev] [PATCH 06/13] port: added port_ras stats
--- config/common_bsdapp |1 + config/common_linuxapp |1 + lib/librte_port/rte_port_ras.c | 38 ++ 3 files changed, 40 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index 523b9e9..0e73ce6 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -386,6 +386,7 @@ CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n +CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index e4baf41..cef8be0 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -393,6 +393,7 @@ CONFIG_RTE_PORT_ETHDEV_READER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n +CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index 5eb627a..d7aaf6c 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -51,6 +51,20 @@ #define RTE_PORT_RAS_N_ENTRIES (RTE_PORT_RAS_N_BUCKETS * RTE_PORT_RAS_N_ENTRIES_PER_BUCKET) #endif +#ifdef RTE_PORT_RING_WRITER_RAS_STATS_COLLECT + +#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(port, val) +#define RTE_PORT_RING_WRITER_RAS_STATS_PKTS_DROP_ADD(port, val) + +#endif + struct rte_port_ring_writer_ras; typedef void (*ras_op)( @@ -63,6 +77,8 @@ static void process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt); struct rte_port_ring_writer_ras { + struct rte_port_out_stats stats; + struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX]; struct rte_ring *ring; uint32_t tx_burst_sz; @@ -153,6 +169,7 @@ send_burst(struct rte_port_ring_writer_ras *p) nb_tx = rte_ring_sp_enqueue_burst(p->ring, (void **)p->tx_buf, p->tx_buf_count); + RTE_PORT_RING_WRITER_RAS_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx); for ( ; nb_tx < p->tx_buf_count; nb_tx++) rte_pktmbuf_free(p->tx_buf[nb_tx]); @@ -225,6 +242,7 @@ rte_port_ring_writer_ras_tx(void *port, struct rte_mbuf *pkt) struct rte_port_ring_writer_ras *p = (struct rte_port_ring_writer_ras *) port; + RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(p, 1); p->f_ras(p, pkt); if (p->tx_buf_count >= p->tx_burst_sz) send_burst(p); @@ -247,6 +265,7 @@ rte_port_ring_writer_ras_tx_bulk(void *port, for (i = 0; i < n_pkts; i++) { struct rte_mbuf *pkt = pkts[i]; + RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(p, 1); p->f_ras(p, pkt); if (p->tx_buf_count >= p->tx_burst_sz) send_burst(p); @@ -257,6 +276,7 @@ rte_port_ring_writer_ras_tx_bulk(void *port, uint64_t pkt_mask = 1LLU << pkt_index; struct rte_mbuf *pkt = pkts[pkt_index]; + RTE_PORT_RING_WRITER_RAS_STATS_PKTS_IN_ADD(p, 1); p->f_ras(p, pkt); if (p->tx_buf_count >= p->tx_burst_sz) send_burst(p); @@ -298,6 +318,22 @@ rte_port_ring_writer_ras_free(void *port) return 0; } +static int +rte_port_ras_writer_stats_read(void *port, + struct rte_port_out_stats *stats, int clear) +{ + struct rte_port_ring_writer_ras *p = + (struct rte_port_ring_writer_ras *) port; + + if (stats != NULL) + memcpy(stats, &p->stats, sizeof(p->stats)); + + if (clear) + memset(&p->stats, 0, sizeof(p->stats)); + + return 0; +} + /* * Summary of port operations */ @@ -307,6 +343,7 @@ struct rte_port_out_ops rte_port_ring_writer_ipv4_ras_ops = { .f_tx = rte_port_ring_writer_ras_tx, .f_tx_bulk = rte_port_ring_writer_ras_tx_bulk, .f_flush = rte_port_ring_writer_ras_flush, + .f_stats = rte_port_ras_writer_stats_read, }; struct rte_port_out_ops rte_port_ring_writer_ipv6_ras_ops = { @@ -315,4 +352,5 @@ struct rte_port_out_ops rte_port_ring_writer_ipv6_ras_ops = { .f_tx = rte_port_ring_writer_ras_tx, .f_tx_bulk = rte_port_ring_writer_ras_tx_bulk, .f_flush = rte_port_ring_writer_ras_flush, + .f_stats = rte_port_ras_writer_stats_read, }; -- 1.7.9.5
[dpdk-dev] [PATCH 07/13] port: added port_ring_reader stats
--- config/common_bsdapp|1 + config/common_linuxapp |1 + lib/librte_port/rte_port_ring.c | 39 ++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/config/common_bsdapp b/config/common_bsdapp index 0e73ce6..b51095c 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -387,6 +387,7 @@ CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n +CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index cef8be0..d84d2cf 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -394,6 +394,7 @@ CONFIG_RTE_PORT_ETHDEV_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n +CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_ring.c b/lib/librte_port/rte_port_ring.c index 371bb1e..6c5b514 100644 --- a/lib/librte_port/rte_port_ring.c +++ b/lib/librte_port/rte_port_ring.c @@ -42,7 +42,23 @@ /* * Port RING Reader */ +#ifdef RTE_PORT_RING_READER_STATS_COLLECT + +#define RTE_PORT_RING_READER_STATS_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_RING_READER_STATS_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_RING_READER_STATS_PKTS_IN_ADD(port, val) +#define RTE_PORT_RING_READER_STATS_PKTS_DROP_ADD(port, val) + +#endif + struct rte_port_ring_reader { + struct rte_port_in_stats stats; + struct rte_ring *ring; }; @@ -77,8 +93,12 @@ static int rte_port_ring_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts) { struct rte_port_ring_reader *p = (struct rte_port_ring_reader *) port; + uint32_t nb_rx; + + nb_rx = rte_ring_sc_dequeue_burst(p->ring, (void **) pkts, n_pkts); + RTE_PORT_RING_READER_STATS_PKTS_IN_ADD(p, nb_rx); - return rte_ring_sc_dequeue_burst(p->ring, (void **) pkts, n_pkts); + return nb_rx; } static int @@ -94,6 +114,22 @@ rte_port_ring_reader_free(void *port) return 0; } +static int +rte_port_ring_reader_stats_read(void *port, + struct rte_port_in_stats *stats, int clear) +{ + struct rte_port_ring_reader *p = + (struct rte_port_ring_reader *) port; + + if (stats != NULL) + memcpy(stats, &p->stats, sizeof(p->stats)); + + if (clear) + memset(&p->stats, 0, sizeof(p->stats)); + + return 0; +} + /* * Port RING Writer */ @@ -503,6 +539,7 @@ struct rte_port_in_ops rte_port_ring_reader_ops = { .f_create = rte_port_ring_reader_create, .f_free = rte_port_ring_reader_free, .f_rx = rte_port_ring_reader_rx, + .f_stats = rte_port_ring_reader_stats_read, }; struct rte_port_out_ops rte_port_ring_writer_ops = { -- 1.7.9.5
[dpdk-dev] [PATCH 08/13] port: added port_ring_writer stats
--- config/common_bsdapp|1 + config/common_linuxapp |1 + lib/librte_port/rte_port_ring.c | 40 +++ 3 files changed, 42 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index b51095c..94930ed 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -388,6 +388,7 @@ CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n +CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index d84d2cf..3127de5 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -395,6 +395,7 @@ CONFIG_RTE_PORT_ETHDEV_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n +CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_ring.c b/lib/librte_port/rte_port_ring.c index 6c5b514..6d03093 100644 --- a/lib/librte_port/rte_port_ring.c +++ b/lib/librte_port/rte_port_ring.c @@ -135,7 +135,23 @@ rte_port_ring_reader_stats_read(void *port, */ #define RTE_PORT_RING_WRITER_APPROACH 1 +#ifdef RTE_PORT_RING_WRITER_STATS_COLLECT + +#define RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(port, val) +#define RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(port, val) + +#endif + struct rte_port_ring_writer { + struct rte_port_out_stats stats; + struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX]; struct rte_ring *ring; uint32_t tx_burst_sz; @@ -183,6 +199,7 @@ send_burst(struct rte_port_ring_writer *p) nb_tx = rte_ring_sp_enqueue_burst(p->ring, (void **)p->tx_buf, p->tx_buf_count); + RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx); for ( ; nb_tx < p->tx_buf_count; nb_tx++) rte_pktmbuf_free(p->tx_buf[nb_tx]); @@ -195,6 +212,7 @@ rte_port_ring_writer_tx(void *port, struct rte_mbuf *pkt) struct rte_port_ring_writer *p = (struct rte_port_ring_writer *) port; p->tx_buf[p->tx_buf_count++] = pkt; + RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, 1); if (p->tx_buf_count >= p->tx_burst_sz) send_burst(p); @@ -214,6 +232,7 @@ rte_port_ring_writer_tx_bulk(void *port, uint64_t n_pkts = __builtin_popcountll(pkts_mask); uint32_t i; + RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, n_pkts); for (i = 0; i < n_pkts; i++) { struct rte_mbuf *pkt = pkts[i]; @@ -228,6 +247,7 @@ rte_port_ring_writer_tx_bulk(void *port, struct rte_mbuf *pkt = pkts[pkt_index]; p->tx_buf[p->tx_buf_count++] = pkt; + RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, 1); if (p->tx_buf_count >= p->tx_burst_sz) send_burst(p); pkts_mask &= ~pkt_mask; @@ -259,8 +279,10 @@ rte_port_ring_writer_tx_bulk(void *port, if (tx_buf_count) send_burst(p); + RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, n_pkts); n_pkts_ok = rte_ring_sp_enqueue_burst(p->ring, (void **)pkts, n_pkts); + RTE_PORT_RING_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - n_pkts_ok); for ( ; n_pkts_ok < n_pkts; n_pkts_ok++) { struct rte_mbuf *pkt = pkts[n_pkts_ok]; @@ -273,6 +295,7 @@ rte_port_ring_writer_tx_bulk(void *port, struct rte_mbuf *pkt = pkts[pkt_index]; p->tx_buf[tx_buf_count++] = pkt; + RTE_PORT_RING_WRITER_STATS_PKTS_IN_ADD(p, 1); pkts_mask &= ~pkt_mask; } @@ -315,6 +338,22 @@ rte_port_ring_writer_free(void *port) return 0; } +static int +rte_port_ring_writer_stats_read(void *port, + struct rte_port_out_stats *stats, int clear) +{ + struct rte_port_ring_writer *p = + (struct rte_port_ring_writer *) port; + + if (stats != NULL) + memcpy(stats, &p->stats, sizeof(p->stats)); + + if (clear) + memset(&p->stats, 0, sizeof(p->stats)); + + return 0; +} + /* * Port RING Writer Nodrop */ @@ -548,6 +587,7 @@ struct rte_port_out_ops rte_port_ring_writer_ops = { .f_tx = rte_port_ring_writer_tx, .f_tx_bulk = rte_port_ring_writer_tx_bulk, .f_flush = rte_port_ring_writer_flush, + .f_stats = rte_port_ring_write
[dpdk-dev] [PATCH 09/13] port: added port_ring_writer_nodrop stats
--- config/common_bsdapp|1 + config/common_linuxapp |1 + lib/librte_port/rte_port_ring.c | 39 +++ 3 files changed, 41 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index 94930ed..4a06da6 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -389,6 +389,7 @@ CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n +CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index 3127de5..26e2d22 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -396,6 +396,7 @@ CONFIG_RTE_PORT_RING_READER_FRAG_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n +CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_ring.c b/lib/librte_port/rte_port_ring.c index 6d03093..b263662 100644 --- a/lib/librte_port/rte_port_ring.c +++ b/lib/librte_port/rte_port_ring.c @@ -359,7 +359,23 @@ rte_port_ring_writer_stats_read(void *port, */ #define RTE_PORT_RING_WRITER_NODROP_APPROACH 1 +#ifdef RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT + +#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(port, val) +#define RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(port, val) + +#endif + struct rte_port_ring_writer_nodrop { + struct rte_port_out_stats stats; + struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX]; struct rte_ring *ring; uint32_t tx_burst_sz; @@ -429,6 +445,7 @@ send_burst_nodrop(struct rte_port_ring_writer_nodrop *p) } /* We didn't send the packets in maximum allowed attempts */ + RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx); for ( ; nb_tx < p->tx_buf_count; nb_tx++) rte_pktmbuf_free(p->tx_buf[nb_tx]); @@ -442,6 +459,7 @@ rte_port_ring_writer_nodrop_tx(void *port, struct rte_mbuf *pkt) (struct rte_port_ring_writer_nodrop *) port; p->tx_buf[p->tx_buf_count++] = pkt; + RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1); if (p->tx_buf_count >= p->tx_burst_sz) send_burst_nodrop(p); @@ -462,6 +480,7 @@ rte_port_ring_writer_nodrop_tx_bulk(void *port, uint64_t n_pkts = __builtin_popcountll(pkts_mask); uint32_t i; + RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts); for (i = 0; i < n_pkts; i++) { struct rte_mbuf *pkt = pkts[i]; @@ -476,6 +495,7 @@ rte_port_ring_writer_nodrop_tx_bulk(void *port, struct rte_mbuf *pkt = pkts[pkt_index]; p->tx_buf[p->tx_buf_count++] = pkt; + RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1); if (p->tx_buf_count >= p->tx_burst_sz) send_burst_nodrop(p); pkts_mask &= ~pkt_mask; @@ -507,6 +527,7 @@ rte_port_ring_writer_nodrop_tx_bulk(void *port, if (tx_buf_count) send_burst_nodrop(p); + RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, n_pkts); n_pkts_ok = rte_ring_sp_enqueue_burst(p->ring, (void **)pkts, n_pkts); if (n_pkts_ok >= n_pkts) @@ -528,6 +549,7 @@ rte_port_ring_writer_nodrop_tx_bulk(void *port, struct rte_mbuf *pkt = pkts[pkt_index]; p->tx_buf[tx_buf_count++] = pkt; + RTE_PORT_RING_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1); pkts_mask &= ~pkt_mask; } @@ -571,6 +593,22 @@ rte_port_ring_writer_nodrop_free(void *port) return 0; } +static int +rte_port_ring_writer_nodrop_stats_read(void *port, + struct rte_port_out_stats *stats, int clear) +{ + struct rte_port_ring_writer_nodrop *p = + (struct rte_port_ring_writer_nodrop *) port; + + if (stats != NULL) + memcpy(stats, &p->stats, sizeof(p->stats)); + + if (clear) + memset(&p->stats, 0, sizeof(p->stats)); + + return 0; +} + /* * Summary of port operations */ @@ -596,4 +634,5 @@ struct rte_port_out_ops rte_port_ring_writer_nodrop_ops = { .f_tx = rte_port_ring_writer_nodrop_tx, .f_tx_bulk = rte_port_ring_writer_nodrop_tx_bulk, .f_flush = rte_port_ring_writer_nodrop_flush, + .f_stats = rte_port_r
[dpdk-dev] [PATCH 10/13] port: added port_sched_reader stats
--- config/common_bsdapp |1 + config/common_linuxapp |1 + lib/librte_port/rte_port_sched.c | 39 +- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/config/common_bsdapp b/config/common_bsdapp index 4a06da6..4b1a877 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -390,6 +390,7 @@ CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n +CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index 26e2d22..055d06e 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -397,6 +397,7 @@ CONFIG_RTE_PORT_RING_WRITER_RAS_STATS_COLLECT=n CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n +CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_sched.c b/lib/librte_port/rte_port_sched.c index 2107f4c..f1cb435 100644 --- a/lib/librte_port/rte_port_sched.c +++ b/lib/librte_port/rte_port_sched.c @@ -40,7 +40,23 @@ /* * Reader */ +#ifdef RTE_PORT_SCHED_READER_STATS_COLLECT + +#define RTE_PORT_SCHED_READER_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_SCHED_READER_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_SCHED_READER_PKTS_IN_ADD(port, val) +#define RTE_PORT_SCHED_READER_PKTS_DROP_ADD(port, val) + +#endif + struct rte_port_sched_reader { + struct rte_port_in_stats stats; + struct rte_sched_port *sched; }; @@ -76,8 +92,12 @@ static int rte_port_sched_reader_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts) { struct rte_port_sched_reader *p = (struct rte_port_sched_reader *) port; + uint32_t nb_rx; - return rte_sched_port_dequeue(p->sched, pkts, n_pkts); + nb_rx = rte_sched_port_dequeue(p->sched, pkts, n_pkts); + RTE_PORT_SCHED_READER_PKTS_IN_ADD(p, nb_rx); + + return nb_rx; } static int @@ -93,6 +113,22 @@ rte_port_sched_reader_free(void *port) return 0; } +static int +rte_port_sched_reader_stats_read(void *port, + struct rte_port_in_stats *stats, int clear) +{ + struct rte_port_sched_reader *p = + (struct rte_port_sched_reader *) port; + + if (stats != NULL) + memcpy(stats, &p->stats, sizeof(p->stats)); + + if (clear) + memset(&p->stats, 0, sizeof(p->stats)); + + return 0; +} + /* * Writer */ @@ -228,6 +264,7 @@ struct rte_port_in_ops rte_port_sched_reader_ops = { .f_create = rte_port_sched_reader_create, .f_free = rte_port_sched_reader_free, .f_rx = rte_port_sched_reader_rx, + .f_stats = rte_port_sched_reader_stats_read, }; struct rte_port_out_ops rte_port_sched_writer_ops = { -- 1.7.9.5
[dpdk-dev] [PATCH 11/13] port: added port_sched_writer stats
--- config/common_bsdapp |1 + config/common_linuxapp |1 + lib/librte_port/rte_port_sched.c | 57 ++ 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/config/common_bsdapp b/config/common_bsdapp index 4b1a877..f222cef 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -391,6 +391,7 @@ CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n +CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index 055d06e..67233e9 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -398,6 +398,7 @@ CONFIG_RTE_PORT_RING_READER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n +CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_sched.c b/lib/librte_port/rte_port_sched.c index f1cb435..93d7930 100644 --- a/lib/librte_port/rte_port_sched.c +++ b/lib/librte_port/rte_port_sched.c @@ -132,7 +132,23 @@ rte_port_sched_reader_stats_read(void *port, /* * Writer */ +#ifdef RTE_PORT_SCHED_WRITER_STATS_COLLECT + +#define RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(port, val) +#define RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(port, val) + +#endif + struct rte_port_sched_writer { + struct rte_port_out_stats stats; + struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX]; struct rte_sched_port *sched; uint32_t tx_burst_sz; @@ -180,8 +196,12 @@ rte_port_sched_writer_tx(void *port, struct rte_mbuf *pkt) struct rte_port_sched_writer *p = (struct rte_port_sched_writer *) port; p->tx_buf[p->tx_buf_count++] = pkt; + RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(p, 1); if (p->tx_buf_count >= p->tx_burst_sz) { - rte_sched_port_enqueue(p->sched, p->tx_buf, p->tx_buf_count); + __rte_unused uint32_t nb_tx; + + nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf, p->tx_buf_count); + RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx); p->tx_buf_count = 0; } @@ -200,15 +220,18 @@ rte_port_sched_writer_tx_bulk(void *port, ((pkts_mask & bsz_mask) ^ bsz_mask); if (expr == 0) { + __rte_unused uint32_t nb_tx; uint64_t n_pkts = __builtin_popcountll(pkts_mask); if (tx_buf_count) { - rte_sched_port_enqueue(p->sched, p->tx_buf, + nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf, tx_buf_count); + RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, tx_buf_count - nb_tx); p->tx_buf_count = 0; } - rte_sched_port_enqueue(p->sched, pkts, n_pkts); + nb_tx = rte_sched_port_enqueue(p->sched, pkts, n_pkts); + RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, n_pkts - nb_tx); } else { for ( ; pkts_mask; ) { uint32_t pkt_index = __builtin_ctzll(pkts_mask); @@ -216,13 +239,17 @@ rte_port_sched_writer_tx_bulk(void *port, struct rte_mbuf *pkt = pkts[pkt_index]; p->tx_buf[tx_buf_count++] = pkt; + RTE_PORT_SCHED_WRITER_STATS_PKTS_IN_ADD(p, 1); pkts_mask &= ~pkt_mask; } p->tx_buf_count = tx_buf_count; if (tx_buf_count >= p->tx_burst_sz) { - rte_sched_port_enqueue(p->sched, p->tx_buf, + __rte_unused uint32_t nb_tx; + + nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf, tx_buf_count); + RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, tx_buf_count - nb_tx); p->tx_buf_count = 0; } } @@ -236,7 +263,10 @@ rte_port_sched_writer_flush(void *port) struct rte_port_sched_writer *p = (struct rte_port_sched_writer *) port; if (p->tx_buf_count) { - rte_sched_port_enqueue(p->sched, p->tx_buf, p->tx_buf_count); + __rte_unused uint32_t nb_tx; + + nb_tx = rte_sched_port_enqueue(p->sched, p->tx_buf, p->tx_buf_count); + RTE_PORT_SCHED_WRITER_STATS_PKTS_DROP_ADD(p, p->tx_buf_count - nb_tx); p->tx_buf_count = 0; } @@ -257,6 +287,22 @@ rte_port_sched_writ
[dpdk-dev] [PATCH 12/13] port: added port_source stats
--- config/common_bsdapp |1 + config/common_linuxapp |1 + lib/librte_port/rte_port_source_sink.c | 35 3 files changed, 37 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index f222cef..2241169 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -392,6 +392,7 @@ CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n +CONFIG_RTE_PORT_SOURCE_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index 67233e9..16ce4ef 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -399,6 +399,7 @@ CONFIG_RTE_PORT_RING_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n +CONFIG_RTE_PORT_SOURCE_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_source_sink.c b/lib/librte_port/rte_port_source_sink.c index b9a25bb..4f51ec7 100644 --- a/lib/librte_port/rte_port_source_sink.c +++ b/lib/librte_port/rte_port_source_sink.c @@ -42,7 +42,23 @@ /* * Port SOURCE */ +#ifdef RTE_PORT_SOURCE_STATS_COLLECT + +#define RTE_PORT_SOURCE_STATS_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_SOURCE_STATS_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_SOURCE_STATS_PKTS_IN_ADD(port, val) +#define RTE_PORT_SOURCE_STATS_PKTS_DROP_ADD(port, val) + +#endif + struct rte_port_source { + struct rte_port_in_stats stats; + struct rte_mempool *mempool; }; @@ -93,9 +109,27 @@ rte_port_source_rx(void *port, struct rte_mbuf **pkts, uint32_t n_pkts) if (rte_mempool_get_bulk(p->mempool, (void **) pkts, n_pkts) != 0) return 0; + RTE_PORT_SOURCE_STATS_PKTS_IN_ADD(p, n_pkts); + return n_pkts; } +static int +rte_port_source_stats_read(void *port, + struct rte_port_in_stats *stats, int clear) +{ + struct rte_port_source *p = + (struct rte_port_source *) port; + + if (stats != NULL) + memcpy(stats, &p->stats, sizeof(p->stats)); + + if (clear) + memset(&p->stats, 0, sizeof(p->stats)); + + return 0; +} + /* * Port SINK */ @@ -147,6 +181,7 @@ struct rte_port_in_ops rte_port_source_ops = { .f_create = rte_port_source_create, .f_free = rte_port_source_free, .f_rx = rte_port_source_rx, + .f_stats = rte_port_source_stats_read, }; struct rte_port_out_ops rte_port_sink_ops = { -- 1.7.9.5
[dpdk-dev] [PATCH 13/13] port: added port_sink stats
--- config/common_bsdapp |1 + config/common_linuxapp |1 + lib/librte_port/rte_port_source_sink.c | 63 ++-- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/config/common_bsdapp b/config/common_bsdapp index 2241169..4c32f43 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -393,6 +393,7 @@ CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_SOURCE_STATS_COLLECT=n +CONFIG_RTE_PORT_SINK_STATS_COLLECT=n # # Compile librte_table diff --git a/config/common_linuxapp b/config/common_linuxapp index 16ce4ef..6a5aa87 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -400,6 +400,7 @@ CONFIG_RTE_PORT_RING_WRITER_NODROP_STATS_COLLECT=n CONFIG_RTE_PORT_SCHED_READER_STATS_COLLECT=n CONFIG_RTE_PORT_SCHED_WRITER_STATS_COLLECT=n CONFIG_RTE_PORT_SOURCE_STATS_COLLECT=n +CONFIG_RTE_PORT_SINK_STATS_COLLECT=n # # Compile librte_table diff --git a/lib/librte_port/rte_port_source_sink.c b/lib/librte_port/rte_port_source_sink.c index 4f51ec7..508fcf6 100644 --- a/lib/librte_port/rte_port_source_sink.c +++ b/lib/librte_port/rte_port_source_sink.c @@ -133,28 +133,64 @@ rte_port_source_stats_read(void *port, /* * Port SINK */ +#ifdef RTE_PORT_SINK_STATS_COLLECT + +#define RTE_PORT_SINK_STATS_PKTS_IN_ADD(port, val) \ + port->stats.n_pkts_in += val +#define RTE_PORT_SINK_STATS_PKTS_DROP_ADD(port, val) \ + port->stats.n_pkts_drop += val + +#else + +#define RTE_PORT_SINK_STATS_PKTS_IN_ADD(port, val) +#define RTE_PORT_SINK_STATS_PKTS_DROP_ADD(port, val) + +#endif + +struct rte_port_sink { + struct rte_port_out_stats stats; +}; + static void * -rte_port_sink_create(__rte_unused void *params, __rte_unused int socket_id) +rte_port_sink_create(__rte_unused void *params, int socket_id) { - return (void *) 1; + struct rte_port_sink *port; + + /* Memory allocation */ + port = rte_zmalloc_socket("PORT", sizeof(*port), + RTE_CACHE_LINE_SIZE, socket_id); + if (port == NULL) { + RTE_LOG(ERR, PORT, "%s: Failed to allocate port\n", __func__); + return NULL; + } + + return port; } static int -rte_port_sink_tx(__rte_unused void *port, struct rte_mbuf *pkt) +rte_port_sink_tx(void *port, struct rte_mbuf *pkt) { + __rte_unused struct rte_port_sink *p = (struct rte_port_sink *) port; + + RTE_PORT_SINK_STATS_PKTS_IN_ADD(p, 1); rte_pktmbuf_free(pkt); + RTE_PORT_SINK_STATS_PKTS_DROP_ADD(p, 1); return 0; } static int -rte_port_sink_tx_bulk(__rte_unused void *port, struct rte_mbuf **pkts, +rte_port_sink_tx_bulk(void *port, struct rte_mbuf **pkts, uint64_t pkts_mask) { + __rte_unused struct rte_port_sink *p = (struct rte_port_sink *) port; + if ((pkts_mask & (pkts_mask + 1)) == 0) { uint64_t n_pkts = __builtin_popcountll(pkts_mask); uint32_t i; + RTE_PORT_SINK_STATS_PKTS_IN_ADD(p, n_pkts); + RTE_PORT_SINK_STATS_PKTS_DROP_ADD(p, n_pkts); for (i = 0; i < n_pkts; i++) { struct rte_mbuf *pkt = pkts[i]; @@ -166,6 +202,8 @@ rte_port_sink_tx_bulk(__rte_unused void *port, struct rte_mbuf **pkts, uint64_t pkt_mask = 1LLU << pkt_index; struct rte_mbuf *pkt = pkts[pkt_index]; + RTE_PORT_SINK_STATS_PKTS_IN_ADD(p, 1); + RTE_PORT_SINK_STATS_PKTS_DROP_ADD(p, 1); rte_pktmbuf_free(pkt); pkts_mask &= ~pkt_mask; } @@ -174,6 +212,22 @@ rte_port_sink_tx_bulk(__rte_unused void *port, struct rte_mbuf **pkts, return 0; } +static int +rte_port_sink_stats_read(void *port, struct rte_port_out_stats *stats, + int clear) +{ + struct rte_port_sink *p = + (struct rte_port_sink *) port; + + if (stats != NULL) + memcpy(stats, &p->stats, sizeof(p->stats)); + + if (clear) + memset(&p->stats, 0, sizeof(p->stats)); + + return 0; +} + /* * Summary of port operations */ @@ -190,4 +244,5 @@ struct rte_port_out_ops rte_port_sink_ops = { .f_tx = rte_port_sink_tx, .f_tx_bulk = rte_port_sink_tx_bulk, .f_flush = NULL, + .f_stats = rte_port_sink_stats_read, }; -- 1.7.9.5
[dpdk-dev] [PATCH 00/10] table: added table statistics
Added statistics for every type of table. By default all table statistics are disabled, user must activate them in config file. Maciej Gajdzica (10): table: added structure for storing table stats table: added acl table stats table: added array table stats table: added hash_ext table stats table: added hash_key16 table stats table: added hash_key32 table stats table: added hash_key8 table stats table: added hash_lru table stats table: added lpm_ipv6 table stats table: added lpm table stats config/common_bsdapp|9 ++ config/common_linuxapp |9 ++ lib/librte_table/rte_table.h| 25 +++ lib/librte_table/rte_table_acl.c| 35 + lib/librte_table/rte_table_array.c | 34 +++- lib/librte_table/rte_table_hash_ext.c | 44 ++ lib/librte_table/rte_table_hash_key16.c | 41 lib/librte_table/rte_table_hash_key32.c | 41 lib/librte_table/rte_table_hash_key8.c | 52 +++ lib/librte_table/rte_table_hash_lru.c | 44 ++ lib/librte_table/rte_table_lpm.c| 34 lib/librte_table/rte_table_lpm_ipv6.c | 34 12 files changed, 401 insertions(+), 1 deletion(-) -- 1.7.9.5
[dpdk-dev] [PATCH 01/10] table: added structure for storing table stats
--- lib/librte_table/rte_table.h | 25 + 1 file changed, 25 insertions(+) diff --git a/lib/librte_table/rte_table.h b/lib/librte_table/rte_table.h index d57bc33..9860b7b 100644 --- a/lib/librte_table/rte_table.h +++ b/lib/librte_table/rte_table.h @@ -58,6 +58,12 @@ extern "C" { #include #include +/** Lookup table statistics */ +struct rte_table_stats { + uint64_t n_pkts_in; + uint64_t n_pkts_lookup_miss; +}; + /** * Lookup table create * @@ -186,6 +192,24 @@ typedef int (*rte_table_op_lookup)( uint64_t *lookup_hit_mask, void **entries); +/** + * Lookup table stats read + * + * @param port + * Handle to lookup table instance + * @param stats + * Handle to table stats struct to copy data + * @param clear + * Flag indicating that stats should be cleared after read + * + * @return + * Error code or 0 on success. + */ +typedef int (*rte_table_op_stats_read)( + void *table, + struct rte_table_stats *stats, + int clear); + /** Lookup table interface defining the lookup table operation */ struct rte_table_ops { rte_table_op_create f_create; /**< Create */ @@ -193,6 +217,7 @@ struct rte_table_ops { rte_table_op_entry_add f_add; /**< Entry add */ rte_table_op_entry_delete f_delete; /**< Entry delete */ rte_table_op_lookup f_lookup; /**< Lookup */ + rte_table_op_stats_read f_stats;/**< Stats */ }; #ifdef __cplusplus -- 1.7.9.5
[dpdk-dev] [PATCH 02/10] table: added acl table stats
--- config/common_bsdapp |1 + config/common_linuxapp |1 + lib/librte_table/rte_table_acl.c | 35 +++ 3 files changed, 37 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index 4c32f43..20aa745 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -399,6 +399,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n # Compile librte_table # CONFIG_RTE_LIBRTE_TABLE=y +CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n # # Compile librte_pipeline diff --git a/config/common_linuxapp b/config/common_linuxapp index 6a5aa87..7d70229 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -406,6 +406,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n # Compile librte_table # CONFIG_RTE_LIBRTE_TABLE=y +CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n # # Compile librte_pipeline diff --git a/lib/librte_table/rte_table_acl.c b/lib/librte_table/rte_table_acl.c index 4416311..194316d 100644 --- a/lib/librte_table/rte_table_acl.c +++ b/lib/librte_table/rte_table_acl.c @@ -43,7 +43,23 @@ #include "rte_table_acl.h" #include +#ifdef RTE_TABLE_ACL_STATS_COLLECT + +#define RTE_TABLE_ACL_STATS_PKTS_IN_ADD(table, val) \ + table->stats.n_pkts_in += val +#define RTE_TABLE_ACL_STATS_PKTS_LOOKUP_MISS(table, val) \ + table->stats.n_pkts_lookup_miss += val + +#else + +#define RTE_TABLE_ACL_STATS_PKTS_IN_ADD(table, val) +#define RTE_TABLE_ACL_STATS_PKTS_LOOKUP_MISS(table, val) + +#endif + struct rte_table_acl { + struct rte_table_stats stats; + /* Low-level ACL table */ char name[2][RTE_ACL_NAMESIZE]; struct rte_acl_param acl_params; /* for creating low level acl table */ @@ -441,6 +457,9 @@ rte_table_acl_lookup( uint64_t pkts_out_mask; uint32_t n_pkts, i, j; + __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask); + RTE_TABLE_ACL_STATS_PKTS_IN_ADD(acl, n_pkts_in); + /* Input conversion */ for (i = 0, j = 0; i < (uint32_t)(RTE_PORT_IN_BURST_SIZE_MAX - __builtin_clzll(pkts_mask)); i++) { @@ -478,6 +497,21 @@ rte_table_acl_lookup( } *lookup_hit_mask = pkts_out_mask; + RTE_TABLE_ACL_STATS_PKTS_LOOKUP_MISS(acl, n_pkts_in - __builtin_popcountll(pkts_out_mask)); + + return 0; +} + +static int +rte_table_acl_stats_read(void *table, struct rte_table_stats *stats, int clear) +{ + struct rte_table_acl *acl = (struct rte_table_acl *) table; + + if (stats != NULL) + memcpy(stats, &acl->stats, sizeof(acl->stats)); + + if (clear) + memset(&acl->stats, 0, sizeof(acl->stats)); return 0; } @@ -488,4 +522,5 @@ struct rte_table_ops rte_table_acl_ops = { .f_add = rte_table_acl_entry_add, .f_delete = rte_table_acl_entry_delete, .f_lookup = rte_table_acl_lookup, + .f_stats = rte_table_acl_stats_read, }; -- 1.7.9.5
[dpdk-dev] [PATCH 03/10] table: added array table stats
--- config/common_bsdapp |1 + config/common_linuxapp |1 + lib/librte_table/rte_table_array.c | 34 +- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/config/common_bsdapp b/config/common_bsdapp index 20aa745..1aba0d5 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -400,6 +400,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n # CONFIG_RTE_LIBRTE_TABLE=y CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n +CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n # # Compile librte_pipeline diff --git a/config/common_linuxapp b/config/common_linuxapp index 7d70229..b4ad91b 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -407,6 +407,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n # CONFIG_RTE_LIBRTE_TABLE=y CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n +CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n # # Compile librte_pipeline diff --git a/lib/librte_table/rte_table_array.c b/lib/librte_table/rte_table_array.c index c031070..3f25fa6 100644 --- a/lib/librte_table/rte_table_array.c +++ b/lib/librte_table/rte_table_array.c @@ -42,7 +42,23 @@ #include "rte_table_array.h" +#ifdef RTE_TABLE_ARRAY_STATS_COLLECT + +#define RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(table, val) \ + table->stats.n_pkts_in += val +#define RTE_TABLE_ARRAY_STATS_PKTS_LOOKUP_MISS(table, val) \ + table->stats.n_pkts_lookup_miss += val + +#else + +#define RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(table, val) +#define RTE_TABLE_ARRAY_STATS_PKTS_LOOKUP_MISS(table, val) + +#endif + struct rte_table_array { + struct rte_table_stats stats; + /* Input parameters */ uint32_t entry_size; uint32_t n_entries; @@ -164,7 +180,8 @@ rte_table_array_lookup( void **entries) { struct rte_table_array *t = (struct rte_table_array *) table; - + __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask); + RTE_TABLE_ARRAY_STATS_PKTS_IN_ADD(t, n_pkts_in); *lookup_hit_mask = pkts_mask; if ((pkts_mask & (pkts_mask + 1)) == 0) { @@ -196,10 +213,25 @@ rte_table_array_lookup( return 0; } +static int +rte_table_array_stats_read(void *table, struct rte_table_stats *stats, int clear) +{ + struct rte_table_array *array = (struct rte_table_array *) table; + + if (stats != NULL) + memcpy(stats, &array->stats, sizeof(array->stats)); + + if (clear) + memset(&array->stats, 0, sizeof(array->stats)); + + return 0; +} + struct rte_table_ops rte_table_array_ops = { .f_create = rte_table_array_create, .f_free = rte_table_array_free, .f_add = rte_table_array_entry_add, .f_delete = NULL, .f_lookup = rte_table_array_lookup, + .f_stats = rte_table_array_stats_read, }; -- 1.7.9.5
[dpdk-dev] [PATCH 04/10] table: added hash_ext table stats
--- config/common_bsdapp |1 + config/common_linuxapp|1 + lib/librte_table/rte_table_hash_ext.c | 44 + 3 files changed, 46 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index 1aba0d5..7f35d53 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -401,6 +401,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n CONFIG_RTE_LIBRTE_TABLE=y CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n +CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n # # Compile librte_pipeline diff --git a/config/common_linuxapp b/config/common_linuxapp index b4ad91b..8e192bc 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -408,6 +408,7 @@ CONFIG_RTE_PORT_SINK_STATS_COLLECT=n CONFIG_RTE_LIBRTE_TABLE=y CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n +CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n # # Compile librte_pipeline diff --git a/lib/librte_table/rte_table_hash_ext.c b/lib/librte_table/rte_table_hash_ext.c index 66e416b..d9ff97b 100644 --- a/lib/librte_table/rte_table_hash_ext.c +++ b/lib/librte_table/rte_table_hash_ext.c @@ -74,6 +74,20 @@ do \ (bucket)->next = (bucket2)->next; \ while (0) +#ifdef RTE_TABLE_HASH_EXT_STATS_COLLECT + +#define RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(table, val) \ + table->stats.n_pkts_in += val +#define RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(table, val) \ + table->stats.n_pkts_lookup_miss += val + +#else + +#define RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(table, val) +#define RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(table, val) + +#endif + struct grinder { struct bucket *bkt; uint64_t sig; @@ -82,6 +96,8 @@ struct grinder { }; struct rte_table_hash { + struct rte_table_stats stats; + /* Input parameters */ uint32_t key_size; uint32_t entry_size; @@ -440,6 +456,9 @@ static int rte_table_hash_ext_lookup_unoptimized( struct rte_table_hash *t = (struct rte_table_hash *) table; uint64_t pkts_mask_out = 0; + __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask); + RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(t, n_pkts_in); + for ( ; pkts_mask; ) { struct bucket *bkt0, *bkt; struct rte_mbuf *pkt; @@ -484,6 +503,7 @@ static int rte_table_hash_ext_lookup_unoptimized( } *lookup_hit_mask = pkts_mask_out; + RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - __builtin_popcountll(pkts_mask_out)); return 0; } @@ -861,6 +881,9 @@ static int rte_table_hash_ext_lookup( uint64_t pkts_mask_out = 0, pkts_mask_match_many = 0; int status = 0; + __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask); + RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(t, n_pkts_in); + /* Cannot run the pipeline with less than 7 packets */ if (__builtin_popcountll(pkts_mask) < 7) return rte_table_hash_ext_lookup_unoptimized(table, pkts, @@ -973,6 +996,7 @@ static int rte_table_hash_ext_lookup( } *lookup_hit_mask = pkts_mask_out; + RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - __builtin_popcountll(pkts_mask_out)); return status; } @@ -990,6 +1014,9 @@ static int rte_table_hash_ext_lookup_dosig( uint64_t pkts_mask_out = 0, pkts_mask_match_many = 0; int status = 0; + __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask); + RTE_TABLE_HASH_EXT_STATS_PKTS_IN_ADD(t, n_pkts_in); + /* Cannot run the pipeline with less than 7 packets */ if (__builtin_popcountll(pkts_mask) < 7) return rte_table_hash_ext_lookup_unoptimized(table, pkts, @@ -1102,15 +1129,31 @@ static int rte_table_hash_ext_lookup_dosig( } *lookup_hit_mask = pkts_mask_out; + RTE_TABLE_HASH_EXT_STATS_PKTS_LOOKUP_MISS(t, n_pkts_in - __builtin_popcountll(pkts_mask_out)); return status; } +static int +rte_table_hash_ext_stats_read(void *table, struct rte_table_stats *stats, int clear) +{ + struct rte_table_hash *t = (struct rte_table_hash *) table; + + if (stats != NULL) + memcpy(stats, &t->stats, sizeof(t->stats)); + + if (clear) + memset(&t->stats, 0, sizeof(t->stats)); + + return 0; +} + struct rte_table_ops rte_table_hash_ext_ops = { .f_create = rte_table_hash_ext_create, .f_free = rte_table_hash_ext_free, .f_add = rte_table_hash_ext_entry_add, .f_delete = rte_table_hash_ext_entry_delete, .f_lookup = rte_table_hash_ext_lookup, + .f_stats = rte_table_hash_ext_stats_read, }; struct rte_table_ops rte_table_hash_ext_dosig_ops = { @@ -1119,4 +1162,5 @@ struct rte_table_ops rte_table_hash_ext_dosig_ops = { .f_add = rte_table_h
[dpdk-dev] [PATCH 05/10] table: added hash_key16 table stats
--- config/common_bsdapp|1 + config/common_linuxapp |1 + lib/librte_table/rte_table_hash_key16.c | 41 +++ 3 files changed, 43 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index 7f35d53..2f92f69 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -402,6 +402,7 @@ CONFIG_RTE_LIBRTE_TABLE=y CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n +CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n # # Compile librte_pipeline diff --git a/config/common_linuxapp b/config/common_linuxapp index 8e192bc..918bbaf 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -409,6 +409,7 @@ CONFIG_RTE_LIBRTE_TABLE=y CONFIG_RTE_TABLE_ACL_STATS_COLLECT=n CONFIG_RTE_TABLE_ARRAY_STATS_COLLECT=n CONFIG_RTE_TABLE_HASH_EXT_STATS_COLLECT=n +CONFIG_RTE_TABLE_HASH_KEY16_STATS_COLLECT=n # # Compile librte_pipeline diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c index ee5f639..4dd4774 100644 --- a/lib/librte_table/rte_table_hash_key16.c +++ b/lib/librte_table/rte_table_hash_key16.c @@ -46,6 +46,20 @@ #define RTE_BUCKET_ENTRY_VALID 0x1LLU +#ifdef RTE_TABLE_HASH_KEY16_STATS_COLLECT + +#define RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(table, val) \ + table->stats.n_pkts_in += val +#define RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(table, val) \ + table->stats.n_pkts_lookup_miss += val + +#else + +#define RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(table, val) +#define RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(table, val) + +#endif + struct rte_bucket_4_16 { /* Cache line 0 */ uint64_t signature[4 + 1]; @@ -61,6 +75,8 @@ struct rte_bucket_4_16 { }; struct rte_table_hash { + struct rte_table_stats stats; + /* Input parameters */ uint32_t n_buckets; uint32_t n_entries_per_bucket; @@ -832,6 +848,9 @@ rte_table_hash_lookup_key16_lru( uint32_t pkt11_index, pkt20_index, pkt21_index; uint64_t pkts_mask_out = 0; + __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask); + RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(f, n_pkts_in); + /* Cannot run the pipeline with less than 5 packets */ if (__builtin_popcountll(pkts_mask) < 5) { for ( ; pkts_mask; ) { @@ -846,6 +865,7 @@ rte_table_hash_lookup_key16_lru( } *lookup_hit_mask = pkts_mask_out; + RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out)); return 0; } @@ -935,6 +955,7 @@ rte_table_hash_lookup_key16_lru( bucket20, bucket21, pkts_mask_out, entries, f); *lookup_hit_mask = pkts_mask_out; + RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out)); return 0; } /* rte_table_hash_lookup_key16_lru() */ @@ -955,6 +976,9 @@ rte_table_hash_lookup_key16_ext( struct rte_bucket_4_16 *buckets[RTE_PORT_IN_BURST_SIZE_MAX]; uint64_t *keys[RTE_PORT_IN_BURST_SIZE_MAX]; + __rte_unused uint32_t n_pkts_in = __builtin_popcountll(pkts_mask); + RTE_TABLE_HASH_KEY16_STATS_PKTS_IN_ADD(f, n_pkts_in); + /* Cannot run the pipeline with less than 5 packets */ if (__builtin_popcountll(pkts_mask) < 5) { for ( ; pkts_mask; ) { @@ -1081,15 +1105,31 @@ grind_next_buckets: } *lookup_hit_mask = pkts_mask_out; + RTE_TABLE_HASH_KEY16_STATS_PKTS_LOOKUP_MISS(f, n_pkts_in - __builtin_popcountll(pkts_mask_out)); return 0; } /* rte_table_hash_lookup_key16_ext() */ +static int +rte_table_hash_key16_stats_read(void *table, struct rte_table_stats *stats, int clear) +{ + struct rte_table_hash *t = (struct rte_table_hash *) table; + + if (stats != NULL) + memcpy(stats, &t->stats, sizeof(t->stats)); + + if (clear) + memset(&t->stats, 0, sizeof(t->stats)); + + return 0; +} + struct rte_table_ops rte_table_hash_key16_lru_ops = { .f_create = rte_table_hash_create_key16_lru, .f_free = rte_table_hash_free_key16_lru, .f_add = rte_table_hash_entry_add_key16_lru, .f_delete = rte_table_hash_entry_delete_key16_lru, .f_lookup = rte_table_hash_lookup_key16_lru, + .f_stats = rte_table_hash_key16_stats_read, }; struct rte_table_ops rte_table_hash_key16_ext_ops = { @@ -1098,4 +1138,5 @@ struct rte_table_ops rte_table_hash_key16_ext_ops = { .f_add = rte_table_hash_entry_add_key16_ext, .f_delete = rte_table_hash_entry_delete_key16_ext, .f_lookup = rte_table_hash_lookup_key16_ext, + .f_stats = rte_table_hash_key16_stats_read, }; -- 1.7.9.5