get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/7695/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 7695,
    "url": "https://patches.dpdk.org/api/patches/7695/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1444989651-6236-7-git-send-email-tomaszx.kulasek@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1444989651-6236-7-git-send-email-tomaszx.kulasek@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1444989651-6236-7-git-send-email-tomaszx.kulasek@intel.com",
    "date": "2015-10-16T10:00:48",
    "name": "[dpdk-dev,v6,6/9] test: dynamic rss configuration",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b63375ec9a746ad50aafa449044827891b61d74b",
    "submitter": {
        "id": 155,
        "url": "https://patches.dpdk.org/api/people/155/?format=api",
        "name": "Tomasz Kulasek",
        "email": "tomaszx.kulasek@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1444989651-6236-7-git-send-email-tomaszx.kulasek@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7695/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7695/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 2A0D68E92;\n\tFri, 16 Oct 2015 12:11:10 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 6E6C137AF\n\tfor <dev@dpdk.org>; Fri, 16 Oct 2015 12:11:08 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga103.jf.intel.com with ESMTP; 16 Oct 2015 03:11:07 -0700",
            "from unknown (HELO Sent) ([10.217.248.129])\n\tby orsmga002.jf.intel.com with SMTP; 16 Oct 2015 03:11:07 -0700",
            "by Sent (sSMTP sendmail emulation); Fri, 16 Oct 2015 12:09:39 +0200"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.17,688,1437462000\"; d=\"scan'208\";a=\"828140164\"",
        "From": "Tomasz Kulasek <tomaszx.kulasek@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 16 Oct 2015 12:00:48 +0200",
        "Message-Id": "<1444989651-6236-7-git-send-email-tomaszx.kulasek@intel.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1444989651-6236-1-git-send-email-tomaszx.kulasek@intel.com>",
        "References": "<1443621905-7872-1-git-send-email-tomaszx.kulasek@intel.com>\n\t<1444989651-6236-1-git-send-email-tomaszx.kulasek@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v6 6/9] test: dynamic rss configuration",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>\n---\n app/test/Makefile                    |    8 +\n app/test/test_link_bonding_rssconf.c |  679 ++++++++++++++++++++++++++++++++++\n 2 files changed, 687 insertions(+)\n create mode 100644 app/test/test_link_bonding_rssconf.c",
    "diff": "diff --git a/app/test/Makefile b/app/test/Makefile\nindex 294618f..c122f28 100644\n--- a/app/test/Makefile\n+++ b/app/test/Makefile\n@@ -138,6 +138,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ACL) += test_acl.c\n ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)\n SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding.c\n SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding_mode4.c\n+SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding_rssconf.c\n endif\n \n SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c\n@@ -168,6 +169,13 @@ ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)\n LDLIBS += -lrte_pmd_ring\n endif\n endif\n+ifneq ($(CONFIG_RTE_LIBRTE_PMD_NULL),y)\n+$(error Link bonding rssconf tests require CONFIG_RTE_LIBRTE_PMD_NULL=y)\n+else\n+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)\n+LDLIBS += -lrte_pmd_null\n+endif\n+endif\n endif\n \n include $(RTE_SDK)/mk/rte.app.mk\ndiff --git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_bonding_rssconf.c\nnew file mode 100644\nindex 0000000..e6714b4\n--- /dev/null\n+++ b/app/test/test_link_bonding_rssconf.c\n@@ -0,0 +1,679 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2015 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <string.h>\n+#include <stdarg.h>\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <stdint.h>\n+#include <inttypes.h>\n+#include <errno.h>\n+#include <rte_cycles.h>\n+#include <sys/queue.h>\n+\n+#include <rte_byteorder.h>\n+#include <rte_common.h>\n+#include <rte_debug.h>\n+#include <rte_ethdev.h>\n+#include <rte_log.h>\n+#include <rte_lcore.h>\n+#include <rte_memory.h>\n+\n+#include <rte_string_fns.h>\n+#include <rte_errno.h>\n+#include <rte_eth_bond.h>\n+#include <rte_eth_null.h>\n+\n+#include \"test.h\"\n+\n+#define SLAVE_COUNT (4)\n+\n+#define RXTX_RING_SIZE\t\t\t1024\n+#define RXTX_QUEUE_COUNT\t\t4\n+\n+#define BONDED_DEV_NAME         (\"rssconf_bond_dev\")\n+\n+#define SLAVE_DEV_NAME_FMT      (\"rssconf_slave%d\")\n+#define SLAVE_RXTX_QUEUE_FMT      (\"rssconf_slave%d_q%d\")\n+\n+#define NUM_MBUFS 8191\n+#define MBUF_SIZE (1600 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)\n+#define MBUF_CACHE_SIZE 250\n+#define BURST_SIZE 32\n+\n+#define INVALID_SOCKET_ID       (-1)\n+#define INVALID_PORT_ID         (0xFF)\n+#define INVALID_BONDING_MODE    (-1)\n+\n+struct slave_conf {\n+\tuint8_t port_id;\n+\tstruct rte_eth_dev_info dev_info;\n+\n+\tstruct rte_eth_rss_conf rss_conf;\n+\tuint8_t rss_key[40];\n+\tstruct rte_eth_rss_reta_entry64 reta_conf[512 / RTE_RETA_GROUP_SIZE];\n+\n+\tuint8_t is_slave;\n+\tstruct rte_ring *rxtx_queue[RXTX_QUEUE_COUNT];\n+};\n+\n+struct link_bonding_rssconf_unittest_params {\n+\tuint8_t bond_port_id;\n+\tstruct rte_eth_dev_info bond_dev_info;\n+\tstruct rte_eth_rss_reta_entry64 bond_reta_conf[512 / RTE_RETA_GROUP_SIZE];\n+\tstruct slave_conf slave_ports[SLAVE_COUNT];\n+\n+\tstruct rte_mempool *mbuf_pool;\n+};\n+\n+static struct link_bonding_rssconf_unittest_params test_params  = {\n+\t.bond_port_id = INVALID_PORT_ID,\n+\t.slave_ports = {\n+\t\t[0 ... SLAVE_COUNT - 1] = { .port_id = INVALID_PORT_ID, .is_slave = 0}\n+\t},\n+\t.mbuf_pool = NULL,\n+};\n+\n+/**\n+ * Default port configuration with RSS turned off\n+ */\n+static struct rte_eth_conf default_pmd_conf = {\n+\t.rxmode = {\n+\t\t.mq_mode = ETH_MQ_RX_NONE,\n+\t\t.max_rx_pkt_len = ETHER_MAX_LEN,\n+\t\t.split_hdr_size = 0,\n+\t\t.header_split   = 0, /**< Header Split disabled */\n+\t\t.hw_ip_checksum = 0, /**< IP checksum offload enabled */\n+\t\t.hw_vlan_filter = 0, /**< VLAN filtering disabled */\n+\t\t.jumbo_frame    = 0, /**< Jumbo Frame Support disabled */\n+\t\t.hw_strip_crc   = 0, /**< CRC stripped by hardware */\n+\t},\n+\t.txmode = {\n+\t\t.mq_mode = ETH_MQ_TX_NONE,\n+\t},\n+\t.lpbk_mode = 0,\n+};\n+\n+static struct rte_eth_conf rss_pmd_conf = {\n+\t.rxmode = {\n+\t\t.mq_mode = ETH_MQ_RX_RSS,\n+\t\t.max_rx_pkt_len = ETHER_MAX_LEN,\n+\t\t.split_hdr_size = 0,\n+\t\t.header_split   = 0, /**< Header Split disabled */\n+\t\t.hw_ip_checksum = 0, /**< IP checksum offload enabled */\n+\t\t.hw_vlan_filter = 0, /**< VLAN filtering disabled */\n+\t\t.jumbo_frame    = 0, /**< Jumbo Frame Support disabled */\n+\t\t.hw_strip_crc   = 0, /**< CRC stripped by hardware */\n+\t},\n+\t.txmode = {\n+\t\t.mq_mode = ETH_MQ_TX_NONE,\n+\t},\n+\t.rx_adv_conf = {\n+\t\t.rss_conf = {\n+\t\t\t.rss_key = NULL,\n+\t\t\t.rss_hf = ETH_RSS_IPV6,\n+\t\t},\n+\t},\n+\t.lpbk_mode = 0,\n+};\n+\n+#define FOR_EACH(_i, _item, _array, _size) \\\n+\tfor (_i = 0, _item = &_array[0]; _i < _size && (_item = &_array[_i]); _i++)\n+\n+/* Macro for iterating over every port that can be used as a slave\n+ * in this test.\n+ * _i variable used as an index in test_params->slave_ports\n+ * _slave pointer to &test_params->slave_ports[_idx]\n+ */\n+#define FOR_EACH_PORT(_i, _port) \\\n+\tFOR_EACH(_i, _port, test_params.slave_ports, \\\n+\t\tRTE_DIM(test_params.slave_ports))\n+\n+static int\n+configure_ethdev(uint8_t port_id, struct rte_eth_conf *eth_conf, uint8_t start)\n+{\n+\tint rxq, txq;\n+\n+\tTEST_ASSERT(rte_eth_dev_configure(port_id, RXTX_QUEUE_COUNT,\n+\t\t\tRXTX_QUEUE_COUNT, eth_conf) == 0, \"Failed to configure device %u\",\n+\t\t\tport_id);\n+\n+\tfor (rxq = 0; rxq < RXTX_QUEUE_COUNT; rxq++) {\n+\t\tTEST_ASSERT(rte_eth_rx_queue_setup(port_id, rxq, RXTX_RING_SIZE,\n+\t\t\t\trte_eth_dev_socket_id(port_id), NULL,\n+\t\t\t\ttest_params.mbuf_pool) == 0, \"Failed to setup rx queue.\");\n+\t}\n+\n+\tfor (txq = 0; txq < RXTX_QUEUE_COUNT; txq++) {\n+\t\tTEST_ASSERT(rte_eth_tx_queue_setup(port_id, txq, RXTX_RING_SIZE,\n+\t\t\t\trte_eth_dev_socket_id(port_id), NULL) == 0,\n+\t\t\t\t\"Failed to setup tx queue.\");\n+\t}\n+\n+\tif (start) {\n+\t\tTEST_ASSERT(rte_eth_dev_start(port_id) == 0,\n+\t\t\"Failed to start device (%d).\", port_id);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * Remove all slaves from bonding\n+ */\n+static int\n+remove_slaves(void)\n+{\n+\tunsigned n;\n+\tstruct slave_conf *port;\n+\n+\tFOR_EACH_PORT(n, port) {\n+\t\tport = &test_params.slave_ports[n];\n+\t\tif (port->is_slave) {\n+\t\t\tTEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove(\n+\t\t\t\t\ttest_params.bond_port_id, port->port_id),\n+\t\t\t\t\t\"Cannot remove slave %d from bonding\", port->port_id);\n+\t\t\tport->is_slave = 0;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+remove_slaves_and_stop_bonded_device(void)\n+{\n+\tTEST_ASSERT_SUCCESS(remove_slaves(), \"Removing slaves\");\n+\trte_eth_dev_stop(test_params.bond_port_id);\n+\treturn TEST_SUCCESS;\n+}\n+\n+/**\n+ * Add all slaves to bonding\n+ */\n+static int\n+bond_slaves(void)\n+{\n+\tunsigned n;\n+\tstruct slave_conf *port;\n+\n+\tFOR_EACH_PORT(n, port) {\n+\t\tport = &test_params.slave_ports[n];\n+\t\tif (!port->is_slave) {\n+\t\t\tTEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(test_params.bond_port_id,\n+\t\t\t\t\tport->port_id), \"Cannot attach slave %d to the bonding\",\n+\t\t\t\t\tport->port_id);\n+\t\t\tport->is_slave = 1;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * Set all RETA values in port_id to value\n+ */\n+static int\n+reta_set(uint8_t port_id, uint8_t value, int reta_size)\n+{\n+\tstruct rte_eth_rss_reta_entry64 reta_conf[512/RTE_RETA_GROUP_SIZE];\n+\tint i, j;\n+\n+\tfor (i = 0; i < reta_size / RTE_RETA_GROUP_SIZE; i++) {\n+\t\t/* select all fields to set */\n+\t\treta_conf[i].mask = ~0LL;\n+\t\tfor (j = 0; j < RTE_RETA_GROUP_SIZE; j++)\n+\t\t\treta_conf[i].reta[j] = value;\n+\t}\n+\n+\treturn rte_eth_dev_rss_reta_update(port_id, reta_conf, reta_size);\n+}\n+\n+/**\n+ * Check if slaves RETA is synchronized with bonding port. Returns 1 if slave\n+ * port is synced with bonding port.\n+ */\n+static int\n+reta_check_synced(struct slave_conf *port)\n+{\n+\tunsigned i;\n+\n+\tfor (i = 0; i < test_params.bond_dev_info.reta_size;\n+\t\t\ti++) {\n+\n+\t\tint index = i / RTE_RETA_GROUP_SIZE;\n+\t\tint shift = i % RTE_RETA_GROUP_SIZE;\n+\n+\t\tif (port->reta_conf[index].reta[shift] !=\n+\t\t\t\ttest_params.bond_reta_conf[index].reta[shift])\n+\t\t\treturn 0;\n+\n+\t}\n+\n+\treturn 1;\n+}\n+\n+/**\n+ * Fetch bonding ports RETA\n+ */\n+static int\n+bond_reta_fetch(void) {\n+\tunsigned j;\n+\n+\tfor (j = 0; j < test_params.bond_dev_info.reta_size / RTE_RETA_GROUP_SIZE;\n+\t\t\tj++)\n+\t\ttest_params.bond_reta_conf[j].mask = ~0LL;\n+\n+\tTEST_ASSERT_SUCCESS(rte_eth_dev_rss_reta_query(test_params.bond_port_id,\n+\t\t\ttest_params.bond_reta_conf, test_params.bond_dev_info.reta_size),\n+\t\t\t\"Cannot take bonding ports RSS configuration\");\n+\treturn 0;\n+}\n+\n+/**\n+ * Fetch slaves RETA\n+ */\n+static int\n+slave_reta_fetch(struct slave_conf *port) {\n+\tunsigned j;\n+\n+\tfor (j = 0; j < port->dev_info.reta_size / RTE_RETA_GROUP_SIZE; j++)\n+\t\tport->reta_conf[j].mask = ~0LL;\n+\n+\tTEST_ASSERT_SUCCESS(rte_eth_dev_rss_reta_query(port->port_id,\n+\t\t\tport->reta_conf, port->dev_info.reta_size),\n+\t\t\t\"Cannot take bonding ports RSS configuration\");\n+\treturn 0;\n+}\n+\n+/**\n+ * Remove and add slave to check if slaves configuration is synced with\n+ * the bonding ports values after adding new slave.\n+ */\n+static int\n+slave_remove_and_add(void)\n+{\n+\tstruct slave_conf *port = &(test_params.slave_ports[0]);\n+\n+\t/* 1. Remove first slave from bonding */\n+\tTEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove(test_params.bond_port_id,\n+\t\t\tport->port_id), \"Cannot remove slave #d from bonding\");\n+\n+\t/* 2. Change removed (ex-)slave and bonding configuration to different\n+\t *    values\n+\t */\n+\treta_set(test_params.bond_port_id, 1, test_params.bond_dev_info.reta_size);\n+\tbond_reta_fetch();\n+\n+\treta_set(port->port_id, 2, port->dev_info.reta_size);\n+\tslave_reta_fetch(port);\n+\n+\tTEST_ASSERT(reta_check_synced(port) == 0,\n+\t\t\t\"Removed slave didn't should be synchronized with bonding port\");\n+\n+\t/* 3. Add (ex-)slave and check if configuration changed*/\n+\tTEST_ASSERT_SUCCESS(rte_eth_bond_slave_add(test_params.bond_port_id,\n+\t\t\tport->port_id), \"Cannot add slave\");\n+\n+\tbond_reta_fetch();\n+\tslave_reta_fetch(port);\n+\n+\treturn reta_check_synced(port);\n+}\n+\n+/**\n+ * Test configuration propagation over slaves.\n+ */\n+static int\n+test_propagate(void)\n+{\n+\tunsigned i;\n+\tuint8_t n;\n+\tstruct slave_conf *port;\n+\tuint8_t bond_rss_key[40];\n+\tstruct rte_eth_rss_conf bond_rss_conf;\n+\n+\tint retval = 0;\n+\tuint64_t rss_hf = 0;\n+\tuint64_t default_rss_hf = 0;\n+\n+\trte_eth_dev_info_get(test_params.bond_port_id, &test_params.bond_dev_info);\n+\n+\t/*\n+\t *  Test hash function propagation\n+\t */\n+\tfor (i = 0; i < sizeof(test_params.bond_dev_info.flow_type_rss_offloads)*8;\n+\t\t\ti++) {\n+\n+\t\trss_hf = test_params.bond_dev_info.flow_type_rss_offloads & (1<<i);\n+\t\tif (rss_hf) {\n+\t\t\tbond_rss_conf.rss_key = NULL;\n+\t\t\tbond_rss_conf.rss_hf = rss_hf;\n+\n+\t\t\tretval = rte_eth_dev_rss_hash_update(test_params.bond_port_id,\n+\t\t\t\t\t&bond_rss_conf);\n+\t\t\tTEST_ASSERT_SUCCESS(retval, \"Cannot set slaves hash function\");\n+\n+\t\t\tFOR_EACH_PORT(n, port) {\n+\t\t\t\tport = &test_params.slave_ports[n];\n+\n+\t\t\t\tretval = rte_eth_dev_rss_hash_conf_get(port->port_id,\n+\t\t\t\t\t\t&port->rss_conf);\n+\t\t\t\tTEST_ASSERT_SUCCESS(retval,\n+\t\t\t\t\t\t\"Cannot take slaves RSS configuration\");\n+\n+\t\t\t\tTEST_ASSERT(port->rss_conf.rss_hf == rss_hf,\n+\t\t\t\t\t\t\"Hash function not propagated for slave %d\",\n+\t\t\t\t\t\tport->port_id);\n+\t\t\t}\n+\n+\t\t\tdefault_rss_hf = rss_hf;\n+\t\t}\n+\n+\t}\n+\n+\t/*\n+\t *  Test key propagation\n+\t */\n+\tfor (i = 1; i < 10; i++) {\n+\n+\t\t/* Set all keys to zero */\n+\t\tFOR_EACH_PORT(n, port) {\n+\t\t\tport = &test_params.slave_ports[n];\n+\t\t\tmemset(port->rss_conf.rss_key, 0, 40);\n+\t\t\tretval = rte_eth_dev_rss_hash_update(port->port_id,\n+\t\t\t\t\t&port->rss_conf);\n+\t\t\tTEST_ASSERT_SUCCESS(retval, \"Cannot set slaves RSS keys\");\n+\t\t}\n+\n+\t\tmemset(bond_rss_key, i, sizeof(bond_rss_key));\n+\t\tbond_rss_conf.rss_hf = default_rss_hf,\n+\t\tbond_rss_conf.rss_key = bond_rss_key;\n+\t\tbond_rss_conf.rss_key_len = 40;\n+\n+\t\tretval = rte_eth_dev_rss_hash_update(test_params.bond_port_id,\n+\t\t\t\t&bond_rss_conf);\n+\t\tTEST_ASSERT_SUCCESS(retval, \"Cannot set bonded port RSS keys\");\n+\n+\t\tFOR_EACH_PORT(n, port) {\n+\t\t\tport = &test_params.slave_ports[n];\n+\n+\t\t\tretval = rte_eth_dev_rss_hash_conf_get(port->port_id,\n+\t\t\t\t\t&(port->rss_conf));\n+\n+\t\t\tTEST_ASSERT_SUCCESS(retval,\n+\t\t\t\t\t\"Cannot take slaves RSS configuration\");\n+\n+\t\t\t/* compare keys */\n+\t\t\tretval = memcmp(port->rss_conf.rss_key, bond_rss_key,\n+\t\t\t\t\tsizeof(bond_rss_key));\n+\t\t\tTEST_ASSERT(retval == 0, \"Key value not propagated for slave %d\",\n+\t\t\t\t\tport->port_id);\n+\t\t}\n+\t}\n+\n+\t/*\n+\t *  Test RETA propagation\n+\t */\n+\tfor (i = 0; i < RXTX_QUEUE_COUNT; i++) {\n+\n+\t\t/* Set all keys to zero */\n+\t\tFOR_EACH_PORT(n, port) {\n+\t\t\tport = &test_params.slave_ports[n];\n+\t\t\tretval = reta_set(port->port_id, (i + 1) % RXTX_QUEUE_COUNT,\n+\t\t\t\t\tport->dev_info.reta_size);\n+\t\t\tTEST_ASSERT_SUCCESS(retval, \"Cannot set slaves RETA\");\n+\t\t}\n+\n+\t\tTEST_ASSERT_SUCCESS(reta_set(test_params.bond_port_id,\n+\t\t\t\ti % RXTX_QUEUE_COUNT, test_params.bond_dev_info.reta_size),\n+\t\t\t\t\"Cannot set bonded port RETA\");\n+\n+\t\tbond_reta_fetch();\n+\n+\t\tFOR_EACH_PORT(n, port) {\n+\t\t\tport = &test_params.slave_ports[n];\n+\n+\t\t\tslave_reta_fetch(port);\n+\t\t\tTEST_ASSERT(reta_check_synced(port) == 1, \"RETAs inconsistent\");\n+\t\t}\n+\t}\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/**\n+ * Test propagation logic, when RX_RSS mq_mode is turned on for bonding port\n+ */\n+static int\n+test_rss(void)\n+{\n+\t/**\n+\t * Configure bonding port in RSS mq mode\n+\t */\n+\tTEST_ASSERT_SUCCESS(configure_ethdev(test_params.bond_port_id,\n+\t\t\t&rss_pmd_conf, 0), \"Failed to configure bonding device\\n\");\n+\n+\trte_eth_dev_info_get(test_params.bond_port_id, &test_params.bond_dev_info);\n+\n+\tTEST_ASSERT_SUCCESS(bond_slaves(), \"Bonding slaves failed\");\n+\n+\tTEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params.bond_port_id),\n+\t\t\t\"Failed to start bonding port (%d).\", test_params.bond_port_id);\n+\n+\tTEST_ASSERT_SUCCESS(test_propagate(), \"Propagation test failed\");\n+\n+\tTEST_ASSERT(slave_remove_and_add() == 1, \"New slave should be synced\");\n+\n+\tremove_slaves_and_stop_bonded_device();\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+/**\n+ * Test propagation logic, when RX_RSS mq_mode is turned off for bonding port\n+ */\n+static int\n+test_rss_lazy(void)\n+{\n+\tTEST_ASSERT_SUCCESS(configure_ethdev(test_params.bond_port_id,\n+\t\t\t&default_pmd_conf, 0), \"Failed to configure bonding device\\n\");\n+\n+\trte_eth_dev_info_get(test_params.bond_port_id, &test_params.bond_dev_info);\n+\n+\tTEST_ASSERT_SUCCESS(bond_slaves(), \"Bonding slaves failed\");\n+\n+\tTEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params.bond_port_id),\n+\t\t\t\"Failed to start bonding port (%d).\", test_params.bond_port_id);\n+\n+\tTEST_ASSERT_SUCCESS(test_propagate(), \"Propagation test failed\");\n+\n+\tTEST_ASSERT(slave_remove_and_add() == 0, \"New slave shouldn't be synced\");\n+\n+\tremove_slaves_and_stop_bonded_device();\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+test_setup(void)\n+{\n+\tunsigned n;\n+\tint retval;\n+\tint port_id;\n+\tchar name[256];\n+\tstruct slave_conf *port;\n+\n+\tif (test_params.mbuf_pool == NULL) {\n+\n+\t\ttest_params.mbuf_pool = rte_mempool_create(\"RSS_MBUF_POOL\", NUM_MBUFS *\n+\t\t\t\tSLAVE_COUNT, MBUF_SIZE, MBUF_CACHE_SIZE,\n+\t\t\t\tsizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init,\n+\t\t\t\tNULL, rte_pktmbuf_init, NULL, rte_socket_id(), 0);\n+\n+\t\tTEST_ASSERT(test_params.mbuf_pool != NULL,\n+\t\t\t\t\"rte_mempool_create failed\\n\");\n+\t}\n+\n+\t/* Create / initialize ring eth devs. */\n+\tFOR_EACH_PORT(n, port) {\n+\t\tport = &test_params.slave_ports[n];\n+\n+\t\tport_id = rte_eth_dev_count();\n+\t\tsnprintf(name, sizeof(name), SLAVE_DEV_NAME_FMT, port_id);\n+\n+\t\tretval = eth_dev_null_create(name, 0, 64, 0);\n+\t\tTEST_ASSERT_SUCCESS(retval, \"Failed to create null device '%s'\\n\",\n+\t\t\t\tname);\n+\n+\t\tport->port_id = port_id;\n+\n+\t\tport->rss_conf.rss_key = port->rss_key;\n+\t\tport->rss_conf.rss_key_len = 40;\n+\n+\t\tretval = configure_ethdev(port->port_id, &default_pmd_conf, 0);\n+\t\tTEST_ASSERT_SUCCESS(retval, \"Failed to configure virtual ethdev %s\\n\",\n+\t\t\t\tname);\n+\n+\t\trte_eth_dev_info_get(port->port_id, &port->dev_info);\n+\t}\n+\n+\tif (test_params.bond_port_id == INVALID_PORT_ID) {\n+\t\tretval = rte_eth_bond_create(BONDED_DEV_NAME, 0, rte_socket_id());\n+\n+\t\tTEST_ASSERT(retval >= 0, \"Failed to create bonded ethdev %s\",\n+\t\t\t\tBONDED_DEV_NAME);\n+\n+\t\ttest_params.bond_port_id = retval;\n+\n+\t\tTEST_ASSERT_SUCCESS(configure_ethdev(test_params.bond_port_id,\n+\t\t\t\t&default_pmd_conf, 0), \"Failed to configure bonding device\\n\");\n+\n+\t\trte_eth_dev_info_get(test_params.bond_port_id,\n+\t\t\t\t&test_params.bond_dev_info);\n+\t}\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+testsuite_teardown(void)\n+{\n+\tstruct slave_conf *port;\n+\tuint8_t i;\n+\n+\t/* Only stop ports.\n+\t * Any cleanup/reset state is done when particular test is\n+\t * started. */\n+\n+\trte_eth_dev_stop(test_params.bond_port_id);\n+\n+\tFOR_EACH_PORT(i, port)\n+\t\trte_eth_dev_stop(port->port_id);\n+\n+\treturn 0;\n+}\n+\n+static int\n+check_environment(void)\n+{\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+test_rssconf_executor(int (*test_func)(void))\n+{\n+\tint test_result;\n+\n+\t/* Check if environment is clean. Fail to launch a test if there was\n+\t * a critical error before that prevented to reset environment. */\n+\tTEST_ASSERT_SUCCESS(check_environment(),\n+\t\t\"Refusing to launch test in dirty environment.\");\n+\n+\tRTE_VERIFY(test_func != NULL);\n+\ttest_result = (*test_func)();\n+\n+\t/* If test succeed check if environment wast left in good condition. */\n+\tif (test_result == TEST_SUCCESS)\n+\t\ttest_result = check_environment();\n+\n+\t/* Reset environment in case test failed to do that. */\n+\tif (test_result != TEST_SUCCESS) {\n+\t\tTEST_ASSERT_SUCCESS(remove_slaves_and_stop_bonded_device(),\n+\t\t\t\"Failed to stop bonded device\");\n+\t}\n+\n+\treturn test_result;\n+}\n+\n+static int\n+test_setup_wrapper(void)\n+{\n+\treturn test_rssconf_executor(&test_setup);\n+}\n+\n+static int\n+test_rss_wrapper(void)\n+{\n+\treturn test_rssconf_executor(&test_rss);\n+}\n+\n+static int\n+test_rss_lazy_wrapper(void)\n+{\n+\treturn test_rssconf_executor(&test_rss_lazy);\n+}\n+\n+static struct unit_test_suite link_bonding_rssconf_test_suite  = {\n+\t.suite_name = \"RSS Dynamic Configuration for Bonding Unit Test Suite\",\n+\t.teardown = testsuite_teardown,\n+\t.unit_test_cases = {\n+\t\tTEST_CASE_NAMED(\"test_setup\", test_setup_wrapper),\n+\t\tTEST_CASE_NAMED(\"test_rss\", test_rss_wrapper),\n+\t\tTEST_CASE_NAMED(\"test_rss_lazy\", test_rss_lazy_wrapper),\n+\t\t{ NULL, NULL, NULL, NULL, NULL } /**< NULL terminate unit test array */\n+\t}\n+};\n+\n+static int\n+test_link_bonding_rssconf(void)\n+{\n+\treturn unit_test_suite_runner(&link_bonding_rssconf_test_suite);\n+}\n+\n+static struct test_command test_link_bonding_rssconf_cmd = {\n+\t.command = \"link_bonding_rssconf_autotest\",\n+\t.callback = test_link_bonding_rssconf,\n+};\n+\n+REGISTER_TEST_COMMAND(test_link_bonding_rssconf_cmd);\n",
    "prefixes": [
        "dpdk-dev",
        "v6",
        "6/9"
    ]
}