All of lore.kernel.org
 help / color / mirror / Atom feed
From: Declan Doherty <declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH v7 1/7] bond: link status interrupt support
Date: Mon, 24 Nov 2014 12:27:28 +0000	[thread overview]
Message-ID: <1416832054-24086-2-git-send-email-declan.doherty@intel.com> (raw)
In-Reply-To: <1416832054-24086-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Adding support for lsc interrupt from bonded device to link
bonding library with supporting unit tests in the test application.

Signed-off-by: Declan Doherty <declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 app/test/test_link_bonding.c           |  213 +++++++++++++++++++++++++++-----
 lib/librte_pmd_bond/rte_eth_bond_api.c |    4 +
 lib/librte_pmd_bond/rte_eth_bond_pmd.c |    6 +
 3 files changed, 189 insertions(+), 34 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index d407e4f..1245c49 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -39,6 +39,7 @@
 #include <inttypes.h>
 #include <errno.h>
 #include <sys/queue.h>
+#include <sys/time.h>
 
 #include <rte_byteorder.h>
 #include <rte_common.h>
@@ -224,10 +225,15 @@ static struct rte_eth_txconf tx_conf_default = {
 };
 
 static int
-configure_ethdev(uint8_t port_id, uint8_t start)
+configure_ethdev(uint8_t port_id, uint8_t start, uint8_t en_isr)
 {
 	int q_id;
 
+	if (en_isr)
+		default_pmd_conf.intr_conf.lsc = 1;
+	else
+		default_pmd_conf.intr_conf.lsc = 0;
+
 	if (rte_eth_dev_configure(port_id, test_params->nb_rx_q,
 			test_params->nb_tx_q, &default_pmd_conf) != 0) {
 		goto error;
@@ -312,7 +318,7 @@ test_setup(void)
 
 			printf("Created virtual ethdev %s\n", pmd_name);
 
-			retval = configure_ethdev(test_params->slave_port_ids[i], 1);
+			retval = configure_ethdev(test_params->slave_port_ids[i], 1, 0);
 			if (retval != 0) {
 				printf("Failed to configure virtual ethdev %s\n", pmd_name);
 				return -1;
@@ -341,7 +347,7 @@ test_create_bonded_device(void)
 		TEST_ASSERT(test_params->bonded_port_id >= 0,
 				"Failed to create bonded ethdev %s", BONDED_DEV_NAME);
 
-		TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0),
+		TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0, 0),
 				"Failed to configure bonded ethdev %s", BONDED_DEV_NAME);
 	}
 
@@ -1081,12 +1087,12 @@ test_set_explicit_bonded_mac(void)
 
 
 static int
-initialize_bonded_device_with_slaves(uint8_t bonding_mode,
+initialize_bonded_device_with_slaves(uint8_t bonding_mode, uint8_t bond_en_isr,
 		uint8_t number_of_slaves, uint8_t enable_slave)
 {
 	/* configure bonded device */
-	TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0),
-			"Failed to configure bonding port (%d) in mode %d "
+	TEST_ASSERT_SUCCESS(configure_ethdev(test_params->bonded_port_id, 0,
+			bond_en_isr), "Failed to configure bonding port (%d) in mode %d "
 			"with (%d) slaves.", test_params->bonded_port_id, bonding_mode,
 			number_of_slaves);
 
@@ -1119,8 +1125,8 @@ test_adding_slave_after_bonded_device_started(void)
 {
 	int i;
 
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 0) !=
-			0)
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 4, 0)
+			!= 0)
 		return -1;
 
 	/* Enabled slave devices */
@@ -1144,6 +1150,144 @@ test_adding_slave_after_bonded_device_started(void)
 	return remove_slaves_and_stop_bonded_device();
 }
 
