From patchwork Fri Oct 28 12:32:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Sitnicki X-Patchwork-Id: 688371 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 3t537Q2Nnzz9t0H for ; Fri, 28 Oct 2016 23:32:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760299AbcJ1Mcp (ORCPT ); Fri, 28 Oct 2016 08:32:45 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38900 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756384AbcJ1Mcl (ORCPT ); Fri, 28 Oct 2016 08:32:41 -0400 Received: by mail-wm0-f51.google.com with SMTP id n67so110944562wme.1 for ; Fri, 28 Oct 2016 05:32:41 -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=PNu8yImo11/iYXyjHNpqxnvgtZ508OK8FR+LLQXgPbI=; b=Mbu9QyJyfarsRY0hEF7D/L1uJE1F1LvDLKuFyzYTW40XzE/D81cG61viFuN0Oin62O oyXd/sClXODIXMR5Kt4VOxng8LrfeEl6Mtj2pEYxorIHRZs+Q7f2yX93vENyb2QcBan7 FnQzTJbipEcQvAgtJjFOYKJuLFMOaP2a6hsmjogUMdSPHfDqh1YPrn5TZH+RWG+vw6Oh WUPATXQP56eYfoassXraBzhEI0FtG5oK/dMv5HZ4mlnmRcCTmkJL4saP/buN0q2YrTso B207H8ixKNR6eEOclHZOZXi/MJFQO3WlxFETE5B53M8nsgjtfD/23unWJV1snKd/cEV5 LfXA== X-Gm-Message-State: ABUngvckO3zBupPgX5u876O3oLi4brGroiD2Dy8g/4qrGu/Ngzw/G+z4PV/szLNSnd4Rc42X X-Received: by 10.28.12.77 with SMTP id 74mr3717989wmm.115.1477657960260; Fri, 28 Oct 2016 05:32:40 -0700 (PDT) Received: from redhat.com ([149.6.38.86]) by smtp.gmail.com with ESMTPSA id h3sm13891744wjp.45.2016.10.28.05.32.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Oct 2016 05:32:39 -0700 (PDT) From: Jakub Sitnicki To: netdev@vger.kernel.org Cc: "David S. Miller" , Hannes Frederic Sowa , Hideaki YOSHIFUJI , Tom Herbert Subject: [PATCH net-next v2 3/5] ipv6: Use multipath hash from flow info if available Date: Fri, 28 Oct 2016 14:32:33 +0200 Message-Id: <1477657955-5157-4-git-send-email-jkbs@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477657955-5157-1-git-send-email-jkbs@redhat.com> References: <1477657955-5157-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) */