From patchwork Fri Feb 22 08:26:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wenxu X-Patchwork-Id: 1046646 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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; dmarc=fail (p=none dis=none) header.from=ucloud.cn Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 445Pb16nfNz9s8m for ; Fri, 22 Feb 2019 19:27:09 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726331AbfBVI1I (ORCPT ); Fri, 22 Feb 2019 03:27:08 -0500 Received: from m97179.mail.qiye.163.com ([220.181.97.179]:49264 "EHLO m97179.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbfBVI1I (ORCPT ); Fri, 22 Feb 2019 03:27:08 -0500 Received: from 10.19.61.167master (unknown [123.59.132.129]) by m97179.mail.qiye.163.com (Hmail) with ESMTPA id BD465E00D2B; Fri, 22 Feb 2019 16:27:05 +0800 (CST) From: wenxu@ucloud.cn To: pablo@netfilter.org Cc: netdev@vger.kernel.org Subject: [PATCH net-next] netfilter: nft_tunnel: Add dst_cache support Date: Fri, 22 Feb 2019 16:26:59 +0800 Message-Id: <1550824019-18188-1-git-send-email-wenxu@ucloud.cn> X-Mailer: git-send-email 1.8.3.1 X-HM-Spam-Status: e1kIGBQJHllBS1VLV1koWUFJQjdXWS1ZQUlXWQkOFx4IWUFZMjUtOjcyP0 FLVUtZBg++ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OAw6Txw4AzlDCQ8UFhEOF0Iw PkowCjlVSlVKTk5LQ0lPS0lOQ05PVTMWGhIXVQweFQMOOw4YFxQOH1UYFUVZV1kSC1lBWUpJSFVO QlVKSElVSklCWVdZCAFZQUpPSEk3Bg++ X-HM-Tid: 0a691450aeba20bdkuqybd465e00d2b Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: wenxu The metadata_dst is not init the dst_cache which make the ip_md_tunnel_xmit can't use the dst_cache. It will lookup route table every packets. Signed-off-by: wenxu --- net/netfilter/nft_tunnel.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/netfilter/nft_tunnel.c b/net/netfilter/nft_tunnel.c index ea28588..b113fca 100644 --- a/net/netfilter/nft_tunnel.c +++ b/net/netfilter/nft_tunnel.c @@ -406,6 +406,13 @@ static int nft_tunnel_obj_init(const struct nft_ctx *ctx, return -ENOMEM; memcpy(&md->u.tun_info, &info, sizeof(info)); +#ifdef CONFIG_DST_CACHE + err = dst_cache_init(&md->u.tun_info.dst_cache, GFP_KERNEL); + if (err < 0) { + metadata_dst_free(md); + return err; + } +#endif ip_tunnel_info_opts_set(&md->u.tun_info, &priv->opts.u, priv->opts.len, priv->opts.flags); priv->md = md;