+#define TEST_STATUS_INTERRUPT_SLAVE_COUNT	4
+#define TEST_LSC_WAIT_TIMEOUT_MS	500
+
+int test_lsc_interupt_count;
+
+static pthread_mutex_t mutex;
+static pthread_cond_t cvar;
+
+static void
+test_bonding_lsc_event_callback(uint8_t port_id __rte_unused,
+		enum rte_eth_event_type type  __rte_unused, void *param __rte_unused)
+{
+	pthread_mutex_lock(&mutex);
+	test_lsc_interupt_count++;
+
+	pthread_cond_signal(&cvar);
+	pthread_mutex_unlock(&mutex);
+}
+
+static inline int
+lsc_timeout(int wait_us)
+{
+	int retval = 0;
+
+	struct timespec ts;
+	struct timeval tp;
+
+	gettimeofday(&tp, NULL);
+
+	/* Convert from timeval to timespec */
+	ts.tv_sec  = tp.tv_sec;
+	ts.tv_nsec = tp.tv_usec * 1000;
+	ts.tv_nsec += wait_us * 1000;
+
+	pthread_mutex_lock(&mutex);
+	if (test_lsc_interupt_count < 1)
+		retval = pthread_cond_timedwait(&cvar, &mutex, &ts);
+
+	pthread_mutex_unlock(&mutex);
+
+	return retval;
+}
+
+static int
+test_status_interrupt(void)
+{
+	int slave_count;
+	uint8_t slaves[RTE_MAX_ETHPORTS];
+
+	pthread_mutex_init(&mutex, NULL);
+	pthread_cond_init(&cvar, NULL);
+
+	/* initialized bonding device with T slaves */
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 1,
+			TEST_STATUS_INTERRUPT_SLAVE_COUNT, 1) != 0)
+		return -1;
+
+	test_lsc_interupt_count = 0;
+
+	/* register link status change interrupt callback */
+	rte_eth_dev_callback_register(test_params->bonded_port_id,
+			RTE_ETH_EVENT_INTR_LSC, test_bonding_lsc_event_callback,
+			&test_params->bonded_port_id);
+
+	slave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id,
+			slaves, RTE_MAX_ETHPORTS);
+
+	TEST_ASSERT_EQUAL(slave_count, TEST_STATUS_INTERRUPT_SLAVE_COUNT,
+			"Number of active slaves (%d) is not as expected (%d)",
+			slave_count, TEST_STATUS_INTERRUPT_SLAVE_COUNT);
+
+	/* Bring all 4 slaves link status to down and test that we have received a
+	 * lsc interrupts */
+	virtual_ethdev_simulate_link_status_interrupt(
+			test_params->slave_port_ids[0], 0);
+	virtual_ethdev_simulate_link_status_interrupt(
+			test_params->slave_port_ids[1], 0);
+	virtual_ethdev_simulate_link_status_interrupt(
+			test_params->slave_port_ids[2], 0);
+
+	TEST_ASSERT_EQUAL(test_lsc_interupt_count, 0,
+			"Received a link status change interrupt unexpectedly");
+
+	virtual_ethdev_simulate_link_status_interrupt(
+			test_params->slave_port_ids[3], 0);
+
+	TEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_MS) == 0,
+			"timed out waiting for interrupt");
+
+	TEST_ASSERT(test_lsc_interupt_count > 0,
+			"Did not receive link status change interrupt");
+
+	slave_count = rte_eth_bond_active_slaves_get(test_params->bonded_port_id,
+			slaves, RTE_MAX_ETHPORTS);
+
+	TEST_ASSERT_EQUAL(slave_count, 0,
+			"Number of active slaves (%d) is not as expected (%d)",
+			slave_count, 0);
+
+	/* bring one slave port up so link status will change */
+	test_lsc_interupt_count = 0;
+
+	virtual_ethdev_simulate_link_status_interrupt(
+			test_params->slave_port_ids[0], 1);
+
+	TEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_MS) == 0,
+			"timed out waiting for interrupt");
+
+	/* test that we have received another lsc interrupt */
+	TEST_ASSERT(test_lsc_interupt_count > 0,
+			"Did not receive link status change interrupt");
+
+	/* Verify that calling the same slave lsc interrupt doesn't cause another
+	 * lsc interrupt from bonded device */
+	test_lsc_interupt_count = 0;
+
+	virtual_ethdev_simulate_link_status_interrupt(
+			test_params->slave_port_ids[0], 1);
+
+	TEST_ASSERT(lsc_timeout(TEST_LSC_WAIT_TIMEOUT_MS) != 0,
+			"received unexpected interrupt");
+
+	TEST_ASSERT_EQUAL(test_lsc_interupt_count, 0,
+			"Did not receive link status change interrupt");
+
+
+	/* unregister lsc callback before exiting */
+	rte_eth_dev_callback_unregister(test_params->bonded_port_id,
+				RTE_ETH_EVENT_INTR_LSC, test_bonding_lsc_event_callback,
+				&test_params->bonded_port_id);
+
+	pthread_mutex_destroy(&mutex);
+	pthread_cond_destroy(&cvar);
+
+	/* Clean up and remove slaves from bonded device */
+	return remove_slaves_and_stop_bonded_device();
+}
+
 static int
 generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size,
 		uint8_t vlan, uint8_t ipv4, uint8_t toggle_dst_mac,
