aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-10-19 20:51:36 -0700
committerDave Barach <openvpp@barachs.net>2020-10-20 17:49:41 +0000
commitac422d6430060c003f70191c9a12466c29dab7e7 (patch)
tree6ed0a22bba0049dc66fb9f5e77fbd6a6b7a7f360
parent2531d50101991011fb1c7755d48f11b41f092628 (diff)
vcl: more session struct cleanup
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I8e466e789c860caaa55f67095a57fc6ab670f32b
-rw-r--r--src/vcl/vcl_locked.c2
-rw-r--r--src/vcl/vcl_private.h67
-rw-r--r--src/vcl/vppcom.c143
3 files changed, 108 insertions, 104 deletions
diff --git a/src/vcl/vcl_locked.c b/src/vcl/vcl_locked.c
index d7f16a50de9..ce94d7500a4 100644
--- a/src/vcl/vcl_locked.c
+++ b/src/vcl/vcl_locked.c
@@ -794,7 +794,7 @@ vls_mt_acq_locks (vcl_locked_session_t * vls, vls_mt_ops_t op, int *locks_acq)
s = vcl_session_get (wrk, vls->session_index);
if (PREDICT_FALSE (!s))
return;
- is_nonblk = VCL_SESS_ATTR_TEST (s->attr, VCL_SESS_ATTR_NONBLOCK);
+ is_nonblk = vcl_session_has_attr (s, VCL_SESS_ATTR_NONBLOCK);
}
switch (op)
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 017da4e5088..c82de1aea60 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -131,56 +131,41 @@ typedef enum
VCL_SESS_ATTR_MAX
} vppcom_session_attr_t;
-#define VCL_SESS_ATTR_SET(ATTR, VAL) \
-do { \
- (ATTR) |= 1 << (VAL); \
- } while (0)
-
-#define VCL_SESS_ATTR_CLR(ATTR, VAL) \
-do { \
- (ATTR) &= ~(1 << (VAL)); \
- } while (0)
-
-#define VCL_SESS_ATTR_TEST(ATTR, VAL) \
- ((ATTR) & (1 << (VAL)) ? 1 : 0)
-
typedef enum vcl_session_flags_
{
VCL_SESSION_F_CONNECTED = 1 << 0,
VCL_SESSION_F_IS_VEP = 1 << 1,
VCL_SESSION_F_IS_VEP_SESSION = 1 << 2,
+ VCL_SESSION_F_HAS_RX_EVT = 1 << 3,
} __clib_packed vcl_session_flags_t;
-typedef struct
+typedef struct vcl_session_
{
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
+
#define _(type, name) type name;
foreach_app_session_field
#undef _
- u32 sndbuf_size; // VPP-TBD: Hack until support setsockopt(SO_SNDBUF)
- u32 rcvbuf_size; // VPP-TBD: Hack until support setsockopt(SO_RCVBUF)
- u32 user_mss; // VPP-TBD: Hack until support setsockopt(TCP_MAXSEG)
- u64 vpp_handle;
- u32 vpp_thread_index;
+ vcl_session_flags_t flags; /**< see @ref vcl_session_flags_t */
+ u32 rx_bytes_pending; /**< bytes rx-ed as segs but not yet freed */
svm_fifo_t *ct_rx_fifo;
svm_fifo_t *ct_tx_fifo;
+ vcl_session_msg_t *accept_evts_fifo;
- /* Socket configuration state */
- vcl_session_flags_t flags;
- /* VCL session index of the listening session (if any) */
- u32 listener_index;
- /* Accepted sessions on this listener */
- int n_accepted_sessions;
- u8 has_rx_evt;
- u32 attr;
+ u64 vpp_handle;
+ u32 vpp_thread_index;
+ u32 listener_index; /**< index of parent listener (if any) */
+ int n_accepted_sessions; /**< sessions accepted by this listener */
+ u32 attributes; /**< see @ref vppcom_session_attr_t */
u64 parent_handle;
- vppcom_epoll_t vep;
int libc_epfd;
- svm_msg_q_t *our_evt_q;
- vcl_session_msg_t *accept_evts_fifo;
- /** bytes delivered as segment but not yet freed */
- u32 rx_bytes_pending;
+ vppcom_epoll_t vep;
+
+ u32 sndbuf_size; // VPP-TBD: Hack until support setsockopt(SO_SNDBUF)
+ u32 rcvbuf_size; // VPP-TBD: Hack until support setsockopt(SO_RCVBUF)
+ u32 user_mss; // VPP-TBD: Hack until support setsockopt(TCP_MAXSEG)
+
#if VCL_ELOG
elog_track_t elog_track;
#endif
@@ -619,6 +604,24 @@ vcl_proto_is_dgram (uint8_t proto)
return proto == VPPCOM_PROTO_UDP;
}
+static inline u8
+vcl_session_has_attr (vcl_session_t * s, u8 attr)
+{
+ return (s->attributes & (1 << attr)) ? 1 : 0;
+}
+
+static inline void
+vcl_session_set_attr (vcl_session_t * s, u8 attr)
+{
+ s->attributes |= 1 << attr;
+}
+
+static inline void
+vcl_session_clear_attr (vcl_session_t * s, u8 attr)
+{
+ s->attributes &= ~(1 << attr);
+}
+
/*
* Helpers
*/
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 1e9e5c45fd7..dd50df153bb 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -520,7 +520,7 @@ vcl_session_connected_handler (vcl_worker_t * wrk,
session->transport.lcl_port = mp->lcl.port;
/* Application closed session before connect reply */
- if (VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_NONBLOCK)
+ if (vcl_session_has_attr (session, VCL_SESS_ATTR_NONBLOCK)
&& session->session_state == VCL_STATE_CLOSED)
vcl_send_session_disconnect (wrk, session);
else
@@ -1288,7 +1288,7 @@ vppcom_session_create (u8 proto, u8 is_nonblocking)
session->is_dgram = vcl_proto_is_dgram (proto);
if (is_nonblocking)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_NONBLOCK);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_NONBLOCK);
vcl_evt (VCL_EVT_CREATE, session, session_type, session->session_state,
is_nonblocking, session_index);
@@ -1560,8 +1560,8 @@ vppcom_session_accept (uint32_t listen_session_handle, vppcom_endpt_t * ep,
goto handle;
}
- is_nonblocking = VCL_SESS_ATTR_TEST (listen_session->attr,
- VCL_SESS_ATTR_NONBLOCK);
+ is_nonblocking = vcl_session_has_attr (listen_session,
+ VCL_SESS_ATTR_NONBLOCK);
while (1)
{
if (svm_msg_q_is_empty (wrk->app_event_queue) && is_nonblocking)
@@ -1593,13 +1593,13 @@ handle:
client_session = vcl_session_get (wrk, client_session_index);
if (flags & O_NONBLOCK)
- VCL_SESS_ATTR_SET (client_session->attr, VCL_SESS_ATTR_NONBLOCK);
+ vcl_session_set_attr (client_session, VCL_SESS_ATTR_NONBLOCK);
VDBG (1, "listener %u [0x%llx]: Got a connect request! session %u [0x%llx],"
" flags %d, is_nonblocking %u", listen_session->session_index,
listen_session->vpp_handle, client_session_index,
client_session->vpp_handle, flags,
- VCL_SESS_ATTR_TEST (client_session->attr, VCL_SESS_ATTR_NONBLOCK));
+ vcl_session_has_attr (client_session, VCL_SESS_ATTR_NONBLOCK));
if (ep)
{
@@ -1699,7 +1699,7 @@ vppcom_session_connect (uint32_t session_handle, vppcom_endpt_t * server_ep)
vcl_send_session_connect (wrk, session);
- if (VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_NONBLOCK))
+ if (vcl_session_has_attr (session, VCL_SESS_ATTR_NONBLOCK))
{
/* State set to STATE_UPDATED to ensure the session is not assumed
* to be ready and to also allow the app to close it prior to vpp's
@@ -1819,11 +1819,11 @@ vppcom_session_read_internal (uint32_t session_handle, void *buf, int n,
return vcl_session_closed_error (s);
}
- is_nonblocking = VCL_SESS_ATTR_TEST (s->attr, VCL_SESS_ATTR_NONBLOCK);
+ is_nonblocking = vcl_session_has_attr (s, VCL_SESS_ATTR_NONBLOCK);
is_ct = vcl_session_is_ct (s);
mq = wrk->app_event_queue;
rx_fifo = is_ct ? s->ct_rx_fifo : s->rx_fifo;
- s->has_rx_evt = 0;
+ s->flags &= ~VCL_SESSION_F_HAS_RX_EVT;
if (svm_fifo_is_empty_cons (rx_fifo))
{
@@ -1929,11 +1929,11 @@ vppcom_session_read_segments (uint32_t session_handle,
if (PREDICT_FALSE (!vcl_session_is_open (s)))
return vcl_session_closed_error (s);
- is_nonblocking = VCL_SESS_ATTR_TEST (s->attr, VCL_SESS_ATTR_NONBLOCK);
+ is_nonblocking = vcl_session_has_attr (s, VCL_SESS_ATTR_NONBLOCK);
is_ct = vcl_session_is_ct (s);
- mq = is_ct ? s->our_evt_q : wrk->app_event_queue;
+ mq = wrk->app_event_queue;
rx_fifo = s->rx_fifo;
- s->has_rx_evt = 0;
+ s->flags &= ~VCL_SESSION_F_HAS_RX_EVT;
if (is_ct)
svm_fifo_unset_event (s->rx_fifo);
@@ -1974,7 +1974,7 @@ vppcom_session_read_segments (uint32_t session_handle,
svm_fifo_unset_event (s->rx_fifo);
if (svm_fifo_max_dequeue_cons (rx_fifo) != n_read
&& svm_fifo_set_event (s->rx_fifo)
- && VCL_SESS_ATTR_TEST (s->attr, VCL_SESS_ATTR_NONBLOCK))
+ && vcl_session_has_attr (s, VCL_SESS_ATTR_NONBLOCK))
{
session_event_t *e;
vec_add2 (wrk->unhandled_evts_vector, e, 1);
@@ -2051,7 +2051,7 @@ vppcom_session_write_inline (vcl_worker_t * wrk, vcl_session_t * s, void *buf,
is_ct = vcl_session_is_ct (s);
tx_fifo = is_ct ? s->ct_tx_fifo : s->tx_fifo;
- is_nonblocking = VCL_SESS_ATTR_TEST (s->attr, VCL_SESS_ATTR_NONBLOCK);
+ is_nonblocking = vcl_session_has_attr (s, VCL_SESS_ATTR_NONBLOCK);
mq = wrk->app_event_queue;
if (!vcl_fifo_is_writeable (tx_fifo, n, is_dgram))
@@ -2785,12 +2785,13 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
break;
vcl_fifo_rx_evt_valid_or_break (session);
session_events = session->vep.ev.events;
- if (!(EPOLLIN & session->vep.ev.events) || session->has_rx_evt)
+ if (!(EPOLLIN & session->vep.ev.events)
+ || (session->flags & VCL_SESSION_F_HAS_RX_EVT))
break;
add_event = 1;
events[*num_ev].events |= EPOLLIN;
session_evt_data = session->vep.ev.data.u64;
- session->has_rx_evt = 1;
+ session->flags |= VCL_SESSION_F_HAS_RX_EVT;
break;
case SESSION_IO_EVT_TX:
sid = e->session_index;
@@ -3088,12 +3089,12 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
{
*flags =
O_RDWR |
- (VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_NONBLOCK) ?
+ (vcl_session_has_attr (session, VCL_SESS_ATTR_NONBLOCK) ?
O_NONBLOCK : 0);
*buflen = sizeof (*flags);
VDBG (2, "VPPCOM_ATTR_GET_FLAGS: sh %u, flags = 0x%08x, "
"is_nonblocking = %u", session_handle, *flags,
- VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_NONBLOCK));
+ vcl_session_has_attr (session, VCL_SESS_ATTR_NONBLOCK));
}
else
rv = VPPCOM_EINVAL;
@@ -3103,13 +3104,13 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
if (PREDICT_TRUE (buffer && buflen && (*buflen == sizeof (*flags))))
{
if (*flags & O_NONBLOCK)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_NONBLOCK);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_NONBLOCK);
else
- VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_NONBLOCK);
+ vcl_session_clear_attr (session, VCL_SESS_ATTR_NONBLOCK);
VDBG (2, "VPPCOM_ATTR_SET_FLAGS: sh %u, flags = 0x%08x,"
" is_nonblocking = %u", session_handle, *flags,
- VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_NONBLOCK));
+ vcl_session_has_attr (session, VCL_SESS_ATTR_NONBLOCK));
}
else
rv = VPPCOM_EINVAL;
@@ -3214,8 +3215,8 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
case VPPCOM_ATTR_GET_LISTEN:
if (buffer && buflen && (*buflen >= sizeof (int)))
{
- *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
- VCL_SESS_ATTR_LISTEN);
+ *(int *) buffer = vcl_session_has_attr (session,
+ VCL_SESS_ATTR_LISTEN);
*buflen = sizeof (int);
VDBG (2, "VPPCOM_ATTR_GET_LISTEN: %d, buflen %d", *(int *) buffer,
@@ -3305,8 +3306,8 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
if (buffer && buflen && (*buflen >= sizeof (int)))
{
/* VPP-TBD */
- *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
- VCL_SESS_ATTR_REUSEADDR);
+ *(int *) buffer = vcl_session_has_attr (session,
+ VCL_SESS_ATTR_REUSEADDR);
*buflen = sizeof (int);
VDBG (2, "VPPCOM_ATTR_GET_REUSEADDR: %d, buflen %d, #VPP-TBD#",
@@ -3318,16 +3319,16 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
case VPPCOM_ATTR_SET_REUSEADDR:
if (buffer && buflen && (*buflen == sizeof (int)) &&
- !VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_LISTEN))
+ !vcl_session_has_attr (session, VCL_SESS_ATTR_LISTEN))
{
/* VPP-TBD */
if (*(int *) buffer)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_REUSEADDR);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_REUSEADDR);
else
- VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_REUSEADDR);
+ vcl_session_clear_attr (session, VCL_SESS_ATTR_REUSEADDR);
VDBG (2, "VPPCOM_ATTR_SET_REUSEADDR: %d, buflen %d, #VPP-TBD#",
- VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_REUSEADDR),
+ vcl_session_has_attr (session, VCL_SESS_ATTR_REUSEADDR),
*buflen);
}
else
@@ -3338,8 +3339,8 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
if (buffer && buflen && (*buflen >= sizeof (int)))
{
/* VPP-TBD */
- *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
- VCL_SESS_ATTR_REUSEPORT);
+ *(int *) buffer = vcl_session_has_attr (session,
+ VCL_SESS_ATTR_REUSEPORT);
*buflen = sizeof (int);
VDBG (2, "VPPCOM_ATTR_GET_REUSEPORT: %d, buflen %d, #VPP-TBD#",
@@ -3351,16 +3352,16 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
case VPPCOM_ATTR_SET_REUSEPORT:
if (buffer && buflen && (*buflen == sizeof (int)) &&
- !VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_LISTEN))
+ !vcl_session_has_attr (session, VCL_SESS_ATTR_LISTEN))
{
/* VPP-TBD */
if (*(int *) buffer)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_REUSEPORT);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_REUSEPORT);
else
- VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_REUSEPORT);
+ vcl_session_clear_attr (session, VCL_SESS_ATTR_REUSEPORT);
VDBG (2, "VPPCOM_ATTR_SET_REUSEPORT: %d, buflen %d, #VPP-TBD#",
- VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_REUSEPORT),
+ vcl_session_has_attr (session, VCL_SESS_ATTR_REUSEPORT),
*buflen);
}
else
@@ -3371,8 +3372,8 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
if (buffer && buflen && (*buflen >= sizeof (int)))
{
/* VPP-TBD */
- *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
- VCL_SESS_ATTR_BROADCAST);
+ *(int *) buffer = vcl_session_has_attr (session,
+ VCL_SESS_ATTR_BROADCAST);
*buflen = sizeof (int);
VDBG (2, "VPPCOM_ATTR_GET_BROADCAST: %d, buflen %d, #VPP-TBD#",
@@ -3387,12 +3388,12 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
{
/* VPP-TBD */
if (*(int *) buffer)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_BROADCAST);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_BROADCAST);
else
- VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_BROADCAST);
+ vcl_session_clear_attr (session, VCL_SESS_ATTR_BROADCAST);
VDBG (2, "VPPCOM_ATTR_SET_BROADCAST: %d, buflen %d, #VPP-TBD#",
- VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_BROADCAST),
+ vcl_session_has_attr (session, VCL_SESS_ATTR_BROADCAST),
*buflen);
}
else
@@ -3403,8 +3404,8 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
if (buffer && buflen && (*buflen >= sizeof (int)))
{
/* VPP-TBD */
- *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
- VCL_SESS_ATTR_V6ONLY);
+ *(int *) buffer = vcl_session_has_attr (session,
+ VCL_SESS_ATTR_V6ONLY);
*buflen = sizeof (int);
VDBG (2, "VPPCOM_ATTR_GET_V6ONLY: %d, buflen %d, #VPP-TBD#",
@@ -3419,12 +3420,12 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
{
/* VPP-TBD */
if (*(int *) buffer)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_V6ONLY);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_V6ONLY);
else
- VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_V6ONLY);
+ vcl_session_clear_attr (session, VCL_SESS_ATTR_V6ONLY);
VDBG (2, "VPPCOM_ATTR_SET_V6ONLY: %d, buflen %d, #VPP-TBD#",
- VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_V6ONLY),
+ vcl_session_has_attr (session, VCL_SESS_ATTR_V6ONLY),
*buflen);
}
else
@@ -3435,8 +3436,8 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
if (buffer && buflen && (*buflen >= sizeof (int)))
{
/* VPP-TBD */
- *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
- VCL_SESS_ATTR_KEEPALIVE);
+ *(int *) buffer = vcl_session_has_attr (session,
+ VCL_SESS_ATTR_KEEPALIVE);
*buflen = sizeof (int);
VDBG (2, "VPPCOM_ATTR_GET_KEEPALIVE: %d, buflen %d, #VPP-TBD#",
@@ -3451,12 +3452,12 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
{
/* VPP-TBD */
if (*(int *) buffer)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_KEEPALIVE);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_KEEPALIVE);
else
- VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_KEEPALIVE);
+ vcl_session_clear_attr (session, VCL_SESS_ATTR_KEEPALIVE);
VDBG (2, "VPPCOM_ATTR_SET_KEEPALIVE: %d, buflen %d, #VPP-TBD#",
- VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_KEEPALIVE),
+ vcl_session_has_attr (session, VCL_SESS_ATTR_KEEPALIVE),
*buflen);
}
else
@@ -3467,8 +3468,8 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
if (buffer && buflen && (*buflen >= sizeof (int)))
{
/* VPP-TBD */
- *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
- VCL_SESS_ATTR_TCP_NODELAY);
+ *(int *) buffer = vcl_session_has_attr (session,
+ VCL_SESS_ATTR_TCP_NODELAY);
*buflen = sizeof (int);
VDBG (2, "VPPCOM_ATTR_GET_TCP_NODELAY: %d, buflen %d, #VPP-TBD#",
@@ -3483,12 +3484,12 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
{
/* VPP-TBD */
if (*(int *) buffer)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_TCP_NODELAY);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_TCP_NODELAY);
else
- VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_TCP_NODELAY);
+ vcl_session_clear_attr (session, VCL_SESS_ATTR_TCP_NODELAY);
VDBG (2, "VPPCOM_ATTR_SET_TCP_NODELAY: %d, buflen %d, #VPP-TBD#",
- VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_TCP_NODELAY),
+ vcl_session_has_attr (session, VCL_SESS_ATTR_TCP_NODELAY),
*buflen);
}
else
@@ -3499,8 +3500,8 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
if (buffer && buflen && (*buflen >= sizeof (int)))
{
/* VPP-TBD */
- *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
- VCL_SESS_ATTR_TCP_KEEPIDLE);
+ *(int *) buffer = vcl_session_has_attr (session,
+ VCL_SESS_ATTR_TCP_KEEPIDLE);
*buflen = sizeof (int);
VDBG (2, "VPPCOM_ATTR_GET_TCP_KEEPIDLE: %d, buflen %d, #VPP-TBD#",
@@ -3515,13 +3516,13 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
{
/* VPP-TBD */
if (*(int *) buffer)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_TCP_KEEPIDLE);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_TCP_KEEPIDLE);
else
- VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_TCP_KEEPIDLE);
+ vcl_session_clear_attr (session, VCL_SESS_ATTR_TCP_KEEPIDLE);
VDBG (2, "VPPCOM_ATTR_SET_TCP_KEEPIDLE: %d, buflen %d, #VPP-TBD#",
- VCL_SESS_ATTR_TEST (session->attr,
- VCL_SESS_ATTR_TCP_KEEPIDLE), *buflen);
+ vcl_session_has_attr (session,
+ VCL_SESS_ATTR_TCP_KEEPIDLE), *buflen);
}
else
rv = VPPCOM_EINVAL;
@@ -3531,8 +3532,8 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
if (buffer && buflen && (*buflen >= sizeof (int)))
{
/* VPP-TBD */
- *(int *) buffer = VCL_SESS_ATTR_TEST (session->attr,
- VCL_SESS_ATTR_TCP_KEEPINTVL);
+ *(int *) buffer = vcl_session_has_attr (session,
+ VCL_SESS_ATTR_TCP_KEEPINTVL);
*buflen = sizeof (int);
VDBG (2, "VPPCOM_ATTR_GET_TCP_KEEPINTVL: %d, buflen %d, #VPP-TBD#",
@@ -3547,13 +3548,13 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
{
/* VPP-TBD */
if (*(int *) buffer)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_TCP_KEEPINTVL);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_TCP_KEEPINTVL);
else
- VCL_SESS_ATTR_CLR (session->attr, VCL_SESS_ATTR_TCP_KEEPINTVL);
+ vcl_session_clear_attr (session, VCL_SESS_ATTR_TCP_KEEPINTVL);
VDBG (2, "VPPCOM_ATTR_SET_TCP_KEEPINTVL: %d, buflen %d, #VPP-TBD#",
- VCL_SESS_ATTR_TEST (session->attr,
- VCL_SESS_ATTR_TCP_KEEPINTVL), *buflen);
+ vcl_session_has_attr (session,
+ VCL_SESS_ATTR_TCP_KEEPINTVL), *buflen);
}
else
rv = VPPCOM_EINVAL;
@@ -3588,15 +3589,15 @@ vppcom_session_attr (uint32_t session_handle, uint32_t op,
case VPPCOM_ATTR_SET_SHUT:
if (*flags == SHUT_RD || *flags == SHUT_RDWR)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_SHUT_RD);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_SHUT_RD);
if (*flags == SHUT_WR || *flags == SHUT_RDWR)
- VCL_SESS_ATTR_SET (session->attr, VCL_SESS_ATTR_SHUT_WR);
+ vcl_session_set_attr (session, VCL_SESS_ATTR_SHUT_WR);
break;
case VPPCOM_ATTR_GET_SHUT:
- if (VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_SHUT_RD))
+ if (vcl_session_has_attr (session, VCL_SESS_ATTR_SHUT_RD))
tmp_flags = 1;
- if (VCL_SESS_ATTR_TEST (session->attr, VCL_SESS_ATTR_SHUT_WR))
+ if (vcl_session_has_attr (session, VCL_SESS_ATTR_SHUT_WR))
tmp_flags |= 2;
if (tmp_flags == 1)
*(int *) buffer = SHUT_RD;