get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 179,
    "url": "https://patches.dpdk.org/api/patches/179/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1408456313-28812-2-git-send-email-declan.doherty@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": "<1408456313-28812-2-git-send-email-declan.doherty@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1408456313-28812-2-git-send-email-declan.doherty@intel.com",
    "date": "2014-08-19T13:51:48",
    "name": "[dpdk-dev,1/6] bond: link status interrupt support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "396f2f8665011c7b4df11a622fdc6ab0e90febbc",
    "submitter": {
        "id": 11,
        "url": "https://patches.dpdk.org/api/people/11/?format=api",
        "name": "Doherty, Declan",
        "email": "declan.doherty@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1408456313-28812-2-git-send-email-declan.doherty@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/179/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/179/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dwdohert@ecsmtp.ir.intel.com>",
        "Received": [
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id F382C5963\n\tfor <dev@dpdk.org>; Tue, 19 Aug 2014 15:48:35 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga102.jf.intel.com with ESMTP; 19 Aug 2014 06:46:08 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga002.jf.intel.com with ESMTP; 19 Aug 2014 06:52:01 -0700",
            "from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com\n\t[10.237.217.46])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\ts7JDq05P002070; Tue, 19 Aug 2014 14:52:00 +0100",
            "from sivswdev02.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev02.ir.intel.com with ESMTP id s7JDq09C002901;\n\tTue, 19 Aug 2014 14:52:00 +0100",
            "(from dwdohert@localhost)\n\tby sivswdev02.ir.intel.com with  id s7JDq0ii002897;\n\tTue, 19 Aug 2014 14:52:00 +0100"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.01,894,1400050800\"; d=\"scan'208\";a=\"590206491\"",
        "From": "Declan Doherty <declan.doherty@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 19 Aug 2014 14:51:48 +0100",
        "Message-Id": "<1408456313-28812-2-git-send-email-declan.doherty@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": "<1408456313-28812-1-git-send-email-declan.doherty@intel.com>",
        "References": "<1408456313-28812-1-git-send-email-declan.doherty@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 1/6] bond: link status interrupt support",
        "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>",
        "X-List-Received-Date": "Tue, 19 Aug 2014 13:48:37 -0000"
    },
    "content": "Adding support for lsc interrupt from bonded device to link\nbonding library with supporting unit tests in the test application.\n\nSigned-off-by: Declan Doherty <declan.doherty@intel.com>\n---\n app/test/test_link_bonding.c           |  216 +++++++++++++++++++++++++++-----\n lib/librte_pmd_bond/rte_eth_bond_api.c |    4 +\n lib/librte_pmd_bond/rte_eth_bond_pmd.c |    6 +\n 3 files changed, 192 insertions(+), 34 deletions(-)",
    "diff": "diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c\nindex 5c1303e..02823b6 100644\n--- a/app/test/test_link_bonding.c\n+++ b/app/test/test_link_bonding.c\n@@ -39,6 +39,7 @@\n #include <inttypes.h>\n #include <errno.h>\n #include <sys/queue.h>\n+#include <sys/time.h>\n \n #include <rte_byteorder.h>\n #include <rte_common.h>\n@@ -224,10 +225,15 @@ static struct rte_eth_txconf tx_conf_default = {\n };\n \n static int\n-configure_ethdev(uint8_t port_id, uint8_t start)\n+configure_ethdev(uint8_t port_id, uint8_t start, uint8_t en_isr)\n {\n \tint q_id;\n \n+\tif (en_isr)\n+\t\tdefault_pmd_conf.intr_conf.lsc = 1;\n+\telse\n+\t\tdefault_pmd_conf.intr_conf.lsc = 0;\n+\n \tif (rte_eth_dev_configure(port_id, test_params->nb_rx_q,\n \t\t\ttest_params->nb_tx_q, &default_pmd_conf) != 0) {\n \t\tgoto error;\n@@ -312,7 +318,7 @@ test_setup(void)\n \n \t\t\tprintf(\"Created virtual ethdev %s\\n\", pmd_name);\n \n-\t\t\tretval = configure_ethdev(test_params->slave_port_ids[i], 1);\n+\t\t\tretval = configure_ethdev(test_params->slave_port_ids[i], 1, 0);\n \t\t\tif (retval != 0) {\n \t\t\t\tprintf(\"Failed to configure virtual ethdev %s\\n\", pmd_name);\n \t\t\t\treturn -1;\n@@ -341,7 +347,7 @@ test_create_bonded_device(void)\n \t\tTEST_ASSERT(test_params->bonded_port_id >= 0,\n \t\t\t\t\"Failed to create bonded ethdev %s\", BONDED_DEV_NAME);\n \n-\t\tTEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0),\n+\t\tTEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0, 0),\n \t\t\t\t\"Failed to configure bonded ethdev %s\", BONDED_DEV_NAME);\n \t}\n \n@@ -1078,12 +1084,12 @@ test_set_explicit_bonded_mac(void)\n \n \n static int\n-initialize_bonded_device_with_slaves(uint8_t bonding_mode,\n+initialize_bonded_device_with_slaves(uint8_t bonding_mode, uint8_t bond_en_isr,\n \t\tuint8_t number_of_slaves, uint8_t enable_slave)\n {\n \t/* configure bonded device */\n-\tTEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0),\n-\t\t\t\"Failed to configure bonding port (%d) in mode %d \"\n+\tTEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0,\n+\t\t\tbond_en_isr), \"Failed to configure bonding port (%d) in mode %d \"\n \t\t\t\"with (%d) slaves.\", test_params->bonded_port_id, bonding_mode,\n \t\t\tnumber_of_slaves);\n \n@@ -1116,8 +1122,8 @@ test_adding_slave_after_bonded_device_started(void)\n {\n \tint i;\n \n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 0) !=\n-\t\t\t0)\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 4, 0)\n+\t\t\t!= 0)\n \t\treturn -1;\n \n \t/* Enabled slave devices */\n@@ -1141,6 +1147,147 @@ test_adding_slave_after_bonded_device_started(void)\n \treturn remove_slaves_and_stop_bonded_device();\n }\n \n+#define TEST_STATUS_INTERRUPT_SLAVE_COUNT\t4\n+#define TEST_LSC_WAIT_TIMEOUT_MS\t500\n+\n+int test_lsc_interupt_count;\n+\n+static pthread_mutex_t mutex;\n+static pthread_cond_t cvar;\n+\n+static void\n+test_bonding_lsc_event_callback(uint8_t port_id __rte_unused,\n+\t\tenum rte_eth_event_type type  __rte_unused, void *param __rte_unused)\n+{\n+\tpthread_mutex_lock(&mutex);\n+\ttest_lsc_interupt_count++;\n+\n+\tpthread_cond_signal(&cvar);\n+\tpthread_mutex_unlock(&mutex);\n+}\n+\n+static inline int\n+lsc_timeout(int wait_us)\n+{\n+\tint retval = 0;\n+\n+\tstruct timespec ts;\n+\tstruct timeval tp;\n+\n+\tgettimeofday(&tp, NULL);\n+\n+\t/* Convert from timeval to timespec */\n+\tts.tv_sec  = tp.tv_sec;\n+\tts.tv_nsec = tp.tv_usec * 1000;\n+\tts.tv_nsec += wait_us * 1000;\n+\n+\tpthread_mutex_lock(&mutex);\n+\tif (test_lsc_interupt_count < 1)\n+\t\tretval = pthread_cond_timedwait(&cvar, &mutex, &ts);\n+\n+\tpthread_mutex_unlock(&mutex);\n+\n+\tif (test_lsc_interupt_count  < 1)\n+               return retval;\n+\n+\treturn 0;\n+}\n+\n+static int\n+test_status_interrupt(void)\n+{\n+\tint slave_count;\n+\tuint8_t slaves[RTE_MAX_ETHPORTS];\n+\n+\tpthread_mutex_init(&mutex, NULL);\n+\tpthread_cond_init(&cvar, NULL);\n+\n+\t/* initialized bonding device with T slaves */\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 1,\n+\t\t\tTEST_STATUS_INTERRUPT_SLAVE_COUNT, 1) != 0)\n+\t\treturn -1;\n+\n+\ttest_lsc_interupt_count = 0;\n+\n+\t/* register link status change interrupt callback */\n+\trte_eth_dev_callback_register(test_params->bonded_port_id,\n+\t\t\tRTE_ETH_EVENT_INTR_LSC, test_bonding_lsc_event_callback,\n+\t\t\t&test_params->bonded_port_id);\n+\n+\tslave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id,\n+\t\t\tslaves, RTE_MAX_ETHPORTS);\n+\n+\tTEST_ASSERT_EQUAL(slave_count, TEST_STATUS_INTERRUPT_SLAVE_COUNT,\n+\t\t\t\"Number of active slaves (%d) is not as expected (%d)\",\n+\t\t\tslave_count, TEST_STATUS_INTERRUPT_SLAVE_COUNT);\n+\n+\t/* Bring all 4 slaves link status to down and test that we have received a\n+\t * lsc interrupts */\n+\tvirtual_ethdev_simulate_link_status_interrupt(\n+\t\t\ttest_params->slave_port_ids[0], 0);\n+\tvirtual_ethdev_simulate_link_status_interrupt(\n+\t\t\ttest_params->slave_port_ids[1], 0);\n+\tvirtual_ethdev_simulate_link_status_interrupt(\n+\t\t\ttest_params->slave_port_ids[2], 0);\n+\n+\tTEST_ASSERT_EQUAL(test_lsc_interupt_count, 0,\n+\t\t\t\"Received a link status change interrupt unexpectedly\");\n+\n+\tvirtual_ethdev_simulate_link_status_interrupt(\n+\t\t\ttest_params->slave_port_ids[3], 0);\n+\n+\tTEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_MS) == 0,\n+\t\t\t\"timed out waiting for interrupt\");\n+\n+\tTEST_ASSERT(test_lsc_interupt_count > 0,\n+\t\t\t\"Did not receive link status change interrupt\");\n+\n+\tslave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id,\n+\t\t\tslaves, RTE_MAX_ETHPORTS);\n+\n+\tTEST_ASSERT_EQUAL(slave_count, 0,\n+\t\t\t\"Number of active slaves (%d) is not as expected (%d)\",\n+\t\t\tslave_count, 0);\n+\n+\t/* bring one slave port up so link status will change */\n+\ttest_lsc_interupt_count = 0;\n+\n+\tvirtual_ethdev_simulate_link_status_interrupt(\n+\t\t\ttest_params->slave_port_ids[0], 1);\n+\n+\tTEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_MS) == 0,\n+\t\t\t\"timed out waiting for interrupt\");\n+\n+\t/* test that we have received another lsc interrupt */\n+\tTEST_ASSERT(test_lsc_interupt_count > 0,\n+\t\t\t\"Did not receive link status change interrupt\");\n+\n+\t/* Verify that calling the same slave lsc interrupt doesn't cause another\n+\t * lsc interrupt from bonded device */\n+\ttest_lsc_interupt_count = 0;\n+\n+\tvirtual_ethdev_simulate_link_status_interrupt(\n+\t\t\ttest_params->slave_port_ids[0], 1);\n+\n+\tTEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_MS) != 0,\n+\t\t\t\"received unexpected interrupt\");\n+\n+\tTEST_ASSERT_EQUAL(test_lsc_interupt_count, 0,\n+\t\t\t\"Did not receive link status change interrupt\");\n+\n+\n+\t/* unregister lsc callback before exiting */\n+\trte_eth_dev_callback_unregister(test_params->bonded_port_id,\n+\t\t\t\tRTE_ETH_EVENT_INTR_LSC, test_bonding_lsc_event_callback,\n+\t\t\t\t&test_params->bonded_port_id);\n+\n+\tpthread_mutex_destroy(&mutex);\n+\tpthread_cond_destroy(&cvar);\n+\n+\t/* Clean up and remove slaves from bonded device */\n+\treturn remove_slaves_and_stop_bonded_device();\n+}\n+\n static int\n generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size,\n \t\tuint8_t vlan, uint8_t ipv4, uint8_t toggle_dst_mac,\n@@ -1209,7 +1356,7 @@ test_roundrobin_tx_burst(void)\n \tstruct rte_mbuf *pkt_burst[MAX_PKT_BURST];\n \tstruct rte_eth_stats port_stats;\n \n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 2, 1)\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 2, 1)\n \t\t\t!= 0)\n \t\treturn -1;\n \n@@ -1279,7 +1426,7 @@ test_roundrobin_rx_burst_on_single_slave(void)\n \tint i, j, nb_rx, burst_size = 25;\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 1) !=\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 4, 1) !=\n \t\t\t0)\n \t\treturn -1;\n \n@@ -1369,7 +1516,7 @@ test_roundrobin_rx_burst_on_multiple_slaves(void)\n \n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 1) !=\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 4, 1) !=\n \t\t\t0)\n \t\treturn -1;\n \n@@ -1461,7 +1608,7 @@ test_roundrobin_verify_mac_assignment(void)\n \trte_eth_macaddr_get(test_params->slave_port_ids[2], &expected_mac_addr_2);\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 1)\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 4, 1)\n \t\t\t!= 0)\n \t\treturn -1;\n \n@@ -1552,7 +1699,7 @@ test_roundrobin_verify_promiscuous_enable_disable(void)\n \tint i, promiscuous_en;\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 1) !=\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 4, 1) !=\n \t\t\t0)\n \t\treturn -1;\n \n@@ -1616,7 +1763,7 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void)\n \n \t/* Initialize bonded device with TEST_RR_LINK_STATUS_SLAVE_COUNT slaves\n \t * in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN,\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0,\n \t\t\tTEST_RR_LINK_STATUS_SLAVE_COUNT, 1) != 0)\n \t\treturn -1;\n \n@@ -1757,7 +1904,7 @@ test_activebackup_tx_burst(void)\n \tstruct rte_mbuf *pkts_burst[MAX_PKT_BURST];\n \tstruct rte_eth_stats port_stats;\n \n-\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 2, 1);\n+\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0, 2, 1);\n \tif (retval != 0) {\n \t\tprintf(\"Failed to initialize_bonded_device_with_slaves.\\n\");\n \t\treturn -1;\n@@ -1854,7 +2001,7 @@ test_activebackup_rx_burst(void)\n \tint i, j, nb_rx, burst_size = 17;\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP,\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0,\n \t\t\tTEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT, 1)\n \t\t\t!= 0)\n \t\treturn -1;\n@@ -1948,7 +2095,7 @@ test_activebackup_verify_promiscuous_enable_disable(void)\n \tint i, primary_port, promiscuous_en;\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 4, 1)\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0, 4, 1)\n \t\t\t!= 0)\n \t\treturn -1;\n \n@@ -2018,7 +2165,7 @@ test_activebackup_verify_mac_assignment(void)\n \trte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1);\n \n \t/* Initialize bonded device with 2 slaves in active backup mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 2, 1)\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0, 2, 1)\n \t\t\t!= 0)\n \t\treturn -1;\n \n@@ -2157,7 +2304,7 @@ test_activebackup_verify_slave_link_status_change_failover(void)\n \t}\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP,\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0,\n \t\t\tTEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT, 1)\n \t\t\t!= 0)\n \t\treturn -1;\n@@ -2328,7 +2475,7 @@ test_balance_xmit_policy_configuration(void)\n {\n \tint retval;\n \n-\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP,\n+\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0,\n \t\t\t2, 1);\n \tif (retval != 0) {\n \t\tprintf(\"Failed to initialize_bonded_device_with_slaves.\\n\");\n@@ -2408,7 +2555,7 @@ test_balance_l2_tx_burst(void)\n \tint retval, i;\n \tstruct rte_eth_stats port_stats;\n \n-\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE,\n+\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0,\n \t\t\tTEST_BALANCE_L2_TX_BURST_SLAVE_COUNT, 1);\n \tif (retval != 0) {\n \t\tprintf(\"Failed to initialize_bonded_device_with_slaves.\\n\");\n@@ -2506,7 +2653,7 @@ balance_l23_tx_burst(uint8_t vlan_enabled, uint8_t ipv4,\n \n \tstruct rte_eth_stats port_stats;\n \n-\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 2, 1);\n+\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 2, 1);\n \tif (retval != 0) {\n \t\tprintf(\"Failed to initialize_bonded_device_with_slaves.\\n\");\n \t\treturn -1;\n@@ -2634,7 +2781,7 @@ balance_l34_tx_burst(uint8_t vlan_enabled, uint8_t ipv4,\n \n \tstruct rte_eth_stats port_stats;\n \n-\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 2, 1);\n+\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 2, 1);\n \tif (retval != 0) {\n \t\tprintf(\"Failed to initialize_bonded_device_with_slaves.\\n\");\n \t\treturn -1;\n@@ -2772,7 +2919,7 @@ test_balance_rx_burst(void)\n \tmemset(gen_pkt_burst, 0, sizeof(gen_pkt_burst));\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 3, 1)\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 3, 1)\n \t\t\t!= 0)\n \t\treturn -1;\n \n@@ -2861,7 +3008,7 @@ test_balance_verify_promiscuous_enable_disable(void)\n \tint i, promiscuous_en;\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 4, 1) != 0)\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 4, 1) != 0)\n \t\treturn -1;\n \n \trte_eth_promiscuous_enable(test_params->bonded_port_id);\n@@ -2915,7 +3062,7 @@ test_balance_verify_mac_assignment(void)\n \trte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1);\n \n \t/* Initialize bonded device with 2 slaves in active backup mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 2, 1) != 0)\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 2, 1) != 0)\n \t\treturn -1;\n \n \t/* Verify that bonded MACs is that of first slave and that the other slave\n@@ -3045,7 +3192,7 @@ test_balance_verify_slave_link_status_change_behaviour(void)\n \tmemset(pkt_burst, 0, sizeof(pkt_burst));\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE,\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0,\n \t\t\tTEST_BALANCE_LINK_STATUS_SLAVE_COUNT, 1) != 0)\n \t\treturn -1;\n \n@@ -3237,7 +3384,7 @@ test_broadcast_tx_burst(void)\n \n \tstruct rte_eth_stats port_stats;\n \n-\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 2, 1);\n+\tretval = initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 0, 2, 1);\n \tif (retval != 0) {\n \t\tprintf(\"Failed to initialize_bonded_device_with_slaves.\\n\");\n \t\treturn -1;\n@@ -3327,7 +3474,7 @@ test_broadcast_rx_burst(void)\n \tmemset(gen_pkt_burst, 0, sizeof(gen_pkt_burst));\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 3, 1) != 0)\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 0, 3, 1) != 0)\n \t\treturn -1;\n \n \n@@ -3419,7 +3566,7 @@ test_broadcast_verify_promiscuous_enable_disable(void)\n \tint i, promiscuous_en;\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 4, 1) != 0)\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 4, 1) != 0)\n \t\treturn -1;\n \n \trte_eth_promiscuous_enable(test_params->bonded_port_id);\n@@ -3475,7 +3622,7 @@ test_broadcast_verify_mac_assignment(void)\n \trte_eth_macaddr_get(test_params->slave_port_ids[2], &expected_mac_addr_1);\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 4, 1) != 0)\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 0, 4, 1) != 0)\n \t\treturn -1;\n \n \t/* Verify that all MACs are the same as first slave added to bonded\n@@ -3575,7 +3722,7 @@ test_broadcast_verify_slave_link_status_change_behaviour(void)\n \tmemset(pkt_burst, 0, sizeof(pkt_burst));\n \n \t/* Initialize bonded device with 4 slaves in round robin mode */\n-\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST,\n+\tif (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 0,\n \t\t\tBROADCAST_LINK_STATUS_NUM_OF_SLAVES, 1) != 0)\n \t\treturn -1;\n \n@@ -3711,7 +3858,7 @@ test_reconfigure_bonded_device(void)\n \ttest_params->nb_rx_q = 4;\n \ttest_params->nb_tx_q = 4;\n \n-\tif (configure_ethdev(test_params->bonded_port_id, 0)  != 0) {\n+\tif (configure_ethdev(test_params->bonded_port_id, 0, 0)  != 0) {\n \t\tprintf(\"failed to reconfigure bonded device\");\n \t\treturn -1;\n \t}\n@@ -3720,7 +3867,7 @@ test_reconfigure_bonded_device(void)\n \ttest_params->nb_rx_q = 2;\n \ttest_params->nb_tx_q = 2;\n \n-\tif (configure_ethdev(test_params->bonded_port_id, 0)  != 0) {\n+\tif (configure_ethdev(test_params->bonded_port_id, 0, 0)  != 0) {\n \t\tprintf(\"failed to reconfigure bonded device with less rx/tx queues\");\n \t\treturn -1;\n \t}\n@@ -3768,6 +3915,7 @@ static struct unit_test_suite link_bonding_test_suite  = {\n \t\tTEST_CASE(test_set_bonding_mode),\n \t\tTEST_CASE(test_set_primary_slave),\n \t\tTEST_CASE(test_set_explicit_bonded_mac),\n+\t\tTEST_CASE(test_status_interrupt),\n \t\tTEST_CASE(test_adding_slave_after_bonded_device_started),\n \t\tTEST_CASE(test_roundrobin_tx_burst),\n \t\tTEST_CASE(test_roundrobin_rx_burst_on_single_slave),\ndiff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c b/lib/librte_pmd_bond/rte_eth_bond_api.c\nindex 75f5694..dd33119 100644\n--- a/lib/librte_pmd_bond/rte_eth_bond_api.c\n+++ b/lib/librte_pmd_bond/rte_eth_bond_api.c\n@@ -177,6 +177,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)\n \tpci_drv->id_table->vendor_id = PCI_ANY_ID;\n \tpci_drv->id_table->subsystem_vendor_id = PCI_ANY_ID;\n \n+\tpci_drv->drv_flags = RTE_PCI_DRV_INTR_LSC;\n+\n \tinternals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);\n \tif (internals == NULL) {\n \t\tRTE_LOG(ERR, PMD, \"Unable to malloc internals on socket\\n\");\n@@ -200,6 +202,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)\n \teth_dev->data->nb_rx_queues = (uint16_t)1;\n \teth_dev->data->nb_tx_queues = (uint16_t)1;\n \n+\tTAILQ_INIT(&(eth_dev->callbacks));\n+\n \teth_dev->data->dev_link.link_status = 0;\n \n \teth_dev->data->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN, 0,\ndiff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c\nindex d72d6ed..cd3eecf 100644\n--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c\n+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c\n@@ -921,6 +921,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,\n \tstruct rte_eth_link link;\n \n \tint i, valid_slave = 0, active_pos = -1;\n+\tuint8_t lsc_flag = 0;\n \n \tif (type != RTE_ETH_EVENT_INTR_LSC || param == NULL)\n \t\treturn;\n@@ -966,6 +967,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,\n \t\t\t/* If first active slave, then change link status */\n \t\t\tbonded_eth_dev->data->dev_link.link_status = 1;\n \t\t\tinternals->current_primary_port = port_id;\n+\t\t\tlsc_flag = 1;\n \n \t\t\t/* Inherit eth dev link properties from first active slave */\n \t\t\tlink_properties_set(bonded_eth_dev,\n@@ -990,6 +992,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,\n \t\t/* No active slaves, change link status to down and reset other\n \t\t * link properties */\n \t\tif (internals->active_slave_count < 1) {\n+\t\t\tlsc_flag = 1;\n \t\t\tbonded_eth_dev->data->dev_link.link_status = 0;\n \n \t\t\tlink_properties_reset(bonded_eth_dev);\n@@ -1005,6 +1008,9 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,\n \t\t\t\tinternals->current_primary_port = internals->primary_port;\n \t\t}\n \t}\n+\n+\tif (lsc_flag)\n+\t\t_rte_eth_dev_callback_process(bonded_eth_dev, RTE_ETH_EVENT_INTR_LSC);\n }\n \n struct eth_dev_ops default_dev_ops = {\n",
    "prefixes": [
        "dpdk-dev",
        "1/6"
    ]
}