@@ -1215,7 +1359,7 @@ test_roundrobin_tx_burst(void)
 	struct rte_mbuf *pkt_burst[MAX_PKT_BURST];
 	struct rte_eth_stats port_stats;
 
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 2, 1)
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 2, 1)
 			!= 0)
 		return -1;
 
@@ -1285,7 +1429,7 @@ test_roundrobin_rx_burst_on_single_slave(void)
 	int i, j, nb_rx, burst_size = 25;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 1) !=
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 4, 1) !=
 			0)
 		return -1;
 
@@ -1375,7 +1519,7 @@ test_roundrobin_rx_burst_on_multiple_slaves(void)
 
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 1) !=
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 4, 1) !=
 			0)
 		return -1;
 
@@ -1467,7 +1611,7 @@ test_roundrobin_verify_mac_assignment(void)
 	rte_eth_macaddr_get(test_params->slave_port_ids[2], &expected_mac_addr_2);
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 1)
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 4, 1)
 			!= 0)
 		return -1;
 
@@ -1558,7 +1702,7 @@ test_roundrobin_verify_promiscuous_enable_disable(void)
 	int i, promiscuous_en;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 4, 1) !=
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0, 4, 1) !=
 			0)
 		return -1;
 
@@ -1622,7 +1766,7 @@ test_roundrobin_verify_slave_link_status_change_behaviour(void)
 
 	/* Initialize bonded device with TEST_RR_LINK_STATUS_SLAVE_COUNT slaves
 	 * in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN,
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ROUND_ROBIN, 0,
 			TEST_RR_LINK_STATUS_SLAVE_COUNT, 1) != 0)
 		return -1;
 
@@ -1763,7 +1907,7 @@ test_activebackup_tx_burst(void)
 	struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
 	struct rte_eth_stats port_stats;
 
-	retval = initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 2, 1);
+	retval = initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0, 2, 1);
 	if (retval != 0) {
 		printf("Failed to initialize_bonded_device_with_slaves.\n");
 		return -1;
@@ -1863,7 +2007,7 @@ test_activebackup_rx_burst(void)
 	int i, j, nb_rx, burst_size = 17;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP,
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0,
 			TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT, 1)
 			!= 0)
 		return -1;
@@ -1957,7 +2101,7 @@ test_activebackup_verify_promiscuous_enable_disable(void)
 	int i, primary_port, promiscuous_en;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 4, 1)
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0, 4, 1)
 			!= 0)
 		return -1;
 
@@ -2027,7 +2171,7 @@ test_activebackup_verify_mac_assignment(void)
 	rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1);
 
 	/* Initialize bonded device with 2 slaves in active backup mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 2, 1)
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0, 2, 1)
 			!= 0)
 		return -1;
 
@@ -2166,7 +2310,7 @@ test_activebackup_verify_slave_link_status_change_failover(void)
 	}
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP,
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0,
 			TEST_ACTIVE_BACKUP_RX_BURST_SLAVE_COUNT, 1)
 			!= 0)
 		return -1;
@@ -2337,7 +2481,7 @@ test_balance_xmit_policy_configuration(void)
 {
 	int retval;
 
-	retval = initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP,
+	retval = initialize_bonded_device_with_slaves(BONDING_MODE_ACTIVE_BACKUP, 0,
 			2, 1);
 	if (retval != 0) {
 		printf("Failed to initialize_bonded_device_with_slaves.\n");
@@ -2417,7 +2561,7 @@ test_balance_l2_tx_burst(void)
 	int retval, i;
 	struct rte_eth_stats port_stats;
 
-	retval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE,
+	retval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0,
 			TEST_BALANCE_L2_TX_BURST_SLAVE_COUNT, 1);
 	if (retval != 0) {
 		printf("Failed to initialize_bonded_device_with_slaves.\n");
@@ -2519,7 +2663,7 @@ balance_l23_tx_burst(uint8_t vlan_enabled, uint8_t ipv4,
 
 	struct rte_eth_stats port_stats;
 
-	retval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 2, 1);
+	retval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 2, 1);
 	if (retval != 0) {
 		printf("Failed to initialize_bonded_device_with_slaves.\n");
 		return -1;
@@ -2647,7 +2791,7 @@ balance_l34_tx_burst(uint8_t vlan_enabled, uint8_t ipv4,
 
 	struct rte_eth_stats port_stats;
 
-	retval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 2, 1);
+	retval = initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 2, 1);
 	if (retval != 0) {
 		printf("Failed to initialize_bonded_device_with_slaves.\n");
 		return -1;
@@ -2785,7 +2929,7 @@ test_balance_rx_burst(void)
 	memset(gen_pkt_burst, 0, sizeof(gen_pkt_burst));
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 3, 1)
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 3, 1)
 			!= 0)
 		return -1;
 
@@ -2874,7 +3018,7 @@ test_balance_verify_promiscuous_enable_disable(void)
 	int i, promiscuous_en;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 4, 1) != 0)
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 4, 1) != 0)
 		return -1;
 
 	rte_eth_promiscuous_enable(test_params->bonded_port_id);
@@ -2928,7 +3072,7 @@ test_balance_verify_mac_assignment(void)
 	rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1);
 
 	/* Initialize bonded device with 2 slaves in active backup mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 2, 1) != 0)
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 2, 1) != 0)
 		return -1;
 
 	/* Verify that bonded MACs is that of first slave and that the other slave
@@ -3058,7 +3202,7 @@ test_balance_verify_slave_link_status_change_behaviour(void)
 	memset(pkt_burst, 0, sizeof(pkt_burst));
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE,
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0,
 			TEST_BALANCE_LINK_STATUS_SLAVE_COUNT, 1) != 0)
 		return -1;
 
@@ -3251,7 +3395,7 @@ test_broadcast_tx_burst(void)
 
 	struct rte_eth_stats port_stats;
 
-	retval = initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 2, 1);
+	retval = initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 0, 2, 1);
 	if (retval != 0) {
 		printf("Failed to initialize_bonded_device_with_slaves.\n");
 		return -1;
@@ -3344,7 +3488,7 @@ test_broadcast_rx_burst(void)
 	memset(gen_pkt_burst, 0, sizeof(gen_pkt_burst));
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 3, 1) != 0)
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 0, 3, 1) != 0)
 		return -1;
 
 
@@ -3436,7 +3580,7 @@ test_broadcast_verify_promiscuous_enable_disable(void)
 	int i, promiscuous_en;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 4, 1) != 0)
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_BALANCE, 0, 4, 1) != 0)
 		return -1;
 
 	rte_eth_promiscuous_enable(test_params->bonded_port_id);
@@ -3492,7 +3636,7 @@ test_broadcast_verify_mac_assignment(void)
 	rte_eth_macaddr_get(test_params->slave_port_ids[2], &expected_mac_addr_1);
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 4, 1) != 0)
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 0, 4, 1) != 0)
 		return -1;
 
 	/* Verify that all MACs are the same as first slave added to bonded
@@ -3592,7 +3736,7 @@ test_broadcast_verify_slave_link_status_change_behaviour(void)
 	memset(pkt_burst, 0, sizeof(pkt_burst));
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
-	if (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST,
+	if (initialize_bonded_device_with_slaves(BONDING_MODE_BROADCAST, 0,
 			BROADCAST_LINK_STATUS_NUM_OF_SLAVES, 1) != 0)
 		return -1;
 
@@ -3729,7 +3873,7 @@ test_reconfigure_bonded_device(void)
 	test_params->nb_rx_q = 4;
 	test_params->nb_tx_q = 4;
 
-	if (configure_ethdev(test_params->bonded_port_id, 0)  != 0) {
+	if (configure_ethdev(test_params->bonded_port_id, 0, 0)  != 0) {
 		printf("failed to reconfigure bonded device");
 		return -1;
 	}
@@ -3738,7 +3882,7 @@ test_reconfigure_bonded_device(void)
 	test_params->nb_rx_q = 2;
 	test_params->nb_tx_q = 2;
 
-	if (configure_ethdev(test_params->bonded_port_id, 0)  != 0) {
+	if (configure_ethdev(test_params->bonded_port_id, 0, 0)  != 0) {
 		printf("failed to reconfigure bonded device with less rx/tx queues");
 		return -1;
 	}
@@ -3786,6 +3930,7 @@ static struct unit_test_suite link_bonding_test_suite  = {
 		TEST_CASE(test_set_bonding_mode),
 		TEST_CASE(test_set_primary_slave),
 		TEST_CASE(test_set_explicit_bonded_mac),
+		TEST_CASE(test_status_interrupt),
 		TEST_CASE(test_adding_slave_after_bonded_device_started),
 		TEST_CASE(test_roundrobin_tx_burst),
 		TEST_CASE(test_roundrobin_rx_burst_on_single_slave),
diff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c b/lib/librte_pmd_bond/rte_eth_bond_api.c
index 75f5694..dd33119 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_api.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_api.c
@@ -177,6 +177,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
 	pci_drv->id_table->vendor_id = PCI_ANY_ID;
 	pci_drv->id_table->subsystem_vendor_id = PCI_ANY_ID;
 
+	pci_drv->drv_flags = RTE_PCI_DRV_INTR_LSC;
+
 	internals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);
 	if (internals == NULL) {
 		RTE_LOG(ERR, PMD, "Unable to malloc internals on socket\n");
@@ -200,6 +202,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
 	eth_dev->data->nb_rx_queues = (uint16_t)1;
 	eth_dev->data->nb_tx_queues = (uint16_t)1;
 
+	TAILQ_INIT(&(eth_dev->callbacks));
+
 	eth_dev->data->dev_link.link_status = 0;
 
 	eth_dev->data->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN, 0,
diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
index 147028b..de0cd56 100644
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -930,6 +930,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 	struct rte_eth_link link;
 
 	int i, valid_slave = 0, active_pos = -1;
+	uint8_t lsc_flag = 0;
 
 	if (type != RTE_ETH_EVENT_INTR_LSC || param == NULL)
 		return;
@@ -975,6 +976,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 			/* If first active slave, then change link status */
 			bonded_eth_dev->data->dev_link.link_status = 1;
 			internals->current_primary_port = port_id;
