Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1998596rbb; Tue, 27 Feb 2024 07:40:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWTycMw9PZdC2sYFjFk1MN7iQbF1SevCwkRWUA8EgXZl22+FO+L1z5CMqxHIN90GjMql/Vye4GItZFu+3kc3s4NUdD/F4W8+IQxwFE/9w== X-Google-Smtp-Source: AGHT+IHsLAJ94W4FyfB6MwsDuyyPyQpeneo4x+3MGXwsQOYGmyuX08GAU/PzvHWQzl1OW1fUxJd6 X-Received: by 2002:a05:6808:171c:b0:3c1:5557:5615 with SMTP id bc28-20020a056808171c00b003c155575615mr2660132oib.47.1709048431158; Tue, 27 Feb 2024 07:40:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709048431; cv=pass; d=google.com; s=arc-20160816; b=XJ7fuAzhsjBA/zo2OBchciUWGjooYHgtHIfvx3oFPw6stMROGvke1MC8oNQKimJ4WG eeDnS8vCMiO1Mk3AoQfI8cXQMD3A4q1hBwr4G05SkbUHCzQbEHM0gUKZbWs8UuyvLbNf xPmzRzhAtwRCBN0FG2ah9x/9Ied/L7QMFpjUZCA/Wlt0SJZ5OcuYfteBN4D26ykeTlyj EezZa4O15PjfQT9pYiFyCZ99k7U3HwGhwUbqErFab/lHvLHsWdkEq7e0lVnlsD+8ZTvr oo3zt/ZgYj4NyaBN2si2nigD27GGY7gBtbtc3xz6DGJQwKN1UPRU++Qj7gMNcbdBp6Uw BXGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=kmbZnjCZObYOZJZ40UNJcGCBXpVKoGZFhhposMuMNfg=; fh=nIhnzVmq1L/vJ3WkbFR9DsHdj3+t2m9dhApud4SCaTo=; b=R3pX3s18CJGVuTF/RqNAyVfasHo8rSp7uRtP/qwCtsOeBp88E7LSLrOmgoZLhN4lM0 6J9TIzSRQVJC5/F/gDpIFHGc1jYEgfe2FkorexxOOH1ZDskeuWACnBXYOsGQdHnFXHX2 fBAby0saX/dD//AA+s2HqqbsTIRHW+u8smbxI6uFZgNVO6g5F+EnBGZOaixX9KPOEOwv bRUiHhFkZfnYnmEr1DEyn7U/BOgytrRiOqUc3mswU7DMHveR4249taDYzjXnEJGRJl9m 8bD3lnvUf2RKHfAl8f+QgssX5ctRe6qh7yS2Bm2n+7Sgup/136bbOraDE2z2jovL2Lvc DXFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mQPZKf7o; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-83471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83471-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k184-20020a6324c1000000b005dc9054610bsi5711210pgk.307.2024.02.27.07.40.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 07:40:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mQPZKf7o; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-83471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83471-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 40845B2BA10 for ; Tue, 27 Feb 2024 15:08:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 557E814690D; Tue, 27 Feb 2024 15:06:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mQPZKf7o" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A9211468E3 for ; Tue, 27 Feb 2024 15:06:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709046397; cv=none; b=a6b1i3zN3t/lm+QFTMY48IDWz0543n5seq5rpj1u2I5GD69BSAP+05xDSorTHI4bhoY5F7HDdM/495bwfKwTNONOqgbGo2/k7f0OKW6Dv9bXcrVomVBFB3VLkXb6ZHDcDbGUSjNxPpOtVD4KdT9rOnFyRJxa3lJiiOlEBzyNIss= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709046397; c=relaxed/simple; bh=Dg60Guh5xxI2n2BEEUudJcXx9ZZbzM3OrI5eLHlaYD4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=HfcKyJ4geq4BdOnhv1f3kpEVCq5pGQXndC1c66FcLXWEtrv2rShX7Ru0uo7v/tvdt+c7R/MYPZss8ccY3Tow8cnI7bP9rZdtHjnP0Uv0X5z5unmO/BxX+ZCnba5enlk9g3qxLhtuCvF2YwosbZ4pYANh5G7uhpVmlOaVDkjCPQA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mQPZKf7o; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ADB6C433C7; Tue, 27 Feb 2024 15:06:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709046396; bh=Dg60Guh5xxI2n2BEEUudJcXx9ZZbzM3OrI5eLHlaYD4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=mQPZKf7o95NPmtnoEHmArkHnuRYhdJFIV+T8FTIKZDbTeA3Mok+A4lfMFvYfm3+Sb bBROEG1uMnZZe/PjJ9CspUT6iGMRSo+64mzKLJGxxASE8z8TKfajIlghsIieSK2gs7 SnlJmPTQk7Hs4PIJ3o006PP3bjp6xsv1rnbji76Gl179z7PSE+1BksUNXVO617MZxx 9u5HtS0x0s3lwnZyPOYQrzvvNjSAIWJCd1YrYrzex3RGhl97CIGxqHvNINw791E6Hm YG6f9jQK1o29f2ov91vo+Yvo/27yqB5x3TYHS4Z379c8KwCGkaAaboypw8ZFJpaY+8 aOoJlelss7ctg== Message-ID: <655ba4a1-4f73-4ef4-aff3-0b439e65a9c9@kernel.org> Date: Tue, 27 Feb 2024 08:06:35 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Net:cache didn't flush when ipv6 rule changed Content-Language: en-US To: =?UTF-8?B?TGVuYSBXYW5nICjnjovlqJwp?= , "davem@davemloft.net" , "kuba@kernel.org" , "pabeni@redhat.com" , "edumazet@google.com" Cc: "linux-kernel@vger.kernel.org" , =?UTF-8?B?U2hpbWluZyBDaGVuZyAo5oiQ6K+X5piOKQ==?= References: <3efcbaf0872481d1a842eb9e18fa368b4b94d940.camel@mediatek.com> From: David Ahern In-Reply-To: <3efcbaf0872481d1a842eb9e18fa368b4b94d940.camel@mediatek.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 2/26/24 6:11 AM, Lena Wang (王娜) wrote: > diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c > index 7523c4baef35..bec2cf4436e1 100644 > --- a/net/ipv6/fib6_rules.c > +++ b/net/ipv6/fib6_rules.c > @@ -449,6 +449,15 @@ static size_t fib6_rule_nlmsg_payload(struct > fib_rule *rule) > + nla_total_size(16); /* src */ > } > > +static void fib6_rule_flush_cache(struct fib_rules_ops *ops) > +{ > + struct net *net = ops->fro_net; > + if (!net) > + return; > + rt_genid_bump_ipv6(net); > + return; > +} This can be written as a 1-liner - the same way as the IPv4 flush cache: static void fib6_rule_flush_cache(struct fib_rules_ops *ops) { rt_genid_bump_ipv6(ops->fro_net); } > + > static const struct fib_rules_ops __net_initconst > fib6_rules_ops_template = { > .family = AF_INET6, > .rule_size = sizeof(struct fib6_rule), > @@ -461,6 +470,7 @@ static const struct fib_rules_ops __net_initconst > fib6_rules_ops_template = { > .compare = fib6_rule_compare, > .fill = fib6_rule_fill, > .nlmsg_payload = fib6_rule_nlmsg_payload, > + .flush_cache = fib6_rule_flush_cache, this should be tabs and the columns should align with existing code. > .nlgroup = RTNLGRP_IPV6_RULE, > .owner = THIS_MODULE, > .fro_net = &init_net, > -- > 2.18.0