summaryrefslogtreecommitdiffstats
path: root/src/vnet/policer/policer.c
AgeCommit message (Collapse)AuthorFilesLines
2021-02-02policer: add countersBrian Russell1-8/+48
Add counters to the policer against each of the 3 possible results: conform, exceed and violate. Type: improvement Signed-off-by: Brian Russell <brian@graphiant.com> Change-Id: Ia98a2f5655df6873259197d6bbf0ff2709b7d60e
2021-01-28policer: add policer handoffBrian Russell1-0/+14
Add thread handoff for packets being policed. Note that the handoff currently requires the policer index to be passed in. This is suitable for use in the ip[46] punt paths where each policer node will only ever use a single policer. For the more general case, this will be expanded in future to use a policer index stored in packet metadata. Type: improvement Signed-off-by: Brian Russell <brian@graphiant.com> Change-Id: I85a0ecbcfb025f8844e763224cd3de1561249aca
2021-01-28policer: add thread index to policerBrian Russell1-0/+1
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
2018-10-23c11 safe string handling supportDave Barach1-1/+1
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
2017-10-24Add extern to *_main global variable declarations in header files.Dave Wallace1-0/+2
- Global variables declared in header files without the use of the 'extern' keword will result in multiple instances of the variable to be created by the compiler -- one for each different source file in which the the header file is included. This results in wasted memory allocated in the BSS segments as well as potentially introducing bugs in the application. Change-Id: I6ef1790b60a0bd9dd3994f8510723decf258b0cc Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2017-08-10Fix memory leaks found in policer code.Chaoyu Jin1-0/+34
2nd commit is to fix style failures. 3rd commit is to remove unneccesary change based on review comment. Change-Id: I4d54d25c27e037b9d0438f8af416cf113763dc6d Signed-off-by: Chaoyu Jin <chjin@cisco.com>
2017-02-22VPP-635: CLI Memory leak with invalid parameterBilly McFall1-3/+10
In the CLI parsing, below is a common pattern: /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) return 0; while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { if (unformat (line_input, "x")) x = 1; : else return clib_error_return (0, "unknown input `%U'", format_unformat_error, line_input); } unformat_free (line_input); The 'else' returns if an unknown string is encountered. There a memory leak because the 'unformat_free(line_input)' is not called. There is a large number of instances of this pattern. Replaced the previous pattern with: /* Get a line of input. */ if (!unformat_user (input, unformat_line_input, line_input)) return 0; while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { if (unformat (line_input, "x")) x = 1; : else { error = clib_error_return (0, "unknown input `%U'", format_unformat_error, line_input); goto done: } } /* ...Remaining code... */ done: unformat_free (line_input); return error; } In multiple files, 'unformat_free (line_input);' was never called, so there was a memory leak whether an invalid string was entered or not. Also, there were multiple instance where: error = clib_error_return (0, "unknown input `%U'", format_unformat_error, line_input); used 'input' as the last parameter instead of 'line_input'. The result is that output did not contain the substring in error, instead just an empty string. Fixed all of those as well. There are a lot of file, and very mind numbing work, so tried to keep it to a pattern to avoid mistakes. Change-Id: I8902f0c32a47dd7fb3bb3471a89818571702f1d2 Signed-off-by: Billy McFall <bmcfall@redhat.com> Signed-off-by: Dave Barach <dave@barachs.net>
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion1-0/+528
Change-Id: I7b51f88292e057c6443b12224486f2d0c9f8ae23 Signed-off-by: Damjan Marion <damarion@cisco.com>