+			lsc_flag = 1;
 
 			/* Inherit eth dev link properties from first active slave */
 			link_properties_set(bonded_eth_dev,
@@ -999,6 +1001,7 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 		/* No active slaves, change link status to down and reset other
 		 * link properties */
 		if (internals->active_slave_count < 1) {
+			lsc_flag = 1;
 			bonded_eth_dev->data->dev_link.link_status = 0;
 
 			link_properties_reset(bonded_eth_dev);
@@ -1014,6 +1017,9 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,
 				internals->current_primary_port = internals->primary_port;
 		}
 	}
+
+	if (lsc_flag)
+		_rte_eth_dev_callback_process(bonded_eth_dev, RTE_ETH_EVENT_INTR_LSC);
 }
 
 struct eth_dev_ops default_dev_ops = {
-- 
1.7.4.1

  parent reply	other threads:[~2014-11-24 12:27 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-19 13:51 [PATCH 0/6] link bonding Declan Doherty
     [not found] ` <1408456313-28812-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-19 13:51   ` [PATCH 1/6] bond: link status interrupt support Declan Doherty
     [not found]     ` <1408456313-28812-2-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-20 20:24       ` Sanford, Robert
2014-08-19 13:51   ` [PATCH 2/6] bond: removing switch statement from rx burst method Declan Doherty
     [not found]     ` <1408456313-28812-3-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-20 20:25       ` Sanford, Robert
2014-08-19 13:51   ` [PATCH 3/6] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
     [not found]     ` <1408456313-28812-4-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-08-20 20:25       ` Sanford, Robert
2014-08-19 13:51   ` [PATCH 4/6] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-08-19 13:51   ` [PATCH 5/6] test app: adding support for generating variable sized packets Declan Doherty
2014-08-19 13:51   ` [PATCH 6/6] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-08-22  7:41   ` [PATCH 0/6] link bonding Jiajia, SunX
2014-09-01  8:31   ` [PATCH v2 " Declan Doherty
     [not found]     ` <1409560289-29558-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-02 13:31       ` De Lara Guarch, Pablo
2014-09-02 18:15       ` Stephen Hemminger
2014-09-01  8:31   ` [PATCH v2 1/6] bond: link status interrupt support Declan Doherty
2014-09-01  8:31   ` [PATCH v2 2/6] bond: removing switch statement from rx burst method Declan Doherty
2014-09-01  8:31   ` [PATCH v2 3/6] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-09-01  8:31   ` [PATCH v2 4/6] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
     [not found]     ` <1409560289-29558-5-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-02  9:22       ` Doherty, Declan
     [not found]         ` <345C63BAECC1AD42A2EC8C63AFFC3ADC2737656B-kPTMFJFq+rF9qrmMLTLiibfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-09-02  9:31           ` Thomas Monjalon
2014-09-23 13:18       ` [PATCH v3 0/5] link bonding Declan Doherty
     [not found]         ` <1411478290-28807-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-23 13:18           ` [PATCH v3 1/5] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-09-23 13:18           ` [PATCH v3 2/5] test app: adding support for generating variable sized packet Declan Doherty
2014-09-23 13:18           ` [PATCH v3 3/5] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-09-23 13:18           ` [PATCH v3 4/5] bond: lsc polling support Declan Doherty
     [not found]             ` <1411478290-28807-5-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-24 13:16               ` Ananyev, Konstantin
2014-09-23 13:18           ` [PATCH v3 5/5] bond: unit test test macro refactor Declan Doherty
2014-09-01  8:31   ` [PATCH v2 5/6] test app: adding support for generating variable sized packets Declan Doherty
2014-09-01  8:31   ` [PATCH v2 6/6] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-09-30  9:57   ` [PATCH v4 0/8] link bonding Declan Doherty
     [not found]     ` <1412071079-7355-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-09-30  9:57       ` [PATCH v4 1/8] bond: link status interrupt support Declan Doherty
2014-09-30  9:57       ` [PATCH v4 2/8] bond: removing switch statement from rx burst method Declan Doherty
2014-09-30  9:57       ` [PATCH v4 3/8] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-09-30  9:57       ` [PATCH v4 4/8] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
     [not found]         ` <1412071079-7355-5-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-13 15:29           ` De Lara Guarch, Pablo
2014-09-30  9:57       ` [PATCH v4 5/8] test app: adding support for generating variable sized packet bursts Declan Doherty
     [not found]         ` <1412071079-7355-6-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-24  3:22           ` Liang, Cunming
2014-09-30  9:57       ` [PATCH v4 6/8] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-09-30  9:57       ` [PATCH v4 7/8] bond: lsc polling support Declan Doherty
2014-09-30  9:57       ` [PATCH v4 8/8] bond: unit test test macro refactor Declan Doherty
2014-10-08  8:49       ` [PATCH v4 0/8] link bonding Jiajia, SunX
2014-10-09 19:20       ` De Lara Guarch, Pablo
2014-10-14 12:59       ` [PATCH v5 " Declan Doherty
     [not found]         ` <1413291597-27326-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-14 12:59           ` [PATCH v5 1/8] bond: link status interrupt support Declan Doherty
2014-10-14 12:59           ` [PATCH v5 2/8] bond: removing switch statement from rx burst method Declan Doherty
2014-10-14 12:59           ` [PATCH v5 3/8] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-10-14 12:59           ` [PATCH v5 4/8] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-10-14 12:59           ` [PATCH v5 5/8] test app: adding support for generating variable sized packet Declan Doherty
2014-10-14 12:59           ` [PATCH v5 6/8] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-10-14 12:59           ` [PATCH v5 7/8] bond: lsc polling support Declan Doherty
2014-10-14 12:59           ` [PATCH v5 8/8] bond: unit test test macro refactor Declan Doherty
2014-10-14 15:59           ` [PATCH v5 0/8] link bonding De Lara Guarch, Pablo
2014-11-05  3:10           ` Jiajia, SunX
2014-11-07 12:22           ` [PATCH v6 " Declan Doherty
     [not found]             ` <1415362978-6306-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-07 12:22               ` [PATCH v6 1/8] bond: link status interrupt support Declan Doherty
2014-11-07 12:22               ` [PATCH v6 2/8] bond: removing switch statement from rx burst method Declan Doherty
2014-11-07 12:22               ` [PATCH v6 3/8] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-11-07 12:22               ` [PATCH v6 4/8] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-11-07 12:22               ` [PATCH v6 5/8] test app: adding support for generating variable sized packet Declan Doherty
2014-11-07 12:22               ` [PATCH v6 6/8] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-11-07 12:22               ` [PATCH v6 7/8] bond: lsc polling support Declan Doherty
2014-11-07 12:22               ` [PATCH v6 8/8] bond: unit test test macro refactor Declan Doherty
2014-11-07 16:40               ` [PATCH v6 0/8] link bonding De Lara Guarch, Pablo
     [not found]                 ` <E115CCD9D858EF4F90C690B0DCB4D89726834C36-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-11-21 17:07                   ` Doherty, Declan
     [not found]                     ` <345C63BAECC1AD42A2EC8C63AFFC3ADC27422D1C-kPTMFJFq+rF9qrmMLTLiibfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-11-21 18:36                       ` Thomas Monjalon
2014-11-23 13:40                         ` Thomas Monjalon
2014-11-21  8:59               ` Jiajia, SunX
2014-11-24 12:27               ` [PATCH v7 0/7] " Declan Doherty
     [not found]                 ` <1416832054-24086-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-24 12:27                   ` Declan Doherty [this message]
2014-11-24 12:27                   ` [PATCH v7 2/7] bond: removing switch statement from rx burst method Declan Doherty
2014-11-24 12:27                   ` [PATCH v7 3/7] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-11-24 12:27                   ` [PATCH v7 4/7] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-11-24 12:27                   ` [PATCH v7 5/7] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-11-24 12:27                   ` [PATCH v7 6/7] bond: lsc polling support Declan Doherty
2014-11-24 12:27                   ` [PATCH v7 7/7] bond: unit test test macro refactor Declan Doherty
2014-11-24 15:35                   ` [PATCH v7 0/7] link bonding Thomas Monjalon
2014-11-24 16:24                     ` Doherty, Declan
     [not found]                       ` <345C63BAECC1AD42A2EC8C63AFFC3ADC274244EC-kPTMFJFq+rF9qrmMLTLiibfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-11-24 17:53                         ` Thomas Monjalon
2014-11-24 16:33                   ` [PATCH v8 " Declan Doherty
     [not found]                     ` <1416846822-26897-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-11-24 16:33                       ` [PATCH v8 1/7] bond: link status interrupt support Declan Doherty
2014-11-24 16:33                       ` [PATCH v8 2/7] bond: removing switch statement from rx burst method Declan Doherty
2014-11-24 16:33                       ` [PATCH v8 3/7] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-11-24 16:33                       ` [PATCH v8 4/7] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-11-24 16:33                       ` [PATCH v8 5/7] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-11-24 16:33                       ` [PATCH v8 6/7] bond: lsc polling support Declan Doherty
2014-11-24 16:33                       ` [PATCH v8 7/7] bond: unit test test macro refactor Declan Doherty
2014-11-24 18:32                       ` [PATCH v8 0/7] link bonding Thomas Monjalon
2014-11-24 18:51                         ` Thomas Monjalon
2014-11-24 20:54                       ` Thomas Monjalon
2014-11-25 10:56                         ` Jastrzebski, MichalX K
     [not found]                           ` <60ABE07DBB3A454EB7FAD707B4BB1582138BC9F8-kPTMFJFq+rHjxeytcECX8bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-11-25 11:20                             ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416832054-24086-2-git-send-email-declan.doherty@intel.com \
    --to=declan.doherty-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.