diff options
author | Florin Coras <fcoras@cisco.com> | 2024-03-18 12:25:38 -0700 |
---|---|---|
committer | Dave Barach <vpp@barachs.net> | 2024-03-25 18:53:05 +0000 |
commit | 8ae63db02066a2b5ac18a89fd63dc0dd2a811ab3 (patch) | |
tree | 0d7877f1c8bd18ce9dd4f32cfddfa3e4f557bc35 /src/vcl/vppcom.c | |
parent | a8d266a7a4bf1188739dcd6d3ddcc8173282d95d (diff) |
vcl: add api to retrieve num bytes for tx
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Iaa1b026e2baea1c03f8c75e7d6879d0ff6d379d6
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r-- | src/vcl/vppcom.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index a0a0336c787..a0bbae170f8 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -3585,7 +3585,19 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op, VDBG (2, "VPPCOM_ATTR_GET_NWRITE: sh %u, nwrite = %d", session_handle, rv); break; - + case VPPCOM_ATTR_GET_NWRITEQ: + if (PREDICT_FALSE (!buffer || !buflen || *buflen != sizeof (int))) + { + rv = VPPCOM_EINVAL; + break; + } + if (!session->tx_fifo || session->session_state == VCL_STATE_DETACHED) + { + rv = VPPCOM_EINVAL; + break; + } + *(int *) buffer = svm_fifo_max_dequeue (session->tx_fifo); + break; case VPPCOM_ATTR_GET_FLAGS: if (PREDICT_TRUE (buffer && buflen && (*buflen >= sizeof (*flags)))) { |