Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 1 | From a2f08a919c72af29c56b937e6c92eb104037fed5 Mon Sep 17 00:00:00 2001 |
| 2 | From: Nelson Escobar <neescoba@cisco.com> |
| 3 | Date: Tue, 22 Mar 2016 13:42:08 -0700 |
| 4 | Subject: [PATCH 22/22] bonding: fix bond link detect in non-interrupt mode |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 5 | |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 6 | Stopping then re-starting a bond interface containing slaves that |
| 7 | used polling for link detection caused the bond to think all slave |
| 8 | links were down and inactive. |
Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 9 | |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 10 | Move the start of the polling for link from slave_add() to |
| 11 | bond_ethdev_start() and in bond_ethdev_stop() make sure we clear |
| 12 | the last_link_status of the slaves. |
Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 13 | |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 14 | Signed-off-by: Nelson Escobar <neescoba@cisco.com> |
| 15 | Signed-off-by: John Daley <johndale@cisco.com> |
Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 16 | --- |
| 17 | drivers/net/bonding/rte_eth_bond_pmd.c | 27 +++++++++++++++++---------- |
| 18 | 1 file changed, 17 insertions(+), 10 deletions(-) |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 19 | |
| 20 | diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c |
Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 21 | index b1373c6..d32c6f5 100644 |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 22 | --- a/drivers/net/bonding/rte_eth_bond_pmd.c |
| 23 | +++ b/drivers/net/bonding/rte_eth_bond_pmd.c |
Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 24 | @@ -1447,18 +1447,11 @@ slave_add(struct bond_dev_private *internals, |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 25 | slave_details->port_id = slave_eth_dev->data->port_id; |
| 26 | slave_details->last_link_status = 0; |
| 27 | |
| 28 | - /* If slave device doesn't support interrupts then we need to enabled |
| 29 | - * polling to monitor link status */ |
| 30 | + /* Mark slave devices that don't support interrupts so we can |
| 31 | + * compensate when we start the bond |
| 32 | + */ |
| 33 | if (!(slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)) { |
| 34 | slave_details->link_status_poll_enabled = 1; |
| 35 | - |
| 36 | - if (!internals->link_status_polling_enabled) { |
| 37 | - internals->link_status_polling_enabled = 1; |
| 38 | - |
| 39 | - rte_eal_alarm_set(internals->link_status_polling_interval_ms * 1000, |
| 40 | - bond_ethdev_slave_link_status_change_monitor, |
| 41 | - (void *)&rte_eth_devices[internals->port_id]); |
| 42 | - } |
| 43 | } |
| 44 | |
| 45 | slave_details->link_status_wait_to_complete = 0; |
Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 46 | @@ -1543,6 +1536,18 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 47 | eth_dev->data->port_id, internals->slaves[i].port_id); |
| 48 | return -1; |
| 49 | } |
| 50 | + /* We will need to poll for link status if any slave doesn't |
| 51 | + * support interrupts |
| 52 | + */ |
| 53 | + if (internals->slaves[i].link_status_poll_enabled) |
| 54 | + internals->link_status_polling_enabled = 1; |
| 55 | + } |
| 56 | + /* start polling if needed */ |
| 57 | + if (internals->link_status_polling_enabled) { |
| 58 | + rte_eal_alarm_set( |
| 59 | + internals->link_status_polling_interval_ms * 1000, |
| 60 | + bond_ethdev_slave_link_status_change_monitor, |
| 61 | + (void *)&rte_eth_devices[internals->port_id]); |
| 62 | } |
| 63 | |
| 64 | if (internals->user_defined_primary_port) |
Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 65 | @@ -1615,6 +1620,8 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 66 | |
| 67 | internals->active_slave_count = 0; |
| 68 | internals->link_status_polling_enabled = 0; |
| 69 | + for (i = 0; i < internals->slave_count; i++) |
| 70 | + internals->slaves[i].last_link_status = 0; |
| 71 | |
| 72 | eth_dev->data->dev_link.link_status = 0; |
| 73 | eth_dev->data->dev_started = 0; |
Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 74 | -- |
| 75 | 1.9.1 |
| 76 | |