From: "Yang Huajian(杨华健)" <huajianyang@asrmicro.com>
To: Florian Westphal <fw@strlen.de>
Cc: "pablo@netfilter.org" <pablo@netfilter.org>,
"kadlec@netfilter.org" <kadlec@netfilter.org>,
"razor@blackwall.org" <razor@blackwall.org>,
"idosch@nvidia.com" <idosch@nvidia.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"dsahern@kernel.org" <dsahern@kernel.org>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"horms@kernel.org" <horms@kernel.org>,
"netfilter-devel@vger.kernel.org"
<netfilter-devel@vger.kernel.org>,
"coreteam@netfilter.org" <coreteam@netfilter.org>,
"bridge@lists.linux.dev" <bridge@lists.linux.dev>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 答复: [PATCH] net: Expand headroom to send fragmented packets in bridge fragment forward
Date: Wed, 9 Apr 2025 10:27:52 +0000 [thread overview]
Message-ID: <0a711412f54c4dc6a7d58f4fa391dc0f@exch03.asrmicro.com> (raw)
In-Reply-To: <20250409091821.GA17911@breakpoint.cc>
Thank you for your reply!
> Some network devices that would not able to ping large packet under
> bridge, but large packet ping is successful if not enable NF_CONNTRACK_BRIDGE.
> Can you add a new test to tools/testing/selftests/net/netfilter/ that demonstrates this problem?
Maybe I can't demonstrate this problem with a shell script,
I actually discovered this problem while debugging a wifi network device.
This netdevice is set a large needed_headroom(80), so ll_rs is oversize and goto blackhole.
We can easily to reproduce it by configing needed_headroom in a netdevice,
then add this netdevice to a bridge, and test bridge forwarding.
ping large packet could reproduce this appearance.(successful if not enable NF_CONNTRACK_BRIDGE)
> I guess this should be
>
> if (first_len - hlen > mtu)
> goto blackhole;
> if (skb_headroom(skb) < ll_rs)
> goto expand_headroom;
> ... but I'm not sure what the actual problem is.
Yes, your guess is correct!
Actual problem: I think it is unreasonable to directly drop skb with insufficient headroom.
> Why does this need to make a full skb copy?
> Should that be using skb_expand_head()?
Using skb_expand_head has the same effect.
> Actually, can't you just (re)use the slowpath for the skb_headroom < ll_rs case instead of adding headroom expansion?
I tested it just now, reuse the slowpath will successed.
But maybe this change cannot resolve all cases if the netdevice really needs this headroom.
Best Regards,
Huajian
-----邮件原件-----
发件人: Florian Westphal [mailto:fw@strlen.de]
发送时间: 2025年4月9日 17:18
收件人: Yang Huajian(杨华健) <huajianyang@asrmicro.com>
抄送: pablo@netfilter.org; kadlec@netfilter.org; razor@blackwall.org; idosch@nvidia.com; davem@davemloft.net; dsahern@kernel.org; edumazet@google.com; kuba@kernel.org; pabeni@redhat.com; horms@kernel.org; netfilter-devel@vger.kernel.org; coreteam@netfilter.org; bridge@lists.linux.dev; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
主题: Re: [PATCH] net: Expand headroom to send fragmented packets in bridge fragment forward
Huajian Yang <huajianyang@asrmicro.com> wrote:
> The config NF_CONNTRACK_BRIDGE will change the way fragments are processed.
> Bridge does not know that it is a fragmented packet and forwards it
> directly, after NF_CONNTRACK_BRIDGE is enabled, function
> nf_br_ip_fragment will check and fraglist this packet.
>
> Some network devices that would not able to ping large packet under
> bridge, but large packet ping is successful if not enable NF_CONNTRACK_BRIDGE.
Can you add a new test to tools/testing/selftests/net/netfilter/ that demonstrates this problem?
> In function nf_br_ip_fragment, checking the headroom before sending is
> undoubted, but it is unreasonable to directly drop skb with
> insufficient headroom.
Are we talking about
if (first_len - hlen > mtu
or
skb_headroom(skb) < ll_rs)
?
>
> if (first_len - hlen > mtu ||
> skb_headroom(skb) < ll_rs)
> - goto blackhole;
> + goto expand_headroom;
I guess this should be
if (first_len - hlen > mtu)
goto blackhole;
if (skb_headroom(skb) < ll_rs)
goto expand_headroom;
... but I'm not sure what the actual problem is.
> +expand_headroom:
> + struct sk_buff *expand_skb;
> +
> + expand_skb = skb_copy_expand(skb, ll_rs, skb_tailroom(skb), GFP_ATOMIC);
> + if (unlikely(!expand_skb))
> + goto blackhole;
Why does this need to make a full skb copy?
Should that be using skb_expand_head()?
> slow_path:
Actually, can't you just (re)use the slowpath for the skb_headroom < ll_rs case instead of adding headroom expansion?
next prev parent reply other threads:[~2025-04-09 10:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-09 7:33 [PATCH] net: Expand headroom to send fragmented packets in bridge fragment forward Huajian Yang
2025-04-09 9:18 ` Florian Westphal
2025-04-09 10:27 ` Yang Huajian(杨华健) [this message]
2025-04-09 10:45 ` 答复: " Florian Westphal
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=0a711412f54c4dc6a7d58f4fa391dc0f@exch03.asrmicro.com \
--to=huajianyang@asrmicro.com \
--cc=bridge@lists.linux.dev \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=razor@blackwall.org \
/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).