netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Petr Machata <petrm@nvidia.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, David Ahern <dsahern@gmail.com>,
	<netdev@vger.kernel.org>, Simon Horman <horms@kernel.org>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Ido Schimmel <idosch@nvidia.com>, <mlxsw@nvidia.com>,
	Roopa Prabhu <roopa@nvidia.com>,
	Benjamin Poirier <bpoirier@nvidia.com>
Subject: Re: [PATCH net-next v2 04/14] net: ipv4: Add ip_mr_output()
Date: Fri, 13 Jun 2025 09:51:43 -0700	[thread overview]
Message-ID: <20250613095143.37b5500b@kernel.org> (raw)
In-Reply-To: <ad02c7a76fca399736192bcf7a00e8969fa15e3b.1749757582.git.petrm@nvidia.com>

On Thu, 12 Jun 2025 22:10:38 +0200 Petr Machata wrote:
> +	/* Forward the frame */
> +	if (c->mfc_origin == htonl(INADDR_ANY) &&
> +	    c->mfc_mcastgrp == htonl(INADDR_ANY)) {
> +		if (ip_hdr(skb)->ttl >
> +				c->_c.mfc_un.res.ttls[c->_c.mfc_parent]) {

weird indent?

> +			/* It's an (*,*) entry and the packet is not coming from
> +			 * the upstream: forward the packet to the upstream
> +			 * only.
> +			 */
> +			psend = c->_c.mfc_parent;
> +			goto last_xmit;
> +		}
> +		goto dont_xmit;
> +	}
> +
> +	for (ct = c->_c.mfc_un.res.maxvif - 1;
> +	     ct >= c->_c.mfc_un.res.minvif; ct--) {
> +		if (ip_hdr(skb)->ttl > c->_c.mfc_un.res.ttls[ct]) {

I'd be tempted to invert condition, continue, save a level of indent.
Presumably we expect TTL to actually be large enough so that'd also
make the expected path not under the if ?

> +			if (psend != -1) {
> +				struct sk_buff *skb2 = skb_clone(skb,
> +								 GFP_ATOMIC);
> +
> +				if (skb2)

maybe this is some local custom in this code but:

				struct sk_buff *skb2;

				skb2 = skb_clone(skb, GFP_ATOMIC);
				if (skb2)

same LoC, less ugly.

> +					ipmr_queue_output_xmit(net, mrt,
> +							       skb2, psend);

  reply	other threads:[~2025-06-13 16:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12 20:10 [PATCH net-next v2 00/14] ipmr, ip6mr: Allow MC-routing locally-generated MC packets Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 01/14] net: ipv4: Add a flags argument to iptunnel_xmit(), udp_tunnel_xmit_skb() Petr Machata
2025-06-13 16:48   ` Jakub Kicinski
2025-06-13 19:23     ` Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 02/14] net: ipv4: ipmr: ipmr_queue_xmit(): Drop local variable `dev' Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 03/14] net: ipv4: ipmr: Split ipmr_queue_xmit() in two Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 04/14] net: ipv4: Add ip_mr_output() Petr Machata
2025-06-13 16:51   ` Jakub Kicinski [this message]
2025-06-13 19:31     ` Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 05/14] net: ipv6: Make udp_tunnel6_xmit_skb() void Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 06/14] net: ipv6: Add a flags argument to ip6tunnel_xmit(), udp_tunnel6_xmit_skb() Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 07/14] net: ipv6: ip6mr: Fix in/out netdev to pass to the FORWARD chain Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 08/14] net: ipv6: ip6mr: Extract a helper out of ip6mr_forward2() Petr Machata
2025-06-13 16:53   ` Jakub Kicinski
2025-06-13 19:40     ` Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 09/14] net: ipv6: Add ip6_mr_output() Petr Machata
2025-06-13 16:48   ` Jakub Kicinski
2025-06-13 18:59     ` Petr Machata
2025-06-13 21:52       ` Jakub Kicinski
2025-06-12 20:10 ` [PATCH net-next v2 10/14] vxlan: Support MC routing in the underlay Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 11/14] selftests: forwarding: lib: Move smcrouted helpers here Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 12/14] selftests: net: lib: Add ip_link_has_flag() Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 13/14] selftests: forwarding: adf_mcd_start(): Allow configuring custom interfaces Petr Machata
2025-06-12 20:10 ` [PATCH net-next v2 14/14] selftests: forwarding: Add a test for verifying VXLAN MC underlay Petr Machata
2025-06-13 16:57   ` Jakub Kicinski
2025-06-13 17:28     ` Matthieu Baerts
2025-06-16 15:06       ` Petr Machata
2025-06-16 16:18         ` Matthieu Baerts
2025-06-16 17:52           ` Jakub Kicinski
2025-06-16 19:53           ` Petr Machata
2025-06-16 20:40             ` Matthieu Baerts
2025-06-16 20:55               ` Jakub Kicinski
2025-06-13 15:48 ` [PATCH net-next v2 00/14] ipmr, ip6mr: Allow MC-routing locally-generated MC packets Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250613095143.37b5500b@kernel.org \
    --to=kuba@kernel.org \
    --cc=bpoirier@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=razor@blackwall.org \
    --cc=roopa@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).