ipsec: make pre-shared keys harder to misuse
[vpp.git] / src / vnet / classify / ip_classify.c
index 43ad2e8..9454ae9 100644 (file)
@@ -102,20 +102,18 @@ ip_classify_inline (vlib_main_t * vm,
        p2 = vlib_get_buffer (vm, from[2]);
 
        vlib_prefetch_buffer_header (p1, STORE);
-       CLIB_PREFETCH (p1->data, CLIB_CACHE_LINE_BYTES, STORE);
+       clib_prefetch_store (p1->data);
        vlib_prefetch_buffer_header (p2, STORE);
-       CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
+       clib_prefetch_store (p2->data);
       }
 
       bi0 = from[0];
       b0 = vlib_get_buffer (vm, bi0);
-      h0 = (void *) vlib_buffer_get_current (b0) -
-       ethernet_buffer_header_size (b0);
+      h0 = vlib_buffer_get_current (b0) - ethernet_buffer_header_size (b0);
 
       bi1 = from[1];
       b1 = vlib_get_buffer (vm, bi1);
-      h1 = (void *) vlib_buffer_get_current (b1) -
-       ethernet_buffer_header_size (b1);
+      h1 = vlib_buffer_get_current (b1) - ethernet_buffer_header_size (b1);
 
       cd_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
       cd0 = classify_dpo_get (cd_index0);
@@ -129,13 +127,11 @@ ip_classify_inline (vlib_main_t * vm,
 
       t1 = pool_elt_at_index (vcm->tables, table_index1);
 
-      vnet_buffer (b0)->l2_classify.hash =
-       vnet_classify_hash_packet (t0, (u8 *) h0);
+      vnet_buffer (b0)->l2_classify.hash = vnet_classify_hash_packet (t0, h0);
 
       vnet_classify_prefetch_bucket (t0, vnet_buffer (b0)->l2_classify.hash);
 
-      vnet_buffer (b1)->l2_classify.hash =
-       vnet_classify_hash_packet (t1, (u8 *) h1);
+      vnet_buffer (b1)->l2_classify.hash = vnet_classify_hash_packet (t1, h1);
 
       vnet_classify_prefetch_bucket (t1, vnet_buffer (b1)->l2_classify.hash);
 
@@ -159,16 +155,14 @@ ip_classify_inline (vlib_main_t * vm,
 
       bi0 = from[0];
       b0 = vlib_get_buffer (vm, bi0);
-      h0 = (void *) vlib_buffer_get_current (b0) -
-       ethernet_buffer_header_size (b0);
+      h0 = vlib_buffer_get_current (b0) - ethernet_buffer_header_size (b0);
 
       cd_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX];
       cd0 = classify_dpo_get (cd_index0);
       table_index0 = cd0->cd_table_index;
 
       t0 = pool_elt_at_index (vcm->tables, table_index0);
-      vnet_buffer (b0)->l2_classify.hash =
-       vnet_classify_hash_packet (t0, (u8 *) h0);
+      vnet_buffer (b0)->l2_classify.hash = vnet_classify_hash_packet (t0, h0);
 
       vnet_buffer (b0)->l2_classify.table_index = table_index0;
       vnet_classify_prefetch_bucket (t0, vnet_buffer (b0)->l2_classify.hash);
@@ -196,7 +190,7 @@ ip_classify_inline (vlib_main_t * vm,
          u32 table_index0;
          vnet_classify_table_t *t0;
          vnet_classify_entry_t *e0;
-         u64 hash0;
+         u32 hash0;
          u8 *h0;
 
          /* Stride 3 seems to work best */
@@ -205,7 +199,7 @@ ip_classify_inline (vlib_main_t * vm,
              vlib_buffer_t *p1 = vlib_get_buffer (vm, from[3]);
              vnet_classify_table_t *tp1;
              u32 table_index1;
-             u64 phash1;
+             u32 phash1;
 
              table_index1 = vnet_buffer (p1)->l2_classify.table_index;
 
@@ -237,7 +231,7 @@ ip_classify_inline (vlib_main_t * vm,
              hash0 = vnet_buffer (b0)->l2_classify.hash;
              t0 = pool_elt_at_index (vcm->tables, table_index0);
 
-             e0 = vnet_classify_find_entry (t0, (u8 *) h0, hash0, now);
+             e0 = vnet_classify_find_entry (t0, h0, hash0, now);
              if (e0)
                {
                  vnet_buffer (b0)->l2_classify.opaque_index
@@ -262,9 +256,8 @@ ip_classify_inline (vlib_main_t * vm,
                          break;
                        }
 
-                     hash0 = vnet_classify_hash_packet (t0, (u8 *) h0);
-                     e0 = vnet_classify_find_entry
-                       (t0, (u8 *) h0, hash0, now);
+                     hash0 = vnet_classify_hash_packet (t0, h0);
+                     e0 = vnet_classify_find_entry (t0, h0, hash0, now);
                      if (e0)
                        {
                          vnet_buffer (b0)->l2_classify.opaque_index
@@ -287,7 +280,7 @@ ip_classify_inline (vlib_main_t * vm,
                vlib_add_trace (vm, node, b0, sizeof (*t));
              t->next_index = next0;
              t->table_index = t0 ? t0 - vcm->tables : ~0;
-             t->entry_index = e0 ? e0 - t0->entries : ~0;
+             t->entry_index = e0 ? e0->opaque_index : ~0;
            }
 
          /* verify speculative enqueue, maybe switch current next frame */