diff options
| author | Sven Eckelmann <sven@narfation.org> | 2026-05-15 16:58:16 +0200 |
|---|---|---|
| committer | Sven Eckelmann <sven@narfation.org> | 2026-06-01 14:22:02 +0200 |
| commit | 735522e7ca3fb852c498ec17b3841750f0a84607 (patch) | |
| tree | a38a3c07d86c94e77ea2e4adc8f00fda4b68baf3 /include/linux/timerqueue_types.h | |
| parent | 5ffd4dd8742586d1e7b80fe04340f56762960d9c (diff) | |
batman-adv: tvlv: avoid unnecessary OGM buffer reallocations
Both OGMv1 (on the primary interface) and OGM2 unconditionally reallocated
their packet buffer on every transmission cycle, regardless of whether the
required size had changed. This meant a kfree/kmalloc pair even when the
TVLV payload size was identical to the previous send.
Introduce struct batadv_ogm_buf to encapsulate the OGM packet buffer
together with its current length, allocated capacity, and fixed header
length. This consolidates the separate buf/len arguments that were
previously threaded through each call site.
In batadv_tvlv_realloc_packet_buff(), the capacity is rounded up to the
next power of two so that small growth or shrinkage in TVLV data does not
trigger a reallocation. When kmalloc fails but the existing buffer is large
enough to hold the new data, the oversized buffer is reused rather than
returning an error.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'include/linux/timerqueue_types.h')
0 files changed, 0 insertions, 0 deletions
