[PATCH v2 0/3] can: raw: optimize the sizes of struct uniqframe and struct raw_sock

Vincent Mailhol posted 3 patches 2 weeks, 1 day ago
net/can/raw.c | 65 ++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 38 insertions(+), 27 deletions(-)
[PATCH v2 0/3] can: raw: optimize the sizes of struct uniqframe and struct raw_sock
Posted by Vincent Mailhol 2 weeks, 1 day ago
A few bytes can be shaved out of can raw's struct uniqframe and struct
raw_sock.

Patch #1 reorders struct uniqframe fields to save 8 bytes.

Patch #2 and #3 modify struct raw_sock to use bitfields and to reorder
its fields to save 24 bytes in total.

Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
Changes in v2:

  - in patch #2 also add raw_sock->bound and raw_sock->join_filters to
    the bitfield.

  - add Oliver's Ack tags.

Link to v1: https://lore.kernel.org/r/20250915-can-raw-repack-v1-0-5ea293bc6d33@kernel.org

---
Vincent Mailhol (3):
      can: raw: reorder struct uniqframe's members to optimise packing
      can: raw: use bitfields to store flags in struct raw_sock
      can: raw: reorder struct raw_sock's members to optimise packing

 net/can/raw.c | 65 ++++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 38 insertions(+), 27 deletions(-)
---
base-commit: 5e87fdc37f8dc619549d49ba5c951b369ce7c136
change-id: 20250915-can-raw-repack-c21aab25cc11

Best regards,
-- 
Vincent Mailhol <mailhol@kernel.org>
Re: [PATCH v2 0/3] can: raw: optimize the sizes of struct uniqframe and struct raw_sock
Posted by Marc Kleine-Budde 1 week, 5 days ago
On 17.09.2025 13:48:23, Vincent Mailhol wrote:
> A few bytes can be shaved out of can raw's struct uniqframe and struct
> raw_sock.
> 
> Patch #1 reorders struct uniqframe fields to save 8 bytes.
> 
> Patch #2 and #3 modify struct raw_sock to use bitfields and to reorder
> its fields to save 24 bytes in total.
> 
> Signed-off-by: Vincent Mailhol <mailhol@kernel.org>

Applied to linux-can-next.

Thanks,
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   |