[P4-dev] Custom Hash Functions
antonin at barefootnetworks.com
Fri Jun 17 23:37:06 EDT 2016
The link you included in your email refers to the original version of the
P4 software switch (p4c-behavioral). We are deprecating this code and most
of the community is now using the new version, known as bmv2:
It is very easy to add a new hash function in bmv2. Once you get familiar
with bmv2 (the README is a good place to start), you can edit this file to
include your hash functions:
This file defines 2 example hash functions (called hash_ex and bmv2_hash),
from which you can take inspiration. Note that the "standard" hash
functions (e.g. crc16) are still available, but they are defined in a
different place, which you need not worry about.
I once wrote a long email to the mailing list about writing your own hash
functions. Unfortunately it cannot be found in the p4-dev archives any more
(we had a technical issue a few months ago and the archives were lost). I
will find it in my inbox and forward it to the list so that you can read it.
On Fri, Jun 17, 2016 at 1:18 PM, Vibhaalakshmi Sivaraman <
vibhaa at princeton.edu> wrote:
> How can we add our own custom hash functions to the existing set of field
> list calculations? Flow Radar
> <https://github.com/USC-NSL/p4c-behavioral/blob/9a4c17c42a0de05f14aa9a0b9d0abf19b5d6129b/p4c_bm/templates/src/checksums_algos.h> seems
> to have done this, but I am not sure what the procedure for compiling it,
> which is the right place to make the addition or if there are any
> restrictions on the format. Any help on this would be great!
> Vibhaalakshmi Sivaraman
> Computer Science
> Princeton University '17
> P4-dev mailing list
> P4-dev at lists.p4.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the P4-dev