[P4-dev] metadata counter value

Roshan Se roshan.sedar at student.uclouvain.be
Fri Aug 18 08:51:12 EDT 2017


Hi,

Can I use a counter variable as follows? Like to perform an operation 
and increments by 1 the counter value.

eg. metadata.counter = metadata.counter +1

 >> add(metadata.counter, metadata.counter, 1)

Can I perform the modulo operation as follows?

modify_field(metadata.indexValue, metadata.counter % int_variable);

And How could I pass a dynamic value to int_variable (= #ports in a 
switch) in this case.

any help would be great.

Thanks,

Best,
Roshan.




More information about the P4-dev mailing list