Re: [PATCH can-next v2 2/3] af_can: store socket pointers in struct netns_can
Marc Kleine-Budde <[email protected]>
| Newsgroups | org.kernel.vger.linux-can |
|---|---|
| Message-ID | <[email protected]> |
On 06.08.2026 17:15:51, Oliver Hartkopp wrote: > > > On 06.08.26 16:16, Marc Kleine-Budde wrote: > > On 06.08.2026 15:14:14, Filippo Storniolo wrote: > > > AF_CAN sockets need to be stored in the netns_can structure > > > in order to be retrieved by the CAN diagnostic module when > > > a netlink request message is issued by the userspace. > > > > > > On socket creation (`can_create()`), add the pointer to the > > > new socket to `netns_can::sk_list`. During socket release > > > (`isotp_release()`, `raw_release()`, `j1939_release()`, > > > `bcm_release()`), remove the corresponding pointer from > > > this list. > > > > > > Since this is a prerequisite of the CAN diagnostic module, > > > deletes and insert operations are conditioned by > > > IS_ENABLED(CONFIG_CAN_DIAG). > > > > > > Signed-off-by: Filippo Storniolo <[email protected]> > > > --- > > > include/linux/can/core.h | 11 +++++++++++ > > > include/net/netns/can.h | 6 ++++++ > > > net/can/af_can.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ > > > net/can/bcm.c | 2 ++ > > > net/can/isotp.c | 2 ++ > > > net/can/j1939/socket.c | 2 ++ > > > net/can/raw.c | 2 ++ > > > 7 files changed, 75 insertions(+) > > > > > > diff --git a/include/linux/can/core.h b/include/linux/can/core.h > > > index 3287232e3cad..5132f5c89b7c 100644 > > > --- a/include/linux/can/core.h > > > +++ b/include/linux/can/core.h > > > @@ -61,4 +61,15 @@ extern int can_send(struct sk_buff *skb, int loop); > > > void can_set_skb_uid(struct sk_buff *skb); > > > void can_sock_destruct(struct sock *sk); > > > > > > +/* function prototypes for the CAN diag module */ > > > +#if IS_ENABLED(CONFIG_CAN_DIAG) > > > +void lock_can_diag_mutex(struct net *net); > > > +void unlock_can_diag_mutex(struct net *net); > > > +void can_add_sock_sklist(struct sock *sk); > > > +void can_remove_sock_sklist(struct sock *sk); > > > +#else > > > +#define can_add_sock_sklist(sk) > > > +#define can_remove_sock_sklist(sk) > > > > Please add static inline functions for these. > > AFAIK "inline" is not wanted anymore and checkpatch complains about it. I'm only talking about the no-op functions. no-op functions must be "static inline". With defines we don't have any type checking, with static inline no-ops, we do. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSl+MghEFFAdY3pYJLMOmT6rpmt0gUCanS5IQAKCRDMOmT6rpmt 0sq3AQCEtewzGNZDFKlO7lY4HjcjRJJI/uvuz+GhKzKKRUpc4wEAnfzve5nl56bP 6y0jzKbw3bCzhdjQ1mLkN6KlZdBLxAw= =b67K -----END PGP SIGNATURE-----