From patchwork Mon Nov 6 01:01:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 834429 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="souV2oY9"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yVZ666t7fz9sRV for ; Mon, 6 Nov 2017 12:02:22 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751192AbdKFBCU (ORCPT ); Sun, 5 Nov 2017 20:02:20 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:45118 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750904AbdKFBCT (ORCPT ); Sun, 5 Nov 2017 20:02:19 -0500 Received: by mail-pf0-f196.google.com with SMTP id d28so6495068pfe.2 for ; Sun, 05 Nov 2017 17:02:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=2c37Y4IF6gnH8VIgNtZI8oImk6QspISWQNvPx8XxwTA=; b=souV2oY9xdOc0cpmGG7gHgO6kz8Empu7jdS4AJ+gPuZ7L4vvan4yL+A+WG/mCRmAb8 IuaHnc2xvtVAZE7nGvQvia1h+LpGFrOmKcDJDsBleJlWn9TJthL2mY1Y8m6LPBwR08Gv QJ/JyHhqRLKdPVssy8wDOv0v1r06neJhUvrMKEkzCFhJobwMLghPV3rdxeHeuuQ1O1aq zhqDouWoNsJVHwgMKccUDMsQ1LO2tcL2FumVwXhaJBw9G176xqKvBpvyXwXu7W2BZL4a 67zJE2JKXd+ESx/6L7qHMzwrNULM9PlEBe3tiN2EcyTWr7Un4hUPkKKZ66OVCczoJc73 SUFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2c37Y4IF6gnH8VIgNtZI8oImk6QspISWQNvPx8XxwTA=; b=uNlwT3N3x2cFRQ4aPoxXa4ZoCkkoH5i9Pk/v4286hmPg2Jj8xPm4zSguVTqd504bvL /nZ+nYFpd+VfLdGAoK0iE/DNMYWrqC+iaaBBNZeDfiTJxMe5sS52YuV4LepgEOA/kjFT zrYqDq8qhKtGo66ylGHetqn4chmJ9LAywrksOaVcr6KrKC9qqWGhRppJANpzpaPbleJc CQ9RUkQkMmfhCcEn/5oB6ZitpQY0OXMjWBZi2MGiVYeH9N2Lz+o6C/tFYzT8w9vltppD uA44n6KzR843Rw1InaHaOpyjul03JtfgkBx8Ck/Z6tdM2+SQjEjNM/gV2N9SlXculCP9 blIg== X-Gm-Message-State: AMCzsaW/mNnMIDhvN8y+LcSDWTa0EZAnVz39uAQpRdHxDUpVR7owgbGe aYKb+jZtE76OW82Qe5S4CI04PCyX X-Google-Smtp-Source: ABhQp+TM8ty+2aQGlBjA58VLtjdKY+WPTUnnVGdGohaB0hXuiNyd76XKlDGQ4i+WSjXz8vEzGcYebw== X-Received: by 10.99.108.193 with SMTP id h184mr13553802pgc.143.1509930138684; Sun, 05 Nov 2017 17:02:18 -0800 (PST) Received: from leo.usersys.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id z2sm19324165pgo.54.2017.11.05.17.02.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Nov 2017 17:02:17 -0800 (PST) From: Hangbin Liu To: netdev@vger.kernel.org Cc: Paolo Abeni , Eric Dumazet , "David S. Miller" , Hangbin Liu Subject: [PATCHv2 net] bonding: discard lowest hash bit for 802.3ad layer3+4 Date: Mon, 6 Nov 2017 09:01:57 +0800 Message-Id: <1509930117-27775-1-git-send-email-liuhangbin@gmail.com> X-Mailer: git-send-email 2.5.5 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org After commit 07f4c90062f8 ("tcp/dccp: try to not exhaust ip_local_port_range in connect()"), we will try to use even ports for connect(). Then if an application (seen clearly with iperf) opens multiple streams to the same destination IP and port, each stream will be given an even source port. So the bonding driver's simple xmit_hash_policy based on layer3+4 addressing will always hash all these streams to the same interface. And the total throughput will limited to a single slave. Change the tcp code will impact the whole tcp behavior, only for bonding usage. Paolo Abeni suggested fix this by changing the bonding code only, which should be more reasonable, and less impact. Fix this by discarding the lowest hash bit because it contains little entropy. After the fix we can re-balance between slaves. Signed-off-by: Paolo Abeni Signed-off-by: Hangbin Liu --- drivers/net/bonding/bond_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index c99dc59..76e8054 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -3253,7 +3253,7 @@ u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb) hash ^= (hash >> 16); hash ^= (hash >> 8); - return hash; + return hash >> 1; } /*-------------------------- Device entry points ----------------------------*/