* [PATCH iproute2-next 1/2] uapi: add IFLA_TX_EXTRA_HEADROOM
2026-11-07 3:48 [PATCH iproute2-next 0/2] iplink: add tx_extra_headroom Tianyi Gao
@ 2026-11-07 3:48 ` Tianyi Gao
2026-11-07 3:48 ` [PATCH iproute2-next 2/2] iplink: add tx_extra_headroom attribute Tianyi Gao
1 sibling, 0 replies; 3+ messages in thread
From: Tianyi Gao @ 2026-11-07 3:48 UTC (permalink / raw)
To: netdev
Cc: David Ahern, Stephen Hemminger, David Keogh,
Jesper Dangaard Brouer, kernel-team, nh-open-source, Tianyi Gao
Add IFLA_TX_EXTRA_HEADROOM from the net-next series "net: configurable
extra TX headroom for local egress".
Signed-off-by: Tianyi Gao <tianyi@cloudflare.com>
---
include/uapi/linux/if_link.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 7ce01d81..21a26dc6 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -382,6 +382,7 @@ enum {
IFLA_HEADROOM,
IFLA_TAILROOM,
IFLA_PACING_OFFLOAD,
+ IFLA_TX_EXTRA_HEADROOM,
__IFLA_MAX
};
--
2.56.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH iproute2-next 2/2] iplink: add tx_extra_headroom attribute
2026-11-07 3:48 [PATCH iproute2-next 0/2] iplink: add tx_extra_headroom Tianyi Gao
2026-11-07 3:48 ` [PATCH iproute2-next 1/2] uapi: add IFLA_TX_EXTRA_HEADROOM Tianyi Gao
@ 2026-11-07 3:48 ` Tianyi Gao
1 sibling, 0 replies; 3+ messages in thread
From: Tianyi Gao @ 2026-11-07 3:48 UTC (permalink / raw)
To: netdev
Cc: David Ahern, Stephen Hemminger, David Keogh,
Jesper Dangaard Brouer, kernel-team, nh-open-source, Tianyi Gao
Add support for IFLA_TX_EXTRA_HEADROOM, which sets and reports the
extra TX headroom of a device.
$ ip link add veth0 tx_extra_headroom 256 type veth peer name veth1 tx_extra_headroom 256
$ ip -details link show veth0
12: veth0@veth1: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 22:5d:72:d3:f4:43 brd ff:ff:ff:ff:ff:ff promiscuity 0 allmulti 0 minmtu 68 maxmtu 65535
veth addrgenmode eui64 numtxqueues 8 numrxqueues 8 gso_max_size 65536 gso_max_segs 65535 tso_max_size 524280 tso_max_segs 65535 gro_max_size 65536 gso_ipv4_max_size 65536 gro_ipv4_max_size 65536 tx_extra_headroom 256
Signed-off-by: Tianyi Gao <tianyi@cloudflare.com>
---
ip/ipaddress.c | 6 ++++++
ip/iplink.c | 10 ++++++++++
man/man8/ip-link.8.in | 13 +++++++++++++
3 files changed, 29 insertions(+)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index ff85792f..8442e5cb 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1238,6 +1238,12 @@ int print_linkinfo(struct nlmsghdr *n, void *arg)
"gro_ipv4_max_size %u ",
rta_getattr_u32(tb[IFLA_GRO_IPV4_MAX_SIZE]));
+ if (tb[IFLA_TX_EXTRA_HEADROOM])
+ print_uint(PRINT_ANY,
+ "tx_extra_headroom",
+ "tx_extra_headroom %u ",
+ rta_getattr_u32(tb[IFLA_TX_EXTRA_HEADROOM]));
+
if (tb[IFLA_PHYS_PORT_NAME])
print_string(PRINT_ANY,
"phys_port_name",
diff --git a/ip/iplink.c b/ip/iplink.c
index c6aee8b6..079b4a63 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -124,6 +124,7 @@ void iplink_usage(void)
" [ protodown_reason PREASON { on | off } ]\n"
" [ gso_max_size BYTES ] [ gso_ipv4_max_size BYTES ] [ gso_max_segs PACKETS ]\n"
" [ gro_max_size BYTES ] [ gro_ipv4_max_size BYTES ]\n"
+ " [ tx_extra_headroom BYTES ]\n"
"\n"
" ip link show [ DEVICE | group GROUP ] [ { up | down } ] [master DEV] [vrf NAME]\n"
" [type TYPE] [nomaster] [ novf ]\n"
@@ -1247,6 +1248,15 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
*argv);
addattr32(&req->n, sizeof(*req),
IFLA_GRO_IPV4_MAX_SIZE, max_size);
+ } else if (strcmp(*argv, "tx_extra_headroom") == 0) {
+ __u32 headroom;
+
+ NEXT_ARG();
+ if (get_u32(&headroom, *argv, 0))
+ invarg("Invalid \"tx_extra_headroom\" value\n",
+ *argv);
+ addattr32(&req->n, sizeof(*req),
+ IFLA_TX_EXTRA_HEADROOM, headroom);
} else if (strcmp(*argv, "parentdev") == 0) {
NEXT_ARG();
addattr_l(&req->n, sizeof(*req), IFLA_PARENT_DEV_NAME,
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index 719781bd..976d546e 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -48,6 +48,9 @@ ip-link \- network device configuration
.RB "[ " gro_ipv4_max_size
.IR BYTES " ]"
.br
+.RB "[ " tx_extra_headroom
+.IR BYTES " ]"
+.br
.RB "[ " netns " {"
.IR PID " | " NETNSNAME " | " NETNSFILE " } ]"
.br
@@ -105,6 +108,9 @@ ip-link \- network device configuration
.RB "[ " gro_ipv4_max_size
.IR BYTES " ]"
.br
+.RB "[ " tx_extra_headroom
+.IR BYTES " ]"
+.br
.RB "[ " name
.IR NEWNAME " ]"
.br
@@ -514,6 +520,13 @@ specifies the maximum size of a IPv4 packet built by GRO stack on this
device. This is especially used for BIG TCP to allow the size of a
merged IPv4 GSO packet on this device greater than 65536.
+.TP
+.BI tx_extra_headroom " BYTES "
+specifies the extra TX headroom that is reserved when a UDP, ping, raw,
+AF_PACKET or AF_XDP (copy mode) socket allocates a packet for this
+device. It avoids a reallocation when a TC egress program adds headers,
+and a copy when generic XDP runs on the peer of a veth device.
+
.TP
.BI index " IDX "
specifies the desired index of the new virtual device. The link
--
2.56.0
^ permalink raw reply related [flat|nested] 3+ messages in thread