# PSA varbit not supported?

**URL:** <https://forum.p4.org/t/psa-varbit-not-supported/760>\
**Category:** Architecture Working Group\
**Created:** [April 26, 2023, 9:31am UTC](https://forum.p4.org/t/psa-varbit-not-supported/760 "2023-04-26T09:31:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Faris](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/faris/32/134_2.png) [@Faris](https://forum.p4.org/u/Faris)\
**Post date:** [April 26, 2023, 9:31am UTC](https://forum.p4.org/t/psa-varbit-not-supported/760/1 "2023-04-26T09:31:58Z")

</div>

as per the title, I am not able to compile my program for the PSA that includes a header with a varbit field.  
I am getting the following error.  
./include/headers.p4(151): [–Werror=target-error] error: Type varbit\<1648\> not supported  
varbit\<1648\> metadata\_stack;  
^^^^^^^^^^^^  
In file: /home/sa/p4/p4c/lib/crash.cpp:266  
Compiler Bug: Exiting with SIGSEGV

Does the PSA not support varbit fields ?

---

<div class="post-metadata">

**Author:** ![andyfingerhut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/andyfingerhut/32/17_2.png) [@andyfingerhut](https://forum.p4.org/u/andyfingerhut)\
**Post date:** [April 26, 2023, 10:43pm UTC](https://forum.p4.org/t/psa-varbit-not-supported/760/2 "2023-04-26T22:43:15Z")

</div>

What command line did you use when attempting to compile the program? I ask because it might depend upon the target device (e.g. BMv2, DPDK, EBPF, etc.) you are compiling for whether there is support for it that works, or not.

Nothing in the PSA specification says that targets should NOT support varbit, but nothing specifically says that they must, either.

---

<div class="post-metadata">

**Author:** ![Faris](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/faris/32/134_2.png) [@Faris](https://forum.p4.org/u/Faris)\
**Post date:** [April 27, 2023, 7:01am UTC](https://forum.p4.org/t/psa-varbit-not-supported/760/3 "2023-04-27T07:01:40Z")

</div>

Thank Andy you for your answer. here are some more details:  
My target is the NIKSS vSwitch that uses the eBPF processing engine.  
the command as per the the documentation of the NIKSS:  
make -f ~/p4c/backends/ebpf/runtime/kernel.mk BPFOBJ=simple\_switch.o P4FILE=simple\_switch.p4 ARGS=“-DPSA\_PORT\_RECIRCULATE=2” P4ARGS=“–Wdisable=unused” psa

---

<div class="post-metadata">

**Author:** ![osinstom](https://avatars.discourse-cdn.com/v4/letter/o/ee7513/32.png) [@osinstom](https://forum.p4.org/u/osinstom)\
**Post date:** [April 27, 2023, 10:56am UTC](https://forum.p4.org/t/psa-varbit-not-supported/760/4 "2023-04-27T10:56:45Z")

</div>

Hi @Faris, thanks for trying out the NIKSS vSwitch! The `varbit` type is not supported by the eBPF backend yet. We’re getting more questions about it, so we might prioritize working on that, but I cannot share any ETA.

Also, you’re defining a quite large field (206 bytes). Remember that the BPF stack size is limited (512 bytes limit), so it’s likely that the generated eBPF code will fail to load.

---

<div class="post-metadata">

**Author:** ![Faris](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/faris/32/134_2.png) [@Faris](https://forum.p4.org/u/Faris)\
**Post date:** [April 28, 2023, 9:38am UTC](https://forum.p4.org/t/psa-varbit-not-supported/760/5 "2023-04-28T09:38:39Z")

</div>

Thank you @osinstom , another curiosity about the NIKSS switch. It seems that the user defined metadata is not carried from ingress to egress (a value that has been set in the ingress goes back to zero in the egress). Is this true about the NIKSS switch ? or maybe I am doing something wrong ?

---

<div class="post-metadata">

**Author:** ![andyfingerhut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.p4.org/andyfingerhut/32/17_2.png) [@andyfingerhut](https://forum.p4.org/u/andyfingerhut)\
**Post date:** [April 30, 2023, 1:54am UTC](https://forum.p4.org/t/psa-varbit-not-supported/760/6 "2023-04-30T01:54:06Z")

</div>

In the PSA definition, nothing is required to be carried from ingress to egress by default.

If you want something to be carried with the packet from ingress to egress, you must define a struct type containing all of the fields you want to preserve, make it the type of the `normal_meta` out parameter of the ingress deparser, and the type o0f the `normal_meta` in parameter of the egress parser, as shown in this example program (search for occurrences of `normal_meta`): [p4-spec/psa-example-bridged-metadata.p4 at main · p4lang/p4-spec · GitHub](https://github.com/p4lang/p4-spec/blob/main/p4-16/psa/examples/psa-example-bridged-metadata.p4)

---

<div class="post-metadata">

**Author:** ![osinstom](https://avatars.discourse-cdn.com/v4/letter/o/ee7513/32.png) [@osinstom](https://forum.p4.org/u/osinstom)\
**Post date:** [May 3, 2023, 7:02pm UTC](https://forum.p4.org/t/psa-varbit-not-supported/760/7 "2023-05-03T19:02:13Z")

</div>

Although the way that Andy mentioned is valid according to the PSA spec, it’s not supported by the eBPF backend yet. We’ll add this feature to the TODO list. In the meantime, I’d suggest prepending a packet with an additional custom packet header carrying bridged metadata, as shown in [p4c/bridged-metadata.p4 at main · p4lang/p4c · GitHub](https://github.com/p4lang/p4c/blob/main/backends/ebpf/tests/p4testdata/bridged-metadata.p4).
