Add a thread index field to the policer structure. The policer is not
thread safe. The thread index will be used to tie it to one worker
thread and other workers can use thread handoff.
Type: improvement
Signed-off-by: Brian Russell <brian@graphiant.com>
Change-Id: I650e983a9ed800bf660d6f06368717484c4a83bf
// computes the shift amount be the largest possible that still supports the
// burst size. This makes the rate accuracy as high as possible.
//
// computes the shift amount be the largest possible that still supports the
// burst size. This makes the rate accuracy as high as possible.
//
-// The 64-bit last_update_time supports a 4Ghz CPU without rollover for 100 years
+// The 64-bit last_update_time supports a 4Ghz CPU without rollover for 100
+// years
-// The lock field should be used for a spin-lock on the struct.
+// The lock field should be used for a spin-lock on the struct. Alternatively,
+// a thread index field is provided so that policed packets may be handed
+// off to a single worker thread.
#define POLICER_TICKS_PER_PERIOD_SHIFT 17
#define POLICER_TICKS_PER_PERIOD (1 << POLICER_TICKS_PER_PERIOD_SHIFT)
#define POLICER_TICKS_PER_PERIOD_SHIFT 17
#define POLICER_TICKS_PER_PERIOD (1 << POLICER_TICKS_PER_PERIOD_SHIFT)
u32 extended_bucket; // MOD
u64 last_update_time; // MOD
u32 extended_bucket; // MOD
u64 last_update_time; // MOD
+ u32 thread_index; // Tie policer to a thread, rather than lock
+ u32 pad32;
} policer_read_response_type_st;
} policer_read_response_type_st;
pi = policer - pm->policers;
hash_set_mem (pm->policer_index_by_name, name, pi);
*policer_index = pi;
pi = policer - pm->policers;
hash_set_mem (pm->policer_index_by_name, name, pi);
*policer_index = pi;
+ policer->thread_index = ~0;