Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3500099pxu; Tue, 8 Dec 2020 13:49:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzlCxNQ6yEG+4peCbtLYrOgNx0QKqHNwdOWg4lRi/iDigLNcXhzoYfBmdP6Lh9AMHegVQE X-Received: by 2002:a05:6402:202e:: with SMTP id ay14mr35026edb.102.1607464197608; Tue, 08 Dec 2020 13:49:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607464197; cv=none; d=google.com; s=arc-20160816; b=Oli64fU9z8DLbAy3YxCG8YNDBK/2ay9zc9eFvxbM2XZTG0QeeXqn61aqCHSK5bLTft 3sKukiLAa2y+e+Mh7COvc4CxyYw0AggANV8jgj8lRp692Avavl9jtIq7gKh2GgywZW1+ s/bj3Hu0bYM1rLBCKvfFw9pGo/1NTIKCbTFUfGFO1rOESVZCd+ye7pnV6oplUSqeLjep VtW4x6af26AeIwmIgrFzJK9T0+6wx0pq30+ZLH+P+vVaC27/VQRNa69YA/tiYcBZ4Iw/ zgdjWWg2ind81XLSeV7eQPC7LTWVYRJuBVVD9TzWV5SNQR4CTBZECND2HkF7jOdVLyEw mX7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:comments:references:in-reply-to:subject:cc :to:from; bh=teQ8P+ywBpCdwFRnPX2pYqeRf6mgU1adsQWFa07UO5s=; b=or69edYfhy+jfzRsNbGcCex62pH7+I84psYdpqKwINWbmPJqogE3FPXTAIcQLKkWXu 0V+jWRUWyNBaFb0Bq24gUPUode4qWDjZUFPoJj0xNt8jne3+Gkd2MCe+rQwG8pMK5lhg glw7wTsA8B4MuXZs5hxqSzhj5kzMvm6uiCT2gBtSloiADWCl0A5uSMNya3TG75wVN6Yh r+lOrTaBRbDhvc+8A2Kx2IWnzL51Y54KvoIXx5gIXcYhFkmw3zBOIHbwOn5AoZeLeqSg eOcP0dISE6Il0URto2db01exOOzRZX2MZRrLwwhB2oJZBpFZI8tYoggMI19Tx0pDQQf8 hnWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g20si5518504ejz.555.2020.12.08.13.49.33; Tue, 08 Dec 2020 13:49:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730054AbgLHVrC convert rfc822-to-8bit (ORCPT + 99 others); Tue, 8 Dec 2020 16:47:02 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:58979 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725874AbgLHVrB (ORCPT ); Tue, 8 Dec 2020 16:47:01 -0500 Received: from 1.general.jvosburgh.us.vpn ([10.172.68.206] helo=famine.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kmkoF-0006sn-Kc; Tue, 08 Dec 2020 21:46:13 +0000 Received: by famine.localdomain (Postfix, from userid 1000) id C5B695FEE7; Tue, 8 Dec 2020 13:46:09 -0800 (PST) Received: from famine (localhost [127.0.0.1]) by famine.localdomain (Postfix) with ESMTP id BE5A99FAB0; Tue, 8 Dec 2020 13:46:09 -0800 (PST) From: Jay Vosburgh To: Jakub Kicinski cc: Lars Everbrand , linux-kernel@vger.kernel.org, Veaceslav Falico , Andy Gospodarek , "David S. Miller" , netdev@vger.kernel.org Subject: Re: [PATCH net-next] bonding: correct rr balancing during link failure In-reply-to: <20201205114513.4886d15e@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com> References: <20201205114513.4886d15e@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com> Comments: In-reply-to Jakub Kicinski message dated "Sat, 05 Dec 2020 11:45:13 -0800." X-Mailer: MH-E 8.6+git; nmh 1.6; GNU Emacs 27.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15307.1607463969.1@famine> Content-Transfer-Encoding: 8BIT Date: Tue, 08 Dec 2020 13:46:09 -0800 Message-ID: <15308.1607463969@famine> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jakub Kicinski wrote: >On Wed, 02 Dec 2020 20:55:57 +0000 Lars Everbrand wrote: >> 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). Are these bandwidth numbers from observation of the actual behavior? I'm not sure the real system would behave this way; my suspicion is that it would increase the likelihood of drops on the overused slave, not that the overall capacity would be limited. >> Signed-off-by: Lars Everbrand > >Thanks for the patch! > >Looking at the code in question it feels a little like we're breaking >abstractions if we bump the counter directly in get_slave_by_id. Agreed; I think a better way to fix this is to enable the slave array for balance-rr mode, and then use the array to find the right slave. This way, we then avoid the problematic "skip unable to tx" logic for free. >For one thing when the function is called for IGMP packets the counter >should not be incremented at all. But also if packets_per_slave is not >1 we'd still be hitting the same leg multiple times (packets_per_slave >/ 2). So it seems like we should round the counter up somehow? > >For IGMP maybe we don't have to call bond_get_slave_by_id() at all, >IMHO, just find first leg that can TX. Then we can restructure >bond_get_slave_by_id() appropriately for the non-IGMP case. For IGMP, the theory is to confine that traffic to a single device. Normally, this will be curr_active_slave, which is updated even in balance-rr mode as interfaces are added to or removed from the bond. The call to bond_get_slave_by_id should be a fallback in case curr_active_slave is empty, and should be the exception, and may not be possible at all. But either way, the IGMP path shouldn't mess with rr_tx_counter, it should be out of band of the normal TX packet counting, so to speak. -J >> 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; > --- -Jay Vosburgh, jay.vosburgh@canonical.com