vcl: basic support for epoll level-triggered evts
[vpp.git] / src / vcl / vcl_private.h
index 956f077..ab3ecab 100644 (file)
@@ -126,8 +126,6 @@ typedef enum
   VCL_SESS_ATTR_TCP_NODELAY,   // SOL_TCP,TCP_NODELAY
   VCL_SESS_ATTR_TCP_KEEPIDLE,  // SOL_TCP,TCP_KEEPIDLE
   VCL_SESS_ATTR_TCP_KEEPINTVL, // SOL_TCP,TCP_KEEPINTVL
-  VCL_SESS_ATTR_SHUT_RD,
-  VCL_SESS_ATTR_SHUT_WR,
   VCL_SESS_ATTR_MAX
 } vppcom_session_attr_t;
 
@@ -137,7 +135,8 @@ typedef enum vcl_session_flags_
   VCL_SESSION_F_IS_VEP = 1 << 1,
   VCL_SESSION_F_IS_VEP_SESSION = 1 << 2,
   VCL_SESSION_F_HAS_RX_EVT = 1 << 3,
-  VCL_SESSION_F_SHUTDOWN = 1 << 4,
+  VCL_SESSION_F_RD_SHUTDOWN = 1 << 4,
+  VCL_SESSION_F_WR_SHUTDOWN = 1 << 5,
 } __clib_packed vcl_session_flags_t;
 
 typedef struct vcl_session_
@@ -254,6 +253,12 @@ typedef struct vcl_worker_
   /** Per worker buffer for receiving mq epoll events */
   struct epoll_event *mq_events;
 
+  /** Vector of session indices recently notified of epoll level events */
+  u32 *ep_level_evts;
+
+  /** Storage for level events session while new ones are processed */
+  u32 *ep_level_evts_fl;
+
   /** Hash table for disconnect processing */
   uword *session_index_by_vpp_handles;
 
@@ -527,6 +532,12 @@ vcl_session_table_lookup_listener (vcl_worker_t * wrk, u64 handle)
       return 0;
     }
 
+  if (s->session_state == VCL_STATE_DISCONNECT)
+    {
+      VDBG (0, "listen session [0x%llx] is closing", s->vpp_handle);
+      return 0;
+    }
+
   ASSERT (s->session_state == VCL_STATE_LISTEN
          || s->session_state == VCL_STATE_LISTEN_NO_MQ
          || vcl_session_is_connectable_listener (wrk, s));
@@ -620,7 +631,8 @@ vcl_ip_copy_to_ep (ip46_address_t * ip, vppcom_endpt_t * ep, u8 is_ip4)
 static inline int
 vcl_proto_is_dgram (uint8_t proto)
 {
-  return proto == VPPCOM_PROTO_UDP || proto == VPPCOM_PROTO_DTLS;
+  return proto == VPPCOM_PROTO_UDP || proto == VPPCOM_PROTO_DTLS ||
+        proto == VPPCOM_PROTO_SRTP;
 }
 
 static inline u8