Skip to content

batman-adv: tt: atomic sashiko fixes

Sven Eckelmann batman 6 versions – New

Get series with b4
b4 am [email protected] change-id 20260730-tt-fixes-fca2b722ebbd

Versions newest first

  1. v6 Latest20 patches 0 repliesNew
  2. v520 patches 0 repliesSuperseded
  3. v4 RFC8 patches 0 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v3 RFC6 patches1 replySuperseded
v26 patches0 repliesSuperseded
v14 patches0 repliesSuperseded

Changes in v6 from the cover letter

- keep roam_at access always in locked region
- use WRITE_ONCE/READ_ONCE to reduec number of times we need to use a lock for a simple read
- drop flag modification from kernel-doc of batadv_tt_local_set_pending_event
- document special case when batadv_tt_local_size_dec can be called without the hash list lock held
- Link to v5: https://patch.msgid.link/[email protected]

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/20batman-adv: tt: remove only the entry which was looked up from the hashnet/batman-adv/translation-table.c+26 -120 replies
2/20batman-adv: tt: extract code handling a roam on addnet/batman-adv/translation-table.c+45 -260 replies
3/20batman-adv: tt: simplify NEW flag transition codenet/batman-adv/translation-table.c+7 -190 replies
4/20batman-adv: tt: drop unnecessary cleanup goto in helpersnet/batman-adv/translation-table.c+12 -130 replies
5/20batman-adv: tt: use protected flag modificationsnet/batman-adv/translation-table.c net/batman-adv/types.h+255 -1070 replies
6/20batman-adv: tt: transition NEW local entries only under locknet/batman-adv/translation-table.c+9 -40 replies
7/20batman-adv: tt: don't uncount never committed clients on pending purgenet/batman-adv/translation-table.c+10 -10 replies
8/20batman-adv: tt: decrement count for committed client on local_removenet/batman-adv/translation-table.c+9 -10 replies
9/20batman-adv: tt: look up wifi state of incoming interface in helpernet/batman-adv/translation-table.c+29 -120 replies
10/20batman-adv: tt: extract allocation of new local entriesnet/batman-adv/translation-table.c+79 -560 replies
11/20batman-adv: tt: replace forward gotos in batadv_tt_local_add()net/batman-adv/translation-table.c+22 -250 replies
12/20batman-adv: tt: extract refresh of existing local entriesnet/batman-adv/translation-table.c+51 -270 replies
13/20batman-adv: tt: extract update of dynamic client flagsnet/batman-adv/translation-table.c+50 -290 replies
14/20batman-adv: tt: extract allocation of new global entriesnet/batman-adv/translation-table.c+51 -250 replies
15/20batman-adv: tt: extract merging of flags into existing global entriesnet/batman-adv/translation-table.c+52 -350 replies
16/20batman-adv: tt: replace add_orig_entry goto in batadv_tt_global_add()net/batman-adv/translation-table.c+5 -40 replies
17/20batman-adv: tt: extract removal of the superseded local entrynet/batman-adv/translation-table.c+41 -200 replies
18/20batman-adv: tt: extract marking of a removed local entrynet/batman-adv/translation-table.c+35 -130 replies
19/20batman-adv: tt: extract immediate purge of a local entrynet/batman-adv/translation-table.c+37 -200 replies
20/20batman-adv: tt: drop the cleanup label from batadv_tt_local_remove()net/batman-adv/translation-table.c+10 -160 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH batadv v6 00/20] batman-adv: tt: atomic sashiko fixes

There were a couple of sashiko reports regarding the batadv-next-pullrequest-20260728 PR. I went through the TT code and tried to handle them and at the same time already predict what else sashiko might report as next. I needed to change the batadv_tt_local_remove() hash interaction as preparation for the related NEW flag (and counter) handling.

And the netdev maintainers rejected this approach (for now). I had to re-add the atomic_t code parts back in this patchset. But since the netdev maintainers didn't like the atomic_t implementation, everything was changed to atomic_t with the help of scoped_guard() or spin_(un)lock_bh (when the routine used "goto").

