aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/policer/police.h
diff options
context:
space:
mode:
authorBrian Russell <brian@graphiant.com>2021-02-15 11:49:42 +0000
committerNeale Ranns <neale@graphiant.com>2021-02-15 16:18:32 +0000
commit54be0cc044f445853fae7b8995c477605250af16 (patch)
treec0be40e818039fa620efda5bb85e7535f63ef296 /src/vnet/policer/police.h
parent1a3e08a7197addb1c07e66c1b1da3286c9bcb140 (diff)
policer: improve policer struct
Ensure policer struct is cache aligned and fits in one cache line. Give it a simpler name to reflect its job as the representation of a policer. Type: improvement Signed-off-by: Brian Russell <brian@graphiant.com> Change-Id: If1ae4931c818b86eee20306e503f4e5d6b84bd0d
Diffstat (limited to 'src/vnet/policer/police.h')
-rw-r--r--src/vnet/policer/police.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/vnet/policer/police.h b/src/vnet/policer/police.h
index 7867a2e2f33..f780bf65c50 100644
--- a/src/vnet/policer/police.h
+++ b/src/vnet/policer/police.h
@@ -71,7 +71,7 @@ typedef enum
typedef struct
{
-
+ CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
u32 lock; // for exclusive access to the struct
u32 single_rate; // 1 = single rate policer, 0 = two rate policer
@@ -97,11 +97,12 @@ typedef struct
u32 thread_index; // Tie policer to a thread, rather than lock
u32 pad32;
-} policer_read_response_type_st;
+} policer_t;
+
+STATIC_ASSERT_SIZEOF (policer_t, CLIB_CACHE_LINE_BYTES);
static inline policer_result_e
-vnet_police_packet (policer_read_response_type_st * policer,
- u32 packet_length,
+vnet_police_packet (policer_t *policer, u32 packet_length,
policer_result_e packet_color, u64 time)
{
u64 n_periods;