summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2026-02-05 13:59:00 +0300
committerPaolo Abeni <pabeni@redhat.com>2026-02-05 13:59:01 +0300
commit021718d2cc1a2df2f53b06968fa89280199371bd (patch)
treef1d09f5cf5ea5f006619c271065441352af0aac6 /include/net
parent0cbcc0fdce2b90a83a8a77b04c6f8da3d22fc591 (diff)
parent3ffecc14ec7ee8eb941e50c0076798a042924c62 (diff)
downloadlinux-021718d2cc1a2df2f53b06968fa89280199371bd.tar.xz
Merge branch 'move-can-skb-headroom-content-to-skb-extensions'
Oliver Hartkopp says: ==================== move CAN skb headroom content to skb extensions CAN bus related skbuffs (ETH_P_CAN/ETH_P_CANFD/ETH_P_CANXL) simply contain CAN frame structs for CAN CC/FD/XL of skb->len length at skb->data. Those CAN skbs do not have network/mac/transport headers nor other such references for encapsulated protocols like ethernet/IP protocols. To store data for CAN specific use-cases all CAN bus related skbuffs are created with a 16 byte private skb headroom (struct can_skb_priv). Using the skb headroom and accessing skb->head for this private data led to several problems in the past likely due to "The struct can_skb_priv business is highly unconventional for the networking stack." [1] This patch set aims to remove the unconventional skb headroom usage for CAN bus related skbuffs and use the common skb extensions instead. [1] https://lore.kernel.org/linux-can/20260104074222.29e660ac@kernel.org/ - v1: https://patch.msgid.link/20260125201601.5018-1-socketcan@hartkopp.net - v2: https://lore.kernel.org/linux-can/20260128-can-skb-ext-v2-0-fe64aa152c8a@pengutronix.de/ - v4: https://lore.kernel.org/netdev/20260128-can_skb_ext-v1-0-330f60fd5d7e@hartkopp.net/ - v5: https://patch.msgid.link/20260129-can_skb_ext-v5-0-21252fdc8900@hartkopp.net - v6: https://patch.msgid.link/20260130-can_skb_ext-v6-0-8fceafab7f26@hartkopp.net - v7: https://patch.msgid.link/20260131-can_skb_ext-v7-0-dd0f8f84a83d@hartkopp.net Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> ==================== Link: https://patch.msgid.link/20260201-can_skb_ext-v8-0-3635d790fe8b@hartkopp.net Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/can.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/net/can.h b/include/net/can.h
new file mode 100644
index 000000000000..6db9e826f0e0
--- /dev/null
+++ b/include/net/can.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
+/*
+ * net/can.h
+ *
+ * Definitions for the CAN network socket buffer extensions
+ *
+ * Copyright (C) 2026 Oliver Hartkopp <socketcan@hartkopp.net>
+ *
+ */
+
+#ifndef _NET_CAN_H
+#define _NET_CAN_H
+
+/**
+ * struct can_skb_ext - skb extensions for CAN specific content
+ * @can_iif: ifindex of the first interface the CAN frame appeared on
+ * @can_framelen: cached echo CAN frame length for bql
+ * @can_gw_hops: can-gw CAN frame time-to-live counter
+ * @can_ext_flags: CAN skb extensions flags
+ */
+struct can_skb_ext {
+ int can_iif;
+ u16 can_framelen;
+ u8 can_gw_hops;
+ u8 can_ext_flags;
+};
+
+#endif /* _NET_CAN_H */