This version of the patchset also includes the cleanups and swithches to scoped_guards (when appropriate). The original cover letter was:

While working on the flag protection changes, it became apparent that the current code is hard to maintain. Too many gotos with large sections which are hard to crasp; because it is unclear how these sections are interact. To simplify everything, sections which are handling a single task are extracted in separate functions. This makes it cleared what the input and output of each "section" are.

---
Changes in v6:
- keep roam_at access always in locked region
- use WRITE_ONCE/READ_ONCE to reduec number of times we need to use a lock for a simple read
- drop flag modification from kernel-doc of batadv_tt_local_set_pending_event
- document special case when batadv_tt_local_size_dec can be called without the hash list lock held
- Link to v5: https://patch.msgid.link/[email protected]

Changes in v5:
- keep all batadv_tt_flags_get changes to "batman-adv: tt: use protected flag modifications"
- remove to non-RCU iterator in batadv_tt_local_transition_new() after switching to locked iteration
- remove RFC patch prefix
- integrate the cleanup patches which depend on this patchset
- Link to v4: https://patch.msgid.link/[email protected]

Changes in v4:
- fix setting of BATADV_TT_CLIENT_ROAM batadv_tt_local_add_roam()
- move the roam_at setting in batadv_tt_global_del_roaming() before the setting of the flag
- don't unset BATADV_TT_CLIENT_NEW when avoiding the batadv_tt_local_size_dec() - it is simply not needed
- new patch: fix lock precondition for batadv_tt_local_size_inc() and document it
- clean up mini-helpers to avoid goto. precondition for using scoped_guard
- switch routines with goto's from scoped_guard to spin_(un)lock_bh
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- switched to spinlock_bh due to rejection atomic_t by netdev (and potentially easier code)
- switch back to RFC
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- rebase on main
- add "batman-adv: tt: use atomic flag modifications" and "batman-adv: tt:
simplify NEW flag transition code" because they are reverted on main
- add patch to extract the roam "add" code in a separate function
- make the "simplify NEW flag transition code" patch independent of atomic_t code
- Link to v1: https://patch.msgid.link/[email protected]

To: [email protected]

---
Sven Eckelmann (20):
batman-adv: tt: remove only the entry which was looked up from the hash
batman-adv: tt: extract code handling a roam on add
batman-adv: tt: simplify NEW flag transition code
batman-adv: tt: drop unnecessary cleanup goto in helpers
batman-adv: tt: use protected flag modifications
batman-adv: tt: transition NEW local entries only under lock
batman-adv: tt: don't uncount never committed clients on pending purge
batman-adv: tt: decrement count for committed client on local_remove
batman-adv: tt: look up wifi state of incoming interface in helper
batman-adv: tt: extract allocation of new local entries
batman-adv: tt: replace forward gotos in batadv_tt_local_add()
batman-adv: tt: extract refresh of existing local entries
batman-adv: tt: extract update of dynamic client flags
batman-adv: tt: extract allocation of new global entries
batman-adv: tt: extract merging of flags into existing global entries
batman-adv: tt: replace add_orig_entry goto in batadv_tt_global_add()
batman-adv: tt: extract removal of the superseded local entry
batman-adv: tt: extract marking of a removed local entry
batman-adv: tt: extract immediate purge of a local entry
batman-adv: tt: drop the cleanup label from batadv_tt_local_remove()

 net/batman-adv/translation-table.c | 1113 ++++++++++++++++++++++++------------
 net/batman-adv/types.h             |   11 +-
 2 files changed, 747 insertions(+), 377 deletions(-)

---
base-commit: f3c33e7fcb7e88cc099b783faf26f0494b774571
change-id: 20260730-tt-fixes-fca2b722ebbd

Best regards,

Signature · 1 line
Sven Eckelmann <[email protected]>