From: Jiri Pirko <jiri@resnulli.us>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Feng zhou <zhoufeng.zf@bytedance.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
john.fastabend@gmail.com, bigeasy@linutronix.de,
lorenzo@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
yangzhenze@bytedance.com, wangdongdong.6@bytedance.com
Subject: Re: [PATCH] net: Don't allow to attach xdp if bond slave device's upper already has a program
Date: Thu, 15 Aug 2024 14:36:53 +0200 [thread overview]
Message-ID: <Zr32ZZ8e4RhYN1xd@nanopsycho.orion> (raw)
In-Reply-To: <fd30815f-cf2b-42a0-9911-4f71e4e4dd14@redhat.com>
Thu, Aug 15, 2024 at 01:18:33PM CEST, pabeni@redhat.com wrote:
>On 8/14/24 11:08, Feng zhou wrote:
>> From: Feng Zhou <zhoufeng.zf@bytedance.com>
>>
>> Cannot attach when an upper device already has a program, This
>> restriction is only for bond's slave devices, and should not be
>> accidentally injured for devices like eth0 and vxlan0.
>>
>> Signed-off-by: Feng Zhou <zhoufeng.zf@bytedance.com>
>> ---
>> net/core/dev.c | 10 ++++++----
>> 1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 6ea1d20676fb..e1f87662376a 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -9501,10 +9501,12 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
>> }
>> /* don't allow if an upper device already has a program */
>> - netdev_for_each_upper_dev_rcu(dev, upper, iter) {
>> - if (dev_xdp_prog_count(upper) > 0) {
>> - NL_SET_ERR_MSG(extack, "Cannot attach when an upper device already has a program");
>> - return -EEXIST;
>> + if (netif_is_bond_slave(dev)) {
>
>I think we want to consider even team port devices.
netif_is_lag_port()
>
>Thanks,
>
>Paolo
>
next prev parent reply other threads:[~2024-08-15 12:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 9:08 [PATCH] net: Don't allow to attach xdp if bond slave device's upper already has a program Feng zhou
2024-08-14 10:03 ` Toke Høiland-Jørgensen
2024-08-15 11:18 ` Paolo Abeni
2024-08-15 12:36 ` Jiri Pirko [this message]
2024-08-22 8:25 ` [External] " Feng Zhou
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=Zr32ZZ8e4RhYN1xd@nanopsycho.orion \
--to=jiri@resnulli.us \
--cc=ast@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=wangdongdong.6@bytedance.com \
--cc=yangzhenze@bytedance.com \
--cc=zhoufeng.zf@bytedance.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