p4lang / pna

Portable NIC Architecture
Apache License 2.0
55 stars 22 forks source link

The types of the generics in crypto_accelerator extern maybe should be a static type instead of a generics #86

Open apinski-cavium opened 2 years ago

apinski-cavium commented 2 years ago

An example is at: https://github.com/p4lang/pna/blob/8fa3993a0e32959b6e394a8923e53292191d4825/examples/include/crypto-accelerator.p4#L100 void set_auth_data_offset<T>(in T offset);

The type checking for this will be done in the backend rather than the front-end. It would be useful for these type T would be a static type (say bit<32>) which will reduce how much type checking needs to be done in the backend. If we really want to use generics here, it would be useful to explain what types are valid in the header file. E.g say all bit<N>, int<N> types, and serializable enums. (yes it might be obvious but sometimes being explicit is makes it less ambiguous as say you have a struct which is just wrapping an bit type).