* Re: [PATCH net] net: wan: fsl_ucc_hdlc: free tx_skbuff in uhdlc_memclean
From: Jakub Kicinski @ 2026-05-05 23:47 UTC (permalink / raw)
To: Holger Brunck
Cc: Christophe Leroy (CS GROUP), netdev@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, andrew+netdev@lunn.ch,
qiang.zhao@nxp.com, horms@kernel.org
In-Reply-To: <AM0PR06MB103966EF99B706158C49CB3EAF73E2@AM0PR06MB10396.eurprd06.prod.outlook.com>
On Tue, 5 May 2026 08:33:34 +0000 Holger Brunck wrote:
> > I don't think you can just kfree() an skb like this.
> >
> > I think you have to call dev_kfree_skb_any() instead.
>
> yes you are right or at least dev_kfree_skb() as the error handling code in
> ucc_hdlc_tx does.
Please make it clear in the commit message how you discovered
the issue and how you tested your patches.
^ permalink raw reply
* Re: [PATCH net] net: wan: fsl_ucc_hdlc: fix indentation error
From: Jakub Kicinski @ 2026-05-05 23:48 UTC (permalink / raw)
To: Holger Brunck
Cc: Christophe Leroy (CS GROUP), netdev@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, andrew+netdev@lunn.ch,
qiang.zhao@nxp.com, horms@kernel.org
In-Reply-To: <AM0PR06MB103966A8283FD757F6C9459A0F73E2@AM0PR06MB10396.eurprd06.prod.outlook.com>
On Tue, 5 May 2026 08:16:01 +0000 Holger Brunck wrote:
> no not mandatory needed. I just saw that and thought that also such minor issues
> should be fixed. Can be abandoned.
Quoting documentation:
Clean-up patches
~~~~~~~~~~~~~~~~
Netdev discourages patches which perform simple clean-ups, which are not in
the context of other work. For example:
* Addressing ``checkpatch.pl``, and other trivial coding style warnings
* Addressing :ref:`Local variable ordering<rcs>` issues
* Conversions to device-managed APIs (``devm_`` helpers)
This is because it is felt that the churn that such changes produce comes
at a greater cost than the value of such clean-ups.
Conversely, spelling and grammar fixes are not discouraged.
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#clean-up-patches
^ permalink raw reply
* [PATCH net v1] net/mlx5e: CT: Fix NAT miss rule cleanup on init failure
From: Prathamesh Deshpande @ 2026-05-05 23:48 UTC (permalink / raw)
To: Saeed Mahameed, Leon Romanovsky
Cc: Tariq Toukan, Chris Mi, netdev, linux-rdma, linux-kernel,
Prathamesh Deshpande
mlx5_tc_ct_init() creates the CT-NAT miss rule before initializing the
conntrack hash tables, workqueue and flow-steering state.
If one of those later initialization steps fails, the error path destroys
the CT-NAT table but does not delete the miss rule and flow group created
in that table.
Add a dedicated unwind step to delete the CT-NAT miss rule before
destroying the CT-NAT table.
Fixes: 49d37d05f216 ("net/mlx5: CT: Separate CT and CT-NAT tuple entries")
Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
index 6c87a1c7db09..15e406d29004 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
@@ -2349,7 +2349,7 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains,
&ct_priv->ct_nat_miss_group,
&ct_priv->ct_nat_miss_rule);
if (err)
- goto err_ct_zone_ht;
+ goto err_ct_nat_miss_rule;
ct_priv->post_act = post_act;
mutex_init(&ct_priv->control_lock);
@@ -2382,6 +2382,9 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains,
err_ct_tuples_ht:
rhashtable_destroy(&ct_priv->zone_ht);
err_ct_zone_ht:
+ tc_ct_del_ct_table_miss_rule(ct_priv->ct_nat_miss_group,
+ ct_priv->ct_nat_miss_rule);
+err_ct_nat_miss_rule:
mlx5_chains_destroy_global_table(chains, ct_priv->ct_nat);
err_ct_nat_tbl:
mlx5_chains_destroy_global_table(chains, ct_priv->ct);
--
2.43.0
^ permalink raw reply related
* Re: [net-next RFC PATCH v5 08/10] dt-bindings: net: pcs: Document support for Airoha Ethernet PCS
From: Benjamin Larsson @ 2026-05-06 0:00 UTC (permalink / raw)
To: Christian Marangi, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Lorenzo Bianconi, Heiner Kallweit, Russell King,
Philipp Zabel, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
Justin Stitt, Daniel Golle, netdev, devicetree, linux-kernel,
linux-arm-kernel, linux-mediatek, llvm
In-Reply-To: <20260505182713.27644-9-ansuelsmth@gmail.com>
Hi.
On 05/05/2026 20:27, Christian Marangi wrote:
> Document support for Airoha Ethernet PCS for AN7581 SoC.
>
> Airoha AN7581 SoC expose multiple Physical Coding Sublayer (PCS) for
> the various Serdes port supporting different Media Independent Interface
> (10BASE-R, USXGMII, 2500BASE-X, 1000BASE-X, SGMII).
10GBASE-R
> This follow the new PCS provider with the use of #pcs-cells property.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> .../bindings/net/pcs/airoha,pcs.yaml | 112 ++++++++++++++++++
> 1 file changed, 112 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/net/pcs/airoha,pcs.yaml
>
> diff --git a/Documentation/devicetree/bindings/net/pcs/airoha,pcs.yaml b/Documentation/devicetree/bindings/net/pcs/airoha,pcs.yaml
> new file mode 100644
> index 000000000000..8bcf7757c728
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/pcs/airoha,pcs.yaml
> @@ -0,0 +1,112 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/pcs/airoha,pcs.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Airoha Ethernet PCS and Serdes
> +
> +maintainers:
> + - Christian Marangi <ansuelsmth@gmail.com>
> +
> +description:
> + Airoha AN7581 SoC expose multiple Physical Coding Sublayer (PCS) for
> + the various Serdes port supporting different Media Independent Interface
> + (10BASE-R, USXGMII, 2500BASE-X, 1000BASE-X, SGMII).
10GBASE-R
> +
> +properties:
> + compatible:
> + enum:
> + - airoha,an7581-pcs-eth
> + - airoha,an7581-pcs-pon
> +
> + reg:
> + items:
> + - description: XFI MAC reg
> + - description: HSGMII AN reg
> + - description: HSGMII PCS reg
> + - description: MULTI SGMII reg
> + - description: USXGMII reg
> + - description: HSGMII rate adaption reg
> + - description: XFI Analog register
> + - description: XFI PMA (Physical Medium Attachment) register
reg or register ?
MvH
Benjamin Larsson
^ permalink raw reply
* [PATCH net v1] net/mlx5: HWS: Reject unsupported remove-header action
From: Prathamesh Deshpande @ 2026-05-06 0:00 UTC (permalink / raw)
To: Saeed Mahameed, Leon Romanovsky
Cc: Moshe Shemesh, Tariq Toukan, Mark Bloch, netdev, linux-kernel,
Prathamesh Deshpande
mlx5_cmd_hws_packet_reformat_alloc() handles
MLX5_REFORMAT_TYPE_REMOVE_HDR by looking up a matching HWS remove-header
action.
If mlx5_fs_get_action_remove_header_vlan() returns NULL, the code only
logs an error and continues. The function then returns success with a NULL
HWS action stored in the packet-reformat object.
Return an error when no matching remove-header action is available.
Fixes: aecd9d1020e3 ("net/mlx5: fs, add HWS packet reformat API function")
Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
---
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
index aca77853abb8..5a172c572a68 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
@@ -1320,8 +1320,10 @@ mlx5_cmd_hws_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns,
break;
case MLX5_REFORMAT_TYPE_REMOVE_HDR:
hws_action = mlx5_fs_get_action_remove_header_vlan(fs_ctx, params);
- if (!hws_action)
+ if (!hws_action) {
mlx5_core_err(dev, "Only vlan remove header supported\n");
+ return -EOPNOTSUPP;
+ }
break;
default:
mlx5_core_err(ns->dev, "Packet-reformat not supported(%d)\n",
--
2.43.0
^ permalink raw reply related
* Re: [PATCH v13 net-next 2/5] psp: add new netlink cmd for dev-assoc and dev-disassoc
From: Wei Wang @ 2026-05-06 0:06 UTC (permalink / raw)
To: Daniel Zahka
Cc: netdev, Jakub Kicinski, Willem de Bruijn, David Wei, Andrew Lunn,
David S . Miller, Eric Dumazet, Simon Horman, Paolo Abeni,
Wei Wang
In-Reply-To: <12f11785-0bd5-400e-8acc-f47b92271e33@gmail.com>
On Tue, May 5, 2026 at 7:07 AM Daniel Zahka <daniel.zahka@gmail.com> wrote:
>
>
> On 5/4/26 7:00 PM, Wei Wang wrote:
> > @@ -281,6 +318,34 @@ operations:
> > post: psp-device-unlock
> > dump:
> > reply: *stats-all
> > + -
> > + name: dev-assoc
> > + doc: Associate a network device with a PSP device.
> > + attribute-set: dev
> > + do:
> > + request:
> > + attributes:
> > + - id
> > + - ifindex
> > + - nsid
> > + reply:
> > + attributes: []
> > + pre: psp-device-get-locked
> > + post: psp-device-unlock
> > + -
> > + name: dev-disassoc
> > + doc: Disassociate a network device from a PSP device.
> > + attribute-set: dev
> > + do:
> > + request:
> > + attributes:
> > + - id
> > + - ifindex
> > + - nsid
> > + reply:
> > + attributes: []
> > + pre: psp-device-get-locked
> > + post: psp-device-unlock
>
>
> Should these require flags: [admin-perm] and/or psp-device-get-locked-admin?
>
It might be worth adding admin-perm so only admin users can do
dev-assoc and dev-disassoc in its own netns.
But it should use psp-device-get-locked because this allows callers
within its own netns to do assoc/disassoc with the PSD in the
different netns.
I will add admin-perm in the next version.
>
^ permalink raw reply
* [PATCH net 00/12] net: shaper: fix various minor bugs
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
Fix various minor bugs in the net shaper API.
First 4 changes are a bit hairy. The readers are currently under
RCU so we need to be careful how we update and insert the nodes.
Patch 4 is a bit of a cop-out. Pre-allocating replacement nodes
is complex. If the workaround is not acceptable I'd seriously
consider making the readers take the instance lock.
Only other patch of note is patch 10. We want to add a Netlink
policy check on the handle ID. This necessitates patch 9.
The rest are simple and self-explanatory.
Jakub Kicinski (12):
net: shaper: drop redundant xa_lock() bracketing
net: shaper: flip the polarity of the valid flag
net: shaper: fix trivial ordering issue in net_shaper_commit()
net: shaper: try to avoid violating RCU
net: shaper: reject duplicate leaves in GROUP request
selftests: drv-net: add shaper test for duplicate leaves
net: shaper: set ret to -ENOMEM when genlmsg_new() fails in group_doit
net: shaper: fix undersized reply skb allocation in GROUP command
tools: ynl: add scope qualifier for definitions
net: shaper: reject handle IDs exceeding internal bit-width
net: shaper: enforce singleton NETDEV scope with id 0
net: shaper: reject QUEUE scope handle with missing id
Documentation/netlink/genetlink-c.yaml | 9 +
Documentation/netlink/genetlink-legacy.yaml | 9 +
Documentation/netlink/genetlink.yaml | 9 +
Documentation/netlink/specs/net_shaper.yaml | 7 +
net/shaper/shaper_nl_gen.h | 2 +
net/shaper/shaper.c | 171 +++++++++++++-----
net/shaper/shaper_nl_gen.c | 7 +-
tools/net/ynl/pyynl/ynl_gen_c.py | 31 +++-
tools/testing/selftests/drivers/net/shaper.py | 25 ++-
9 files changed, 216 insertions(+), 54 deletions(-)
--
2.54.0
^ permalink raw reply
* [PATCH net 01/12] net: shaper: drop redundant xa_lock() bracketing
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
The shaper insertion code is written in a way that suggests that
perhaps it was expecting readers to be fenced off by xa_lock.
This is not the case, readers of XArray are purely under RCU.
Remove the explicit taking of xa_lock() to simplify subsequent fixes.
All writers to hierarchy->shapers are serialized by the netdev instance
lock. For Netlink taken in net_shaper_nl_pre_doit_write().
net_shaper_set_real_num_tx_queues() has a netdev_assert_locked().
net_shaper_flush_netdev() runs after netdev is made inaccessible
to readers.
The explicit xa_lock() bracketing in pre_insert(), commit(), rollback()
and flush() therefore does not protect against any other writer.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/shaper/shaper.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/net/shaper/shaper.c b/net/shaper/shaper.c
index 94bc9c7382ea..e28d20774713 100644
--- a/net/shaper/shaper.c
+++ b/net/shaper/shaper.c
@@ -373,10 +373,8 @@ static int net_shaper_pre_insert(struct net_shaper_binding *binding,
/* Mark 'tentative' shaper inside the hierarchy container.
* xa_set_mark is a no-op if the previous store fails.
*/
- xa_lock(&hierarchy->shapers);
- prev = __xa_store(&hierarchy->shapers, index, cur, GFP_KERNEL);
- __xa_set_mark(&hierarchy->shapers, index, NET_SHAPER_NOT_VALID);
- xa_unlock(&hierarchy->shapers);
+ prev = xa_store(&hierarchy->shapers, index, cur, GFP_KERNEL);
+ xa_set_mark(&hierarchy->shapers, index, NET_SHAPER_NOT_VALID);
if (xa_err(prev)) {
NL_SET_ERR_MSG(extack, "Can't insert shaper into device store");
kfree_rcu(cur, rcu);
@@ -402,7 +400,6 @@ static void net_shaper_commit(struct net_shaper_binding *binding,
int index;
int i;
- xa_lock(&hierarchy->shapers);
for (i = 0; i < nr_shapers; ++i) {
index = net_shaper_handle_to_index(&shapers[i].handle);
@@ -413,11 +410,10 @@ static void net_shaper_commit(struct net_shaper_binding *binding,
/* Successful update: drop the tentative mark
* and update the hierarchy container.
*/
- __xa_clear_mark(&hierarchy->shapers, index,
- NET_SHAPER_NOT_VALID);
+ xa_clear_mark(&hierarchy->shapers, index,
+ NET_SHAPER_NOT_VALID);
*cur = shapers[i];
}
- xa_unlock(&hierarchy->shapers);
}
/* Rollback all the tentative inserts from the hierarchy. */
@@ -430,13 +426,11 @@ static void net_shaper_rollback(struct net_shaper_binding *binding)
if (!hierarchy)
return;
- xa_lock(&hierarchy->shapers);
xa_for_each_marked(&hierarchy->shapers, index, cur,
NET_SHAPER_NOT_VALID) {
- __xa_erase(&hierarchy->shapers, index);
+ xa_erase(&hierarchy->shapers, index);
kfree(cur);
}
- xa_unlock(&hierarchy->shapers);
}
static int net_shaper_parse_handle(const struct nlattr *attr,
@@ -1382,12 +1376,10 @@ static void net_shaper_flush(struct net_shaper_binding *binding)
if (!hierarchy)
return;
- xa_lock(&hierarchy->shapers);
xa_for_each(&hierarchy->shapers, index, cur) {
- __xa_erase(&hierarchy->shapers, index);
+ xa_erase(&hierarchy->shapers, index);
kfree(cur);
}
- xa_unlock(&hierarchy->shapers);
kfree(hierarchy);
}
--
2.54.0
^ permalink raw reply related
* [PATCH net 02/12] net: shaper: flip the polarity of the valid flag
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
The usual way of inserting entries which are not yet fully ready
into XArray is to have a VALID flag. The shaper code has a NOT_VALID
flag. Since XArray code does not let us create entries with a marks
already set - the creation of entries is currently not atomic.
Flip the polarity of the VALID flag. This closes the tiny race
in net_shaper_pre_insert() of entries being created without
the NOT_VALID flag.
Fixes: 93954b40f6a4 ("net-shapers: implement NL set and delete operations")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/shaper/shaper.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/net/shaper/shaper.c b/net/shaper/shaper.c
index e28d20774713..c5cf10543af0 100644
--- a/net/shaper/shaper.c
+++ b/net/shaper/shaper.c
@@ -275,11 +275,13 @@ static void net_shaper_default_parent(const struct net_shaper_handle *handle,
parent->id = 0;
}
-/*
- * MARK_0 is already in use due to XA_FLAGS_ALLOC, can't reuse such flag as
- * it's cleared by xa_store().
+/* MARK_0 is already in use due to XA_FLAGS_ALLOC. The VALID mark is set on
+ * an entry only after the device-side configuration has completed
+ * successfully (see net_shaper_commit()). Lookups and dumps must filter on
+ * this mark to avoid exposing tentative entries inserted by
+ * net_shaper_pre_insert() while the driver call is still in flight.
*/
-#define NET_SHAPER_NOT_VALID XA_MARK_1
+#define NET_SHAPER_VALID XA_MARK_1
static struct net_shaper *
net_shaper_lookup(struct net_shaper_binding *binding,
@@ -289,8 +291,8 @@ net_shaper_lookup(struct net_shaper_binding *binding,
struct net_shaper_hierarchy *hierarchy;
hierarchy = net_shaper_hierarchy_rcu(binding);
- if (!hierarchy || xa_get_mark(&hierarchy->shapers, index,
- NET_SHAPER_NOT_VALID))
+ if (!hierarchy || !xa_get_mark(&hierarchy->shapers, index,
+ NET_SHAPER_VALID))
return NULL;
return xa_load(&hierarchy->shapers, index);
@@ -370,11 +372,10 @@ static int net_shaper_pre_insert(struct net_shaper_binding *binding,
goto free_id;
}
- /* Mark 'tentative' shaper inside the hierarchy container.
- * xa_set_mark is a no-op if the previous store fails.
+ /* Insert as 'tentative' (no VALID mark). The mark will be set by
+ * net_shaper_commit() once the driver-side configuration succeeds.
*/
prev = xa_store(&hierarchy->shapers, index, cur, GFP_KERNEL);
- xa_set_mark(&hierarchy->shapers, index, NET_SHAPER_NOT_VALID);
if (xa_err(prev)) {
NL_SET_ERR_MSG(extack, "Can't insert shaper into device store");
kfree_rcu(cur, rcu);
@@ -410,8 +411,7 @@ static void net_shaper_commit(struct net_shaper_binding *binding,
/* Successful update: drop the tentative mark
* and update the hierarchy container.
*/
- xa_clear_mark(&hierarchy->shapers, index,
- NET_SHAPER_NOT_VALID);
+ xa_set_mark(&hierarchy->shapers, index, NET_SHAPER_VALID);
*cur = shapers[i];
}
}
@@ -426,8 +426,9 @@ static void net_shaper_rollback(struct net_shaper_binding *binding)
if (!hierarchy)
return;
- xa_for_each_marked(&hierarchy->shapers, index, cur,
- NET_SHAPER_NOT_VALID) {
+ xa_for_each(&hierarchy->shapers, index, cur) {
+ if (xa_get_mark(&hierarchy->shapers, index, NET_SHAPER_VALID))
+ continue;
xa_erase(&hierarchy->shapers, index);
kfree(cur);
}
@@ -830,7 +831,8 @@ int net_shaper_nl_get_dumpit(struct sk_buff *skb,
goto out_unlock;
for (; (shaper = xa_find(&hierarchy->shapers, &ctx->start_index,
- U32_MAX, XA_PRESENT)); ctx->start_index++) {
+ U32_MAX, NET_SHAPER_VALID));
+ ctx->start_index++) {
ret = net_shaper_fill_one(skb, binding, shaper, info);
if (ret)
break;
--
2.54.0
^ permalink raw reply related
* [PATCH net 03/12] net: shaper: fix trivial ordering issue in net_shaper_commit()
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
We should update the entry before we mark it as valid.
Fixes: 93954b40f6a4 ("net-shapers: implement NL set and delete operations")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/shaper/shaper.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/shaper/shaper.c b/net/shaper/shaper.c
index c5cf10543af0..692e38df42cb 100644
--- a/net/shaper/shaper.c
+++ b/net/shaper/shaper.c
@@ -295,6 +295,10 @@ net_shaper_lookup(struct net_shaper_binding *binding,
NET_SHAPER_VALID))
return NULL;
+ /* Pairs with smp_wmb() in net_shaper_commit(): if the entry is
+ * valid, its contents must be visible too.
+ */
+ smp_rmb();
return xa_load(&hierarchy->shapers, index);
}
@@ -411,8 +415,9 @@ static void net_shaper_commit(struct net_shaper_binding *binding,
/* Successful update: drop the tentative mark
* and update the hierarchy container.
*/
- xa_set_mark(&hierarchy->shapers, index, NET_SHAPER_VALID);
*cur = shapers[i];
+ smp_wmb();
+ xa_set_mark(&hierarchy->shapers, index, NET_SHAPER_VALID);
}
}
@@ -833,6 +838,10 @@ int net_shaper_nl_get_dumpit(struct sk_buff *skb,
for (; (shaper = xa_find(&hierarchy->shapers, &ctx->start_index,
U32_MAX, NET_SHAPER_VALID));
ctx->start_index++) {
+ /* Pairs with smp_wmb() in net_shaper_commit(): the entry
+ * is marked VALID, so its contents must be visible too.
+ */
+ smp_rmb();
ret = net_shaper_fill_one(skb, binding, shaper, info);
if (ret)
break;
--
2.54.0
^ permalink raw reply related
* [PATCH net 04/12] net: shaper: try to avoid violating RCU
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
net_shaper_commit() overrides nodes which may be concurrently read
under RCU. This is not a huge deal since the entries only contain
config, worst case user will see inconsistent config params. But
we should try to avoid this obvious RCU violation. Try to allocate
a new node. Since commit() can't fail fall back to overriding.
Full fix is probably not worth the complexity, struct net_shaper
is around 80B, and the allocation is with GFP_KERNEL.
Fixes: 93954b40f6a4 ("net-shapers: implement NL set and delete operations")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/shaper/shaper.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/net/shaper/shaper.c b/net/shaper/shaper.c
index 692e38df42cb..a2e9adca9afc 100644
--- a/net/shaper/shaper.c
+++ b/net/shaper/shaper.c
@@ -406,18 +406,36 @@ static void net_shaper_commit(struct net_shaper_binding *binding,
int i;
for (i = 0; i < nr_shapers; ++i) {
+ struct net_shaper *new;
+
index = net_shaper_handle_to_index(&shapers[i].handle);
cur = xa_load(&hierarchy->shapers, index);
if (WARN_ON_ONCE(!cur))
continue;
- /* Successful update: drop the tentative mark
- * and update the hierarchy container.
+ /* If the shaper is already visible try to allocate a new
+ * entry so that we don't cause torn reads under RCU.
+ * This tiny GFP_KERNEL alloc should never fail, really,
+ * but if it does just override, the torn read is acceptable.
*/
- *cur = shapers[i];
- smp_wmb();
- xa_set_mark(&hierarchy->shapers, index, NET_SHAPER_VALID);
+ new = NULL;
+ if (xa_get_mark(&hierarchy->shapers, index, NET_SHAPER_VALID))
+ new = kmalloc_obj(*new);
+
+ if (new) {
+ *new = shapers[i];
+ smp_wmb();
+ /* Replacing an entry, xa_store() can't fail */
+ WARN_ON(xa_err(xa_store(&hierarchy->shapers, index,
+ new, GFP_KERNEL)));
+ kfree_rcu(cur, rcu);
+ } else {
+ *cur = shapers[i];
+ smp_wmb();
+ xa_set_mark(&hierarchy->shapers, index,
+ NET_SHAPER_VALID);
+ }
}
}
--
2.54.0
^ permalink raw reply related
* [PATCH net 05/12] net: shaper: reject duplicate leaves in GROUP request
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
net_shaper_nl_group_doit() does not deduplicate NET_SHAPER_A_LEAVES
entries. When userspace supplies the same leaf handle twice, the same
old-parent pointer lands twice in old_nodes[]. The cleanup loop double
frees the parent. Of course the same parent may still be in old_nodes[]
twice if we are moving multiple of its leaves.
Note that this patch also implicitly fixes the fact that the
i >= leaves_count path forgets to set ret.
Fixes: 5d5d4700e75d ("net-shapers: implement NL group operation")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/shaper/shaper.c | 60 +++++++++++++++++++++++++++++++++------------
1 file changed, 45 insertions(+), 15 deletions(-)
diff --git a/net/shaper/shaper.c b/net/shaper/shaper.c
index a2e9adca9afc..a27673e5919f 100644
--- a/net/shaper/shaper.c
+++ b/net/shaper/shaper.c
@@ -955,6 +955,46 @@ static int net_shaper_handle_cmp(const struct net_shaper_handle *a,
return memcmp(a, b, sizeof(*a));
}
+static int net_shaper_parse_leaves(struct net_shaper_binding *binding,
+ struct genl_info *info,
+ const struct net_shaper *node,
+ struct net_shaper *leaves,
+ int leaves_count)
+{
+ struct nlattr *attr;
+ int i, j, ret, rem;
+
+ i = 0;
+ nla_for_each_attr_type(attr, NET_SHAPER_A_LEAVES,
+ genlmsg_data(info->genlhdr),
+ genlmsg_len(info->genlhdr), rem) {
+ if (WARN_ON_ONCE(i >= leaves_count))
+ return -EINVAL;
+
+ ret = net_shaper_parse_leaf(binding, attr, info,
+ node, &leaves[i]);
+ if (ret)
+ return ret;
+
+ /* Reject duplicates */
+ for (j = 0; j < i; j++) {
+ if (net_shaper_handle_cmp(&leaves[i].handle,
+ &leaves[j].handle))
+ continue;
+
+ NL_SET_ERR_MSG_ATTR_FMT(info->extack, attr,
+ "Duplicate leaf shaper %d:%d",
+ leaves[i].handle.scope,
+ leaves[i].handle.id);
+ return -EINVAL;
+ }
+
+ i++;
+ }
+
+ return 0;
+}
+
static int net_shaper_parent_from_leaves(int leaves_count,
const struct net_shaper *leaves,
struct net_shaper *node,
@@ -1195,10 +1235,9 @@ int net_shaper_nl_group_doit(struct sk_buff *skb, struct genl_info *info)
struct net_shaper **old_nodes, *leaves, node = {};
struct net_shaper_hierarchy *hierarchy;
struct net_shaper_binding *binding;
- int i, ret, rem, leaves_count;
+ int i, ret, leaves_count;
int old_nodes_count = 0;
struct sk_buff *msg;
- struct nlattr *attr;
if (GENL_REQ_ATTR_CHECK(info, NET_SHAPER_A_LEAVES))
return -EINVAL;
@@ -1226,19 +1265,10 @@ int net_shaper_nl_group_doit(struct sk_buff *skb, struct genl_info *info)
if (ret)
goto free_leaves;
- i = 0;
- nla_for_each_attr_type(attr, NET_SHAPER_A_LEAVES,
- genlmsg_data(info->genlhdr),
- genlmsg_len(info->genlhdr), rem) {
- if (WARN_ON_ONCE(i >= leaves_count))
- goto free_leaves;
-
- ret = net_shaper_parse_leaf(binding, attr, info,
- &node, &leaves[i]);
- if (ret)
- goto free_leaves;
- i++;
- }
+ ret = net_shaper_parse_leaves(binding, info, &node,
+ leaves, leaves_count);
+ if (ret)
+ goto free_leaves;
/* Prepare the msg reply in advance, to avoid device operation
* rollback on allocation failure.
--
2.54.0
^ permalink raw reply related
* [PATCH net 06/12] selftests: drv-net: add shaper test for duplicate leaves
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
Add test exercising duplicate leaves.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
tools/testing/selftests/drivers/net/shaper.py | 25 +++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/shaper.py b/tools/testing/selftests/drivers/net/shaper.py
index 11310f19bfa0..f7872c931bf6 100755
--- a/tools/testing/selftests/drivers/net/shaper.py
+++ b/tools/testing/selftests/drivers/net/shaper.py
@@ -1,7 +1,10 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0
-from lib.py import ksft_run, ksft_exit, ksft_eq, ksft_true, KsftSkipEx
+import errno
+
+from lib.py import ksft_run, ksft_exit
+from lib.py import ksft_eq, ksft_raises, ksft_true, KsftSkipEx
from lib.py import EthtoolFamily, NetshaperFamily
from lib.py import NetDrvEnv
from lib.py import NlError
@@ -438,6 +441,21 @@ from lib.py import cmd
nl_shaper.delete({'ifindex': cfg.ifindex,
'handle': {'scope': 'queue', 'id': i}})
+def dup_leaves(cfg, nl_shaper) -> None:
+ """ Ensure that the kernel rejects duplicate leaves. """
+ if not cfg.groups:
+ raise KsftSkipEx("device does not support node scope")
+
+ with ksft_raises(NlError) as cm:
+ nl_shaper.group({
+ 'ifindex': cfg.ifindex,
+ 'leaves':[{'handle': {'scope': 'queue', 'id': 0}},
+ {'handle': {'scope': 'queue', 'id': 0}}],
+ 'handle': {'scope':'node'},
+ 'metric': 'bps',
+ 'bw-max': 10000})
+ ksft_eq(cm.exception.error, errno.EINVAL)
+
def main() -> None:
with NetDrvEnv(__file__, queue_count=4) as cfg:
cfg.queues = False
@@ -453,7 +471,10 @@ from lib.py import cmd
basic_groups,
qgroups,
delegation,
- queue_update], args=(cfg, NetshaperFamily()))
+ queue_update,
+ dup_leaves
+ ],
+ args=(cfg, NetshaperFamily()))
ksft_exit()
--
2.54.0
^ permalink raw reply related
* [PATCH net 07/12] net: shaper: set ret to -ENOMEM when genlmsg_new() fails in group_doit
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
genlmsg_new() alloc failure path in net_shaper_nl_group_doit() forgets
to set ret before jumping to error handling.
Fixes: 5d5d4700e75d ("net-shapers: implement NL group operation")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/shaper/shaper.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/shaper/shaper.c b/net/shaper/shaper.c
index a27673e5919f..2ba397fa3bfd 100644
--- a/net/shaper/shaper.c
+++ b/net/shaper/shaper.c
@@ -1274,8 +1274,10 @@ int net_shaper_nl_group_doit(struct sk_buff *skb, struct genl_info *info)
* rollback on allocation failure.
*/
msg = genlmsg_new(net_shaper_handle_size(), GFP_KERNEL);
- if (!msg)
+ if (!msg) {
+ ret = -ENOMEM;
goto free_leaves;
+ }
hierarchy = net_shaper_hierarchy_setup(binding);
if (!hierarchy) {
--
2.54.0
^ permalink raw reply related
* [PATCH net 08/12] net: shaper: fix undersized reply skb allocation in GROUP command
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
net_shaper_group_send_reply() writes both the NET_SHAPER_A_IFINDEX
attribute (via net_shaper_fill_binding()) and the nested
NET_SHAPER_A_HANDLE attribute (via net_shaper_fill_handle()), but
the reply skb at the call site in net_shaper_nl_group_doit() is
allocated using net_shaper_handle_size(), which only accounts for
the nested handle.
The allocation is therefore short by nla_total_size(sizeof(u32))
(8 bytes) for the IFINDEX attribute. In practice the slab allocator
rounds up the small allocation so the bug is latent, but the size
accounting is wrong and could bite if the reply grew further.
Introduce net_shaper_group_reply_size() that accounts for the full
reply payload and use it both at the genlmsg_new() call site and in
the defensive WARN_ONCE message.
Fixes: 5d5d4700e75d ("net-shapers: implement NL group operation")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/shaper/shaper.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/shaper/shaper.c b/net/shaper/shaper.c
index 2ba397fa3bfd..10d76f7148bf 100644
--- a/net/shaper/shaper.c
+++ b/net/shaper/shaper.c
@@ -90,6 +90,12 @@ static int net_shaper_handle_size(void)
nla_total_size(sizeof(u32)));
}
+static int net_shaper_group_reply_size(void)
+{
+ return nla_total_size(sizeof(u32)) + /* NET_SHAPER_A_IFINDEX */
+ net_shaper_handle_size(); /* NET_SHAPER_A_HANDLE */
+}
+
static int net_shaper_fill_binding(struct sk_buff *msg,
const struct net_shaper_binding *binding,
u32 type)
@@ -1225,7 +1231,7 @@ static int net_shaper_group_send_reply(struct net_shaper_binding *binding,
free_msg:
/* Should never happen as msg is pre-allocated with enough space. */
WARN_ONCE(true, "calculated message payload length (%d)",
- net_shaper_handle_size());
+ net_shaper_group_reply_size());
nlmsg_free(msg);
return -EMSGSIZE;
}
@@ -1273,7 +1279,7 @@ int net_shaper_nl_group_doit(struct sk_buff *skb, struct genl_info *info)
/* Prepare the msg reply in advance, to avoid device operation
* rollback on allocation failure.
*/
- msg = genlmsg_new(net_shaper_handle_size(), GFP_KERNEL);
+ msg = genlmsg_new(net_shaper_group_reply_size(), GFP_KERNEL);
if (!msg) {
ret = -ENOMEM;
goto free_leaves;
--
2.54.0
^ permalink raw reply related
* [PATCH net 09/12] tools: ynl: add scope qualifier for definitions
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski, donald.hunter, ast
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
Using definitions in kernel policies is awkward right now.
On one hand we want defines for max values and such.
On the other we don't have a way of adding kernel-only defines.
Adding unnecessary defines to uAPI is a bad idea, we won't
be able to delete them. And when it comes to policy user
space should just query it via the policy dump, not use
hard coded defines.
Add a "scope" property to definitions, which will let us tell
the codegen that a definition is for kernel use only. Support
following values:
- uapi: render into the uAPI header (default, today's behavior)
- kernel: render to kernel header only
- user: same as kernel but for the user-side generated header
Definitions may have a header property (definition is "external",
provided by existing header). Extend the scope to headers, too.
If definition has both scope and header properties we will only
generate the includes in the right scope.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
This will fail yamllint, sticking to the same format as the rest
of the file (extra spaces inside brackets).
CC: donald.hunter@gmail.com
CC: ast@fiberby.net
---
Documentation/netlink/genetlink-c.yaml | 9 ++++++
Documentation/netlink/genetlink-legacy.yaml | 9 ++++++
Documentation/netlink/genetlink.yaml | 9 ++++++
tools/net/ynl/pyynl/ynl_gen_c.py | 31 +++++++++++++++++++--
4 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/Documentation/netlink/genetlink-c.yaml b/Documentation/netlink/genetlink-c.yaml
index 57f59fe23e3f..4ea31e8fc4d1 100644
--- a/Documentation/netlink/genetlink-c.yaml
+++ b/Documentation/netlink/genetlink-c.yaml
@@ -69,6 +69,15 @@ additionalProperties: False
header:
description: For C-compatible languages, header which already defines this value.
type: string
+ scope:
+ description: |
+ Visibility of this definition. "uapi" (default) renders into
+ the uAPI header, "kernel" renders into the kernel-side
+ generated header, "user" renders into the user-side
+ generated header. When combined with `header:`, the
+ definition is not rendered, and the named header is
+ included only by code matching the scope.
+ enum: [ uapi, kernel, user ]
type:
enum: [ const, enum, flags ]
doc:
diff --git a/Documentation/netlink/genetlink-legacy.yaml b/Documentation/netlink/genetlink-legacy.yaml
index 66fb8653a344..f9c44747729a 100644
--- a/Documentation/netlink/genetlink-legacy.yaml
+++ b/Documentation/netlink/genetlink-legacy.yaml
@@ -83,6 +83,15 @@ additionalProperties: False
header:
description: For C-compatible languages, header which already defines this value.
type: string
+ scope:
+ description: |
+ Visibility of this definition. "uapi" (default) renders into
+ the uAPI header, "kernel" renders into the kernel-side
+ generated header, "user" renders into the user-side
+ generated header. When combined with `header:`, the
+ definition is not rendered, and the named header is
+ included only by code matching the scope.
+ enum: [ uapi, kernel, user ]
type:
enum: [ const, enum, flags, struct ] # Trim
doc:
diff --git a/Documentation/netlink/genetlink.yaml b/Documentation/netlink/genetlink.yaml
index a1194d5d93fc..d3f3f3399ddf 100644
--- a/Documentation/netlink/genetlink.yaml
+++ b/Documentation/netlink/genetlink.yaml
@@ -55,6 +55,15 @@ additionalProperties: False
header:
description: For C-compatible languages, header which already defines this value.
type: string
+ scope:
+ description: |
+ Visibility of this definition. "uapi" (default) renders into
+ the uAPI header, "kernel" renders into the kernel-side
+ generated header, "user" renders into the user-side
+ generated header. When combined with `header:`, the
+ definition is not rendered, and the named header is
+ included only by code matching the scope.
+ enum: [ uapi, kernel, user ]
type:
enum: [ const, enum, flags ]
doc:
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index 0e1e486c1185..cdc3646f2642 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -3212,6 +3212,8 @@ _C_KW = {
for const in family['definitions']:
if const.get('header'):
continue
+ if const.get('scope', 'uapi') != 'uapi':
+ continue
if const['type'] != 'const':
cw.writes_defines(defines)
@@ -3339,6 +3341,25 @@ _C_KW = {
cw.p(f'#endif /* {hdr_prot} */')
+def render_scoped_consts(family, cw, scope):
+ defines = []
+ for const in family['definitions']:
+ if const['type'] != 'const':
+ continue
+ if const.get('header'):
+ continue
+ if const.get('scope') != scope:
+ continue
+ name_pfx = const.get('name-prefix', f"{family.ident_name}-")
+ defines.append([
+ c_upper(family.get('c-define-name',
+ f"{name_pfx}{const['name']}")),
+ const['value']])
+ if defines:
+ cw.writes_defines(defines)
+ cw.nl()
+
+
def _render_user_ntf_entry(ri, op):
if not ri.family.is_classic():
ri.cw.block_start(line=f"[{op.enum_name}] = ")
@@ -3504,8 +3525,12 @@ _C_KW = {
cw.p('#include "ynl.h"')
headers = []
for definition in parsed['definitions'] + parsed['attribute-sets']:
- if 'header' in definition:
- headers.append(definition['header'])
+ if 'header' not in definition:
+ continue
+ scope = definition.get('scope', 'uapi')
+ if scope != 'uapi' and scope != args.mode:
+ continue
+ headers.append(definition['header'])
if args.mode == 'user':
headers.append(parsed.uapi_header)
seen_header = []
@@ -3522,6 +3547,7 @@ _C_KW = {
for one in args.user_header:
cw.p(f'#include "{one}"')
else:
+ render_scoped_consts(parsed, cw, 'user')
cw.p('struct ynl_sock;')
cw.nl()
render_user_family(parsed, cw, True)
@@ -3529,6 +3555,7 @@ _C_KW = {
if args.mode == "kernel":
if args.header:
+ render_scoped_consts(parsed, cw, 'kernel')
for _, struct in sorted(parsed.pure_nested_structs.items()):
if struct.request:
cw.p('/* Common nested types */')
--
2.54.0
^ permalink raw reply related
* [PATCH net 10/12] net: shaper: reject handle IDs exceeding internal bit-width
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
net_shaper_parse_handle() reads the user-supplied handle ID via
nla_get_u32(), accepting the full u32 range. However, the xarray key
is built by net_shaper_handle_to_index() using
FIELD_PREP(NET_SHAPER_ID_MASK, handle->id), where NET_SHAPER_ID_MASK
is GENMASK(25, 0) - only 26 bits wide. FIELD_PREP silently masks off
the upper bits at runtime. A user-supplied NODE id like 0x04000123
becomes id 0x123.
Additionally, a user-supplied id equal to NET_SHAPER_ID_UNSPEC
(0x03FFFFFF, which is NET_SHAPER_ID_MASK itself) would collide with
the sentinel used internally by the group operation to signal
"allocate a new NODE id".
Reject user-supplied IDs >= NET_SHAPER_ID_MASK (i.e., >= 0x03FFFFFF)
in the policy.
Fixes: 4b623f9f0f59 ("net-shapers: implement NL get operation")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
Documentation/netlink/specs/net_shaper.yaml | 7 +++++++
net/shaper/shaper_nl_gen.h | 2 ++
net/shaper/shaper.c | 4 +++-
net/shaper/shaper_nl_gen.c | 7 ++++++-
4 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/Documentation/netlink/specs/net_shaper.yaml b/Documentation/netlink/specs/net_shaper.yaml
index 3f2ad772b64b..de01f922040a 100644
--- a/Documentation/netlink/specs/net_shaper.yaml
+++ b/Documentation/netlink/specs/net_shaper.yaml
@@ -33,6 +33,11 @@ doc: |
@cap-get operation.
definitions:
+ -
+ type: const
+ name: max-handle-id
+ value: 0x3fffffe
+ scope: kernel
-
type: enum
name: scope
@@ -140,6 +145,8 @@ doc: |
-
name: id
type: u32
+ checks:
+ max: max-handle-id
doc: |
Numeric identifier of a shaper. The id semantic depends on
the scope. For @queue scope it's the queue id and for @node
diff --git a/net/shaper/shaper_nl_gen.h b/net/shaper/shaper_nl_gen.h
index 42c46c52c775..2406652a9014 100644
--- a/net/shaper/shaper_nl_gen.h
+++ b/net/shaper/shaper_nl_gen.h
@@ -12,6 +12,8 @@
#include <uapi/linux/net_shaper.h>
+#define NET_SHAPER_MAX_HANDLE_ID 67108862
+
/* Common nested types */
extern const struct nla_policy net_shaper_handle_nl_policy[NET_SHAPER_A_HANDLE_ID + 1];
extern const struct nla_policy net_shaper_leaf_info_nl_policy[NET_SHAPER_A_WEIGHT + 1];
diff --git a/net/shaper/shaper.c b/net/shaper/shaper.c
index 10d76f7148bf..16bf24d9e3ca 100644
--- a/net/shaper/shaper.c
+++ b/net/shaper/shaper.c
@@ -21,6 +21,8 @@
#define NET_SHAPER_ID_UNSPEC NET_SHAPER_ID_MASK
+static_assert(NET_SHAPER_ID_UNSPEC == NET_SHAPER_MAX_HANDLE_ID + 1);
+
struct net_shaper_hierarchy {
struct xarray shapers;
};
@@ -360,7 +362,7 @@ static int net_shaper_pre_insert(struct net_shaper_binding *binding,
handle->id == NET_SHAPER_ID_UNSPEC) {
u32 min, max;
- handle->id = NET_SHAPER_ID_MASK - 1;
+ handle->id = NET_SHAPER_MAX_HANDLE_ID;
max = net_shaper_handle_to_index(handle);
handle->id = 0;
min = net_shaper_handle_to_index(handle);
diff --git a/net/shaper/shaper_nl_gen.c b/net/shaper/shaper_nl_gen.c
index 9b29be3ef19a..76eff85ec66d 100644
--- a/net/shaper/shaper_nl_gen.c
+++ b/net/shaper/shaper_nl_gen.c
@@ -11,10 +11,15 @@
#include <uapi/linux/net_shaper.h>
+/* Integer value ranges */
+static const struct netlink_range_validation net_shaper_a_handle_id_range = {
+ .max = NET_SHAPER_MAX_HANDLE_ID,
+};
+
/* Common nested types */
const struct nla_policy net_shaper_handle_nl_policy[NET_SHAPER_A_HANDLE_ID + 1] = {
[NET_SHAPER_A_HANDLE_SCOPE] = NLA_POLICY_MAX(NLA_U32, 3),
- [NET_SHAPER_A_HANDLE_ID] = { .type = NLA_U32, },
+ [NET_SHAPER_A_HANDLE_ID] = NLA_POLICY_FULL_RANGE(NLA_U32, &net_shaper_a_handle_id_range),
};
const struct nla_policy net_shaper_leaf_info_nl_policy[NET_SHAPER_A_WEIGHT + 1] = {
--
2.54.0
^ permalink raw reply related
* [PATCH net 11/12] net: shaper: enforce singleton NETDEV scope with id 0
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
The NETDEV scope represents a singleton root shaper in the per-device
hierarchy. All code assumes NETDEV shapers have id 0:
net_shaper_default_parent() hardcodes parent->id = 0 when returning
the NETDEV parent for QUEUE/NODE children, and the UAPI documentation
describes NETDEV scope as "the main shaper" (singular, not plural).
Make sure we reject non-0 IDs like we reject out of range queues.
Fixes: 4b623f9f0f59 ("net-shapers: implement NL get operation")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/shaper/shaper.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/shaper/shaper.c b/net/shaper/shaper.c
index 16bf24d9e3ca..2adf8b0e1105 100644
--- a/net/shaper/shaper.c
+++ b/net/shaper/shaper.c
@@ -535,6 +535,13 @@ static int net_shaper_validate_caps(struct net_shaper_binding *binding,
return -EOPNOTSUPP;
}
+ if (shaper->handle.scope == NET_SHAPER_SCOPE_NETDEV &&
+ shaper->handle.id != 0) {
+ NL_SET_ERR_MSG(info->extack,
+ "Netdev scope is a singleton, must use ID 0");
+ return -EINVAL;
+ }
+
if (shaper->handle.scope == NET_SHAPER_SCOPE_QUEUE &&
binding->type == NET_SHAPER_BINDING_TYPE_NETDEV &&
shaper->handle.id >= binding->netdev->real_num_tx_queues) {
--
2.54.0
^ permalink raw reply related
* [PATCH net 12/12] net: shaper: reject QUEUE scope handle with missing id
From: Jakub Kicinski @ 2026-05-06 0:06 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
linux-kselftest, Jakub Kicinski
In-Reply-To: <20260506000628.1501691-1-kuba@kernel.org>
net_shaper_parse_handle() does not enforce that the user provides
the handle ID. For NODE the ID defaults to UNSPEC for all other
cases it defaults to 0.
For NETDEV 0 is the only option. For QUEUE defaulting to 0 makes
less intuitive sense. Specifically because the behavior should
(IMHO) be the same for all cases where there may be more than
one ID (QUEUE and NODE).
We should either document this as intentional or reject.
I picked the latter with no strong conviction.
Fixes: 4b623f9f0f59 ("net-shapers: implement NL get operation")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/shaper/shaper.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/shaper/shaper.c b/net/shaper/shaper.c
index 2adf8b0e1105..daaefc02237b 100644
--- a/net/shaper/shaper.c
+++ b/net/shaper/shaper.c
@@ -491,10 +491,15 @@ static int net_shaper_parse_handle(const struct nlattr *attr,
* shaper (any other value).
*/
id_attr = tb[NET_SHAPER_A_HANDLE_ID];
- if (id_attr)
+ if (id_attr) {
id = nla_get_u32(id_attr);
- else if (handle->scope == NET_SHAPER_SCOPE_NODE)
+ } else if (handle->scope == NET_SHAPER_SCOPE_NODE) {
id = NET_SHAPER_ID_UNSPEC;
+ } else if (handle->scope == NET_SHAPER_SCOPE_QUEUE) {
+ NL_SET_ERR_ATTR_MISS(info->extack, attr,
+ NET_SHAPER_A_HANDLE_ID);
+ return -EINVAL;
+ }
handle->id = id;
return 0;
--
2.54.0
^ permalink raw reply related
* Re: [PATCH v4 2/4] ynl_gen: generate Rust files from yaml files
From: Jakub Kicinski @ 2026-05-06 0:16 UTC (permalink / raw)
To: Alice Ryhl
Cc: Carlos Llamas, Greg Kroah-Hartman, Andrew Lunn, Donald Hunter,
David S. Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
Matthew Maurer, Miguel Ojeda, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, Christian Brauner, linux-kernel,
rust-for-linux, netdev
In-Reply-To: <afmz-dgqXjuIntRM@google.com>
On Tue, 5 May 2026 09:10:17 +0000 Alice Ryhl wrote:
> On Mon, May 04, 2026 at 04:58:58PM -0700, Jakub Kicinski wrote:
> > On Mon, 04 May 2026 09:04:55 +0000 Alice Ryhl wrote:
> > > tools/net/ynl/pyynl/ynl_gen_c.py | 139 ++++++++++++++++++++++++++++++++++++++-
> >
> > No. Rust. In. This. File.
> >
> > Just commit the artifacts. I truly hope that this is the only Netlink
> > family we will have in Rust.
>
> There's no reason to react like this. I have not ignored your concern.
> Last time we discussed this, the discussion ended on splitting the file
> into ynl_gen_c.py and ynl_gen_rust.py, which you did not reply to, and I
> actually spent some time working on that. However, I felt the change was
> non-trivial and I wanted to discuss whether that was the correct way
> forward before spending more time on it. Therefore, I kept this patch
> as-is for now and noted why it was non-trivial (sharing of CodeWriter)
> in the commit message, until we could discuss further.
>
> I think you are probably right that just comitting the artifacts is the
> simplest way forward for now. Especially since Donald is apparently
> working on splitting up the file for strace [1]. On the off-chance that
> a second Netlink family is ever added, hopefully Donald's work has
> already completed and we can easily add this support in a new file when
> the time comes.
>
> I guess another way forward is to commit a copy of the python script
> with the Rust support to drivers/android/binder/ and I can run it
> manually if the Binder yaml file is ever updated.
Could you _please_ do what I'm asking you to do instead inventing your
own solutions. Just commit the generated files and leave the script out.
We lived without Netlink code gen for 30 years.
^ permalink raw reply
* Re: [PATCH] crypto: af_alg - Document the deprecation of AF_ALG
From: Eric Biggers @ 2026-05-06 0:17 UTC (permalink / raw)
To: Andy Lutomirski
Cc: linux-crypto, Herbert Xu, linux-doc, linux-api, linux-kernel,
netdev, Linus Torvalds
In-Reply-To: <CALCETrVqG+1yErRJjkxvJrf=A+Vu84HTR4Bx1Pcd8G1C0PJcMA@mail.gmail.com>
On Tue, May 05, 2026 at 04:17:18PM -0700, Andy Lutomirski wrote:
> > On Apr 29, 2026, at 6:19 PM, Eric Biggers <ebiggers@kernel.org> wrote:
> >
> > AF_ALG is almost completely unnecessary, and it exposes a massive attack
> > surface that hasn't been standing up to modern vulnerability discovery
> > tools. The latest one even has its own website, providing a small
> > Python script that reliably roots most Linux distros: https://copy.fail/
>
> How about adding a configuration option, defaulted on, that requires
> capable(CAP_SYS_ADMIN) to create the socket (and maybe also to bind /
> connect it). And a sysctl to allow the administrator to override this
> in the unlikely event that it’s needed.
>
> IIRC cryptsetup used to and maybe even still does require these
> sockets sometimes and this would let it keep working. And there's all
> the FIPS stuff downthread.
Yes, I'd like to add a default-on requirement to hold a capability in
the initial user namespace. We're trying to figure out the details.
It sounds like iwd runs with CAP_NET_ADMIN, not necessarily
CAP_SYS_ADMIN. So it may need to be:
has_capability_noaudit(current, CAP_NET_ADMIN) || capable(CAP_SYS_ADMIN)
iwd is being discussed in the thread
https://lore.kernel.org/linux-crypto/bcbbef00-5881-421b-8892-7be6c04b832d@gmail.com/
cryptsetup is normally run with CAP_SYS_ADMIN, but not always (e.g.,
'cryptsetup benchmark'). It might be acceptable for users to add sudo
in the exceptional cases. cryptsetup is being discussed in the thread
https://lore.kernel.org/linux-crypto/5dd3be22-13fb-41fb-b469-1ae6472200b1@gmail.com/
bluez needs investigation.
- Eric
^ permalink raw reply
* Re: [PATCH batadv 0/8] batman-adv: follow up fixes
From: Jakub Kicinski @ 2026-05-06 0:20 UTC (permalink / raw)
To: Sven Eckelmann
Cc: Marek Lindner, Simon Wunderlich, Antonio Quartulli,
David S. Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
b.a.t.m.a.n, netdev, linux-kernel, Ao Zhou, Haoze Xie,
Jiexun Wang, Juefei Pu, Luxing Yin, Ruide Cao, Xin Liu, Yifan Wu,
Yuan Tan, stable
In-Reply-To: <5990011.DvuYhMxLoT@sven-l14>
On Tue, 05 May 2026 06:46:11 +0200 Sven Eckelmann wrote:
> On Tuesday, 5 May 2026 02:10:51 CEST Jakub Kicinski wrote:
> > On Sun, 03 May 2026 14:22:33 +0200 Sven Eckelmann wrote:
> > > While reviewing the fixes submitted to batman-adv in the recent weeks,
> > > further problems in similar or adjecent code was identified. This was either
> > > noticed in the manual review or reported by sashiko.dev.
> >
> > Are you CCing netdev to get this reviewed by Sashiko?
> > Please don't..
> > We delegate code to sub-sub-systems to lower the patch volume :(
>
> Because of `b4 prep --auto-to-cc`. Will now manually remove you.
Ah, I see. I was asking because I don't recall us getting much batadv
patches CCed to netdev. Maybe it's simply because there wasn't that
many of them to begin with.
If the rate keeps up let's add an X: to MAINTAINERS to avoid
netdev@ being CCed. IDK if that's what X is supposed to be used for
but we use it for wireless and bluetooth already. The PRs still
flow thru networking tree, but there's no need for netdev to be CCed
on 99% of the patch submissions.
^ permalink raw reply
* Re: [PATCH v5 net-next 3/3] selftests:net: Implement ptp4l sync test using netdevsim
From: Jakub Kicinski @ 2026-05-06 0:22 UTC (permalink / raw)
To: Maciek Machnikowski
Cc: netdev, richardcochran, milena.olech, willemdebruijn.kernel,
andrew, vadim.fedorenko, horms
In-Reply-To: <b2ceffa3-a1d3-4124-b640-68fc11996f51@machnikowski.net>
On Tue, 5 May 2026 09:36:30 +0200 Maciek Machnikowski wrote:
> On 04/05/2026 19:07, Jakub Kicinski wrote:
> > On Sun, 3 May 2026 09:47:47 +0200 Maciek Machnikowski wrote:
> >> Add PTP synchronization test using ptp4l and netdevsim.
> >>
> >> The test creates two netdevsim adapters, links them together
> >> and runs the ptp4l leader and ptp4l follower on two ends
> >> of the netdevsim link and waits for the follower to report the
> >> synchronized state (s2) in its output log.
> >>
> >> This implementation runs the test runs over IPv4 link.
> >
> > Doesn't seem to pass on netdevsim for us:
> >
> > # 41.13 [+40.95] # ptp4l follower did not reach locked state (s2) within 40s
> > # 41.13 [+0.00] # Follower log (last 10 lines): ptp4l[2179.605]: ioctl SIOCETHTOOL failed: Operation not supported | ptp4l[2179.607]: interface 'eth0' does not support requested timestamping mode | failed to create a clock
> > # 41.15 [+0.02] # Check| At /srv/vmksft/testing/wt-2/tools/testing/selftests/net/./ptp.py, line 173, in ptp_sync_test:
> > # 41.15 [+0.01] # Check| _run_ptp4l_wait_sync(nsimsv.ifname, nsimcl.ifname, nssv.name, nscl.name)
> > # 41.16 [+0.01] # Check| At /srv/vmksft/testing/wt-2/tools/testing/selftests/net/./ptp.py, line 99, in _run_ptp4l_wait_sync:
> > # 41.17 [+0.01] # Check| ksft_true(False, "PTP sync timeout")
> > # 41.17 [+0.00] # Check failed False does not eval to True PTP sync timeout
> > # 41.32 [+0.16] not ok 1 ptp.ptp_sync_test
> > # 41.33 [+0.00] # Totals: pass:0 fail:1 xfail:0 xpass:0 skip:0 error:0
> >
> > Anything we need to do?
>
> Can you share the config file you used? Seems the PTP clock was not
> found which may lead to PTP_1588_CLOCK_MOCK not being enabled?
You have to add it to the relevant config.
Please read: github.com/linux-netdev/nipa/wiki/Netdev-CI-system
^ permalink raw reply
* Re: [PATCH v5 net-next 3/3] selftests:net: Implement ptp4l sync test using netdevsim
From: Jakub Kicinski @ 2026-05-06 0:23 UTC (permalink / raw)
To: Maciek Machnikowski
Cc: netdev, richardcochran, milena.olech, willemdebruijn.kernel,
andrew, vadim.fedorenko, horms
In-Reply-To: <20260505172234.3348a81b@kernel.org>
On Tue, 5 May 2026 17:22:34 -0700 Jakub Kicinski wrote:
> On Tue, 5 May 2026 09:36:30 +0200 Maciek Machnikowski wrote:
> > On 04/05/2026 19:07, Jakub Kicinski wrote:
> > > On Sun, 3 May 2026 09:47:47 +0200 Maciek Machnikowski wrote:
> > > Doesn't seem to pass on netdevsim for us:
> > >
> > > # 41.13 [+40.95] # ptp4l follower did not reach locked state (s2) within 40s
> > > # 41.13 [+0.00] # Follower log (last 10 lines): ptp4l[2179.605]: ioctl SIOCETHTOOL failed: Operation not supported | ptp4l[2179.607]: interface 'eth0' does not support requested timestamping mode | failed to create a clock
> > > # 41.15 [+0.02] # Check| At /srv/vmksft/testing/wt-2/tools/testing/selftests/net/./ptp.py, line 173, in ptp_sync_test:
> > > # 41.15 [+0.01] # Check| _run_ptp4l_wait_sync(nsimsv.ifname, nsimcl.ifname, nssv.name, nscl.name)
> > > # 41.16 [+0.01] # Check| At /srv/vmksft/testing/wt-2/tools/testing/selftests/net/./ptp.py, line 99, in _run_ptp4l_wait_sync:
> > > # 41.17 [+0.01] # Check| ksft_true(False, "PTP sync timeout")
> > > # 41.17 [+0.00] # Check failed False does not eval to True PTP sync timeout
> > > # 41.32 [+0.16] not ok 1 ptp.ptp_sync_test
> > > # 41.33 [+0.00] # Totals: pass:0 fail:1 xfail:0 xpass:0 skip:0 error:0
> > >
> > > Anything we need to do?
> >
> > Can you share the config file you used? Seems the PTP clock was not
> > found which may lead to PTP_1588_CLOCK_MOCK not being enabled?
>
> You have to add it to the relevant config.
>
> Please read: github.com/linux-netdev/nipa/wiki/Netdev-CI-system
Sorry, wrong link, this:
https://github.com/linux-netdev/nipa/wiki/How-to-run-netdev-selftests-CI-style
^ permalink raw reply
* Re: [PATCH net-next v2 2/2] net: bcmasp: Keep PHY link during WoL sleep cycle
From: Jakub Kicinski @ 2026-05-06 0:25 UTC (permalink / raw)
To: justin.chen
Cc: Jakub Kicinski, netdev, bcm-kernel-feedback-list, pabeni,
edumazet, davem, andrew+netdev, florian.fainelli
In-Reply-To: <20260501185625.422361-3-justin.chen@broadcom.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
net: bcmasp: Keep PHY link during WoL sleep cycle
This patch splits the suspend/resume paths so that when WoL is enabled
the PHY is left running and the MAC is only partially re-initialized on
resume. phy_stop() is skipped during suspend and phy_start() is replaced
with a forced relink via phy_trigger_machine() when the MAC was reset.
> diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
> index e2b51ec903af..9ffd0dfa5969 100644
> --- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
> +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
[ ... ]
> @@ -946,7 +946,8 @@ static void bcmasp_netif_deinit(struct net_device *dev)
>
> umac_enable_set(intf, UMC_CMD_TX_EN, 0);
>
> - phy_stop(dev->phydev);
> + if (stop_phy)
> + phy_stop(dev->phydev);
Skipping phy_stop() in the WoL path means phy_stop_machine() and the
cancel_delayed_work_sync() on phydev->state_queue are no longer executed
before the ASP clock is disabled in bcmasp_interface_suspend().
The PHY state machine runs on system_power_efficient_wq, which is not
WQ_FREEZABLE, so task freeze does not stop it. If a PHY IRQ fires (or
the polling timer expires) between clk_disable_unprepare(intf->parent->clk)
and the matching clk_prepare_enable() on resume, the state machine can
reach bcmasp_adj_link() via phy_check_link_status() ->
phy_link_up()/phy_link_down() -> phydev->adjust_link.
bcmasp_adj_link() reads and writes UMC_CMD, UMC_EEE_LPI_TIMER,
UMC_EEE_CTRL and RGMII_OOB_CNTRL, which sit behind the disabled ASP
clock. Can those accesses hang the bus or return 0xffffffff on these
SoCs?
bcmgenet pins phydev->state = PHY_READY during WoL suspend specifically
to freeze the state machine in a no-op state. Is an equivalent
protection needed here?
> @@ -1385,15 +1386,20 @@ int bcmasp_interface_suspend(struct bcmasp_intf *intf)
> {
> struct device *kdev = &intf->parent->pdev->dev;
> struct net_device *dev = intf->ndev;
> + bool wake;
>
> if (!netif_running(dev))
> return 0;
>
> netif_device_detach(dev);
>
> - bcmasp_netif_deinit(dev);
> + wake = device_may_wakeup(kdev) && intf->wolopts;
>
> - if (!intf->wolopts) {
> + bcmasp_netif_deinit(dev, !wake);
> +
> + if (wake) {
> + bcmasp_suspend_to_wol(intf);
> + } else {
> bcmasp_phy_hw_unprepare(intf);
[ ... ]
> @@ -1438,17 +1444,34 @@ int bcmasp_interface_resume(struct bcmasp_intf *intf)
> if (ret)
> return ret;
>
> - bcmasp_core_clock_set_intf(intf, true);
> -
> - bcmasp_resume_from_wol(intf);
> + wake = device_may_wakeup(kdev) && intf->wolopts;
>
> - bcmasp_phy_hw_prepare(intf);
> + bcmasp_core_clock_set_intf(intf, true);
>
> - umac_reset_and_init(intf, dev->dev_addr);
> + /* The interface might be HW reset in some suspend modes, so we may
> + * need to restore the UNIMAC/PHY if that is the case.
> + */
> + reg = umac_rl(intf, UMC_CMD);
> + if (wake && (reg & UMC_CMD_RX_EN)) {
> + umac_enable_set(intf, UMC_CMD_TX_EN, 1);
> + bcmasp_resume_from_wol(intf);
> + } else {
> + bcmasp_phy_hw_prepare(intf);
> + umac_reset_and_init(intf, dev->dev_addr);
> + }
In the wake && !(reg & UMC_CMD_RX_EN) branch (MAC was HW reset during
suspend), bcmasp_resume_from_wol() is not called.
bcmasp_suspend_to_wol() unconditionally does two things that live in
the shared parent register block, not the per-interface UMC block:
wakeup_intr2_core_wl(intf->parent, 0xffffffff,
ASP_WAKEUP_INTR2_MASK_CLEAR);
if (ndev->phydev && ndev->phydev->eee_cfg.eee_enabled &&
intf->parent->eee_fixup)
intf->parent->eee_fixup(intf, true);
The wakeup interrupt mask and the EEE fixup bits (phy_lpi_overwrite in
ASP_EDPKT_SPARE_REG) are not cleared by a reset that only wipes UMC_CMD.
In this branch the wakeup IRQ remains unmasked (bcmasp_isr_wol would
then fire on subsequent MPD/FILT events during normal traffic) and the
EEE fixup stays asserted. Should this branch also invoke the parts of
bcmasp_resume_from_wol() / eee_fixup(false) that live in the shared
register block?
Separately, bcmasp_suspend_to_wol() explicitly programs
UMC_CMD_PROMISC:
reg |= UMC_CMD_RX_EN | UMC_CMD_PROMISC;
umac_wl(intf, reg, UMC_CMD);
In the wake && (reg & UMC_CMD_RX_EN) fast-resume branch, the only
writes to UMC_CMD are:
umac_enable_set(intf, UMC_CMD_TX_EN, 1);
and whatever bcmasp_resume_from_wol() does, which only touches
UMC_MPD_CTRL and ASP_WAKEUP_INTR2_MASK_SET. bcmasp_netif_init() calls
bcmasp_set_rx_mode() which manages ASP_RX_FILTER_MDA but not
UMC_CMD_PROMISC, and bcmasp_adj_link() only reprograms PROMISC inside
its if (reg & UMC_CMD_SW_RESET) branch (not taken here). Since
old_link/old_duplex/old_pause are preserved across the fast path,
adj_link's changed flag stays zero and it returns without rewriting
UMC_CMD.
Does this leave the MAC stuck in UMC_CMD_PROMISC after every WoL
resume, until the interface is toggled down/up?
>
> bcmasp_netif_init(dev);
>
> - phy_start(dev->phydev);
> + /* If HW was reset, we need to force a relink */
> + if (wake && !(reg & UMC_CMD_RX_EN)) {
> + mutex_lock(&dev->phydev->lock);
> + if (dev->phydev->state == PHY_RUNNING)
> + dev->phydev->state = PHY_UP;
> + mutex_unlock(&dev->phydev->lock);
> + phy_trigger_machine(dev->phydev);
> + } else if (!wake) {
> + phy_start(dev->phydev);
> + }
The forced-relink branch only demotes PHY_RUNNING -> PHY_UP before
phy_trigger_machine(). Since phy_stop() was skipped during suspend,
phydev->state is whatever it was at suspend time, which may instead be
PHY_NOLINK (cable was unplugged), PHY_HALTED or PHY_ERROR.
For PHY_NOLINK, _phy_state_machine() runs phy_check_link_status() +
phy_update_stats() only; it does not trigger _phy_start_aneg() (that is
the PHY_UP case). If the HW reset that cleared UMC_CMD_RX_EN also
touched the PHY chip (shared reset/power domain), autoneg may need to
be restarted.
Does this path handle states other than PHY_RUNNING, and does it
guarantee the PHY is reinitialized and autoneg restarted when the MAC
has been reset?
> +
> netif_device_attach(dev);
>
> return 0;
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox