From 00e0d113e5ffcb69304b8d5d83f0357ec416c6c4 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 23 Sep 2020 20:36:51 -0400 Subject: [PATCH] zebra: the mlag_rd_buf_offset variable was write only The mlag_rd_buf_offset function was only ever being set to 0 in the mlag_read function and only written in that function. There is no need for this global variable. Signed-off-by: Donald Sharp --- zebra/zebra_mlag.c | 1 - zebra/zebra_mlag.h | 2 -- zebra/zebra_mlag_private.c | 4 +--- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/zebra/zebra_mlag.c b/zebra/zebra_mlag.c index fb8798ebd9..d8ed9b2a3a 100644 --- a/zebra/zebra_mlag.c +++ b/zebra/zebra_mlag.c @@ -49,7 +49,6 @@ 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 85028d2774..b195c75ea3 100644 --- a/zebra/zebra_mlag.h +++ b/zebra/zebra_mlag.h @@ -42,12 +42,10 @@ 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 1dae758b12..9c34aa2c36 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 = mlag_rd_buf_offset; + uint32_t tot_len, curr_len = 0; zrouter.mlag_info.t_read = NULL; @@ -101,7 +101,6 @@ 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(); @@ -139,7 +138,6 @@ 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