From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-7.cisco.com (alln-iport-7.cisco.com [173.37.142.94]) by dpdk.org (Postfix) with ESMTP id 2AB45374E for ; Sat, 26 Mar 2016 01:44:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2720; q=dns/txt; s=iport; t=1458953093; x=1460162693; h=from:to:cc:subject:date:message-id; bh=AMbltAdMXD6lCFPRwNYgxjNWbf/pD9WF9LlV+HpDNSI=; b=B6kA/FnGywaS31BUzf9exNG/tJw0EZIqUqYuEBxLvRaya1ShMNf2SF+e 5U1uP4oInrH5ywdy0GgdyF1GCYMK6jTOeD09kT9ws1SB/hWpMwPOGJQNn NSI5puCkiDlDgId8mg/zGaPSm9ilosOUE6FBAEOuL0oA0zJzuKSuhh7O2 I=; X-IronPort-AV: E=Sophos;i="5.24,393,1454976000"; d="scan'208";a="253709399" Received: from rcdn-core-3.cisco.com ([173.37.93.154]) by alln-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2016 00:44:52 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id u2Q0ipsU016606; Sat, 26 Mar 2016 00:44:52 GMT Received: by cisco.com (Postfix, from userid 392789) id D8E053FAADBD; Fri, 25 Mar 2016 17:44:51 -0700 (PDT) From: John Daley To: dev@dpdk.org Cc: Nelson Escobar , John Daley Date: Fri, 25 Mar 2016 17:44:50 -0700 Message-Id: <1458953090-12764-1-git-send-email-johndale@cisco.com> X-Mailer: git-send-email 2.7.0 Subject: [dpdk-dev] [PATCH] bonding: fix bond link detect in non-interrupt mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Mar 2016 00:44:53 -0000 From: Nelson Escobar Stopping then re-starting a bond interface containing slaves that used polling for link detection caused the bond to think all slave links were down and inactive. Move the start of the polling for link from slave_add() to bond_ethdev_start() and in bond_ethdev_stop() make sure we clear the last_link_status of the slaves. Signed-off-by: Nelson Escobar Signed-off-by: John Daley --- drivers/net/bonding/rte_eth_bond_pmd.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index fb26d35..f0960c6 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -1454,18 +1454,11 @@ slave_add(struct bond_dev_private *internals, slave_details->port_id = slave_eth_dev->data->port_id; slave_details->last_link_status = 0; - /* If slave device doesn't support interrupts then we need to enabled - * polling to monitor link status */ + /* Mark slave devices that don't support interrupts so we can + * compensate when we start the bond + */ if (!(slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)) { slave_details->link_status_poll_enabled = 1; - - if (!internals->link_status_polling_enabled) { - internals->link_status_polling_enabled = 1; - - rte_eal_alarm_set(internals->link_status_polling_interval_ms * 1000, - bond_ethdev_slave_link_status_change_monitor, - (void *)&rte_eth_devices[internals->port_id]); - } } slave_details->link_status_wait_to_complete = 0; @@ -1550,6 +1543,18 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, internals->slaves[i].port_id); return -1; } + /* We will need to poll for link status if any slave doesn't + * support interrupts + */ + if (internals->slaves[i].link_status_poll_enabled) + internals->link_status_polling_enabled = 1; + } + /* start polling if needed */ + if (internals->link_status_polling_enabled) { + rte_eal_alarm_set( + internals->link_status_polling_interval_ms * 1000, + bond_ethdev_slave_link_status_change_monitor, + (void *)&rte_eth_devices[internals->port_id]); } if (internals->user_defined_primary_port) @@ -1622,6 +1627,8 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) internals->active_slave_count = 0; internals->link_status_polling_enabled = 0; + for (i = 0; i < internals->slave_count; i++) + internals->slaves[i].last_link_status = 0; eth_dev->data->dev_link.link_status = 0; eth_dev->data->dev_started = 0; -- 2.7.0