diff options
-rw-r--r-- | src/vcl/ldp.c | 8 | ||||
-rw-r--r-- | src/vcl/vppcom.c | 14 | ||||
-rw-r--r-- | src/vcl/vppcom.h | 1 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c index 566b5a858a3..bd3457fa8fd 100644 --- a/src/vcl/ldp.c +++ b/src/vcl/ldp.c @@ -613,7 +613,13 @@ ioctl (int fd, unsigned long int cmd, ...) case FIONREAD: rv = vls_attr (vlsh, VPPCOM_ATTR_GET_NREAD, 0, 0); break; - + case TIOCOUTQ: + { + u32 *buf = va_arg (ap, void *); + u32 *buflen = va_arg (ap, u32 *); + rv = vls_attr (vlsh, VPPCOM_ATTR_GET_NWRITEQ, buf, buflen); + } + break; case FIONBIO: { u32 flags = *(va_arg (ap, int *)) ? O_NONBLOCK : 0; 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)))) { diff --git a/src/vcl/vppcom.h b/src/vcl/vppcom.h index 5683cb2cf0b..386d7d0c3f7 100644 --- a/src/vcl/vppcom.h +++ b/src/vcl/vppcom.h @@ -184,6 +184,7 @@ typedef enum VPPCOM_ATTR_SET_IP_PKTINFO, VPPCOM_ATTR_GET_IP_PKTINFO, VPPCOM_ATTR_GET_ORIGINAL_DST, + VPPCOM_ATTR_GET_NWRITEQ, } vppcom_attr_op_t; typedef struct _vcl_poll |