Skip to content

Commit

Permalink
Modify sample rates
Browse files Browse the repository at this point in the history
  • Loading branch information
KristopherChen committed Jul 23, 2017
1 parent 534b115 commit 9bec538
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ZodiacFX/src/config/config_zodiac.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

#define MAX_METER_13 8 // Maximum number of meter entries in meter table
#define MAX_METER_BANDS_13 3 // Maximum number of meter bands per meter
#define POLICING_SAMPLES 12 // Sample for rate limiter
#define POLICING_SLICE 10 // ms time slice for each sample
#define POLICING_SAMPLES 4 // Sample for rate limiter
#define POLICING_SLICE 30 // time (ms) slice for each sample

#endif /* CONFIG_ZODIAC_H_ */
6 changes: 3 additions & 3 deletions ZodiacFX/src/openflow/of_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,8 +1407,8 @@ int meter_handler(uint32_t id, uint16_t bytes)
{
TRACE("of_helper.c: no bands triggered - packet not dropped");

// Check if last packet was within 1 ms of this one
if(meter_samples[meter_index].sample[sample_index].packet_time == current_time)
// Check if last packet was within 1 slice of this one
if(meter_samples[meter_index].sample[sample_index].packet_time >= (current_time-POLICING_SLICE-1))
{
meter_samples[meter_index].sample[sample_index].byte_count += bytes;
meter_samples[meter_index].sample[sample_index].packet_count++;
Expand All @@ -1430,7 +1430,7 @@ int meter_handler(uint32_t id, uint16_t bytes)
// Populate (overwrite) next element
meter_samples[meter_index].sample[sample_index].packet_time = current_time;
meter_samples[meter_index].sample[sample_index].byte_count = bytes;
meter_samples[meter_index].sample[sample_index].packet_count++;
meter_samples[meter_index].sample[sample_index].packet_count = 0;
}

return METER_NOACT;
Expand Down

0 comments on commit 9bec538

Please sign in to comment.