From 59f098dd4dc6371346f50dd532b87fd014b55168 Mon Sep 17 00:00:00 2001 From: jackiechen1985 Date: Fri, 12 Apr 2019 16:33:21 +0800 Subject: Fix bugs in comm.h 1. Fix id error while pushing a new element. The new element id should indicate the stack length, not the old one; 2. Fix dump callback return VAPI_EINVAL in last call. In last call, we should ignore replication because VPP pass NULL pointer while is_last is true; Change-Id: I8b14a3fda3b168c82d28470edc8b11cad6ebadc8 Signed-off-by: jackiechen1985 --- src/scvpp/inc/scvpp/comm.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/scvpp/inc/scvpp/comm.h b/src/scvpp/inc/scvpp/comm.h index 9a27517..8d2b2e2 100644 --- a/src/scvpp/inc/scvpp/comm.h +++ b/src/scvpp/inc/scvpp/comm.h @@ -142,7 +142,7 @@ static inline int push(struct elt **stack, void *data, int length) memcpy(el->data, data, length); if (*stack) - el->id = (*stack)->id++; + el->id = (*stack)->id + 1; else el->id = 0; el->next = *stack; //point to old value of stack @@ -174,8 +174,13 @@ static vapi_error_e \ api_name##_all_cb(vapi_ctx_t ctx, void *caller_ctx, vapi_error_e rv, bool is_last, \ vapi_payload_##api_name##_details *reply) \ { \ - UNUSED(ctx); UNUSED(rv); UNUSED(is_last); \ + UNUSED(ctx); UNUSED(rv); \ struct elt **stackp; \ + \ + if (is_last) { \ + return VAPI_OK; \ + } \ + \ ARG_CHECK2(VAPI_EINVAL, caller_ctx, reply); \ \ stackp = (struct elt**) caller_ctx; \ -- cgit 1.2.3-korg