vcl: add api to retrieve num bytes for tx
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Iaa1b026e2baea1c03f8c75e7d6879d0ff6d379d6
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index a0a0336..a0bbae1 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -3585,7 +3585,19 @@
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))))
{