From ded3e3e39c08996343aa00cf2775933e4ef176c3 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 5 Oct 2020 12:19:41 -0400 Subject: [PATCH] Revert "zebra: the mlag_rd_buf_offset variable was write only" This reverts commit 00e0d113e5ffcb69304b8d5d83f0357ec416c6c4. --- zebra/zebra_mlag.c | 1 + zebra/zebra_mlag.h | 2 ++ zebra/zebra_mlag_private.c | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/zebra/zebra_mlag.c b/zebra/zebra_mlag.c index d8ed9b2a3a..fb8798ebd9 100644 --- a/zebra/zebra_mlag.c +++ b/zebra/zebra_mlag.c @@ -49,6 +49,7 @@ DEFINE_HOOK(zebra_mlag_private_cleanup_data, (), ()) uint8_t mlag_wr_buffer[ZEBRA_MLAG_BUF_LIMIT]; uint8_t mlag_rd_buffer[ZEBRA_MLAG_BUF_LIMIT]; +uint32_t mlag_rd_buf_offset; static bool test_mlag_in_progress; diff --git a/zebra/zebra_mlag.h b/zebra/zebra_mlag.h index b195c75ea3..85028d2774 100644 --- a/zebra/zebra_mlag.h +++ b/zebra/zebra_mlag.h @@ -42,10 +42,12 @@ DECLARE_HOOK(zebra_mlag_private_cleanup_data, (), ()) extern uint8_t mlag_wr_buffer[ZEBRA_MLAG_BUF_LIMIT]; extern uint8_t mlag_rd_buffer[ZEBRA_MLAG_BUF_LIMIT]; +extern uint32_t mlag_rd_buf_offset; static inline void zebra_mlag_reset_read_buffer(void) { memset(mlag_wr_buffer, 0, ZEBRA_MLAG_BUF_LIMIT); + mlag_rd_buf_offset = 0; } enum zebra_mlag_state { diff --git a/zebra/zebra_mlag_private.c b/zebra/zebra_mlag_private.c index 343e7801db..d39b0c0aee 100644 --- a/zebra/zebra_mlag_private.c +++ b/zebra/zebra_mlag_private.c @@ -76,7 +76,7 @@ static int zebra_mlag_read(struct thread *thread) { uint32_t *msglen; uint32_t h_msglen; - uint32_t tot_len, curr_len = 0; + uint32_t tot_len, curr_len = mlag_rd_buf_offset; /* * Received message in sock_stream looks like below @@ -99,6 +99,7 @@ static int zebra_mlag_read(struct thread *thread) zebra_mlag_handle_process_state(MLAG_DOWN); return -1; } + mlag_rd_buf_offset += data_len; if (data_len != (ssize_t)(ZEBRA_MLAG_LEN_SIZE - curr_len)) { /* Try again later */ zebra_mlag_sched_read(); @@ -136,6 +137,7 @@ static int zebra_mlag_read(struct thread *thread) zebra_mlag_handle_process_state(MLAG_DOWN); return -1; } + mlag_rd_buf_offset += data_len; if (data_len != (ssize_t)(tot_len - curr_len)) { /* Try again later */ zebra_mlag_sched_read(); -- 2.39.5