+ if (VPPCOM_DEBUG > 0)
+ {
+ if (ep->is_ip4)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_LCL_ADDR: addr:%d.%d.%d.%d:%d",
+ .format_args = "i1i1i1i1i2",
+ };
+ CLIB_PACKED (struct {
+ u8 addr[4]; //4
+ u16 port; //2
+ }) * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+
+ ed->addr[0] = session->lcl_addr.ip46.ip4.as_u8[0];
+ ed->addr[1] = session->lcl_addr.ip46.ip4.as_u8[1];
+ ed->addr[2] = session->lcl_addr.ip46.ip4.as_u8[2];
+ ed->addr[3] = session->lcl_addr.ip46.ip4.as_u8[3];
+ ed->port = clib_net_to_host_u16 (session->peer_port);
+ /* *INDENT-ON* */
+ }
+ else
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_LCL_ADDR: addr:IP6:%d",
+ .format_args = "i2",
+ };
+ CLIB_PACKED (struct {
+ u16 port; //2
+ }) * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+
+ ed->port = clib_net_to_host_u16 (session->peer_port);
+ /* *INDENT-ON* */
+ }
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_LIBC_EPFD:
+ rv = session->libc_epfd;
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_LIBC_EPFD: libc_epfd %d",
+ getpid (), rv);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_LIBC_EPFD: libc_epfd=%d",
+ .format_args = "i4",
+ };
+ CLIB_PACKED (struct {
+ i32 data;
+ }) * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+ ed->data = session->libc_epfd;
+ /* *INDENT-ON* */
+ }
+
+ break;
+
+ case VPPCOM_ATTR_SET_LIBC_EPFD:
+ if (PREDICT_TRUE (buffer && buflen &&
+ (*buflen == sizeof (session->libc_epfd))))
+ {
+ session->libc_epfd = *(int *) buffer;
+ *buflen = sizeof (session->libc_epfd);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_LIBC_EPFD: libc_epfd %d, "
+ "buflen %d", getpid (), session->libc_epfd,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_LIBC_EPFD: libc_epfd=%s%d buflen=%d",
+ .format_args = "t1i4i4",
+ .n_enum_strings = 2,
+ .enum_strings = {"", "-",},
+ };
+ CLIB_PACKED (struct {
+ u8 sign;
+ u32 data[2];
+ }) * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+
+ ed->sign = (session->libc_epfd < 0);
+ ed->data[0] = abs(session->libc_epfd);
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_PROTOCOL:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ *(int *) buffer = session->proto;
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_PROTOCOL: %d (%s), "
+ "buflen %d", getpid (), *(int *) buffer,
+ *(int *) buffer ? "UDP" : "TCP", *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_PROTOCOL: %s buflen=%d",
+ .format_args = "t1i4",
+ .n_enum_strings = 2,
+ .enum_strings = {"TCP", "UDP",},
+ };
+
+ CLIB_PACKED (struct {
+ u8 proto;
+ u32 buflen;
+ }) * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+ ed->proto = session->proto;
+ ed->buflen = *(int *) buffer;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_LISTEN:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_LISTEN);
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_LISTEN: %d, "
+ "buflen %d", getpid (), *(int *) buffer, *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_LISTEN: %d buflen=%d",
+ .format_args = "i4i4",
+ };
+
+ struct {
+ u32 data[2];
+ } * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+ ed->data[0] = *(int *) buffer;
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_ERROR:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ *(int *) buffer = 0;
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_ERROR: %d, "
+ "buflen %d, #VPP-TBD#", getpid (),
+ *(int *) buffer, *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_ERROR: %d buflen=%d",
+ .format_args = "i4i4",
+ };
+
+ struct {
+ u32 data[2];
+ } * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+ ed->data[0] = *(int *) buffer;
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_TX_FIFO_LEN:
+ if (buffer && buflen && (*buflen >= sizeof (u32)))
+ {
+ svm_fifo_t *tx_fifo;
+
+ tx_fifo = ((!session->is_cut_thru || session->is_server) ?
+ session->server_tx_fifo : session->server_rx_fifo);
+
+ /* VPP-TBD */
+ *(size_t *) buffer = (session->sndbuf_size ? session->sndbuf_size :
+ tx_fifo ? tx_fifo->nitems :
+ vcm->cfg.tx_fifo_size);
+ *buflen = sizeof (u32);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_TX_FIFO_LEN: %u (0x%x), "
+ "buflen %d, #VPP-TBD#", getpid (),
+ *(size_t *) buffer, *(size_t *) buffer, *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_TX_FIFO_LEN: 0x%x buflen=%d",
+ .format_args = "i4i4",
+ };
+
+ struct {
+ u32 data[2];
+ } * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+ ed->data[0] = *(size_t *) buffer;
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_TX_FIFO_LEN:
+ if (buffer && buflen && (*buflen == sizeof (u32)))
+ {
+ /* VPP-TBD */
+ session->sndbuf_size = *(u32 *) buffer;
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_TX_FIFO_LEN: %u (0x%x), "
+ "buflen %d, #VPP-TBD#", getpid (),
+ session->sndbuf_size, session->sndbuf_size,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_TX_FIFO_LEN: 0x%x buflen=%d",
+ .format_args = "i4i4",
+ };
+
+ struct {
+ u32 data[2];
+ } * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+ ed->data[0] = session->sndbuf_size;
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_RX_FIFO_LEN:
+ if (buffer && buflen && (*buflen >= sizeof (u32)))
+ {
+ svm_fifo_t *rx_fifo;
+
+ rx_fifo = ((!session->is_cut_thru || session->is_server) ?
+ session->server_rx_fifo : session->server_tx_fifo);
+
+ /* VPP-TBD */
+ *(size_t *) buffer = (session->rcvbuf_size ? session->rcvbuf_size :
+ rx_fifo ? rx_fifo->nitems :
+ vcm->cfg.rx_fifo_size);
+ *buflen = sizeof (u32);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_RX_FIFO_LEN: %u (0x%x), "
+ "buflen %d, #VPP-TBD#", getpid (),
+ *(size_t *) buffer, *(size_t *) buffer, *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_RX_FIFO_LEN: 0x%x buflen=%d",
+ .format_args = "i4i4",
+ };
+
+ struct {
+ u32 data[2];
+ } * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+ ed->data[0] = *(size_t *) buffer;
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_RX_FIFO_LEN:
+ if (buffer && buflen && (*buflen == sizeof (u32)))
+ {
+ /* VPP-TBD */
+ session->rcvbuf_size = *(u32 *) buffer;
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_TX_FIFO_LEN: %u (0x%x), "
+ "buflen %d, #VPP-TBD#", getpid (),
+ session->sndbuf_size, session->sndbuf_size,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_TX_FIFO_LEN: 0x%x buflen=%d",
+ .format_args = "i4i4",
+ };
+
+ struct {
+ u32 data[2];
+ } * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+ ed->data[0] = session->sndbuf_size;
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_REUSEADDR:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_REUSEADDR);
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_REUSEADDR: %d, "
+ "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_REUSEADDR: %d buflen=%d",
+ .format_args = "i4i4",
+ };
+
+ struct {
+ u32 data[2];
+ } * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, session->elog_track);
+ ed->data[0] = *(int *) buffer;
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }