From: Jiri Pirko <jiri@resnulli.us>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, pabeni@redhat.com, davem@davemloft.net,
edumazet@google.com, jacob.e.keller@intel.com, jhs@mojatatu.com,
johannes@sipsolutions.net, andriy.shevchenko@linux.intel.com,
amritha.nambiar@intel.com, sdf@google.com, horms@kernel.org
Subject: Re: [patch net-next v3 5/9] genetlink: implement release callback and free sk_user_data there
Date: Wed, 22 Nov 2023 10:29:44 +0100 [thread overview]
Message-ID: <ZV3KCF7Q2fwZyzg4@nanopsycho> (raw)
In-Reply-To: <20231121095512.089139f9@kernel.org>
Tue, Nov 21, 2023 at 06:55:12PM CET, kuba@kernel.org wrote:
>On Tue, 21 Nov 2023 14:12:55 +0100 Jiri Pirko wrote:
>> >How is this supposed to work?
>> >
>> >genetlink sockets are not bound to a family. User can use a single
>> >socket to subscribe to notifications from all families and presumably
>> >each one of the would interpret sk->sk_user_data as their own state?
>> >
>> >You need to store the state locally in the family, keyed
>> >on pid, and free it using the NETLINK_URELEASE notifier...
>>
>> Well, pin can have 2 sockets of different config. I think that sk/family
>> tuple is needed. I'm exploring a possibility to have genetlink
>> sk->sk_user_data used to store the hashlist keyed by the sk/family tuple.
>
>If you're doing it centrally, please put the state as a new field in
>the netlink socket. sk_user_data is for the user.
I planned to use sk_user_data. What do you mean it is for the user?
I see it is already used for similar usecase by connector for example:
$ git grep sk_user_data drivers/connector/
drivers/connector/cn_proc.c: if (!dsk || !dsk->sk_user_data || !data)
drivers/connector/cn_proc.c: val = ((struct proc_input *)(dsk->sk_user_data))->event_type;
drivers/connector/cn_proc.c: mc_op = ((struct proc_input *)(dsk->sk_user_data))->mcast_op;
drivers/connector/cn_proc.c: if (sk->sk_user_data == NULL) {
drivers/connector/cn_proc.c: sk->sk_user_data = kzalloc(sizeof(struct proc_input),
drivers/connector/cn_proc.c: if (sk->sk_user_data == NULL) {
drivers/connector/cn_proc.c: ((struct proc_input *)(sk->sk_user_data))->mcast_op;
drivers/connector/cn_proc.c: ((struct proc_input *)(sk->sk_user_data))->event_type =
drivers/connector/cn_proc.c: ((struct proc_input *)(sk->sk_user_data))->mcast_op = mc_op;
drivers/connector/cn_proc.c: ((struct proc_input *)(sk->sk_user_data))->event_type =
drivers/connector/connector.c: kfree(sk->sk_user_data);
drivers/connector/connector.c: sk->sk_user_data = NULL;
>
>Also let's start with a list, practically speaking using one socket
>in many families should be very rare.
Okay.
next prev parent reply other threads:[~2023-11-22 9:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 8:46 [patch net-next v3 0/9] devlink: introduce notifications filtering Jiri Pirko
2023-11-20 8:46 ` [patch net-next v3 1/9] devlink: use devl_is_registered() helper instead xa_get_mark() Jiri Pirko
2023-11-20 8:46 ` [patch net-next v3 2/9] devlink: introduce __devl_is_registered() helper and use it instead of xa_get_mark() Jiri Pirko
2023-11-20 8:46 ` [patch net-next v3 3/9] devlink: send notifications only if there are listeners Jiri Pirko
2023-11-20 8:46 ` [patch net-next v3 4/9] devlink: introduce a helper for netlink multicast send Jiri Pirko
2023-11-20 8:46 ` [patch net-next v3 5/9] genetlink: implement release callback and free sk_user_data there Jiri Pirko
2023-11-21 2:50 ` Jakub Kicinski
2023-11-21 7:36 ` Jiri Pirko
2023-11-21 13:12 ` Jiri Pirko
2023-11-21 17:55 ` Jakub Kicinski
2023-11-22 9:29 ` Jiri Pirko [this message]
2023-11-22 17:08 ` Jakub Kicinski
2023-11-22 18:20 ` Jiri Pirko
2023-11-22 19:50 ` Jakub Kicinski
2023-11-23 6:37 ` Jiri Pirko
2023-11-23 10:32 ` Jiri Pirko
2023-11-23 16:24 ` Jakub Kicinski
2023-11-23 16:53 ` Jiri Pirko
2023-11-20 8:46 ` [patch net-next v3 6/9] netlink: introduce typedef for filter function Jiri Pirko
2023-11-20 8:46 ` [patch net-next v3 7/9] genetlink: introduce helpers to do filtered multicast Jiri Pirko
2023-11-20 8:46 ` [patch net-next v3 8/9] devlink: add a command to set notification filter and use it for multicasts Jiri Pirko
2023-11-21 2:51 ` Jakub Kicinski
2023-11-21 7:35 ` Jiri Pirko
2023-11-20 8:46 ` [patch net-next v3 9/9] devlink: extend multicast filtering by port index Jiri Pirko
2023-11-21 2:29 ` [patch net-next v3 0/9] devlink: introduce notifications filtering 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=ZV3KCF7Q2fwZyzg4@nanopsycho \
--to=jiri@resnulli.us \
--cc=amritha.nambiar@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=jhs@mojatatu.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@google.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