summaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo
diff options
context:
space:
mode:
authorDave Barach <dbarach@cisco.com>2018-05-03 08:26:39 -0400
committerFlorin Coras <florin.coras@gmail.com>2018-05-04 15:15:22 +0000
commiteb987d3a09f669787014b1553f032219522149e1 (patch)
tree8d092c7368cfc2e02fc1869c6ded7410ad734392 /src/vnet/dpo
parent432bf677c6decadd05e3edfe54c02b1d01b2c64e (diff)
Harmonize vec/pool_get_aligned object sizes and alignment requests
Object sizes must evenly divide alignment requests, or vice versa. Otherwise, only the first object will be aligned as requested. Three choices: add CLIB_CACHE_LINE_ALIGN_MARK(align_me) at the end of structures, manually pad to an even divisor or multiple of the alignment request, or use plain vectors/pools. static assert for enforcement. Change-Id: I41aa6ff1a58267301d32aaf4b9cd24678ac1c147 Signed-off-by: Dave Barach <dbarach@cisco.com>
Diffstat (limited to 'src/vnet/dpo')
-rw-r--r--src/vnet/dpo/classify_dpo.h5
-rw-r--r--src/vnet/dpo/l3_proxy_dpo.h6
-rw-r--r--src/vnet/dpo/load_balance.h6
-rw-r--r--src/vnet/dpo/load_balance_map.h6
-rw-r--r--src/vnet/dpo/lookup_dpo.h6
-rw-r--r--src/vnet/dpo/mpls_disposition.h6
-rw-r--r--src/vnet/dpo/mpls_label_dpo.h6
-rw-r--r--src/vnet/dpo/receive_dpo.h6
-rw-r--r--src/vnet/dpo/replicate_dpo.h6
9 files changed, 53 insertions, 0 deletions
diff --git a/src/vnet/dpo/classify_dpo.h b/src/vnet/dpo/classify_dpo.h
index 48f4b2bf8a5..439727d351f 100644
--- a/src/vnet/dpo/classify_dpo.h
+++ b/src/vnet/dpo/classify_dpo.h
@@ -25,6 +25,11 @@
*/
typedef struct classify_dpo_t
{
+ /**
+ * required for pool_get_aligned.
+ */
+ CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
+
dpo_proto_t cd_proto;
u32 cd_table_index;
diff --git a/src/vnet/dpo/l3_proxy_dpo.h b/src/vnet/dpo/l3_proxy_dpo.h
index f17ace50876..fcc28b3bf97 100644
--- a/src/vnet/dpo/l3_proxy_dpo.h
+++ b/src/vnet/dpo/l3_proxy_dpo.h
@@ -27,6 +27,12 @@
typedef struct l3_proxy_dpo_t_
{
/**
+ * required for pool_get_aligned.
+ * memebers used in the switch path come first!
+ */
+ CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
+
+ /**
* The Software interface index on which traffic is l3_proxyd
*/
u32 l3p_sw_if_index;
diff --git a/src/vnet/dpo/load_balance.h b/src/vnet/dpo/load_balance.h
index d37f07d579f..dd9589f9ee8 100644
--- a/src/vnet/dpo/load_balance.h
+++ b/src/vnet/dpo/load_balance.h
@@ -83,6 +83,12 @@ typedef struct load_balance_path_t_ {
*/
typedef struct load_balance_t_ {
/**
+ * required for pool_get_aligned.
+ * memebers used in the switch path come first!
+ */
+ CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
+
+ /**
* number of buckets in the load-balance. always a power of 2.
*/
u16 lb_n_buckets;
diff --git a/src/vnet/dpo/load_balance_map.h b/src/vnet/dpo/load_balance_map.h
index f9344c01c1e..82dd36b41b1 100644
--- a/src/vnet/dpo/load_balance_map.h
+++ b/src/vnet/dpo/load_balance_map.h
@@ -29,6 +29,12 @@ struct load_balance_map_path_t_;
*/
typedef struct load_balance_map_t_ {
/**
+ * required for pool_get_aligned.
+ * memebers used in the switch path come first!
+ */
+ CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
+
+ /**
* The buckets of the map that provide the index to index translation.
* In the first cacheline.
*/
diff --git a/src/vnet/dpo/lookup_dpo.h b/src/vnet/dpo/lookup_dpo.h
index 4ebd6050fc6..21aecadc280 100644
--- a/src/vnet/dpo/lookup_dpo.h
+++ b/src/vnet/dpo/lookup_dpo.h
@@ -65,6 +65,12 @@ typedef enum lookup_cast_t_ {
typedef struct lookup_dpo_t
{
/**
+ * required for pool_get_aligned.
+ * memebers used in the switch path come first!
+ */
+ CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
+
+ /**
* The FIB, or interface from which to get a FIB, in which to perform
* the next lookup;
*/
diff --git a/src/vnet/dpo/mpls_disposition.h b/src/vnet/dpo/mpls_disposition.h
index 9c3cc46ff30..86dd60ae290 100644
--- a/src/vnet/dpo/mpls_disposition.h
+++ b/src/vnet/dpo/mpls_disposition.h
@@ -27,6 +27,12 @@
typedef struct mpls_disp_dpo_t
{
/**
+ * required for pool_get_aligned.
+ * memebers used in the switch path come first!
+ */
+ CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
+
+ /**
* Next DPO in the graph
*/
dpo_id_t mdd_dpo;
diff --git a/src/vnet/dpo/mpls_label_dpo.h b/src/vnet/dpo/mpls_label_dpo.h
index 98c88f7d812..4e032d33458 100644
--- a/src/vnet/dpo/mpls_label_dpo.h
+++ b/src/vnet/dpo/mpls_label_dpo.h
@@ -67,6 +67,12 @@ extern u8* format_mpls_label_dpo_flags(u8 *s, va_list *args);
typedef struct mpls_label_dpo_t
{
/**
+ * required for pool_get_aligned.
+ * memebers used in the switch path come first!
+ */
+ CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
+
+ /**
* The MPLS label header to impose. Outer most label first.
* Each DPO will occupy one cache line, stuff that many labels in.
*/
diff --git a/src/vnet/dpo/receive_dpo.h b/src/vnet/dpo/receive_dpo.h
index 2420fd7843c..9ab86a824c6 100644
--- a/src/vnet/dpo/receive_dpo.h
+++ b/src/vnet/dpo/receive_dpo.h
@@ -26,6 +26,12 @@
typedef struct receive_dpo_t_
{
/**
+ * required for pool_get_aligned.
+ * memebers used in the switch path come first!
+ */
+ CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
+
+ /**
* The Software interface index on which traffic is received
*/
u32 rd_sw_if_index;
diff --git a/src/vnet/dpo/replicate_dpo.h b/src/vnet/dpo/replicate_dpo.h
index ccb25630e16..7b075394bc3 100644
--- a/src/vnet/dpo/replicate_dpo.h
+++ b/src/vnet/dpo/replicate_dpo.h
@@ -53,6 +53,12 @@ extern replicate_main_t replicate_main;
*/
typedef struct replicate_t_ {
/**
+ * required for pool_get_aligned.
+ * memebers used in the switch path come first!
+ */
+ CLIB_CACHE_LINE_ALIGN_MARK(cacheline0);
+
+ /**
* number of buckets in the replicate.
*/
u16 rep_n_buckets;