[PATCH net-next v6 1/4] net: dsa: add driver-private pointer to struct dsa_bridge

Daniel Golle posted 4 patches 1 week, 5 days ago
There is a newer version of this series
[PATCH net-next v6 1/4] net: dsa: add driver-private pointer to struct dsa_bridge
Posted by Daniel Golle 1 week, 5 days ago
When a DSA driver offloads a bridge to firmware, it typically receives a
firmware-assigned bridge identifier (e.g. a FID) that must be stored and
retrieved by subsequent operations. Without a place to store this in the
DSA core's bridge structure, drivers must maintain a parallel list of
bridge objects and search it on every join, leave, and FDB operation.

Add a void *priv field to struct dsa_bridge so drivers can store their
firmware bridge identifier directly, eliminating the need for driver-side
bridge tracking structures.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
v6: new patch

 include/net/dsa.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/net/dsa.h b/include/net/dsa.h
index 6c17446f3dcc2..1c6f6c3b88e86 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -234,6 +234,7 @@ struct dsa_bridge {
 	unsigned int num;
 	bool tx_fwd_offload;
 	refcount_t refcount;
+	void *priv;
 };
 
 struct dsa_port {
-- 
2.53.0
Re: [PATCH net-next v6 1/4] net: dsa: add driver-private pointer to struct dsa_bridge
Posted by Vladimir Oltean 1 week, 4 days ago
On Sun, Mar 22, 2026 at 12:18:58AM +0000, Daniel Golle wrote:
> When a DSA driver offloads a bridge to firmware, it typically receives a
> firmware-assigned bridge identifier (e.g. a FID) that must be stored and
> retrieved by subsequent operations. Without a place to store this in the
> DSA core's bridge structure, drivers must maintain a parallel list of
> bridge objects and search it on every join, leave, and FDB operation.

Why list?

What's wrong with a driver-level array for lookup? The bridge.num is
guaranteed to be between 1 and ds->max_num_bridges.