get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 7748,
    "url": "https://patches.dpdk.org/api/patches/7748/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1445268976-27491-5-git-send-email-ehkinzie@gmail.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": "<1445268976-27491-5-git-send-email-ehkinzie@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1445268976-27491-5-git-send-email-ehkinzie@gmail.com",
    "date": "2015-10-19T15:36:16",
    "name": "[dpdk-dev,v6,4/4] bond mode 4: tests for external state machine",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "111a71889089fd5bf68ef028d144cec5962edbd4",
    "submitter": {
        "id": 208,
        "url": "https://patches.dpdk.org/api/people/208/?format=api",
        "name": "Eric Kinzie",
        "email": "ehkinzie@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1445268976-27491-5-git-send-email-ehkinzie@gmail.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7748/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7748/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 EB8328E87;\n\tMon, 19 Oct 2015 17:37:07 +0200 (CEST)",
            "from mail-pa0-f41.google.com (mail-pa0-f41.google.com\n\t[209.85.220.41]) by dpdk.org (Postfix) with ESMTP id 3D0618E95\n\tfor <dev@dpdk.org>; Mon, 19 Oct 2015 17:37:05 +0200 (CEST)",
            "by pasz6 with SMTP id z6so33562391pas.2\n\tfor <dev@dpdk.org>; Mon, 19 Oct 2015 08:37:04 -0700 (PDT)",
            "from buildhost2.vyatta.com. ([144.49.132.22])\n\tby smtp.gmail.com with ESMTPSA id\n\tez2sm37002362pbb.5.2015.10.19.08.37.02\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 19 Oct 2015 08:37:03 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=biqNBSgC5UIu6QjVqs6ECH1ZfuPHQhG1amnpzrTKJO4=;\n\tb=qqQXpseoAbJKW064FExBHiMeWEBeUCNRpCswRKRbT/D2AlwRjlCESP9tJSr643p0KT\n\tMhuuU0eyxsEBFuUBihim3mRflHtpYxmewT+eQIQ476Ta7CJiL5Y25jIkEZppP/7O3vmg\n\tyiQi5jSzQ+wdMCkOeztvR9009Zf4QzofXiTsx82BjHdRCkyY5/bYti4dqaGxQqSOQo2T\n\tgogcfKVp7a8IEPqiScOoktxDiM8tfvXVig4tvZPCkeDCMPuUm2kUto4Sjt9npXJQGUNA\n\tObq+TvV99XYBspfaLbfLpm0TJjYqazN5wvIDxf4UqTsOT/ibtKcsXDA0/vhWI9i/uKdN\n\t5JOA==",
        "X-Received": "by 10.68.136.71 with SMTP id py7mr11522474pbb.28.1445269024691; \n\tMon, 19 Oct 2015 08:37:04 -0700 (PDT)",
        "From": "Eric Kinzie <ehkinzie@gmail.com>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 19 Oct 2015 08:36:16 -0700",
        "Message-Id": "<1445268976-27491-5-git-send-email-ehkinzie@gmail.com>",
        "X-Mailer": "git-send-email 1.7.10.4",
        "In-Reply-To": "<1445268976-27491-1-git-send-email-ehkinzie@gmail.com>",
        "References": "<1445268976-27491-1-git-send-email-ehkinzie@gmail.com>",
        "Cc": "Eric Kinzie <ekinzie@brocade.com>",
        "Subject": "[dpdk-dev] [PATCH v6 4/4] bond mode 4: tests for external state\n\tmachine",
        "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": "From: Eric Kinzie <ekinzie@brocade.com>\n\n  This adds test cases for exercising the external state machine API to\n  the mode 4 autotest.\n\nSigned-off-by: Eric Kinzie <ehkinzie@gmail.com>\n---\n app/test/test_link_bonding_mode4.c |  210 ++++++++++++++++++++++++++++++++++--\n 1 file changed, 201 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c\nindex d785393..6a459cd 100644\n--- a/app/test/test_link_bonding_mode4.c\n+++ b/app/test/test_link_bonding_mode4.c\n@@ -151,6 +151,8 @@ static struct rte_eth_conf default_pmd_conf = {\n \t.lpbk_mode = 0,\n };\n \n+static uint8_t lacpdu_rx_count[RTE_MAX_ETHPORTS] = {0, };\n+\n #define FOR_EACH(_i, _item, _array, _size) \\\n \tfor (_i = 0, _item = &_array[0]; _i < _size && (_item = &_array[_i]); _i++)\n \n@@ -320,8 +322,26 @@ remove_slave(struct slave_conf *slave)\n \treturn 0;\n }\n \n+static void\n+lacp_recv_cb(uint8_t slave_id, struct rte_mbuf *lacp_pkt)\n+{\n+\tstruct ether_hdr *hdr;\n+\tstruct slow_protocol_frame *slow_hdr;\n+\n+\tRTE_VERIFY(lacp_pkt != NULL);\n+\n+\thdr = rte_pktmbuf_mtod(lacp_pkt, struct ether_hdr *);\n+\tRTE_VERIFY(hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_SLOW));\n+\n+\tslow_hdr = rte_pktmbuf_mtod(lacp_pkt, struct slow_protocol_frame *);\n+\tRTE_VERIFY(slow_hdr->slow_protocol.subtype == SLOW_SUBTYPE_LACP);\n+\n+\tlacpdu_rx_count[slave_id]++;\n+\trte_pktmbuf_free(lacp_pkt);\n+}\n+\n static int\n-initialize_bonded_device_with_slaves(uint8_t slave_count, uint8_t start)\n+initialize_bonded_device_with_slaves(uint8_t slave_count, uint8_t external_sm)\n {\n \tuint8_t i;\n \n@@ -337,9 +357,17 @@ initialize_bonded_device_with_slaves(uint8_t slave_count, uint8_t start)\n \trte_eth_bond_8023ad_setup(test_params.bonded_port_id, NULL);\n \trte_eth_promiscuous_disable(test_params.bonded_port_id);\n \n-\tif (start)\n-\t\tTEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params.bonded_port_id),\n-\t\t\t\"Failed to start bonded device\");\n+\tif (external_sm) {\n+\t\tstruct rte_eth_bond_8023ad_conf conf;\n+\n+\t\trte_eth_bond_8023ad_conf_get(test_params.bonded_port_id, &conf);\n+\t\tconf.slowrx_cb = lacp_recv_cb;\n+\t\trte_eth_bond_8023ad_setup(test_params.bonded_port_id, &conf);\n+\n+\t}\n+\n+\tTEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params.bonded_port_id),\n+\t\t\"Failed to start bonded device\");\n \n \treturn TEST_SUCCESS;\n }\n@@ -642,7 +670,7 @@ test_mode4_lacp(void)\n {\n \tint retval;\n \n-\tretval = initialize_bonded_device_with_slaves(TEST_LACP_SLAVE_COUT, 1);\n+\tretval = initialize_bonded_device_with_slaves(TEST_LACP_SLAVE_COUT, 0);\n \tTEST_ASSERT_SUCCESS(retval, \"Failed to initialize bonded device\");\n \n \t/* Test LACP handshake function */\n@@ -740,7 +768,7 @@ test_mode4_rx(void)\n \tstruct ether_addr dst_mac;\n \tstruct ether_addr bonded_mac;\n \n-\tretval = initialize_bonded_device_with_slaves(TEST_PROMISC_SLAVE_COUNT, 1);\n+\tretval = initialize_bonded_device_with_slaves(TEST_PROMISC_SLAVE_COUNT, 0);\n \tTEST_ASSERT_SUCCESS(retval, \"Failed to initialize bonded device\");\n \n \tretval = bond_handshake();\n@@ -917,7 +945,7 @@ test_mode4_tx_burst(void)\n \tstruct ether_addr dst_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } };\n \tstruct ether_addr bonded_mac;\n \n-\tretval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 1);\n+\tretval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 0);\n \tTEST_ASSERT_SUCCESS(retval, \"Failed to initialize bonded device\");\n \n \tretval = bond_handshake();\n@@ -1101,7 +1129,7 @@ test_mode4_marker(void)\n \tuint8_t i, j;\n \tconst uint16_t ethtype_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW);\n \n-\tretval = initialize_bonded_device_with_slaves(TEST_MARKER_SLAVE_COUT, 1);\n+\tretval = initialize_bonded_device_with_slaves(TEST_MARKER_SLAVE_COUT, 0);\n \tTEST_ASSERT_SUCCESS(retval, \"Failed to initialize bonded device\");\n \n \t/* Test LACP handshake function */\n@@ -1186,7 +1214,7 @@ test_mode4_expired(void)\n \n \tstruct rte_eth_bond_8023ad_conf conf;\n \n-\tretval = initialize_bonded_device_with_slaves(TEST_EXPIRED_SLAVE_COUNT, 1);\n+\tretval = initialize_bonded_device_with_slaves(TEST_EXPIRED_SLAVE_COUNT, 0);\n \t/* Set custom timeouts to make test last shorter. */\n \trte_eth_bond_8023ad_conf_get(test_params.bonded_port_id, &conf);\n \tconf.fast_periodic_ms = 100;\n@@ -1268,6 +1296,156 @@ test_mode4_expired(void)\n }\n \n static int\n+test_mode4_ext_ctrl(void)\n+{\n+\t/*\n+\t * configure bonded interface without the external sm enabled\n+\t *   . try to transmit lacpdu (should fail)\n+\t *   . try to set collecting and distributing flags (should fail)\n+\t * reconfigure w/external sm\n+\t *   . transmit one lacpdu on each slave using new api\n+\t *   . make sure each slave receives one lacpdu using the callback api\n+\t *   . transmit one data pdu on each slave (should fail)\n+\t *   . enable distribution and collection, send one data pdu each again\n+\t */\n+\n+\tint retval;\n+\tstruct slave_conf *slave = NULL;\n+\tuint8_t i;\n+\n+\tstruct rte_mbuf *lacp_tx_buf[SLAVE_COUNT];\n+\tstruct ether_addr src_mac, dst_mac;\n+\tstruct lacpdu_header lacpdu = {\n+\t\t.lacpdu = {\n+\t\t\t.subtype = SLOW_SUBTYPE_LACP,\n+\t\t},\n+\t};\n+\n+\tether_addr_copy(&parnter_system, &src_mac);\n+\tether_addr_copy(&slow_protocol_mac_addr, &dst_mac);\n+\n+\tinitialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac,\n+\t\t\t      ETHER_TYPE_SLOW, 0, 0);\n+\n+\tfor (i = 0; i < SLAVE_COUNT; i++) {\n+\t\tlacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool);\n+\t\trte_memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *),\n+\t\t\t   &lacpdu, sizeof(lacpdu));\n+\t\trte_pktmbuf_pkt_len(lacp_tx_buf[i]) = sizeof(lacpdu);\n+\t}\n+\n+\tretval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 0);\n+\tTEST_ASSERT_SUCCESS(retval, \"Failed to initialize bonded device\");\n+\n+\tFOR_EACH_SLAVE(i, slave) {\n+\t\tTEST_ASSERT_FAIL(rte_eth_bond_8023ad_ext_slowtx(\n+\t\t\t\t\t\ttest_params.bonded_port_id,\n+\t\t\t\t\t\tslave->port_id, lacp_tx_buf[i]),\n+\t\t\t\t \"Slave should not allow manual LACP xmit\");\n+\t\tTEST_ASSERT_FAIL(rte_eth_bond_8023ad_ext_collect(\n+\t\t\t\t\t\ttest_params.bonded_port_id,\n+\t\t\t\t\t\tslave->port_id, 1),\n+\t\t\t\t \"Slave should not allow external state controls\");\n+\t}\n+\n+\tfree_pkts(lacp_tx_buf, RTE_DIM(lacp_tx_buf));\n+\n+\tretval = remove_slaves_and_stop_bonded_device();\n+\tTEST_ASSERT_SUCCESS(retval, \"Bonded device cleanup failed.\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+\n+static int\n+test_mode4_ext_lacp(void)\n+{\n+\tint retval;\n+\tstruct slave_conf *slave = NULL;\n+\tuint8_t all_slaves_done = 0, i;\n+\tuint16_t nb_pkts;\n+\tconst unsigned delay = bond_get_update_timeout_ms();\n+\n+\tstruct rte_mbuf *lacp_tx_buf[SLAVE_COUNT];\n+\tstruct rte_mbuf *buf[SLAVE_COUNT];\n+\tstruct ether_addr src_mac, dst_mac;\n+\tstruct lacpdu_header lacpdu = {\n+\t\t.lacpdu = {\n+\t\t\t.subtype = SLOW_SUBTYPE_LACP,\n+\t\t},\n+\t};\n+\n+\tether_addr_copy(&parnter_system, &src_mac);\n+\tether_addr_copy(&slow_protocol_mac_addr, &dst_mac);\n+\n+\tinitialize_eth_header(&lacpdu.eth_hdr, &src_mac, &dst_mac,\n+\t\t\t      ETHER_TYPE_SLOW, 0, 0);\n+\n+\tfor (i = 0; i < SLAVE_COUNT; i++) {\n+\t\tlacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool);\n+\t\trte_memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *),\n+\t\t\t   &lacpdu, sizeof(lacpdu));\n+\t\trte_pktmbuf_pkt_len(lacp_tx_buf[i]) = sizeof(lacpdu);\n+\t}\n+\n+\tretval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 1);\n+\tTEST_ASSERT_SUCCESS(retval, \"Failed to initialize bonded device\");\n+\n+\tmemset(lacpdu_rx_count, 0, sizeof(lacpdu_rx_count));\n+\n+\t/* Wait for new settings to be applied. */\n+\tfor (i = 0; i < 30; ++i)\n+\t\trte_delay_ms(delay);\n+\n+\tFOR_EACH_SLAVE(i, slave) {\n+\t\tretval = rte_eth_bond_8023ad_ext_slowtx(\n+\t\t\t\t\t\ttest_params.bonded_port_id,\n+\t\t\t\t\t\tslave->port_id, lacp_tx_buf[i]);\n+\t\tTEST_ASSERT_SUCCESS(retval,\n+\t\t\t\t    \"Slave should allow manual LACP xmit\");\n+\t}\n+\n+\tnb_pkts = bond_tx(NULL, 0);\n+\tTEST_ASSERT_EQUAL(nb_pkts, 0, \"Packets transmitted unexpectedly\");\n+\n+\tFOR_EACH_SLAVE(i, slave) {\n+\t\tnb_pkts = slave_get_pkts(slave, buf, RTE_DIM(buf));\n+\t\tTEST_ASSERT_EQUAL(nb_pkts, 1, \"found %u packets on slave %d\\n\",\n+\t\t\t\t  nb_pkts, i);\n+\t\tslave_put_pkts(slave, buf, nb_pkts);\n+\t}\n+\n+\tnb_pkts = bond_rx(buf, RTE_DIM(buf));\n+\tfree_pkts(buf, nb_pkts);\n+\tTEST_ASSERT_EQUAL(nb_pkts, 0, \"Packets received unexpectedly\");\n+\n+\t/* wait for the periodic callback to run */\n+\tfor (i = 0; i < 30 && all_slaves_done == 0; ++i) {\n+\t\tuint8_t s, total = 0;\n+\n+\t\trte_delay_ms(delay);\n+\t\tFOR_EACH_SLAVE(s, slave) {\n+\t\t\ttotal += lacpdu_rx_count[slave->port_id];\n+\t\t}\n+\n+\t\tif (total >= SLAVE_COUNT)\n+\t\t\tall_slaves_done = 1;\n+\t}\n+\n+\tFOR_EACH_SLAVE(i, slave) {\n+\t\tTEST_ASSERT_EQUAL(lacpdu_rx_count[slave->port_id], 1,\n+\t\t\t\t  \"Slave port %u should have received 1 lacpdu (count=%u)\",\n+\t\t\t\t  slave->port_id,\n+\t\t\t\t  lacpdu_rx_count[slave->port_id]);\n+\t}\n+\n+\tretval = remove_slaves_and_stop_bonded_device();\n+\tTEST_ASSERT_SUCCESS(retval, \"Test cleanup failed.\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n check_environment(void)\n {\n \tstruct slave_conf *port;\n@@ -1383,6 +1561,18 @@ test_mode4_expired_wrapper(void)\n \treturn test_mode4_executor(&test_mode4_expired);\n }\n \n+static int\n+test_mode4_ext_ctrl_wrapper(void)\n+{\n+\treturn test_mode4_executor(&test_mode4_ext_ctrl);\n+}\n+\n+static int\n+test_mode4_ext_lacp_wrapper(void)\n+{\n+\treturn test_mode4_executor(&test_mode4_ext_lacp);\n+}\n+\n static struct unit_test_suite link_bonding_mode4_test_suite  = {\n \t.suite_name = \"Link Bonding mode 4 Unit Test Suite\",\n \t.setup = test_setup,\n@@ -1393,6 +1583,8 @@ static struct unit_test_suite link_bonding_mode4_test_suite  = {\n \t\tTEST_CASE_NAMED(\"test_mode4_tx_burst\", test_mode4_tx_burst_wrapper),\n \t\tTEST_CASE_NAMED(\"test_mode4_marker\", test_mode4_marker_wrapper),\n \t\tTEST_CASE_NAMED(\"test_mode4_expired\", test_mode4_expired_wrapper),\n+\t\tTEST_CASE_NAMED(\"test_mode4_ext_ctrl\", test_mode4_ext_ctrl_wrapper),\n+\t\tTEST_CASE_NAMED(\"test_mode4_ext_lacp\", test_mode4_ext_lacp_wrapper),\n \t\t{ NULL, NULL, NULL, NULL, NULL } /**< NULL terminate unit test array */\n \t}\n };\n",
    "prefixes": [
        "dpdk-dev",
        "v6",
        "4/4"
    ]
}