p4-dev@lists.p4.org

list for questions/discussion of p4 programs and tools

View all threads

Re: XOR operation in P4_16

FM
Francisco Machado
Sat, May 1, 2021 6:24 PM

Hi,
I was trying to implement some Network Functions using bmv2 and with
minimal controller interaction.
I don't remember exactly why, but at some point I tried to use the XOR Hash
Algorithm and it did not work.

I managed to implement it just by using ^ (XOR operation), as you
recommended.

Thanks for the help,
Francisco Machado

Gurevich, Vladimir vladimir.gurevich@intel.com escreveu no dia sexta,
23/04/2021 à(s) 01:43:

Nik, Francisco!

I am trying to understand, why do you need this operation, since it can be
easily expressed using ^ (XOR operation) and bit slicing operator.

I get the need in the context of P4_14, but why would you need it in P4_16
and (especially) on BMv2?

Happy hacking,

Vladimir Gurevich

Principal Engineer,  Barefoot Division (BXD)
http://intel.com/programmable-networking
Director, Intel® Connectivity Education Hub
http://intel.com/connectivity-education

Email:      Vladimir.Gurevich@intel.com

Cell:        +1 (408) 833-4505

[image: A close up of a sign Description automatically generated]
http://intel.com/

*From: *Francisco Machado franciscocmachado@gmail.com
*Date: *Thursday, April 22, 2021 at 10:04 AM
*To: *Nik Sultana nsultana@seas.upenn.edu
*Cc: *"p4-dev@lists.p4.org" p4-dev@lists.p4.org
*Subject: *[P4-dev] Re: XOR operation in P4_16

I am going to open an issue and will report here if any solution comes up.

Thanks for the help.

Nik Sultana nsultana@seas.upenn.edu escreveu no dia quarta, 21/04/2021
à(s) 21:17:

On Wed, 21 Apr 2021, Francisco Machado wrote:

Yes. All other HashAlgorithms are working.

Thanks for checking. I haven't encountered this behaviour -- if you
don't receive a reply from somebody else on the list I'd suggest you
create an Issue at https://github.com/p4lang/behavioral-model (after
checking that an existing issue doesn't already cover this) and one of
the developers is likely to pick it up.

Nik Sultana nsultana@seas.upenn.edu escreveu no dia quarta, 21/04/2021
à(s) 15:44:

(Looping in p4-dev -- best to 'cc all' in case somebody's seen the same
problem)

On Wed, 21 Apr 2021, Francisco Machado wrote:

Yes, BMv2. I am using the repository p4-learning
https://github.com/nsg-ethz/p4-learning and running different code
instead of the examples/tutorials.

Mininet just returns " P4 switch s1 did not start correctly. Check

the

switch log file.", while the log only says " Unknown hash algorithm:

xor16."

That does seem to come from BMv2.
In case you're running up against an incomplete implementation of these
features, have you tried using other values in HashAlgorithm, such as
crc32 or identity, to see if they go through?

