vmware-archive / p4c-xdp

Backend for the P4 compiler targeting XDP
Apache License 2.0
171 stars 26 forks source link

Adding PERCPU_ARRAY Question #130

Open aaglenn opened 3 years ago

aaglenn commented 3 years ago

Not letting my lack of C++ experience stop me, I'm trying to fix the TODO on line 197 in xdpProgram.cpp.

Despite some review of the code base, I am unsure how to appropriately reference a unsigned 32bit type to pass as key and value types in the emitTableDecl() call. A simple uint32_t or something else?

mihaibudiu commented 3 years ago

A few lines lower in the code there's a reference to u32. That is a 32-bit unsigned integer.

aaglenn commented 3 years ago

indeed that was about all I was able to understand on my own. I may have confused myself with p4c's cstring.h when touching ebpf/target.cpp to add the tableKind

I'm unsure what to use to pass as cstring keyType, cstring valueType as defined in ::emitTableDecl() in, admittedly, p4c and not here. following some definitions lead me to arrayIndexType. In the spirit of changing things and seeing what happens, I will go and do just that.