Restrictions on User Extern Usage - 2022.2 English

Vitis Networking P4 User Guide (UG1308)

Document ID
2022.2 English

The UserExtern declaration provides the flexibility needed to interface between P4 and custom functionality. Users are free to have an arbitrary number of instances of UserExtern and because of type specialization, each instance can accept different types of data. Furthermore, the type specialization allows the use of structured data with UserExtern, either as an input, an output or both. For example, it is permitted to pass a data structure such as a packet header into an instance of UserExtern, which can be very useful for implementing custom functionality such as an application-specific hashing.

However, the following tool-enforced restrictions apply to UserExtern:
  • UserExtern can only be instantiated in the match-action stage of the XilinxPipeline().
  • The apply() method of a given instance of UserExtern can be invoked once and only once in the P4 program.
  • Because structured data might be passed between P4 and the custom functionality, nested structures are not supported.