David Ahern [Sun, 28 Jun 2026 17:13:03 +0000 (11:13 -0600)]
Merge branch 'devlink-per-port-res' into next
Tariq Toukan says:
====================
Currently, devlink resource show only supports querying a specific
device and displays device-level resources. However, some resources
are per-port, such as the maximum number of SFs that can be created
on a specific PF port.
This series extends devlink resource show with full support for
port-level resources, including a dump mode, per-port querying syntax,
and scope filtering. In preparation for these features, the first two
patches refactor how dpipe tables are handled to unblock dump support
and ensure errors in secondary queries are non-fatal.
The series is organized as follows:
Patch 1 splits the dpipe tables display into a separate function.
Patch 2 moves the dpipe tables query into the per-device resource show
callback, ensuring it behaves correctly during a multi-device dump.
Patch 3 fixes a pre-existing memory leak in resource_ctx_fini.
Patch 4 adds dump support to resource show (no device required).
Patch 5 shows port-level resources returned in a dump reply.
Patch 6 adds DEV/PORT_INDEX syntax to resource show.
Patch 7 adds scope filter to resource show.
With this series, users can query resources at all levels:
$ devlink resource show
pci/0000:03:00.0:
name local_max_SFs size 508 unit entry
name external_max_SFs size 508 unit entry
pci/0000:03:00.0/196608:
name max_SFs size 20 unit entry
$ devlink resource show scope dev
pci/0000:03:00.0:
name local_max_SFs size 508 unit entry
name external_max_SFs size 508 unit entry
$ devlink resource show scope port
pci/0000:03:00.0/196608:
name max_SFs size 20 unit entry
$ devlink resource show pci/0000:03:00.0/196608
pci/0000:03:00.0/196608:
name max_SFs size 20 unit entry
This series is the userspace counterpart to the kernel series:
https://lore.kernel.org/all/20260407194107.148063-1-tariqt@nvidia.com/
Or Har-Toov [Tue, 9 Jun 2026 05:39:53 +0000 (08:39 +0300)]
devlink: add scope filter to resource show
Add optional 'scope { dev | port }' argument to 'devlink resource show'
without a device handle to filter the full dump to device-level or
port-level resources only.
Example - dump only device-level resources:
$ devlink resource show scope dev
pci/0000:03:00.0:
name max_local_SFs size 128 unit entry dpipe_tables none
name max_external_SFs size 128 unit entry dpipe_tables none
pci/0000:03:00.1:
name max_local_SFs size 128 unit entry dpipe_tables none
name max_external_SFs size 128 unit entry dpipe_tables none
Example - dump only port-level resources:
$ devlink resource show scope port
pci/0000:03:00.0/196608:
name max_SFs size 128 unit entry dpipe_tables none
pci/0000:03:00.0/196609:
name max_SFs size 128 unit entry dpipe_tables none
pci/0000:03:00.1/196708:
name max_SFs size 128 unit entry dpipe_tables none
pci/0000:03:00.1/196709:
name max_SFs size 128 unit entry dpipe_tables none
Signed-off-by: Or Har-Toov <ohartoov@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Or Har-Toov [Tue, 9 Jun 2026 05:39:52 +0000 (08:39 +0300)]
devlink: add per-port resource show support
Extend 'devlink resource show' to accept DEV/PORT_INDEX, sending
DEVLINK_ATTR_PORT_INDEX to the kernel so it returns only that port's
resources directly.
For example:
$ devlink resource show pci/0000:03:00.0/196608
pci/0000:03:00.0/196608:
name max_SFs size 128 unit entry dpipe_tables none
Signed-off-by: Or Har-Toov <ohartoov@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Or Har-Toov [Tue, 9 Jun 2026 05:39:51 +0000 (08:39 +0300)]
devlink: show port resources in resource dump
When the kernel returns port-level resource messages during a
DEVLINK_CMD_RESOURCE_DUMP, display them alongside device-level
resources.
For example:
$ devlink resource show
pci/0000:03:00.0:
name max_local_SFs size 32 unit entry dpipe_tables none
name max_external_SFs size 32 unit entry dpipe_tables none
pci/0000:03:00.0/196608:
name max_SFs size 32 unit entry dpipe_tables none
pci/0000:03:00.1:
name max_local_SFs size 32 unit entry dpipe_tables none
name max_external_SFs size 32 unit entry dpipe_tables none
pci/0000:03:00.1/262144:
name max_SFs size 32 unit entry dpipe_tables none
Signed-off-by: Or Har-Toov <ohartoov@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Or Har-Toov [Tue, 9 Jun 2026 05:39:49 +0000 (08:39 +0300)]
devlink: fix memory leak in resource_ctx_fini
resource_ctx_init() allocates ctx->resources via resources_alloc()
which calls calloc(). resource_ctx_fini() calls resources_free() to
free the list items inside the struct, but never frees the struct
itself.
Signed-off-by: Or Har-Toov <ohartoov@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Ido Schimmel [Tue, 9 Jun 2026 05:39:48 +0000 (08:39 +0300)]
devlink: Move dpipe tables query to resources show callback
As previously explained, as part of showing device resources, devlink
queries the device's dpipe tables so that it will be able to show the
association between resources and dpipe tables.
Currently, the dpipe tables are queried before the device resources.
This will become a problem when devlink is extended to support dumping
the resources of all available devices.
Therefore, in preparation for resource dump support, move the querying
of the device's dpipe tables to the resources show callback which is
invoked per-device.
There is no difference in the output of the resource show command, but
one functional difference is that errors in dpipe tables query are not
considered fatal. This seems reasonable given that errors are unlikely
and that displaying the dpipe tables is secondary to showing the device
resources.
Reviewed-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Ido Schimmel [Tue, 9 Jun 2026 05:39:47 +0000 (08:39 +0300)]
devlink: Split dpipe tables output to a separate function
As part of showing device resources, devlink also iterates over
available dpipe tables and shows the associated tables, if any.
A subsequent patch will show the device resources even if we failed to
retrieve the dpipe tables. In preparation for this change, split the
functionality of showing the associated dpipe tables into a separate
function.
No functional changes intended.
Reviewed-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
iplink_geneve: Support IFLA_GENEVE_LOCAL and IFLA_GENEVE_LOCAL6.
IFLA_GENEVE_LOCAL and IFLA_GENEVE_LOCAL6 allow specifying a local
IPv4/IPv6 address for the backend UDP socket of a GENEVE devcie.
Let's support the attributes with the "local" keyword.
# for i in $(seq 1 2);
do
ip link add geneve4_${i} type geneve local 192.168.0.${i} external
ip addr add 192.168.0.${i}/24 dev geneve4_${i}
ip link set geneve4_${i} up
ip link add geneve6_${i} type geneve local 2001:9292::${i} external
ip addr add 2001:9292::${i}/64 dev geneve6_${i} nodad
ip link set geneve6_${i} up
done
# ip -d l | grep geneve
9: geneve4_1: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
geneve external id 0 local 192.168.0.1 ...
10: geneve6_1: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
geneve external id 0 local 2001:9292::1 ...
11: geneve4_2: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
geneve external id 0 local 192.168.0.2 ...
12: geneve6_2: <BROADCAST,MULTICAST,UP,LOWER_UP> ...
geneve external id 0 local 2001:9292::2 ...
iplink: set NLA_F_NESTED for IPv4 devconf attributes
In order to use set multiple IPv4 devconf parameters at once,
NLA_F_NESTED flag is required.
ip link set dev enp8s0 inet forwarding on proxy_arp off
Fixes: fdb064bf64e5 ("iplink: add support for setting IPv4 devconf parameters") Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de> Signed-off-by: David Ahern <dsahern@kernel.org>
man: iplink: fix indentation level after inet parameter
The indentation for inet block opens with +8 but closes with -10. Fix
the imbalance.
Fixes: fdb064bf64e5 ("iplink: add support for setting IPv4 devconf parameters") Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de> Signed-off-by: David Ahern <dsahern@kernel.org>
Andy Roulin [Wed, 3 Jun 2026 17:33:04 +0000 (10:33 -0700)]
iplink: bridge: add stp_mode support
Add support for the IFLA_BR_STP_MODE bridge attribute that allows
userspace to explicitly select the STP mode:
- auto (0): default, try /sbin/bridge-stp helper in init_net
- user (1): directly enable userspace STP without the helper,
works in any network namespace
- kernel (2): directly enable kernel STP without the helper
A shared file-scope stp_modes[] table indexed by BR_STP_MODE_* drives
both directions: parsing uses parse_one_of(), printing goes through a
stp_mode_to_str() helper that returns "(unknown)" for modes not yet
known to iproute2, keeping the JSON type of stp_mode consistently a
string.
Example usage:
ip link set br0 type bridge stp_mode user
ip link set br0 type bridge stp_state 1
Link: https://lore.kernel.org/netdev/20260405205224.3163000-1-aroulin@nvidia.com/ Assisted-by: Claude:claude-opus-4-7 Reviewed-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Nikolay Aleksandrov <nikolay@nvidia.com> Signed-off-by: Andy Roulin <aroulin@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
iplink: add support for setting IPv4 devconf parameters
Currently, modifying IPv4 interface configuration parameters requires
interacting with sysctl (/proc/sys/net/ipv4/conf/*). While
ip-netconf exists for monitoring these values, there has been no native
way to set them directly through iproute2.
This patch introduces the support for that via 'inet' at the 'ip link
set'. It uses IFLA_INET_CONF netlink attribute to set the parameter.
Example to enable forwarding on an interface:
ip link set dev enp8s0 inet forwarding on
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de> Signed-off-by: David Ahern <dsahern@kernel.org>
(Code length fixups and s/matches/strcmp/ when applying)
Petr Oros [Tue, 26 May 2026 11:52:45 +0000 (13:52 +0200)]
dpll: monitor: add -t/--timestamp and --tshort options
Bring dpll monitor in line with the rest of iproute2 by allowing each
received notification to be prefixed with a wall-clock timestamp.
-t / --timestamp emit a separate "Timestamp:" line before each event,
using the default text form of print_timestamp()
(matches ip / bridge / tc -t monitor)
--tshort emit a compact ISO 8601 prefix
"[YYYY-MM-DDTHH:MM:SS.uuuuuu]" inline instead
(matches ip -ts monitor)
When combined with -j, the timestamp shows up as a "timestamp" /
"timestamp_short" field on each notification object, the same way
ip -j -t mptcp monitor integrates the helper.
The flag is parsed globally but only consulted from the monitor
callback, so passing -t to non-monitor commands is a no-op.
--tshort has no short alias, so its long_options entry uses an
identifier above the ASCII range (OPT_TSHORT = 256) following the
iproute2 convention used in misc/ss.c, instead of consuming an
ASCII letter that could later collide with a real short option.
Reviewed-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: Petr Oros <poros@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Petr Oros [Tue, 26 May 2026 11:53:09 +0000 (13:53 +0200)]
dpll: man: restore Frequency monitor status in device show output
The dpll(8) merge of main into next (commit 62d1e70fa85a37 ("Merge
remote-tracking branch 'main/main' into next")) resolved the conflict
in the "dpll device show" output bullet list by keeping main's three
new entries (Supported modes, Phase offset monitor status, Phase
offset averaging factor) but inadvertently dropped the
"Frequency monitor status (enable/disable)" entry that was
introduced on next by commit 12954bc7d2c3 ("dpll: add frequency
monitoring support").
The frequency-monitor feature itself is still present (parser,
device-set documentation and pin "Measured frequency in Hz" line
are intact), only the corresponding bullet in the device-get output
list was lost. Add it back so the listed attributes match what
"dpll device show" actually prints.
Signed-off-by: Petr Oros <poros@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
The kernel now reports struct tc_netem_xstats via TCA_STATS_APP with
per-impairment counters: delayed, loss, corrupted, duplicated,
reordered, and ecn_marked.
Add netem_print_xstats() following the same pattern as
fq_print_xstats()
Example output of `tc -s qdisc show dev eth0`:
qdisc netem 8001: root refcnt 2 limit 1000 delay 100ms loss 5%
Sent 1234567 bytes 15483 pkt (dropped 774, overlimits 0 requeues 0)
delayed 14709 dropped 774 corrupted 154 duplicated 309 reordered 61 ecn_marked 0
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: David Ahern <dsahern@kernel.org>
Mohsin Bashir [Fri, 22 May 2026 03:07:02 +0000 (20:07 -0700)]
netshaper: Fix man page accuracy and formatting issues
This is a follow up to a previous patch that was merged before the
feedback was provided. See link below for previous patch series.
https://lore.kernel.org/netdev/20260518202353.390827-1-mohsin.bashr@gmail.com
Address the following concerns:
- Document that parent scope must be node or netdev; queue is
rejected by parse_scope_id() but the man page did not state this.
- Document that parent scope node requires an id, while parent scope
netdev may omit the id.
- Document that leaf scope must be queue; parse_leaves() enforces
this but the man page only implied it by example.
- Replace "scheduling groups" with "intermediate scheduling nodes"
for the node scope to avoid confusion with the group command name.
- Show group handle scope choices explicitly in the synopsis as
{ node | netdev } instead of an unrestricted HANDLE_SCOPE token.
- Replace unusual { } repeat-group notation for leaves with a
separate LEAF_SPEC definition using standard [ SPEC ... ] syntax.
- Use .B/.RB for literal keywords (bw-min, bw-max, weight, id,
parent, leaves) and .I for metavariables, matching iproute2
man page conventions.
- Clarify example 4 so the 10 Gbit/s cap clearly applies to the
node, not the netdev parent.
- Update .TH date.
Assisted-by: Claude:claude-opus-4.7 Signed-off-by: Mohsin Bashir <hmohsin@meta.com> Signed-off-by: David Ahern <dsahern@kernel.org>
David Ahern [Wed, 20 May 2026 01:06:02 +0000 (19:06 -0600)]
Merge branch 'netshaper-updates' into next
Mohsin Bashir says:
====================
From: Mohsin Bashir <hmohsin@meta.com>
This series extends the netshaper CLI with missing parameter support
and adds the group command for building scheduling hierarchies.
The existing netshaper tool only supports setting bw-max on individual
shapers. This series adds the remaining shaper attributes (bw-min,
weight) needed for TX scheduling, and introduces the group command
which ties leaf shapers to a parent node in a single operation.
Mohsin Bashir [Mon, 18 May 2026 20:23:53 +0000 (13:23 -0700)]
netshaper: Update man page for new parameters and group command
Document bw-min, weight, and the group command in the netshaper
man page. Node id is required for set/show/delete but optional
for the group command. Leaves support optional per-queue weight
and priority parameters for scheduling within the group.
Assisted-by: Claude:claude-opus-4.7 Signed-off-by: Mohsin Bashir <hmohsin@meta.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Mohsin Bashir [Mon, 18 May 2026 20:23:52 +0000 (13:23 -0700)]
netshaper: Add group command for creating scheduling hierarchies
Add the group command to create and update scheduling groups via the
NET_SHAPER_CMD_GROUP netlink operation. This enables building shaper
hierarchies by specifying a node handle, parent scope, rate parameters,
and a set of leaf shapers to attach.
The group command allows the node handle id to be omitted, letting
the kernel auto-assign one for new nodes. Group handle and parent
scopes are validated to accept only node or netdev. Parent node scope
requires an explicit id since it must reference an existing node.
Leaf parsing is extracted into parse_leaves() which dynamically
allocates the leaves array via realloc, avoiding arbitrary limits.
Each leaf accepts optional weight and priority parameters for
per-queue scheduling control within the group. Handle and parent
parsing share parse_scope_id() to avoid code duplication. Common
argument parsing (dev, bw-min, bw-max, weight) reuses the
parse_shaper_arg() helper introduced in the previous patch.
Example usage:
netshaper group dev foo handle scope node parent scope netdev \
bw-max 1gbit leaves scope queue id 0 weight 3 \
scope queue id 1 weight 2
Assisted-by: Claude:claude-opus-4.7 Signed-off-by: Mohsin Bashir <hmohsin@meta.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Mohsin Bashir [Mon, 18 May 2026 20:23:51 +0000 (13:23 -0700)]
netshaper: Extract struct shaper_args and parse_shaper_arg() helper
Extract common shaper parameters (dev, bw-min, bw-max, weight) into
struct shaper_args and add parse_shaper_arg() to parse them. This
avoids duplicating argument parsing when the group command is added
in the next patch.
Assisted-by: Claude:claude-opus-4.7 Signed-off-by: Mohsin Bashir <hmohsin@meta.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Mohsin Bashir [Mon, 18 May 2026 20:23:50 +0000 (13:23 -0700)]
netshaper: Extend show output with parent, bw-min and weight
Extend print_netshaper_attrs() to display parent scope/id, bw-min,
and weight fields in the show output. Replace the switch-based
iteration with direct attribute checks for cleaner output formatting.
Use print_rate() for bandwidth display so that sub-Mbps rates
like 100kbit render correctly instead of truncating to 0 mbps.
Assisted-by: Claude:claude-opus-4.7 Signed-off-by: Mohsin Bashir <hmohsin@meta.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Mohsin Bashir [Mon, 18 May 2026 20:23:49 +0000 (13:23 -0700)]
netshaper: Add bw-min and weight parameter support
Add bw-min and weight parameters to the set command. Previously
only bw-max was supported. Use boolean flags (has_bw_min,
has_bw_max, has_weight) to track which parameters were provided,
so that zero-valued attrs like bw-max 0 are correctly sent.
Only emit rate and weight attrs for the set command. Add device
name validation and only send handle id when explicitly provided.
Update usage text to reflect the new parameters.
Assisted-by: Claude:claude-opus-4.7 Signed-off-by: Mohsin Bashir <hmohsin@meta.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Mohsin Bashir [Mon, 18 May 2026 20:23:48 +0000 (13:23 -0700)]
netshaper: Extract parse_scope() and parse_rate() helpers
Add parse_scope() and parse_rate() helpers in preparation for
adding the group command which will need scope and rate parsing
at various places in the code. This patch will help to avoid
code duplication.
Verify that the tool works as before:
./netshaper set dev eth2 handle scope queue id 0 bw-max 100kbit
./netshaper delete dev eth2 handle scope queue id 0 bw-max 100kbit
Assisted-by: Claude:claude-opus-4.7 Signed-off-by: Mohsin Bashir <hmohsin@meta.com> Signed-off-by: David Ahern <dsahern@kernel.org>
David Ahern [Wed, 20 May 2026 00:44:24 +0000 (18:44 -0600)]
Merge branch 'neigh-fwd-grat' into next
Danielle Ratson says:
====================
The existing neighbor suppression unconditionally suppresses gratuitous
ARP and unsolicited Neighbor Advertisements, which breaks legitimate use
cases like Multi-Homing and EVPN where these announcements need to
propagate across the VXLAN fabric.
This series adds a new neigh_forward_grat option that provides
independent control of gratuitous ARP and unsolicited NA forwarding.
When neigh_suppress is enabled and neigh_forward_grat is also enabled,
regular neighbor discovery is suppressed while gratuitous announcements
are forwarded.
Both port-level control (via IFLA_BRPORT_NEIGH_FORWARD_GRAT) and
per-VLAN control (via BRIDGE_VLANDB_ENTRY_NEIGH_FORWARD_GRAT) are
provided. The default value of OFF preserves existing behavior.
The new attributes use NLA_U8, although the kernel netlink guideline
recommends NLA_U32 as the minimum integer type on the grounds that
alignment makes smaller types equivalent on the wire. For a simple
on/off attribute there is no technical advantage to u32 over u8, and
keeping u8 preserves consistency with all surrounding bridge port
attributes and avoids introducing new helpers alongside the existing
infrastructure.
Petr Oros [Tue, 12 May 2026 13:52:24 +0000 (15:52 +0200)]
dpll: align help and man notation with actual option parsing
dpll uses getopt_long(), which only accepts long options with the
"--" prefix. The iproute2-wide "-X[name]" shorthand used in the
help text and man page implies a single-dash long form
(e.g. -Version, -json, -pretty) that getopt_long does not parse;
only -V/--Version, -j/--json and -p/--pretty actually work.
Replace the misleading shorthand with explicit "-V | --Version"
style so the documented forms match what the parser accepts, and
drop the redundant second usage line in help() that listed only a
subset of the options and implied dpll could be invoked without an
OBJECT. No functional change.
Signed-off-by: Petr Oros <poros@redhat.com> Reviewed-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
David Ahern [Tue, 12 May 2026 19:29:33 +0000 (13:29 -0600)]
devlink: Drop now duplicate pid fallback for netns
Now that netns_get_fd handles by name and pid, the special
handling in devlink to fallback to PID can be removed with
both cases handled by the FD attribute.
Signed-off-by: David Ahern <dahern@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
David Ahern [Tue, 12 May 2026 19:26:03 +0000 (13:26 -0600)]
namespace: Add fallback to netns by pid
Update netns_get_fd to try the passed in string as a name first. If the
netns filesystem entry does not exist, try converting the string to an
integer and if successful return an fd to /proc/<pid>/ns/net.
This allows netns_get_fd to uniformly handle the 2 common use cases of
specifying network namespace by name and pid.
Signed-off-by: David Ahern <dahern@nvidia.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Ivan Vecera [Wed, 13 May 2026 14:51:15 +0000 (16:51 +0200)]
dpll: add fractional-frequency-offset to parent-device
Kernel commit 9c11fcb2e9a54 ("dpll: add fractional frequency offset
to pin-parent-device") added fractional-frequency-offset (PPM) and
fractional-frequency-offset-ppt (PPT) attributes to the
pin-parent-device nested attribute set, alongside the existing
top-level pin attributes. Add their display into
dpll_pin_print_parent_devices() and add ppm and ppt units to the
respective outputs.
Extract dpll_pr_ffo() helper to consolidate the duplicated PPM/PPT
fallback logic used in both top-level and parent-device contexts.
Signed-off-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Ivan Vecera [Wed, 13 May 2026 14:51:14 +0000 (16:51 +0200)]
dpll: add pin operstate attribute support
Kernel commit 781c8893a5da8 ("dpll: add pin operational state")
added the DPLL_A_PIN_OPERSTATE attribute which reports the operational
state of a pin with respect to its parent DPLL device. The attribute
is nested inside parent-device and can have values: active, standby,
no-signal, qual-failed.
Add operstate filtering for pin show command, allowing to filter pins
by their operational state on parent device. Update bash-completion
and man page accordingly.
Signed-off-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
rdma: Align FRMR pool UAPI names with merged kernel UAPI
The FRMR pools UAPI merged in kernel v7.0-rc1 commit dbd0472fd7a5
("RDMA/nldev: Expose kernel-internal FRMR pools in netlink")
uses different identifier names than what the iproute2 FRMR pools
series was developed against.
Update the vendored copy of RDMA UAPI and all references in the rdma
tool to match the names that actually shipped in the kernel.
Fixes: 93368ee34528 ("rdma: Update headers") Signed-off-by: Michael Guralnik <michaelgur@nvidia.com> Signed-off-by: Chiara Meiohas <cmeiohas@nvidia.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
David Ahern [Thu, 7 May 2026 15:24:02 +0000 (09:24 -0600)]
Merge branch 'dpll-phase-unit-freq-monitor' into next
Ivan Vecera says:
====================
This series improves dpll pin output formatting and adds support for
the frequency monitoring feature.
Patch 1 adds picosecond unit to phase-adjust-min, phase-adjust-max
and phase-adjust attributes. It also introduces dpll_pr_phase_offset()
helper that properly formats phase-offset as fractional picoseconds by
dividing the raw kernel value by DPLL_PHASE_OFFSET_DIVIDER.
Patch 2 adds support for the new frequency monitoring feature including
the DPLL_A_FREQUENCY_MONITOR device attribute and
DPLL_A_PIN_MEASURED_FREQUENCY pin attribute. The measured frequency is
displayed as fractional Hz using dpll_pr_measured_frequency() helper
since the kernel reports the value in millihertz. It also refactors
phase-offset-monitor parsing into a shared helper.
Tested on EDS2 development board with zl3073x DPLL:
# dpll pin show package-label REF0P
pin id 196:
module-name: zl3073x
clock-id: 13709406750444215013
board-label: SyncE IN M1 CLK1
package-label: REF0P
type: synce-eth-port
frequency: 125000000 Hz
measured-frequency: 124999326.000 Hz
frequency-supported: 2500000 Hz 25000000 Hz 125000000 Hz
capabilities: 0x6 state-can-change priority-can-change
phase-adjust-min: -2147483648 ps
phase-adjust-max: 2147483647 ps
phase-adjust: 0 ps
parent-device:
id 14 direction input prio 10 state selectable phase-offset 0.000 ps
id 15 direction input prio 0 state connected phase-offset 323.000 ps
Ivan Vecera [Mon, 4 May 2026 16:30:13 +0000 (18:30 +0200)]
dpll: add ps unit to phase-related pin attributes
Display phase-adjust-min, phase-adjust-max and phase-adjust values
with ps unit. Add DPLL_PR_PHASE_OFFSET macro that properly formats
phase-offset as fractional picoseconds by dividing the raw kernel
value by DPLL_PHASE_OFFSET_DIVIDER.
Reviewed-by: Petr Oros <poros@redhat.com> Signed-off-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Ivan Vecera [Sun, 3 May 2026 16:42:00 +0000 (18:42 +0200)]
dpll: fix man page correctness issues
Fix several inaccuracies in dpll.8 man page:
- Remove bogus "holdover" and "freerun" from operating modes list,
only "manual" and "automatic" modes exist in the DPLL API
- Fix typo "locked-ho-ack" -> "locked-ho-acq" in lock status list
- Add missing device show output fields: lock-status-error,
clock-quality-level, mode-supported, phase-offset-monitor and
phase-offset-avg-factor
- Add missing pin show output fields: panel-label, package-label,
fractional-frequency-offset and esync-pulse
- Remove non-existent exit codes 2 and 255, the tool only returns
0 (success) or 1 (failure)
- Use canonical enable/disable for phase-offset-monitor to match
the tool's help text
Fixes: 656cfc3ce05b ("dpll: Add dpll command") Signed-off-by: Ivan Vecera <ivecera@redhat.com> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
lib: add input validation for time, rate, and size parsing functions
The parsing functions get_time(), get_time64(), get_rate(), get_rate64(),
and get_size64() use strtod() to convert user input but don't validate
the parsed values. This allows negative numbers and overflow values to
be passed through, which can cause unexpected behavior or security issues
when these values reach the kernel as unsigned integers.
Add validation to reject:
- Negative values (which make no sense for time, rate, or size)
- Overflow conditions (when strtod() returns HUGE_VAL with ERANGE)
- Empty strings (already checked, but now with explicit comments)
This prevents potential issues and provides clearer error reporting.
Fixing it in iproute2 does not mean that the kernel is off the hook
for handling negative values. Checks are still needed.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: David Ahern <dsahern@kernel.org>
bash-completion: devlink: Fix dev completion trailing colon
Cited commit extended 'devlink dev show' to print the instance index when
the kernel provides DEVLINK_ATTR_INDEX, printing the device handle followed
by a colon and the index. The completion code was using the raw text output
as a word list, causing the device handle to be offered with a trailing
colon, e.g. "pci/0000:01:00.0:" instead of "pci/0000:01:00.0".
Switch to JSON output and extract device names using jq, consistent
with how port completion already works, to reliably get only the device
handle names regardless of what additional attributes are printed.
Fixes: 36252727bfc6 ("devlink: show devlink instance index in dev output") Signed-off-by: Danielle Ratson <danieller@nvidia.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
As Eric pointed out, fflush() only makes sense in monitor mode.
In other modes buffering the output helps with large outputs
like route dumps.
Move the fflush() into rtnl_listen() which is the common code
used by all monitoring subcommands. This also ensures any future
monitor subcommand gets correct flushing behavior automatically.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Iproute2 never handled control characters in strings correctly.
There are some cases like where string is under user control
like paths in ss command. Make iproute2 json output conform
to RFC 8259.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Justin Iurman [Fri, 20 Mar 2026 14:08:46 +0000 (15:08 +0100)]
seg6: add tunsrc support in iproute_lwtunnel
Add support for the new optional "tunsrc" parameter. Now, a tunnel
source address can be configured per route and has priority over the
configured per-netns source address (if any).
Example:
ip -6 r a 2001:db8:1::/64 encap seg6 mode encap tunsrc 2001:db8:ab::
segs 2001:db8:42::1,2001:db8:ffff::2 dev eth0
Signed-off-by: Justin Iurman <justin.iurman@6wind.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Vitaly Grinberg [Sun, 29 Mar 2026 07:51:01 +0000 (10:51 +0300)]
dpll: Send object per event in JSON monitor mode
Previously, monitor mode wrapped all events in a single JSON array
inside a top-level object, which made piping the output to external
tools (such as `jq`) impossible.
Send a separate JSON object for each event in monitor mode,
making the output suitable for line-by-line consumers. Skip the
global JSON wrapper for monitor mode.
Signed-off-by: Vitaly Grinberg <vgrinber@redhat.com> Reviewed-by: Petr Oros <poros@redhat.com> Reviewed-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
David Ahern [Sun, 5 Apr 2026 17:07:21 +0000 (11:07 -0600)]
Merge branch 'frmr-pools' into next
Chiara Meiohas says:
====================
This series adds support for managing Fast Registration Memory Region
(FRMR) pools in rdma tool, enabling users to monitor and configure FRMR
pool behavior.
FRMR pools are used to cache and reuse Fast Registration Memory Region
handles to improve performance by avoiding the overhead of repeated
memory region creation and destruction. This series introduces commands
to view FRMR pool statistics and configure pool parameters such as
aging time and pinned handle count.
The 'show' command allows users to display FRMR pools created on
devices, their properties, and usage statistics. Each pool is identified
by a unique key (hex-encoded properties) for easy reference in
subsequent operations.
The aging 'set' command allows users to modify the aging time parameter,
which controls how long unused FRMR handles remain in the pool before
being released.
The pinned 'set' command allows users to configure the number of pinned
handles in a pool. Pinned handles are exempt from aging and remain
permanently available for reuse, which is useful for workloads with
predictable memory region usage patterns.
Command usage and examples are included in the commits and man pages.
These patches are complimentary to the kernel patches:
https://lore.kernel.org/linux-rdma/20260226-frmr_pools-v4-0-95360b54f15e@nvidia.com/
Michael Guralnik [Mon, 30 Mar 2026 17:31:18 +0000 (20:31 +0300)]
rdma: Add FRMR pools set pinned command
Add an option to set the amount of pinned handles to FRMR pool.
Pinned handles are not affected by aging and stay available for reuse in
the FRMR pool.
The pool is identified by a colon-separated key of hexadecimal fields
(vendor_key:num_dma_blocks:access_flags:ats) as shown in the 'show'
command output.
Usage:
Set 250 pinned handles to FRMR pool with key 0:800:0:0 on
device rocep8s0f0
$rdma resource set frmr_pools dev rocep8s0f0 pinned 0:800:0:0 250
Signed-off-by: Michael Guralnik <michaelgur@nvidia.com> Reviewed-by: Patrisious Haddad <phaddad@nvidia.com> Reviewed-by: Chiara Meiohas <cmeiohas@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Michael Guralnik [Mon, 30 Mar 2026 17:31:17 +0000 (20:31 +0300)]
rdma: Add FRMR pools set aging command
Add support for configuring the aging period of FRMR pools.
The aging mechanism frees unused FRMR handles that have not been
in use for the specified period.
Usage:
rdma resource set frmr_pools dev DEV aging AGING_PERIOD
Signed-off-by: Michael Guralnik <michaelgur@nvidia.com> Reviewed-by: Patrisious Haddad <phaddad@nvidia.com> Reviewed-by: Chiara Meiohas <cmeiohas@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Michael Guralnik [Mon, 30 Mar 2026 17:31:16 +0000 (20:31 +0300)]
rdma: Add resource FRMR pools show command
Allow users to see the FRMR pools that were created on the devices,
their properties and their usage statistics.
The set of properties of each pool are encoded as a colon-separated
list of hexadecimal fields (vendor_key:num_dma_blocks:access_flags:ats)
to simplify referencing a specific pool in 'set' commands.
Sample output:
$rdma resource show frmr_pools
dev rocep8s0f0 key 0:1000:0:0 queue 0 in_use 0 max_in_use 200
dev rocep8s0f0 key 0:800:0:0 queue 0 in_use 0 max_in_use 200
dev rocep8s0f0 key 0:400:0:0 queue 0 in_use 0 max_in_use 200
David Ahern [Sun, 5 Apr 2026 16:32:35 +0000 (10:32 -0600)]
Merge branch 'tc-64b-burst' into next
Ioana Lazea says:
====================
This patchset updates the TBF and HTB queuing discipline
configurations to support burst sizes beyond the legacy 32-bit limits.
As network interface speeds increase, the kernel’s internal
representation of burst (calculated as time at a specific rate) can
easily exceed the 4 GB threshold. These changes enable userspace to
accommodate these larger values where the kernel API allows.
Additionally, if the burst exceeds the upper limit supported by
the kernel API, it is now reported as an error in userspace before
attempting the Netlink transition. Previously, such values would
silently overflow, causing corrupted values to be passed to the kernel.
The implementation follows the approach used for tc police burst
handling introduced in commit 3b26e8abf404 ("tc/police: enable use of 64
bit burst parameter"). The reasoning behind the patches proposed here is
largely based on the rationale described in the aforementioned change.
Similarly to the case of the tc police burst option, as
implemented now the TBF and HTB burst option limit the sizes of the
burst up to 4 GB (UINT_MAX for a 32 bit unsigned int) due to the
constraints in the user space tooling. Historically, TBF and HTB burst
options were capped at 32 bits, which was a sufficient limit for the
lower line rates common when they were initially developed. However,
since the underlying kernel logic treats the burst as a time-based
value, it is already capable of handling larger sizes at high rates
without requiring internal modifications. This patchset bridges that gap
in the user space tools.
The detailed technical explanation for this change was
previously detailed by Jay Vosburgh:
Below is a short description of the main changes made to the TBF
and HTB queuing disciplines.
In both TBF and HTB, the primary modification replaces the
unsigned integer burst variable with an unsigned 64 bit integer variable
(buffer64) so that burst sizes larger than 4 GB can be represented and
passed correctly through the kernel API.
For the TBF qdisc specifically, the following logic was added:
Increasing the burst size representation to 64 bits introduces
an issue with TCA_TBF_BURST. The kernel expects this attribute as
NLA_U32 (a 32-bit unsigned value), while the updated implementation may
produce burst values exceeding this range. Passing such values would
cause the tbf_policy validation in the kernel to fail. To avoid this,
TCA_TBF_BURST is only included when the value fits within 32 bits. When
the attribute is omitted (for example, when buffer64 exceeds the 32-bit
limit), the kernel falls back to using the value stored in qopt->buffer,
which already supports larger burst sizes.
As seen in commit 2e04ad424b03 ("sch_tbf: add
TBF_BURST/TBF_PBURST attribute"), TCA_TBF_BURST was originally
introduced to handle issues with very small burst values. Omitting the
attribute for large bursts therefore preserves the intended behavior
while avoiding incompatibilities with the kernel attribute policy.
Additionally, the burst value is explicitly cast to 32 bits where
required, ensuring that 64-bit values are not passed to kernel
interfaces expecting 32-bit fields.
These modifications bring the user space tools in line with the
kernel's internal 64-bit handling. The logic effectively avoids Netlink
attribute validation failures while preserving the original intent of
the burst mechanism for small values.
Ioana Lazea [Mon, 23 Mar 2026 09:29:13 +0000 (09:29 +0000)]
tc/htb: enable use of 64 bit burst
Modify the HTB queueing discipline to allow burst sizes up to the
limits supported by the kernel API, which may exceed 4 GB at higher rates.
In the current implementation, the burst option is effectively limited
to 4 GB due to the use of a 32-bit field while parsing the burst size.
However, the kernel internally represents the burst in terms of time
derived from the configured rate. As a result, at sufficiently high
rates this time-based representation can correspond to burst sizes
larger than 4 GB, making such bursts feasible without requiring changes
to the kernel.
This change removes the artificial 4 GB limit and allows larger burst
sizes where supported by the kernel API.
Signed-off-by: Ioana Lazea <ioana.lazea@canonical.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Ioana Lazea [Mon, 23 Mar 2026 09:29:12 +0000 (09:29 +0000)]
tc/tbf: enable use of 64 bit burst
Modify the TBF queueing discipline configuration to allow burst sizes up
to the limits supported by the kernel API, which may exceed 4 GB at
higher rates.
In the current implementation, the burst option is effectively limited
to 4 GB because it is stored in a 32-bit field. However, the kernel
internally represents the burst in psched ticks (64 nsec each). At
sufficiently high rates, this representation can correspond to burst
sizes larger than 4 GB without requiring kernel changes.
Overflows (burst values that exceed UINT_MAX psched ticks) are now
correctly detected, and flagged as an error, rather than passing
arbitrary psched tick values to the kernel.
The change to increase the burst size to 64-bit introduced an issue with
TCA_TBF_BURST. The kernel expects this attribute as NLA_U32 (a 32-bit
unsigned value), but the updated implementation may produce a 64-bit
value, causing the tbf_policy check in the kernel to fail. However, when
TCA_TBF_BURST is omitted (which occurs when buffer64 >= UINT_MAX), the
kernel falls back to using the value assigned to qopt->buffer, which
correctly supports large burst sizes. Omitting TCA_TBF_BURST for large
bursts preserves backward compatibility and aligns with existing kernel
behavior. This change therefore ensures correct handling of large burst
sizes while remaining compatible with kernel and iproute2 expectations.
Signed-off-by: Ioana Lazea <ioana.lazea@canonical.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Eric Dumazet [Fri, 3 Apr 2026 10:23:09 +0000 (10:23 +0000)]
ss: add support for TCP delack timers
Kernel commit c698f5cc940d ("inet_diag: report delayed ack timer information")
added a new enum for idiag_timer values and support for delayed ack timers.
Change tcp_timer_print() to use the new enum and display "delack"
instead of "unknown":
Petr Oros [Tue, 31 Mar 2026 13:59:18 +0000 (15:59 +0200)]
dpll: add direction and state filtering for pin show
Allow filtering pins by direction (input/output) and state
(connected/disconnected/selectable) in the pin show command.
These filters match against parent-device nested attributes and
can be combined with the parent-device filter to check a specific
parent-device relationship.
Example: dpll pin show parent-device 0 direction input state connected Signed-off-by: Petr Oros <poros@redhat.com> Tested-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Andrea Claudi [Thu, 12 Mar 2026 18:35:47 +0000 (19:35 +0100)]
dpll: Fix missing notifications in monitor mode
When running dpll monitor with output redirected to a file, notifications
could be lost because stdout is fully buffered for file redirection instead
of line-buffered like in interactive mode. If the program is killed or
crashes, buffered data is lost before reaching the file.
Fix by calling fflush(stdout) after each notification to ensure immediate
writes to the log file.
Fixes: 656cfc3ce05b ("dpll: Add dpll command") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Jiri Pirko [Mon, 16 Mar 2026 15:44:17 +0000 (16:44 +0100)]
mnl: add fallback implementation for mnl_attr_get_uint()
libmnl introduced mnl_attr_get_uint() to handle NLA_UINT
variable-width attributes. Add a configure check to detect it
and provide a fallback implementation for older libmnl versions.
Signed-off-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Petr Oros [Tue, 24 Feb 2026 09:12:40 +0000 (10:12 +0100)]
dpll: fix pin id-get type filter parsing
dpll_parse_attr_enum() expects the keyword to be already consumed,
but cmd_pin_id_get() used dpll_argv_match() which does not advance
the argument pointer. This caused the parser to read the keyword
"type" as the enum value instead of the actual type (e.g. "gnss").
Use dpll_argv_match_inc() to properly consume the keyword before
parsing the value.
Fixes: 656cfc3ce05b ("dpll: Add dpll command") Signed-off-by: Petr Oros <poros@redhat.com>
Since commit 962692356a1c ("Makefile: use /usr/share/iproute2 for config
files") the path was moved to /usr/share in Makefile; but there
were leftover references.
Reported-by: Yedaya Katsman <yedaya.ka@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Petr Oros [Tue, 24 Feb 2026 09:12:43 +0000 (10:12 +0100)]
dpll: add pin filtering by parent-device and parent-pin
The existing "device" argument in "dpll pin show" sent DPLL_A_ID
in the pin dump request, but the kernel does not use this attribute
for pin dump filtering. Replace it with client-side parent-device
filtering that checks DPLL_A_PIN_PARENT_ID inside nested
DPLL_A_PIN_PARENT_DEVICE attributes.
Also add parent-pin filtering for mux pin hierarchies using the
same approach with DPLL_A_PIN_PARENT_PIN nested attributes.
Rename the "device" argument to "parent-device" to better reflect
the actual semantics.
Signed-off-by: Petr Oros <poros@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Petr Oros [Tue, 24 Feb 2026 09:12:42 +0000 (10:12 +0100)]
dpll: add client-side filtering for pin show
Add client-side filtering support for dpll pin show command.
Users can filter pins by module-name, clock-id, board-label,
panel-label, package-label, and type. Multiple filters use AND
semantics. Filters work with both dump and single GET operations.
Signed-off-by: Petr Oros <poros@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Petr Oros [Tue, 24 Feb 2026 09:12:41 +0000 (10:12 +0100)]
dpll: add client-side filtering for device show
Add client-side filtering support for dpll device show command.
Users can filter devices by module-name, clock-id, type, mode,
and lock-status. Multiple filters use AND semantics. Filters
work with both dump (all devices) and single GET (by id) operations.
Signed-off-by: Petr Oros <poros@redhat.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Hangbin Liu [Thu, 26 Feb 2026 03:38:44 +0000 (03:38 +0000)]
iplink: bond_slave: print actor and partner churn state
Add ability to print both actor and partner port churn states
(MONITOR/CHURN/NO_CHURN) via netlink attributes. This provides
visibility into the LACP churn detection state for bond slaves.
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Signed-off-by: David Ahern <dsahern@kernel.org>
Daniel Schulte [Wed, 25 Feb 2026 19:39:03 +0000 (20:39 +0100)]
ss: Remove trailing whitespace when output is not a TTY
Sometimes a value in the last column might be very long.
When grepping ss output the matched lines are also padded to the longest value.
In some cases this can result in multiple lines of the terminal getting filled
with spaces.
Don't print right padding in last visible column when ss can't determine the
screen width.
Signed-off-by: Daniel Schulte <trilader@schroedingers-bit.net>
ss: suppress netlink errors for unsupported protocols
Error messages from sock_diag were only suppressed for extended
protocols (> 255). Protocols like SCTP and DCCP also get EINVAL
when their kernel modules are not loaded. Remove the conditional
so all protocols suppress the error.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>