netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ipv4: Set nexthop flags in a more consistent way
@ 2020-11-10 10:25 Ido Schimmel
  2020-11-10 15:25 ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: Ido Schimmel @ 2020-11-10 10:25 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, dsahern, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@nvidia.com>

Be more consistent about the way in which the nexthop flags are set and
set them in one go.

Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
RTNH_F_DEAD and RTNH_F_LINKDOWN are set separately above, so I decided
to keep them as-is.
---
 net/ipv4/fib_semantics.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index f70b9a0c4957..7612ff6111a7 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1641,11 +1641,8 @@ int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc,
 		break;
 	}
 
-	*flags |= (nhc->nhc_flags & RTNH_F_ONLINK);
-	if (nhc->nhc_flags & RTNH_F_OFFLOAD)
-		*flags |= RTNH_F_OFFLOAD;
-	if (nhc->nhc_flags & RTNH_F_TRAP)
-		*flags |= RTNH_F_TRAP;
+	*flags |= (nhc->nhc_flags &
+		   (RTNH_F_ONLINK | RTNH_F_OFFLOAD | RTNH_F_TRAP));
 
 	if (!skip_oif && nhc->nhc_dev &&
 	    nla_put_u32(skb, RTA_OIF, nhc->nhc_dev->ifindex))
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ipv4: Set nexthop flags in a more consistent way
  2020-11-10 10:25 [PATCH net-next] ipv4: Set nexthop flags in a more consistent way Ido Schimmel
@ 2020-11-10 15:25 ` David Ahern
  2020-11-12  4:25   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2020-11-10 15:25 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: davem, kuba, mlxsw, Ido Schimmel

On 11/10/20 3:25 AM, Ido Schimmel wrote:
> From: Ido Schimmel <idosch@nvidia.com>
> 
> Be more consistent about the way in which the nexthop flags are set and
> set them in one go.
> 
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> ---
> RTNH_F_DEAD and RTNH_F_LINKDOWN are set separately above, so I decided
> to keep them as-is.
> ---
>  net/ipv4/fib_semantics.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ipv4: Set nexthop flags in a more consistent way
  2020-11-10 15:25 ` David Ahern
@ 2020-11-12  4:25   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-11-12  4:25 UTC (permalink / raw)
  To: David Ahern; +Cc: Ido Schimmel, netdev, davem, mlxsw, Ido Schimmel

On Tue, 10 Nov 2020 08:25:50 -0700 David Ahern wrote:
> On 11/10/20 3:25 AM, Ido Schimmel wrote:
> > From: Ido Schimmel <idosch@nvidia.com>
> > 
> > Be more consistent about the way in which the nexthop flags are set and
> > set them in one go.
> > 
> > Suggested-by: Jakub Kicinski <kuba@kernel.org>
> > Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> 
> Reviewed-by: David Ahern <dsahern@kernel.org>

Applied, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-12  5:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 10:25 [PATCH net-next] ipv4: Set nexthop flags in a more consistent way Ido Schimmel
2020-11-10 15:25 ` David Ahern
2020-11-12  4:25   ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).