diff options
| author | Marc Harvey <marcharvey@google.com> | 2026-04-09 02:59:23 +0000 |
|---|---|---|
| committer | Paolo Abeni <pabeni@redhat.com> | 2026-04-13 15:09:48 +0200 |
| commit | 3faf0ce6e499dfd32e596bcb5bca2c44d64f4cc1 (patch) | |
| tree | c307d88647fc5ac55a93098ced591d19ba090013 /include/linux | |
| parent | 8806d502e0a7e7d895b74afbd24e8550a65a2b17 (diff) | |
net: team: Annotate reads and writes for mixed lock accessed values
The team_port's "index" and the team's "en_port_count" are read in
the hot transmit path, but are only written to when holding the rtnl
lock.
Use READ_ONCE() for all lockless reads of these values, and use
WRITE_ONCE() for all writes.
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Marc Harvey <marcharvey@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260409-teaming-driver-internal-v7-1-f47e7589685d@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/if_team.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/if_team.h b/include/linux/if_team.h index ccb5327de26d0..06f4d7400c1e1 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h @@ -77,7 +77,7 @@ static inline struct team_port *team_port_get_rcu(const struct net_device *dev) static inline bool team_port_enabled(struct team_port *port) { - return port->index != -1; + return READ_ONCE(port->index) != -1; } static inline bool team_port_txable(struct team_port *port) @@ -272,7 +272,7 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team, struct hlist_head *head = team_port_index_hash(team, port_index); hlist_for_each_entry_rcu(port, head, hlist) - if (port->index == port_index) + if (READ_ONCE(port->index) == port_index) return port; return NULL; } |