Hi, I was trying to implement some Network Functions using bmv2 and with minimal controller interaction. I don't remember exactly why, but at some point I tried to use the XOR Hash Algorithm and it did not work. I managed to implement it just by using ^ (XOR operation), as you recommended. Thanks for the help, Francisco Machado Gurevich, Vladimir <vladimir.gurevich@intel.com> escreveu no dia sexta, 23/04/2021 à(s) 01:43: > Nik, Francisco! > > > > I am trying to understand, why do you need this operation, since it can be > easily expressed using ^ (XOR operation) and bit slicing operator. > > > > I get the need in the context of P4_14, but why would you need it in P4_16 > and (especially) on BMv2? > > > > Happy hacking, > > *Vladimir Gurevich* > > Principal Engineer, Barefoot Division (BXD) > <http://intel.com/programmable-networking> > Director, Intel® Connectivity Education Hub > <http://intel.com/connectivity-education> > > > > Email: Vladimir.Gurevich@intel.com > > Cell: +1 (408) 833-4505 > > *[image: A close up of a sign Description automatically generated]* > <http://intel.com/> > > > > > > *From: *Francisco Machado <franciscocmachado@gmail.com> > *Date: *Thursday, April 22, 2021 at 10:04 AM > *To: *Nik Sultana <nsultana@seas.upenn.edu> > *Cc: *"p4-dev@lists.p4.org" <p4-dev@lists.p4.org> > *Subject: *[P4-dev] Re: XOR operation in P4_16 > > > > I am going to open an issue and will report here if any solution comes up. > > Thanks for the help. > > > > Nik Sultana <nsultana@seas.upenn.edu> escreveu no dia quarta, 21/04/2021 > à(s) 21:17: > > On Wed, 21 Apr 2021, Francisco Machado wrote: > > > Yes. All other HashAlgorithms are working. > > Thanks for checking. I haven't encountered this behaviour -- if you > don't receive a reply from somebody else on the list I'd suggest you > create an Issue at https://github.com/p4lang/behavioral-model (after > checking that an existing issue doesn't already cover this) and one of > the developers is likely to pick it up. > > > > > Nik Sultana <nsultana@seas.upenn.edu> escreveu no dia quarta, 21/04/2021 > > à(s) 15:44: > > > > > (Looping in p4-dev -- best to 'cc all' in case somebody's seen the same > > > problem) > > > > > > On Wed, 21 Apr 2021, Francisco Machado wrote: > > > > Yes, BMv2. I am using the repository p4-learning > > > > <https://github.com/nsg-ethz/p4-learning> and running different code > > > > instead of the examples/tutorials. > > > > > > > > Mininet just returns " P4 switch s1 did not start correctly. Check > the > > > > switch log file.", while the log only says " Unknown hash algorithm: > > > xor16." > > > > > > That does seem to come from BMv2. > > > In case you're running up against an incomplete implementation of these > > > features, have you tried using other values in HashAlgorithm, such as > > > crc32 or identity, to see if they go through? > >
FM
Francisco Machado
Sat, May 1, 2021 6:26 PM

I also opened an Issue, as Nik recommended.
Here is the link https://github.com/p4lang/behavioral-model/issues/995

Francisco Machado franciscocmachado@gmail.com escreveu no dia sábado,
1/05/2021 à(s) 19:24:

Hi,
I was trying to implement some Network Functions using bmv2 and with
minimal controller interaction.
I don't remember exactly why, but at some point I tried to use the XOR
Hash Algorithm and it did not work.

I managed to implement it just by using ^ (XOR operation), as you
recommended.

Thanks for the help,
Francisco Machado

Gurevich, Vladimir vladimir.gurevich@intel.com escreveu no dia sexta,
23/04/2021 à(s) 01:43:

Nik, Francisco!

I am trying to understand, why do you need this operation, since it can
be easily expressed using ^ (XOR operation) and bit slicing operator.

I get the need in the context of P4_14, but why would you need it in
P4_16 and (especially) on BMv2?

Happy hacking,

Vladimir Gurevich

Principal Engineer,  Barefoot Division (BXD)
http://intel.com/programmable-networking
Director, Intel® Connectivity Education Hub
http://intel.com/connectivity-education

Email:      Vladimir.Gurevich@intel.com

Cell:        +1 (408) 833-4505

[image: A close up of a sign Description automatically generated]
http://intel.com/

*From: *Francisco Machado franciscocmachado@gmail.com
*Date: *Thursday, April 22, 2021 at 10:04 AM
*To: *Nik Sultana nsultana@seas.upenn.edu
*Cc: *"p4-dev@lists.p4.org" p4-dev@lists.p4.org
*Subject: *[P4-dev] Re: XOR operation in P4_16

I am going to open an issue and will report here if any solution comes up.

Thanks for the help.

Nik Sultana nsultana@seas.upenn.edu escreveu no dia quarta, 21/04/2021
à(s) 21:17:

On Wed, 21 Apr 2021, Francisco Machado wrote:

Yes. All other HashAlgorithms are working.

Thanks for checking. I haven't encountered this behaviour -- if you
don't receive a reply from somebody else on the list I'd suggest you
create an Issue at https://github.com/p4lang/behavioral-model (after
checking that an existing issue doesn't already cover this) and one of
the developers is likely to pick it up.

Nik Sultana nsultana@seas.upenn.edu escreveu no dia quarta,

