summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2021-10-28 10:50:47 +0200
committerDamjan Marion <dmarion@me.com>2021-11-02 22:33:32 +0000
commit6ea5c4744a132ca5f21b8cffab7676a386d6ebf5 (patch)
tree128d1109491a6eef8ecf2d1b6fae3b6e16fe74c2
parent78b4f4e19bb60b89c5ed00a2d81b1bbfee27c3e2 (diff)
fib: allow vnet rewrite max size to be smaller the pre_data
There is no reason to enforce vnet rewrite size to be equal to pre_data. Moreover, since vnet rewrite size is now saved as u8, this limits pre_data to 192 bytes. Type: fix Fixes: 7dbf9a1a4fff5c3b20ad972289e49e3f88e82f2d Change-Id: I3f848aa905ea4a794f3b4aa62c929a481261a3f1 Signed-off-by: Benoît Ganne <bganne@cisco.com>
-rw-r--r--src/vnet/adj/rewrite.h4
-rw-r--r--src/vnet/buffer.h4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/vnet/adj/rewrite.h b/src/vnet/adj/rewrite.h
index 4234986dc37..5cb90e47318 100644
--- a/src/vnet/adj/rewrite.h
+++ b/src/vnet/adj/rewrite.h
@@ -136,7 +136,7 @@ always_inline void
vnet_rewrite_clear_data_internal (vnet_rewrite_header_t * rw, int max_size)
{
/* Sanity check values carefully for this clib_memset operation */
- ASSERT ((max_size > 0) && (max_size < VLIB_BUFFER_PRE_DATA_SIZE));
+ ASSERT ((max_size > 0) && (max_size < VNET_REWRITE_TOTAL_BYTES));
rw->data_bytes = 0;
clib_memset (rw->data, 0xfe, max_size);
@@ -147,7 +147,7 @@ vnet_rewrite_set_data_internal (vnet_rewrite_header_t * rw,
int max_size, void *data, int data_bytes)
{
/* Sanity check values carefully for this clib_memset operation */
- ASSERT ((max_size > 0) && (max_size < VLIB_BUFFER_PRE_DATA_SIZE));
+ ASSERT ((max_size > 0) && (max_size < VNET_REWRITE_TOTAL_BYTES));
ASSERT ((data_bytes >= 0) && (data_bytes < max_size));
rw->data_bytes = data_bytes;
diff --git a/src/vnet/buffer.h b/src/vnet/buffer.h
index 2b3152fbcd6..09abedd5e74 100644
--- a/src/vnet/buffer.h
+++ b/src/vnet/buffer.h
@@ -417,7 +417,9 @@ typedef struct
};
} vnet_buffer_opaque_t;
-#define VNET_REWRITE_TOTAL_BYTES (VLIB_BUFFER_PRE_DATA_SIZE)
+#define VNET_REWRITE_TOTAL_BYTES 128
+STATIC_ASSERT (VNET_REWRITE_TOTAL_BYTES <= VLIB_BUFFER_PRE_DATA_SIZE,
+ "VNET_REWRITE_TOTAL_BYTES too big");
STATIC_ASSERT (STRUCT_SIZE_OF (vnet_buffer_opaque_t, ip.save_rewrite_length)
== STRUCT_SIZE_OF (vnet_buffer_opaque_t,