bmv2
Designing your own switch target with bmv2
|
Go to the source code of this file.
Macros | |
#define | REGISTER_HASH(hash_name) |
Each hash algorithm supported by the target needs to be declared as a functor. This is how you declare one:
Note that the signature of the functor must exactly match the one of the example: uint32_t(const char *buf, size_t s) const
. Otherwise, you will get a compilation error.
You can then register your hash function like this:
In P4 v1.0.2, hash algorithms are used by field_list_calculation
objects
#define REGISTER_HASH | ( | hash_name | ) |
When implementing an hash operation for a target, this macro needs to be called to make this module aware of the hash existence. When calling this macro from an anonymous namespace, some compiler may give you a warning.