Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rtnetlink: add needed_{head,tail}room attributes

Various network interface types make use of needed_{head,tail}room values
to efficiently reserve buffer space for additional encapsulation headers,
such as VXLAN, Geneve, IPSec, etc. However, it is not currently possible
to query these values in a generic way.

Introduce ability to query the needed_{head,tail}room values of a network
device via rtnetlink, such that applications that may wish to use these
values can do so.

For example, Cilium agent iterates over present devices based on user config
(direct routing, vxlan, geneve, wireguard etc.) and in future will configure
netkit in order to expose the needed_{head,tail}room into K8s pods. See
b9ed315d3c4c ("netkit: Allow for configuring needed_{head,tail}room").

Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alasdair McWilliam <alasdair@mcwilliam.dev>
Reviewed-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://patch.msgid.link/20250917095543.14039-1-alasdair@mcwilliam.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Alasdair McWilliam and committed by
Jakub Kicinski
b73b8146 0c2a4d30

+17 -1
+6
Documentation/netlink/specs/rt-link.yaml
··· 1057 1057 - 1058 1058 name: netns-immutable 1059 1059 type: u8 1060 + - 1061 + name: headroom 1062 + type: u16 1063 + - 1064 + name: tailroom 1065 + type: u16 1060 1066 - 1061 1067 name: prop-list-link-attrs 1062 1068 subset-of: link-attrs
+2
include/uapi/linux/if_link.h
··· 379 379 IFLA_DPLL_PIN, 380 380 IFLA_MAX_PACING_OFFLOAD_HORIZON, 381 381 IFLA_NETNS_IMMUTABLE, 382 + IFLA_HEADROOM, 383 + IFLA_TAILROOM, 382 384 __IFLA_MAX 383 385 }; 384 386
+9 -1
net/core/rtnetlink.c
··· 1326 1326 + rtnl_devlink_port_size(dev) 1327 1327 + rtnl_dpll_pin_size(dev) 1328 1328 + nla_total_size(8) /* IFLA_MAX_PACING_OFFLOAD_HORIZON */ 1329 + + nla_total_size(2) /* IFLA_HEADROOM */ 1330 + + nla_total_size(2) /* IFLA_TAILROOM */ 1329 1331 + 0; 1330 1332 } 1331 1333 ··· 2093 2091 nla_put_u32(skb, IFLA_CARRIER_UP_COUNT, 2094 2092 atomic_read(&dev->carrier_up_count)) || 2095 2093 nla_put_u32(skb, IFLA_CARRIER_DOWN_COUNT, 2096 - atomic_read(&dev->carrier_down_count))) 2094 + atomic_read(&dev->carrier_down_count)) || 2095 + nla_put_u16(skb, IFLA_HEADROOM, 2096 + READ_ONCE(dev->needed_headroom)) || 2097 + nla_put_u16(skb, IFLA_TAILROOM, 2098 + READ_ONCE(dev->needed_tailroom))) 2097 2099 goto nla_put_failure; 2098 2100 2099 2101 if (rtnl_fill_proto_down(skb, dev)) ··· 2249 2243 [IFLA_GSO_IPV4_MAX_SIZE] = NLA_POLICY_MIN(NLA_U32, MAX_TCP_HEADER + 1), 2250 2244 [IFLA_GRO_IPV4_MAX_SIZE] = { .type = NLA_U32 }, 2251 2245 [IFLA_NETNS_IMMUTABLE] = { .type = NLA_REJECT }, 2246 + [IFLA_HEADROOM] = { .type = NLA_REJECT }, 2247 + [IFLA_TAILROOM] = { .type = NLA_REJECT }, 2252 2248 }; 2253 2249 2254 2250 static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {