summaryrefslogtreecommitdiff
path: root/zebra
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2025-01-31 12:12:17 -0500
committerDonald Sharp <sharpd@nvidia.com>2025-01-31 15:05:40 -0500
commitc58da10d2a700164e329352c5c22a924af3fa45c (patch)
treecbdde1e1537b93f42287b0485eee8f565d091368 /zebra
parent22c7151c2322b165f87ad3b06e93a1c48ae72c6c (diff)
zebra: Limit mutex for obuf to when we access obuf
The mutex that wraps access to the output buffer is being held for the entire time the data is being generated to send down the pipe. Since the generation has absolutely nothing to do with the obuf, let's limit the mutex holding some. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/dplane_fpm_nl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c
index a65bae95c4..9f26852d1f 100644
--- a/zebra/dplane_fpm_nl.c
+++ b/zebra/dplane_fpm_nl.c
@@ -951,8 +951,6 @@ static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx)
nl_buf_len = 0;
- frr_mutex_lock_autounlock(&fnc->obuf_mutex);
-
/*
* If route replace is enabled then directly encode the install which
* is going to use `NLM_F_REPLACE` (instead of delete/add operations).
@@ -1105,6 +1103,8 @@ static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx)
/* We must know if someday a message goes beyond 65KiB. */
assert((nl_buf_len + FPM_HEADER_SIZE) <= UINT16_MAX);
+ frr_mutex_lock_autounlock(&fnc->obuf_mutex);
+
/* Check if we have enough buffer space. */
if (STREAM_WRITEABLE(fnc->obuf) < (nl_buf_len + FPM_HEADER_SIZE)) {
atomic_fetch_add_explicit(&fnc->counters.buffer_full, 1,