[P4-dev] Difference between `clone` and `clone3` in v1model

Dingyuan Hu h-dy at outlook.com
Tue Oct 24 20:18:33 EDT 2017


Hi all,

I notices in v1model.p4, there are two clone methods without comment.

	extern void clone(in CloneType type, in bit<32> session);
	extern void clone3<T>(in CloneType type, in bit<32> session, in T data);

- What does `session` means?

- What is difference between clone and clone3<T>?
I think clone3<T> can clone packet with extra data, it's right? And how can I get them?

Another question: https://github.com/p4lang/p4c/blob/3ad8d93f334a34d181e8d9d83100d797bac3f65a/p4include/v1model.p4#L130-L134 
- In emun CloneType, there are only two kind of types (I2E,E2E). Why not four (plus E2I,I2I).
Can I just clone packet to ingress?

I can't find answer in P4_14 SPEC. 

Thanks,
Dingyuan Hu




More information about the P4-dev mailing list