zebra: Isolate mlag_rd_buf_offset to the actual using function

Isolate the mlag_rd_buf_offset variable to the actual used function,
instead of having it a global.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2020-10-05 12:24:10 -04:00
parent ded3e3e39c
commit ca3491262b
3 changed files with 2 additions and 3 deletions

View File

@ -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;

View File

@ -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 {

View File

@ -74,6 +74,7 @@ static void zebra_mlag_sched_read(void)
static int zebra_mlag_read(struct thread *thread)
{
static uint32_t mlag_rd_buf_offset;
uint32_t *msglen;
uint32_t h_msglen;
uint32_t tot_len, curr_len = mlag_rd_buf_offset;
@ -159,6 +160,7 @@ static int zebra_mlag_read(struct thread *thread)
/* Register read thread. */
zebra_mlag_reset_read_buffer();
mlag_rd_buf_offset = 0;
zebra_mlag_sched_read();
return 0;
}