21/04/2021

à(s) 15:44:

(Looping in p4-dev -- best to 'cc all' in case somebody's seen the

same

problem)

On Wed, 21 Apr 2021, Francisco Machado wrote:

Yes, BMv2. I am using the repository p4-learning
https://github.com/nsg-ethz/p4-learning and running different

code

instead of the examples/tutorials.

Mininet just returns " P4 switch s1 did not start correctly. Check

the

switch log file.", while the log only says " Unknown hash algorithm:

xor16."

That does seem to come from BMv2.
In case you're running up against an incomplete implementation of

these

features, have you tried using other values in HashAlgorithm, such as
crc32 or identity, to see if they go through?

I also opened an Issue, as Nik recommended. Here is the link <https://github.com/p4lang/behavioral-model/issues/995> Francisco Machado <franciscocmachado@gmail.com> escreveu no dia sábado, 1/05/2021 à(s) 19:24: > Hi, > I was trying to implement some Network Functions using bmv2 and with > minimal controller interaction. > I don't remember exactly why, but at some point I tried to use the XOR > Hash Algorithm and it did not work. > > I managed to implement it just by using ^ (XOR operation), as you > recommended. > > Thanks for the help, > Francisco Machado > > Gurevich, Vladimir <vladimir.gurevich@intel.com> escreveu no dia sexta, > 23/04/2021 à(s) 01:43: > >> Nik, Francisco! >> >> >> >> I am trying to understand, why do you need this operation, since it can >> be easily expressed using ^ (XOR operation) and bit slicing operator. >> >> >> >> I get the need in the context of P4_14, but why would you need it in >> P4_16 and (especially) on BMv2? >> >> >> >> Happy hacking, >> >> *Vladimir Gurevich* >> >> Principal Engineer, Barefoot Division (BXD) >> <http://intel.com/programmable-networking> >> Director, Intel® Connectivity Education Hub >> <http://intel.com/connectivity-education> >> >> >> >> Email: Vladimir.Gurevich@intel.com >> >> Cell: +1 (408) 833-4505 >> >> *[image: A close up of a sign Description automatically generated]* >> <http://intel.com/> >> >> >> >> >> >> *From: *Francisco Machado <franciscocmachado@gmail.com> >> *Date: *Thursday, April 22, 2021 at 10:04 AM >> *To: *Nik Sultana <nsultana@seas.upenn.edu> >> *Cc: *"p4-dev@lists.p4.org" <p4-dev@lists.p4.org> >> *Subject: *[P4-dev] Re: XOR operation in P4_16 >> >> >> >> I am going to open an issue and will report here if any solution comes up. >> >> Thanks for the help. >> >> >> >> Nik Sultana <nsultana@seas.upenn.edu> escreveu no dia quarta, 21/04/2021 >> à(s) 21:17: >> >> On Wed, 21 Apr 2021, Francisco Machado wrote: >> >> > Yes. All other HashAlgorithms are working. >> >> Thanks for checking. I haven't encountered this behaviour -- if you >> don't receive a reply from somebody else on the list I'd suggest you >> create an Issue at https://github.com/p4lang/behavioral-model (after >> checking that an existing issue doesn't already cover this) and one of >> the developers is likely to pick it up. >> >> > >> > Nik Sultana <nsultana@seas.upenn.edu> escreveu no dia quarta, >> 21/04/2021 >> > à(s) 15:44: >> > >> > > (Looping in p4-dev -- best to 'cc all' in case somebody's seen the >> same >> > > problem) >> > > >> > > On Wed, 21 Apr 2021, Francisco Machado wrote: >> > > > Yes, BMv2. I am using the repository p4-learning >> > > > <https://github.com/nsg-ethz/p4-learning> and running different >> code >> > > > instead of the examples/tutorials. >> > > > >> > > > Mininet just returns " P4 switch s1 did not start correctly. Check >> the >> > > > switch log file.", while the log only says " Unknown hash algorithm: >> > > xor16." >> > > >> > > That does seem to come from BMv2. >> > > In case you're running up against an incomplete implementation of >> these >> > > features, have you tried using other values in HashAlgorithm, such as >> > > crc32 or identity, to see if they go through? >> >>