netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jiri Pirko <jiri@resnulli.us>
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,
	przemyslaw.kitszel@intel.com
Subject: Re: [patch net-next v7 5/9] genetlink: introduce per-sock family private storage
Date: Thu, 14 Dec 2023 19:23:58 -0800	[thread overview]
Message-ID: <20231214192358.1b150fda@kernel.org> (raw)
In-Reply-To: <20231214181549.1270696-6-jiri@resnulli.us>

On Thu, 14 Dec 2023 19:15:45 +0100 Jiri Pirko wrote:
> - converted family->sock_priv_list to family->sock_privs xarray
>   and use it to store the per-socket privs, use sock pointer as
>   an xarrar index. This made the code much simpler

Nice! 

FWIW I think I remember Willy saying that storing pointers in xarray is
comparatively inefficient / slow, but we can cross that bridge later.

> +void *__genl_sk_priv_get(struct genl_family *family, struct sock *sk)
> +{
> +	if (WARN_ON_ONCE(!family->sock_privs))
> +		return NULL;
> +	return xa_load(family->sock_privs, (unsigned long) sk);
> +}
> +
> +/**
> + * genl_sk_priv_get - Get family private pointer for socket
> + *
> + * @family: family
> + * @sk: socket
> + *
> + * Lookup a private memory for a Generic netlink family and specified socket.
> + * Allocate the private memory in case it was not already done.
> + *
> + * Return: valid pointer on success, otherwise negative error value
> + * encoded by ERR_PTR().

nit: probably better if __genl_sk_priv_get() returned an error pointer
     if family is broken, save ourselves the bot-generated "fixes"..

> + */
> +void *genl_sk_priv_get(struct genl_family *family, struct sock *sk)
> +{
> +	void *priv, *old_priv;
> +
> +	priv = __genl_sk_priv_get(family, sk);
> +	if (priv)
> +		return priv;


  parent reply	other threads:[~2023-12-15  3:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 18:15 [patch net-next v7 0/9] devlink: introduce notifications filtering Jiri Pirko
2023-12-14 18:15 ` [patch net-next v7 1/9] devlink: use devl_is_registered() helper instead xa_get_mark() Jiri Pirko
2023-12-14 18:15 ` [patch net-next v7 2/9] devlink: introduce __devl_is_registered() helper and use it instead of xa_get_mark() Jiri Pirko
2023-12-14 18:15 ` [patch net-next v7 3/9] devlink: send notifications only if there are listeners Jiri Pirko
2023-12-14 18:15 ` [patch net-next v7 4/9] devlink: introduce a helper for netlink multicast send Jiri Pirko
2023-12-14 18:15 ` [patch net-next v7 5/9] genetlink: introduce per-sock family private storage Jiri Pirko
2023-12-15  3:05   ` Jacob Keller
2023-12-15  3:23   ` Jakub Kicinski [this message]
2023-12-15 10:03     ` Jiri Pirko
2023-12-15 10:17     ` Jiri Pirko
2023-12-16  1:47       ` Jakub Kicinski
2023-12-16  9:17         ` Jiri Pirko
2023-12-14 18:15 ` [patch net-next v7 6/9] netlink: introduce typedef for filter function Jiri Pirko
2023-12-14 18:15 ` [patch net-next v7 7/9] genetlink: introduce helpers to do filtered multicast Jiri Pirko
2023-12-14 18:15 ` [patch net-next v7 8/9] devlink: add a command to set notification filter and use it for multicasts Jiri Pirko
2023-12-14 18:15 ` [patch net-next v7 9/9] devlink: extend multicast filtering by port index Jiri Pirko

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=20231214192358.1b150fda@kernel.org \
    --to=kuba@kernel.org \
    --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=jiri@resnulli.us \
    --cc=johannes@sipsolutions.net \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.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;
as well as URLs for NNTP newsgroup(s).