From patchwork Mon Oct 24 09:28:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Sitnicki X-Patchwork-Id: 685743 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3t2WFb0Qmpz9t17 for ; Mon, 24 Oct 2016 20:29:23 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938696AbcJXJ3D (ORCPT ); Mon, 24 Oct 2016 05:29:03 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:36425 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757214AbcJXJ27 (ORCPT ); Mon, 24 Oct 2016 05:28:59 -0400 Received: by mail-wm0-f42.google.com with SMTP id b80so92915287wme.1 for ; Mon, 24 Oct 2016 02:28:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6HRuI35KA2/hE/up9nnlbolaB1VsQaWPPLsRqKiKTcQ=; b=cwhsS3bi2w2pWEBZ0jXPInoIeUZiXYDaLwbTtPRM043J9iZxNb2jHwLO1IccYUKZxL MaI20z/d9Lwq6CKBZgd+uAg5gRcJ9/hmM4t+0+jd3AOOQR/JvomvYp4Udlvmnl7FWOGJ jRckpZOhLZraOFEDYAhp9En5DFlx3+vE6G1j8smi9pDC5k3Gf3u5l6yUlFpspq23Zc+x LCbipK/KFUOeBvryxQ7mCDjVtq/YhA+tt+Bc7a9KDcFzt8JtjuVTP+S0tW7BeSqYFqjP IcuM5XXJZ4a820MFoXkvFNmW5E5boRaj+QN45wX2wn6y5Oz3RogK77R+haKlDikyvI6f bj2A== X-Gm-Message-State: ABUngveFvUoxcPLXF/NubiwZw+w2uCAgQ/uvCEqZSAvgxXgUlMBMqgWB4jaVP6J5xTXi5O2r X-Received: by 10.194.30.70 with SMTP id q6mr10876236wjh.124.1477301337869; Mon, 24 Oct 2016 02:28:57 -0700 (PDT) Received: from redhat.com ([149.6.38.86]) by smtp.gmail.com with ESMTPSA id h133sm13692191wmg.23.2016.10.24.02.28.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2016 02:28:57 -0700 (PDT) From: Jakub Sitnicki To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy Subject: [PATCH net-next 3/5] ipv6: Use multipath hash from flow info if available Date: Mon, 24 Oct 2016 11:28:50 +0200 Message-Id: <1477301332-23954-4-git-send-email-jkbs@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477301332-23954-1-git-send-email-jkbs@redhat.com> References: <1477301332-23954-1-git-send-email-jkbs@redhat.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Allow our callers to influence the choice of ECMP link by honoring the hash passed together with the flow info. This will allow for special treatment of ICMP errors which we would like to route over the same link as the IP datagram that triggered the error. Signed-off-by: Jakub Sitnicki Acked-by: Hannes Frederic Sowa --- net/ipv6/route.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 0514b35..1184c2b 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -430,9 +430,11 @@ static struct rt6_info *rt6_multipath_select(struct rt6_info *match, int strict) { struct rt6_info *sibling, *next_sibling; + unsigned int hash; int route_choosen; - route_choosen = get_hash_from_flowi6(fl6) % (match->rt6i_nsiblings + 1); + hash = fl6->mp_hash ? : get_hash_from_flowi6(fl6); + route_choosen = hash % (match->rt6i_nsiblings + 1); /* Don't change the route, if route_choosen == 0 * (siblings does not include ourself) */