session: fix prefetch out of struct bound on Arm
[vpp.git] / src / vnet / session / session_node.c
index 8817b08..18fb61d 100644 (file)
@@ -401,8 +401,6 @@ session_mq_unlisten_rpc (session_unlisten_msg_t *mp)
   sh = mp->handle;
   context = mp->context;
 
-  vlib_worker_thread_barrier_sync (vm);
-
   app = application_lookup (mp->client_index);
   if (!app)
     return;
@@ -411,15 +409,18 @@ session_mq_unlisten_rpc (session_unlisten_msg_t *mp)
   a->app_index = app->app_index;
   a->handle = sh;
   a->wrk_map_index = mp->wrk_index;
+
+  vlib_worker_thread_barrier_sync (vm);
+
   if ((rv = vnet_unlisten (a)))
     clib_warning ("unlisten returned: %d", rv);
 
+  vlib_worker_thread_barrier_release (vm);
+
   app_wrk = application_get_worker (app, a->wrk_map_index);
   if (!app_wrk)
     return;
 
-  vlib_worker_thread_barrier_release (vm);
-
   mq_send_unlisten_reply (app_wrk, sh, context, rv);
   clib_mem_free (mp);
 }
@@ -1017,7 +1018,15 @@ session_tx_not_ready (session_t * s, u8 peek_data)
       /* Can retransmit for closed sessions but can't send new data if
        * session is not ready or closed */
       else if (s->session_state < SESSION_STATE_READY)
-       return 1;
+       {
+         /* Allow accepting session to send custom packets.
+          * For instance, tcp want to send acks in established, but
+          * the app has not called accept() yet */
+         if (s->session_state == SESSION_STATE_ACCEPTING &&
+             (s->flags & SESSION_F_CUSTOM_TX))
+           return 0;
+         return 1;
+       }
       else if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSED)
        {
          /* Allow closed transports to still send custom packets.
@@ -1571,7 +1580,7 @@ session_event_dispatch_io (session_worker_t * wrk, vlib_node_runtime_t * node,
       s = session_event_get_session (wrk, e);
       if (PREDICT_FALSE (!s))
        break;
-      CLIB_PREFETCH (s->tx_fifo, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
+      CLIB_PREFETCH (s->tx_fifo, sizeof (*(s->tx_fifo)), LOAD);
       wrk->ctx.s = s;
       /* Spray packets in per session type frames, since they go to
        * different nodes */