Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3098050ybi; Sun, 14 Jul 2019 06:35:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxanEYDWR7PTE1+fjGcDzrSLGgd7F4AEbrSl20wFxqwADBP/sP2jVklxX/ANOtnBXZmb/pd X-Received: by 2002:a17:902:70cc:: with SMTP id l12mr22929216plt.87.1563111305014; Sun, 14 Jul 2019 06:35:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563111305; cv=none; d=google.com; s=arc-20160816; b=ro5YIosQf3J03JXpb8HonqWTprSd7ihFknYYodjZeNn3HNwwx1FQu3zsPPxUPeOLHe QNDJtJdqCUCwsPBCvNQkVumdXuKtHUlGnDlqiGpHsEJVt0CGHOwaqImXeHUX3TpimETv Y8ofptlspqmQ9/6LmXyfyq9BAe5dEVlSmQI7VC/D8dT/T2aSM23BDae0I5R89aop/afb T3Bgp1SKdcUmo009YTWe+jm+e1s51VP8C597e5dQdW3AC7/s6jB9VhMZKk/WSbxE1+j4 FGHWAwaXTRL+S9CMqCyy7swJEPIaa3QhJ6TusdFgkMvHG7qbBHXeoxrVixaCkIs3W8Jz lN5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=3mpt6Yu2PcBU5IgYyqPeIn1CmTpm+elhtlE4jhU7w4k=; b=wz76E2tAWlnhtzotVCtvU3+KO6lbSO1L0GZw5NTFypNbMLdMxEOaZ+PAymmHLVd61S gHYBwoJTEMKj0gPYJC6xXhw32VyAjBYfYzAF5GOE3vEeGngZCac4SuQhYVDnsl/hrcLW hJwJry3N5XxVCMfVXYOWBTqbnNbYCqYzY8nbIR7oDv1xejRoFFHjqj3wb+inO4Bhyo0b qKD3CfzUhkOjTYD3JB6S1mHZccIwWBZv8QApiDnLgTN07mYB74PixI5HSdz3NtXUXfTU m+bF81yQGHJgM2+H8bM0HE3Bb5OwzRmXwfkvhF6iMRERJRVIeFhxq8RMcvIVVfTsflOK kRvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j25si13717768pfr.11.2019.07.14.06.34.30; Sun, 14 Jul 2019 06:35:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728415AbfGNNdB (ORCPT + 99 others); Sun, 14 Jul 2019 09:33:01 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:2374 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728346AbfGNNdA (ORCPT ); Sun, 14 Jul 2019 09:33:00 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.9]) by rmmx-syy-dmz-app06-12006 (RichMail) with SMTP id 2ee65d2b2ecb0c4-4529b; Sun, 14 Jul 2019 21:31:56 +0800 (CST) X-RM-TRANSID: 2ee65d2b2ecb0c4-4529b X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost (unknown[223.105.0.241]) by rmsmtp-syy-appsvr05-12005 (RichMail) with SMTP id 2ee55d2b2eca11a-b5f09; Sun, 14 Jul 2019 21:31:56 +0800 (CST) X-RM-TRANSID: 2ee55d2b2eca11a-b5f09 From: Haishuang Yan To: "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Haishuang Yan Subject: [PATCH] sit: use dst_cache in ipip6_tunnel_xmit Date: Sun, 14 Jul 2019 21:31:22 +0800 Message-Id: <1563111082-10721-1-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Same as other ip tunnel, use dst_cache in xmit action to avoid unnecessary fib lookups. Signed-off-by: Haishuang Yan --- net/ipv6/sit.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 8061089..b2ccbc4 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -900,12 +900,17 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, RT_TOS(tos), RT_SCOPE_UNIVERSE, IPPROTO_IPV6, 0, dst, tiph->saddr, 0, 0, sock_net_uid(tunnel->net, NULL)); - rt = ip_route_output_flow(tunnel->net, &fl4, NULL); - if (IS_ERR(rt)) { - dev->stats.tx_carrier_errors++; - goto tx_error_icmp; + rt = dst_cache_get_ip4(&tunnel->dst_cache, &fl4.saddr); + if (!rt) { + rt = ip_route_output_flow(tunnel->net, &fl4, NULL); + if (IS_ERR(rt)) { + dev->stats.tx_carrier_errors++; + goto tx_error_icmp; + } + dst_cache_set_ip4(&tunnel->dst_cache, &rt->dst, fl4.saddr); } + if (rt->rt_type != RTN_UNICAST) { ip_rt_put(rt); dev->stats.tx_carrier_errors++; -- 1.8.3.1