+ 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_RX_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_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] = 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* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_SET_REUSEADDR:
+ if (buffer && buflen && (*buflen == sizeof (int)) &&
+ !VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_LISTEN))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_REUSEADDR);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_REUSEADDR);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_REUSEADDR: %d, "
+ "buflen %d, #VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_REUSEADDR),
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_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] = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_REUSEADDR);
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_REUSEPORT:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_REUSEPORT);
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_REUSEPORT: %d, "
+ "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_REUSEPORT: %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_SET_REUSEPORT:
+ if (buffer && buflen && (*buflen == sizeof (int)) &&
+ !VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_LISTEN))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_REUSEPORT);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_REUSEPORT);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_REUSEPORT: %d, "
+ "buflen %d, #VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_REUSEPORT),
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_REUSEPORT: %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] = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_REUSEPORT);
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_BROADCAST:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_BROADCAST);
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_BROADCAST: %d, "
+ "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_BROADCAST: %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_SET_BROADCAST:
+ if (buffer && buflen && (*buflen == sizeof (int)))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_BROADCAST);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_BROADCAST);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_BROADCAST: %d, "
+ "buflen %d, #VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_BROADCAST),
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_BROADCAST: %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] = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_BROADCAST);
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_V6ONLY:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_V6ONLY);
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_V6ONLY: %d, "
+ "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_V6ONLY: %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_SET_V6ONLY:
+ if (buffer && buflen && (*buflen == sizeof (int)))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_V6ONLY);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_V6ONLY);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_V6ONLY: %d, "
+ "buflen %d, #VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_V6ONLY), *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_V6ONLY: %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] = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_V6ONLY);
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_KEEPALIVE:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_KEEPALIVE);
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_KEEPALIVE: %d, "
+ "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_KEEPALIVE: %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_SET_KEEPALIVE:
+ if (buffer && buflen && (*buflen == sizeof (int)))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_KEEPALIVE);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_KEEPALIVE);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_KEEPALIVE: %d, "
+ "buflen %d, #VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_KEEPALIVE),
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_KEEPALIVE: %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] = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_KEEPALIVE);
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_TCP_NODELAY:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_NODELAY);
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_TCP_NODELAY: %d, "
+ "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_TCP_NODELAY: %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_SET_TCP_NODELAY:
+ if (buffer && buflen && (*buflen == sizeof (int)))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_TCP_NODELAY);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_TCP_NODELAY);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_TCP_NODELAY: %d, "
+ "buflen %d, #VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_NODELAY),
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_TCP_NODELAY: %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] = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_NODELAY);
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_TCP_KEEPIDLE:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_KEEPIDLE);
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_TCP_KEEPIDLE: %d, "
+ "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_TCP_KEEPIDLE: %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_SET_TCP_KEEPIDLE:
+ if (buffer && buflen && (*buflen == sizeof (int)))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_TCP_KEEPIDLE);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_TCP_KEEPIDLE);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_TCP_KEEPIDLE: %d, "
+ "buflen %d, #VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_KEEPIDLE),
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_TCP_KEEPIDLE: %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] = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_KEEPIDLE);
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_TCP_KEEPINTVL:
+ if (buffer && buflen && (*buflen >= sizeof (int)))
+ {
+ /* VPP-TBD */
+ *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_KEEPINTVL);
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_TCP_KEEPINTVL: %d, "
+ "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_TCP_KEEPIDLE: %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_SET_TCP_KEEPINTVL:
+ if (buffer && buflen && (*buflen == sizeof (int)))
+ {
+ /* VPP-TBD */
+ if (*(int *) buffer)
+ VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_TCP_KEEPINTVL);
+ else
+ VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_TCP_KEEPINTVL);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_TCP_KEEPINTVL: %d, "
+ "buflen %d, #VPP-TBD#", getpid (),
+ VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_KEEPINTVL),
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_TCP_KEEPINTVL: %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] = VCL_SESS_ATTR_TEST (session->attr,
+ VCL_SESS_ATTR_TCP_KEEPINTVL);
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ case VPPCOM_ATTR_GET_TCP_USER_MSS:
+ if (buffer && buflen && (*buflen >= sizeof (u32)))
+ {
+ /* VPP-TBD */
+ *(u32 *) buffer = session->user_mss;
+ *buflen = sizeof (int);
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_GET_TCP_USER_MSS: %d, "
+ "buflen %d, #VPP-TBD#", getpid (), *(int *) buffer,
+ *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_GET_TCP_USER_MSS: %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_SET_TCP_USER_MSS:
+ if (buffer && buflen && (*buflen == sizeof (u32)))
+ {
+ /* VPP-TBD */
+ session->user_mss = *(u32 *) buffer;
+
+ if (VPPCOM_DEBUG > 2)
+ clib_warning ("VCL<%d>: VPPCOM_ATTR_SET_TCP_USER_MSS: %u, "
+ "buflen %d, #VPP-TBD#", getpid (),
+ session->user_mss, *buflen);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "VPPCOM_ATTR_SET_TCP_USER_MSS: %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] = session->user_mss;
+ ed->data[1] = *buflen;
+ /* *INDENT-ON* */
+ }
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
+ default:
+ rv = VPPCOM_EINVAL;
+ break;
+ }
+
+done:
+ clib_spinlock_unlock (&vcm->sessions_lockp);
+ return rv;
+}
+
+int
+vppcom_session_recvfrom (uint32_t session_index, void *buffer,
+ uint32_t buflen, int flags, vppcom_endpt_t * ep)
+{
+ int rv = VPPCOM_OK;
+ session_t *session = 0;
+
+ if (ep)
+ {
+ clib_spinlock_lock (&vcm->sessions_lockp);
+ rv = vppcom_session_at_index (session_index, &session);
+ if (PREDICT_FALSE (rv))
+ {
+ clib_spinlock_unlock (&vcm->sessions_lockp);
+ if (VPPCOM_DEBUG > 0)
+ clib_warning ("VCL<%d>: invalid session, "
+ "sid (%u) has been closed!",
+ getpid (), session_index);
+ if (VPPCOM_DEBUG > 0)
+ {
+ /* *INDENT-OFF* */
+ ELOG_TYPE_DECLARE (e) =
+ {
+ .format = "invalid session: %d closed",
+ .format_args = "i4",
+ };
+
+ struct {
+ u32 data;
+ } * ed;
+
+ ed = ELOG_TRACK_DATA (&vcm->elog_main, e, vcm->elog_track);
+ ed->data = session_index;
+ /* *INDENT-ON* */
+ }
+ rv = VPPCOM_EBADFD;
+ clib_spinlock_unlock (&vcm->sessions_lockp);
+ goto done;
+ }
+ ep->is_ip4 = session->peer_addr.is_ip4;
+ ep->port = session->peer_port;
+ if (session->peer_addr.is_ip4)
+ clib_memcpy (ep->ip, &session->peer_addr.ip46.ip4,
+ sizeof (ip4_address_t));
+ else
+ clib_memcpy (ep->ip, &session->peer_addr.ip46.ip6,
+ sizeof (ip6_address_t));
+ clib_spinlock_unlock (&vcm->sessions_lockp);
+ }
+
+ if (flags == 0)
+ rv = vppcom_session_read (session_index, buffer, buflen);
+ else if (flags & MSG_PEEK)
+ rv = vppcom_session_peek (session_index, buffer, buflen);
+ else
+ {
+ clib_warning ("VCL<%d>: Unsupport flags for recvfrom %d",
+ getpid (), flags);
+ rv = VPPCOM_EAFNOSUPPORT;
+ }
+
+done: