vcl: epoll out deq notifications only if fifo exists
[vpp.git] / src / vcl / vppcom.c
index 2189243..b576e1a 100644 (file)
@@ -636,12 +636,17 @@ vcl_session_migrated_handler (vcl_worker_t * wrk, void *data)
       return;
     }
 
-  fs_index = vcl_segment_table_lookup (mp->segment_handle);
-  if (fs_index == VCL_INVALID_SEGMENT_INDEX)
+  /* Only validate if a value is provided */
+  if (mp->segment_handle != SESSION_INVALID_HANDLE)
     {
-      VDBG (0, "segment for session %u is not mounted!", s->session_index);
-      s->session_state = VCL_STATE_DETACHED;
-      return;
+      fs_index = vcl_segment_table_lookup (mp->segment_handle);
+      if (fs_index == VCL_INVALID_SEGMENT_INDEX)
+       {
+         VDBG (0, "segment %lx for session %u is not mounted!",
+               mp->segment_handle, s->session_index);
+         s->session_state = VCL_STATE_DETACHED;
+         return;
+       }
     }
 
   s->vpp_handle = mp->new_handle;
@@ -1526,6 +1531,10 @@ vppcom_unformat_proto (uint8_t * proto, char *proto_str)
     *proto = VPPCOM_PROTO_QUIC;
   else if (!strcmp (proto_str, "quic"))
     *proto = VPPCOM_PROTO_QUIC;
+  else if (!strcmp (proto_str, "DTLS"))
+    *proto = VPPCOM_PROTO_DTLS;
+  else if (!strcmp (proto_str, "dtls"))
+    *proto = VPPCOM_PROTO_DTLS;
   else
     return 1;
   return 0;
@@ -2649,10 +2658,13 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
       s->vep.et_mask = VEP_DEFAULT_ET_MASK;
       s->vep.ev = *event;
       txf = vcl_session_is_ct (s) ? s->ct_tx_fifo : s->tx_fifo;
-      if (event->events & EPOLLOUT)
-       svm_fifo_add_want_deq_ntf (txf, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
-      else
-       svm_fifo_del_want_deq_ntf (txf, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
+      if (txf)
+       {
+         if (event->events & EPOLLOUT)
+           svm_fifo_add_want_deq_ntf (txf, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
+         else
+           svm_fifo_del_want_deq_ntf (txf, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
+       }
       VDBG (1, "EPOLL_CTL_MOD: vep_sh %u, sh %u, events 0x%x, data 0x%llx!",
            vep_handle, session_handle, event->events, event->data.u64);
       break;
@@ -3933,6 +3945,9 @@ vppcom_proto_str (vppcom_proto_t proto)
     case VPPCOM_PROTO_QUIC:
       proto_str = "QUIC";
       break;
+    case VPPCOM_PROTO_DTLS:
+      proto_str = "DTLS";
+      break;
     default:
       proto_str = "UNKNOWN";
       break;