[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230516134447.193511-3-mateusz.palczewski@intel.com>
Date: Tue, 16 May 2023 09:44:47 -0400
From: Mateusz Palczewski <mateusz.palczewski@...el.com>
To: j.vosburgh@...il.com,
andy@...yhouse.net,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
dbanerje@...mai.com,
netdev@...r.kernel.org
Cc: Sebastian Basierski <sebastianx.basierski@...el.com>,
Mateusz Palczewski <mateusz.palczewski@...el.com>
Subject: [PATCH iwl-net v1 2/2] drivers/net/bonding: Added some delay while checking for VFs link
From: Sebastian Basierski <sebastianx.basierski@...el.com>
Right now bonding driver checks if link is ready once.
VF interface takes a little more time to get ready than PF,
so driver needs to wait for it to be ready.
1000ms delay was set, if VF link will not be set within given amount
of time, for sure problems should be investigated elsewhere.
Fixes: b3c898e20b18 ("Revert "bonding: allow carrier and link status to determine link state"")
Signed-off-by: Sebastian Basierski <sebastianx.basierski@...el.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@...el.com>
---
drivers/net/bonding/bond_main.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 710548dbd0c1..6d49fb25969e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -736,6 +736,8 @@ const char *bond_slave_link_status(s8 link)
* It'd be nice if there was a good way to tell if a driver supports
* netif_carrier, but there really isn't.
*/
+#define BOND_CARRIER_CHECK_TIMEOUT 1000
+
static int bond_check_dev_link(struct bonding *bond,
struct net_device *slave_dev, int reporting)
{
@@ -743,12 +745,22 @@ static int bond_check_dev_link(struct bonding *bond,
int (*ioctl)(struct net_device *, struct ifreq *, int);
struct ifreq ifr;
struct mii_ioctl_data *mii;
+ int delay;
if (!reporting && !netif_running(slave_dev))
return 0;
+ for (delay = 0; delay < BOND_CARRIER_CHECK_TIMEOUT; delay++) {
+ mdelay(1);
+
+ if (bond->params.use_carrier &&
+ netif_carrier_ok(slave_dev)) {
+ return BMSR_LSTATUS;
+ }
+ }
+
if (bond->params.use_carrier)
- return netif_carrier_ok(slave_dev) ? BMSR_LSTATUS : 0;
+ return 0;
/* Try to get link status using Ethtool first. */
if (slave_dev->ethtool_ops->get_link)
--
2.31.1
Powered by blists - more mailing lists