From: Lars Everbrand <lars.everbrand@protonmail.com>
To: linux-kernel@vger.kernel.org
Cc: Jay Vosburgh <j.vosburgh@gmail.com>,
Veaceslav Falico <vfalico@gmail.com>,
Andy Gospodarek <andy@greyhouse.net>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org
Subject: [PATCH net-next] bonding: correct rr balancing during link failure
Date: Wed, 02 Dec 2020 20:55:57 +0000 [thread overview]
Message-ID: <X8f/WKR6/j9k+vMz@black-debian> (raw)
This patch updates the sending algorithm for roundrobin to avoid
over-subscribing interface(s) when one or more interfaces in the bond is
not able to send packets. This happened when order was not random and
more than 2 interfaces were used.
Previously the algorithm would find the next available interface
when an interface failed to send by, this means that most often it is
current_interface + 1. The problem is that when the next packet is to be
sent and the "normal" algorithm then continues with interface++ which
then hits that same interface again.
This patch updates the resending algorithm to update the global counter
of the next interface to use.
Example (prior to patch):
Consider 6 x 100 Mbit/s interfaces in a rr bond. The normal order of links
being used to send would look like:
1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 ...
If, for instance, interface 2 where unable to send the order would have been:
1 3 3 4 5 6 1 3 3 4 5 6 1 3 3 4 5 6 ...
The resulting speed (for TCP) would then become:
50 + 0 + 100 + 50 + 50 + 50 = 300 Mbit/s
instead of the expected 500 Mbit/s.
If interface 3 also would fail the resulting speed would be half of the
expected 400 Mbit/s (33 + 0 + 0 + 100 + 33 + 33).
Signed-off-by: Lars Everbrand <lars.everbrand@protonmail.com>
---
drivers/net/bonding/bond_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index e0880a3840d7..e02d9c6d40ee 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4107,6 +4107,7 @@ static struct slave *bond_get_slave_by_id(struct bonding *bond,
if (--i < 0) {
if (bond_slave_can_tx(slave))
return slave;
+ bond->rr_tx_counter++;
}
}
@@ -4117,6 +4118,7 @@ static struct slave *bond_get_slave_by_id(struct bonding *bond,
break;
if (bond_slave_can_tx(slave))
return slave;
+ bond->rr_tx_counter++;
}
/* no slave that can tx has been found */
return NULL;
--
2.29.2
next reply other threads:[~2020-12-02 20:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-02 20:55 Lars Everbrand [this message]
2020-12-05 19:45 ` [PATCH net-next] bonding: correct rr balancing during link failure Jakub Kicinski
2020-12-08 21:46 ` Jay Vosburgh
2020-12-15 21:54 ` Lars Everbrand
2020-12-15 21:32 ` Lars Everbrand
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=X8f/WKR6/j9k+vMz@black-debian \
--to=lars.everbrand@protonmail.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=j.vosburgh@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vfalico@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).