From: Daniel Zahka <daniel.zahka@gmail.com>
To: Wei Wang <weibunny@fb.com>,
netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
David Wei <dw@davidwei.uk>, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH v2 net-next 6/9] psp: Add new netlink cmd for dev-assoc and dev-disassoc
Date: Wed, 4 Mar 2026 11:17:29 -0500 [thread overview]
Message-ID: <316b1fdd-f495-4a12-acd8-669ba5f2bf26@gmail.com> (raw)
In-Reply-To: <20260304000050.3366381-7-weibunny@fb.com>
On 3/3/26 7:00 PM, Wei Wang wrote:
> +int psp_nl_dev_disassoc_doit(struct sk_buff *skb, struct genl_info *info)
> +{
> + struct psp_assoc_dev *entry, *found = NULL;
> + struct psp_dev *psd = info->user_ptr[0];
> + u32 assoc_ifindex;
> + struct sk_buff *rsp;
> + struct net *net;
> + int nsid;
> +
> + if (GENL_REQ_ATTR_CHECK(info, PSP_A_DEV_IFINDEX) ||
> + GENL_REQ_ATTR_CHECK(info, PSP_A_DEV_NSID))
> + return -EINVAL;
> +
> + nsid = nla_get_s32(info->attrs[PSP_A_DEV_NSID]);
> + net = get_net_ns_by_id(genl_info_net(info), nsid);
> + if (!net) {
> + NL_SET_BAD_ATTR(info->extack, info->attrs[PSP_A_DEV_NSID]);
> + return -EINVAL;
> + }
> +
> + assoc_ifindex = nla_get_u32(info->attrs[PSP_A_DEV_IFINDEX]);
> +
> + /* Search the association list by ifindex and netns */
> + list_for_each_entry(entry, &psd->assoc_dev_list, dev_list) {
> + if (entry->assoc_dev->ifindex == assoc_ifindex &&
> + dev_net(entry->assoc_dev) == net) {
> + found = entry;
> + break;
> + }
> + }
> +
> + if (!found) {
> + put_net(net);
> + NL_SET_BAD_ATTR(info->extack, info->attrs[PSP_A_DEV_IFINDEX]);
> + return -ENODEV;
> + }
> +
> + rsp = psp_nl_reply_new(info);
> + if (!rsp) {
> + put_net(net);
> + return -ENOMEM;
> + }
> +
> + /* Remove from the association list */
> + list_del(&found->dev_list);
> + rcu_assign_pointer(found->assoc_dev->psp_dev, NULL);
> + netdev_put(found->assoc_dev, &found->dev_tracker);
> + kfree(found);
in the case where found was the last associated device in its netns in
psd->assoc_dev_list, listeners in that netns will not receive any
notification that a psp device has gone away.
> +
> + put_net(net);
> +
> + psp_nl_notify_dev(psd, PSP_CMD_DEV_CHANGE_NTF);
next prev parent reply other threads:[~2026-03-04 16:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 0:00 [PATCH v2 net-next 0/9] psp: Add support for dev-assoc/disassoc Wei Wang
2026-03-04 0:00 ` [PATCH v2 net-next 2/9] selftests/net: Export Netlink class via lib.py Wei Wang
2026-03-04 0:00 ` [PATCH v2 net-next 3/9] selftests/net: Add env for container based tests Wei Wang
2026-03-04 0:00 ` [PATCH v2 net-next 4/9] selftests/net: Add netkit container ping test Wei Wang
2026-03-04 0:00 ` [PATCH v2 net-next 5/9] psp: add unprivileged version of psp_device_get_locked Wei Wang
2026-03-04 15:00 ` Daniel Zahka
2026-03-04 16:25 ` Willem de Bruijn
2026-03-04 17:42 ` Wei Wang
2026-03-04 18:01 ` Daniel Zahka
2026-03-04 18:03 ` Daniel Zahka
2026-03-04 22:31 ` Wei Wang
2026-03-04 23:41 ` Willem de Bruijn
2026-03-06 21:34 ` Jakub Kicinski
2026-03-04 0:00 ` [PATCH v2 net-next 6/9] psp: Add new netlink cmd for dev-assoc and dev-disassoc Wei Wang
2026-03-04 15:20 ` Daniel Zahka
2026-03-04 16:17 ` Daniel Zahka [this message]
2026-03-04 17:28 ` Wei Wang
2026-03-04 0:00 ` [PATCH v2 net-next 7/9] psp: add a new netdev event for dev unregister Wei Wang
2026-03-04 0:00 ` [PATCH v2 net-next 8/9] selftests/net: Add bpf skb forwarding program Wei Wang
2026-03-04 0:00 ` [PATCH v2 net-next 9/9] selftest/net: psp: Add test for dev-assoc/disassoc Wei Wang
2026-03-06 21:53 ` 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=316b1fdd-f495-4a12-acd8-669ba5f2bf26@gmail.com \
--to=daniel.zahka@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=weibunny@fb.com \
--cc=willemdebruijn.kernel@gmail.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