28/07/2022 17:11, Cristian Dumitrescu: > The sequence of steps to build a SWX pipeline object are: > > 1. Create the specification file (pipeline.p4 -> pipeline.spec): This text > file represents the > pipeline program that is typically generated by the P4 compiler or > sometimes manually created. > > 2. Generate the C source code file (pipeline.spec -> pipeline.c): The C file > contains a C function > for every pipeline action and several C functions for the pipeline main > program. It allows the C > compiler to generate optimized code by having access to the entire > pipeline program rather than > using the small pre-build functions corresponding to the individual > instructions > > 3. Build the shared object library (pipeline.c -> pipeline.o -> pipeline.so). > > 4. Load the shared object library (pipeline.so): At initialization, the > pipeline object is “patched” > with the optimized C functions from the shared object library. > > Previously, steps 2., 3. and 4. were implemented under the hood by the > pipeline library at the > initialization time in a completely hard-coded and non-customizable way. The > user was not able to > select the C compiler (GCC was assumed), the compiler version, the build > flags, the file locations, > etc. The code generation (step 2.) and library build (step 3.) were done > on-the-fly at init and > could potentially fail for many setup related reasons. > > Now, this process is no longer done under the hood by the pipeline library > and the individual steps > are explicitly supported by the API functions. The code generation (step 2.) > is done off-line at any > time before the pipeline execution. The library build (step 3.) is also done > off-line and is now > fully customizable by the user, who is able to gracefully access the > generated C code and decide on > the various build options. > > We also take the opportunity to streamline the pipeline I/O port > configuration by introducing an I/O > specification file. Essentially, the pipeline is now configured and build > based on two files: > > a) The shared object library file (pipeline.so): It defines how the packets > are processed by the > program through tables and actions; the same P4 program can be executed by > many pipelines. > > b) The I/O specification file (pipeline.io): High level text file defining > how the packets are > received and transmitted by the pipeline; this is not part of the P4 > program, which is completely > agnostic about the pipeline I/O ports. This is defined differently for > each pipeline object when > initialized.
Series applied, thanks.