# Getting Started with P4

**URL:** https://forum.p4.org/c/getting-started-with-p4/13.md?page=5

[Latest](https://forum.p4.org/latest.md) · [Categories](https://forum.p4.org/categories.md)

**Page:** 6

---

## [Detecting queue lengths in Ingress Control](https://forum.p4.org/t/detecting-queue-lengths-in-ingress-control/634)

<div class="topic-metadata">

**Author:** [@libmyx](https://forum.p4.org/u/libmyx)\
**Replies:** 3\
**Last updated:** [February 7, 2023, 2:52pm UTC](https://forum.p4.org/t/detecting-queue-lengths-in-ingress-control/634 "2023-02-07T14:52:17Z")

</div>

Is there a way to detect all queue lengths in Ingress Control part in Tofino? It seems that the queue information is only presented in egress\_intrinsic\_metadata\_t. And I would like to choose a special qid in Ingress Cont…

---

## [Execute Scripts on Running p4App](https://forum.p4.org/t/execute-scripts-on-running-p4app/613)

<div class="topic-metadata">

**Author:** [@christnp](https://forum.p4.org/u/christnp)\
**Replies:** 2\
**Last updated:** [February 1, 2023, 8:54pm UTC](https://forum.p4.org/t/execute-scripts-on-running-p4app/613 "2023-02-01T20:54:09Z")

</div>

Good Evening, I’d like to have a couple of terminals open and execute scripts on an existing p4App container. This can be either two remote terminals (SSH) or using the exec command. I’ve tried the guidance in the READ…

---

## [Documentation on simple\_switch](https://forum.p4.org/t/documentation-on-simple-switch/611)

<div class="topic-metadata">

**Author:** [@kspimparkar](https://forum.p4.org/u/kspimparkar)\
**Replies:** 2\
**Last updated:** [January 24, 2023, 11:00pm UTC](https://forum.p4.org/t/documentation-on-simple-switch/611 "2023-01-24T23:00:31Z")

</div>

I want to study more on the architecture of simple\_switch. The kind of queue it uses, packet I/O. I was referring to this document (behavioral-model/simple\_switch.md at main · p4lang/behavioral-model · GitHub) but it doe…

---

## [Set up multiple switches and controllers in a single machine](https://forum.p4.org/t/set-up-multiple-switches-and-controllers-in-a-single-machine/617)

<div class="topic-metadata">

**Author:** [@Mel](https://forum.p4.org/u/Mel)\
**Replies:** 1\
**Last updated:** [January 24, 2023, 6:41pm UTC](https://forum.p4.org/t/set-up-multiple-switches-and-controllers-in-a-single-machine/617 "2023-01-24T18:41:15Z")

</div>

Hey everyone, I’m wondering if it’s possible to set up multiple connection pairs between switch and controller (One switch is connected with one controller)? I would like to test my P4 program using different datasets. …

---

## [Commands (cmd) on Hosts not running](https://forum.p4.org/t/commands-cmd-on-hosts-not-running/614)

<div class="topic-metadata">

**Author:** [@christnp](https://forum.p4.org/u/christnp)\
**Replies:** 0\
**Last updated:** [January 22, 2023, 5:25am UTC](https://forum.p4.org/t/commands-cmd-on-hosts-not-running/614 "2023-01-22T05:25:17Z")

</div>

Good Evening, It could be that I misunderstand the function of the “cmd” field in the p4App.json file when using the switch target; however, when I set the “cmd” to a valid script file (one that I run manually without i…

---

## [Detecting data in TCP payload](https://forum.p4.org/t/detecting-data-in-tcp-payload/595)

<div class="topic-metadata">

**Author:** [@christnp](https://forum.p4.org/u/christnp)\
**Replies:** 2\
**Last updated:** [January 22, 2023, 12:55am UTC](https://forum.p4.org/t/detecting-data-in-tcp-payload/595 "2023-01-22T00:55:45Z")

</div>

I am new to P4, so I appreciate your patience! I’ve seen similar questions to this, but none have quite answered my question (I don’t think). I’m performing some basic research and I need a way to manipulate TCP payload…

---

## [Question about Inband Network Telemetry](https://forum.p4.org/t/question-about-inband-network-telemetry/610)

<div class="topic-metadata">

**Author:** [@kspimparkar](https://forum.p4.org/u/kspimparkar)\
**Replies:** 2\
**Last updated:** [January 18, 2023, 5:48pm UTC](https://forum.p4.org/t/question-about-inband-network-telemetry/610 "2023-01-18T17:48:18Z")

</div>

I was going through INT specification on this document - INT\_v2\_1.pdf (p4.org). I am just curious to know about what the difference between queue and buffer is as mentioned on page 8 (Queue occupancy, Buffer occupancy). …

---

## [Running P4 on a Linux Bridge](https://forum.p4.org/t/running-p4-on-a-linux-bridge/586)

<div class="topic-metadata">

**Author:** [@kspimparkar](https://forum.p4.org/u/kspimparkar)\
**Replies:** 2\
**Last updated:** [January 12, 2023, 12:11am UTC](https://forum.p4.org/t/running-p4-on-a-linux-bridge/586 "2023-01-12T00:11:43Z")

</div>

For my experiment I am trying to run P4 on a Linux bridge connecting wlan and eth. Is there any way I could run P4 on such an environment? I am also open to having a user space switch running P4 on a x86 machine. Thank y…

---

## [Running simple\_switch\_grpc?](https://forum.p4.org/t/running-simple-switch-grpc/599)

<div class="topic-metadata">

**Author:** [@kspimparkar](https://forum.p4.org/u/kspimparkar)\
**Replies:** 4\
**Last updated:** [January 11, 2023, 9:38am UTC](https://forum.p4.org/t/running-simple-switch-grpc/599 "2023-01-11T09:38:28Z")

</div>

I had a quick question I am very sorry if it is basic but I could not find the answer over internet anywhere. I wanted to know if simple\_switch\_grpc (behavioral\_model) supports only veth interfaces? I was planning on add…

---

## [P4 Easily Deployable Testing Solution for IPv6](https://forum.p4.org/t/p4-easily-deployable-testing-solution-for-ipv6/589)

<div class="topic-metadata">

**Author:** [@ThePuriProdigy](https://forum.p4.org/u/ThePuriProdigy)\
**Replies:** 10\
**Last updated:** [January 7, 2023, 11:58pm UTC](https://forum.p4.org/t/p4-easily-deployable-testing-solution-for-ipv6/589 "2023-01-07T23:58:31Z")

</div>

I’ve been using: GitHub - p4lang/tutorials: P4 language tutorials as a source for examples and tutorials to learn/practice writing P4 code and testing it in a virtual network through Mininet. The GitHub tutorials contain…

---

## [How define the arp header in the P4 program](https://forum.p4.org/t/how-define-the-arp-header-in-the-p4-program/584)

<div class="topic-metadata">

**Author:** [@Lululouisa](https://forum.p4.org/u/Lululouisa)\
**Replies:** 4\
**Last updated:** [January 7, 2023, 8:47am UTC](https://forum.p4.org/t/how-define-the-arp-header-in-the-p4-program/584 "2023-01-07T08:47:34Z")

</div>

Hi all, about the ARP flows, I am wondering how to define the header and parser part. According to papers/parser.p4 at master · p4lang/papers · GitHub, maybe I can directly use header arp\_rarp\_t and parser\_arp\_rarp. How…

---

## [Using P4 to program user space switch/bridge that connects wlan and eth of ubuntu server (x86)](https://forum.p4.org/t/using-p4-to-program-user-space-switch-bridge-that-connects-wlan-and-eth-of-ubuntu-server-x86/588)

<div class="topic-metadata">

**Author:** [@kspimparkar](https://forum.p4.org/u/kspimparkar)\
**Replies:** 1\
**Last updated:** [January 6, 2023, 1:28pm UTC](https://forum.p4.org/t/using-p4-to-program-user-space-switch-bridge-that-connects-wlan-and-eth-of-ubuntu-server-x86/588 "2023-01-06T13:28:51Z")

</div>

I need some resources to get started with Using P4 to program user space switch/bridge that connects wlan and eth of ubuntu server (x86). I am trying to implement Inband Network Telemetry on an Ubuntu Server that acts a…

---

## [Bitmap P4 Representation](https://forum.p4.org/t/bitmap-p4-representation/583)

<div class="topic-metadata">

**Author:** [@ThePuriProdigy](https://forum.p4.org/u/ThePuriProdigy)\
**Replies:** 10\
**Last updated:** [January 6, 2023, 1:36am UTC](https://forum.p4.org/t/bitmap-p4-representation/583 "2023-01-06T01:36:21Z")

</div>

I was wondering in P4, how are Bitmap lookups typically done/recreated? Would creating a bitstring in metadata in the data plane be a sensible approach? For example, if I wanted a 2^16 long bitmap/bitstring, what would b…

---

## [P4 Loading Large Amounts of Table Entries from Control Plane](https://forum.p4.org/t/p4-loading-large-amounts-of-table-entries-from-control-plane/582)

<div class="topic-metadata">

**Author:** [@ThePuriProdigy](https://forum.p4.org/u/ThePuriProdigy)\
**Replies:** 4\
**Last updated:** [January 3, 2023, 6:50pm UTC](https://forum.p4.org/t/p4-loading-large-amounts-of-table-entries-from-control-plane/582 "2023-01-03T18:50:52Z")

</div>

I’ve written a functional P4 program that works for small datasets. I’m currently trying to apply a larger dataset with many more table entries/data. I’m using the P4 tutorial VM and the Mininet Makefile/process for read…

---

## [P4 switch bandwidth in Mininet](https://forum.p4.org/t/p4-switch-bandwidth-in-mininet/567)

<div class="topic-metadata">

**Author:** [@ZSL](https://forum.p4.org/u/ZSL)\
**Replies:** 3\
**Last updated:** [December 24, 2022, 6:31pm UTC](https://forum.p4.org/t/p4-switch-bandwidth-in-mininet/567 "2022-12-24T18:31:28Z")

</div>

Hello， I have a question about the P4 switch. I created a network in mininet using p4lang / tutorials. However, when I tested the bandwidth with the iperf tool, I found that the bandwidth was only less than 20Mbps. Howe…

---

## [P4 Large TCAM/SRAM Lookup Table](https://forum.p4.org/t/p4-large-tcam-sram-lookup-table/545)

<div class="topic-metadata">

**Author:** [@ThePuriProdigy](https://forum.p4.org/u/ThePuriProdigy)\
**Replies:** 11\
**Last updated:** [November 27, 2022, 6:16am UTC](https://forum.p4.org/t/p4-large-tcam-sram-lookup-table/545 "2022-11-27T06:16:37Z")

</div>

Hi all, I’m fairly new to P4 and still wrapping my head around certain parts. I understand that the general gist is that the P4 compiler will try to take advantage of any possible parallelization whenever possible. For e…

---

## [How do registers map to available SRAM?](https://forum.p4.org/t/how-do-registers-map-to-available-sram/553)

<div class="topic-metadata">

**Author:** [@mudhaniu](https://forum.p4.org/u/mudhaniu)\
**Replies:** 2\
**Last updated:** [November 25, 2022, 3:12am UTC](https://forum.p4.org/t/how-do-registers-map-to-available-sram/553 "2022-11-25T03:12:09Z")

</div>

Hi, I am using an Intel Tofino2-based switch, which says it has ~1.2MB SRAM per stage. I was wondering typically how much of this is available for a P4 register array? (I am trying to do back-of-the-envelope calculation…

---

## [Toeplitz Hash Not working](https://forum.p4.org/t/toeplitz-hash-not-working/549)

<div class="topic-metadata">

**Author:** [@srihari39](https://forum.p4.org/u/srihari39)\
**Replies:** 5\
**Last updated:** [November 25, 2022, 2:26am UTC](https://forum.p4.org/t/toeplitz-hash-not-working/549 "2022-11-25T02:26:52Z")

</div>

I’m trying to use the Toeplitz hash function in one of my p4 programs, but the v1model.p4 doesn’t seem to have the Toeplitz in the enum tag. But I found the implementation of Toeplitz in the subsequent backends and front…

---

## [Understanding P4 Meters \*\*Explanation Needed\*\*](https://forum.p4.org/t/understanding-p4-meters-explanation-needed/89)

<div class="topic-metadata">

**Author:** [@mharrist](https://forum.p4.org/u/mharrist)\
**Replies:** 4\
**Last updated:** [November 22, 2022, 1:51pm UTC](https://forum.p4.org/t/understanding-p4-meters-explanation-needed/89 "2022-11-22T13:51:38Z")

</div>

Hi, I have been looking into P4 meters which I could use as a traffic rate limiter for my application. I stumbled across this P4 meter example in P4-Learning GitHub Repo. From the Runtime CLI, when we execute: meter\_ar…

---

## [How to work with packet payload](https://forum.p4.org/t/how-to-work-with-packet-payload/539)

<div class="topic-metadata">

**Author:** [@arashams](https://forum.p4.org/u/arashams)\
**Replies:** 1\
**Last updated:** [November 18, 2022, 8:53am UTC](https://forum.p4.org/t/how-to-work-with-packet-payload/539 "2022-11-18T08:53:23Z")

</div>

Hello, I have a question regarding doing some action on packet payload like different CRC calculations over payload, for example, one CRC calculation would be done on every packet and another algorithm would run on each …

---

## [How to use p4-ovs on my dpu?](https://forum.p4.org/t/how-to-use-p4-ovs-on-my-dpu/534)

<div class="topic-metadata">

**Author:** [@Livin](https://forum.p4.org/u/Livin)\
**Replies:** 4\
**Last updated:** [November 18, 2022, 12:36am UTC](https://forum.p4.org/t/how-to-use-p4-ovs-on-my-dpu/534 "2022-11-18T00:36:43Z")

</div>

Hello everyone, Recently, I have some questions about p4-ovs to ask. First, my DPU has an independent ubuntu 20.04. I want to create an OVS environment and deploy P4 programs in OVS. How do I apply p4 to OVS? Is p4 run…

---

## [Standard\_metadata value always zero](https://forum.p4.org/t/standard-metadata-value-always-zero/516)

<div class="topic-metadata">

**Author:** [@Lululouisa](https://forum.p4.org/u/Lululouisa)\
**Replies:** 3\
**Last updated:** [November 6, 2022, 2:28pm UTC](https://forum.p4.org/t/standard-metadata-value-always-zero/516 "2022-11-06T14:28:34Z")

</div>

Hello, there are always some problems when i tried to read the hdr.tcp.syn and also some variables from standard\_metadata. When i used scapy to create a SYN packet (pkt=IP(dst=“10.0.1.2”)/TCP(flags=“S”)) and sent it fr…

---

## [Can't have more than one constant operand to an SALU compare](https://forum.p4.org/t/cant-have-more-than-one-constant-operand-to-an-salu-compare/511)

<div class="topic-metadata">

**Author:** [@KathyJXY](https://forum.p4.org/u/KathyJXY)\
**Replies:** 1\
**Last updated:** [November 2, 2022, 2:33pm UTC](https://forum.p4.org/t/cant-have-more-than-one-constant-operand-to-an-salu-compare/511 "2022-11-02T14:33:02Z")

</div>

When I compiling my p4 program on tna, I got the error message: error: can’t have more than one constant operand to an SALU compare. I have no clue of what’s causing this error, can anyone give some advice please? Tha…

---

## [How JSON Runtime files work](https://forum.p4.org/t/how-json-runtime-files-work/487)

<div class="topic-metadata">

**Author:** [@DeMur](https://forum.p4.org/u/DeMur)\
**Replies:** 1\
**Last updated:** [October 10, 2022, 12:52am UTC](https://forum.p4.org/t/how-json-runtime-files-work/487 "2022-10-10T00:52:20Z")

</div>

Hello everyone, I just started learning the p4 and I have some trouble. Firstly, I started using the tutorials that I found on GitHub and they are very helpful but I need someone to explain/ confirm if I understand righ…

---

## [What is the standard\_metadata.egress\_spec?](https://forum.p4.org/t/what-is-the-standard-metadata-egress-spec/489)

<div class="topic-metadata">

**Author:** [@DeMur](https://forum.p4.org/u/DeMur)\
**Replies:** 1\
**Last updated:** [October 10, 2022, 12:45am UTC](https://forum.p4.org/t/what-is-the-standard-metadata-egress-spec/489 "2022-10-10T00:45:34Z")

</div>

Hello everyone, could someone explain to me what is standard\_metadata.egress\_spec that is used here? In the Basic exercise from GitHub (tutorials/exercises/basic at master · p4lang/tutorials · GitHub) the ipv4\_forward a…

---

## [Change the forward in proactive mode](https://forum.p4.org/t/change-the-forward-in-proactive-mode/475)

<div class="topic-metadata">

**Author:** [@juanda](https://forum.p4.org/u/juanda)\
**Replies:** 9\
**Last updated:** [September 25, 2022, 7:35pm UTC](https://forum.p4.org/t/change-the-forward-in-proactive-mode/475 "2022-09-25T19:35:35Z")

</div>

Hi, I have a question, I have 2 hosts conected to a switch: h1 connected to port 1 en h2 connected to port 2. h1 and h2 generates flux 1 and 2, respectively. flux 1 (with header UDPport\_dst=X) forward to port 3 flux…

---

## [Counting up to n packets and using that as trigger](https://forum.p4.org/t/counting-up-to-n-packets-and-using-that-as-trigger/467)

<div class="topic-metadata">

**Author:** [@yiwen](https://forum.p4.org/u/yiwen)\
**Replies:** 5\
**Last updated:** [September 14, 2022, 7:29pm UTC](https://forum.p4.org/t/counting-up-to-n-packets-and-using-that-as-trigger/467 "2022-09-14T19:29:39Z")

</div>

I would like to implement a way for the P4 switch to count to n ingress packets, and at that time, to trigger a set of actions for sampling a packet (like gather information about it and send it to an external controller…

---

## [PSA egress behavior](https://forum.p4.org/t/psa-egress-behavior/466)

<div class="topic-metadata">

**Author:** [@kesnar](https://forum.p4.org/u/kesnar)\
**Replies:** 4\
**Last updated:** [September 12, 2022, 2:05pm UTC](https://forum.p4.org/t/psa-egress-behavior/466 "2022-09-12T14:05:19Z")

</div>

Hello, I am trying to understand the egress part of the PSA. So I am using p4-dpdk-target and I have written a simple bounce-back program that switches dst and src mac addresses. To do that I am parsing the packet hea…

---

## [Extract payload from packet](https://forum.p4.org/t/extract-payload-from-packet/447)

<div class="topic-metadata">

**Author:** [@svenchen](https://forum.p4.org/u/svenchen)\
**Replies:** 4\
**Last updated:** [August 25, 2022, 10:31am UTC](https://forum.p4.org/t/extract-payload-from-packet/447 "2022-08-25T10:31:22Z")

</div>

Hi, I’m wondering if it is feasible to extract a payload (such as TCP/UDP payload) from the packet. I tried to define the payload by creating a new header but failed since the size of the payload varies. Thank you very …

---

## [Is it possible to add timers for packet generators in dataplane?](https://forum.p4.org/t/is-it-possible-to-add-timers-for-packet-generators-in-dataplane/458)

<div class="topic-metadata">

**Author:** [@asdwerrtyyui](https://forum.p4.org/u/asdwerrtyyui)\
**Replies:** 6\
**Last updated:** [August 25, 2022, 7:15am UTC](https://forum.p4.org/t/is-it-possible-to-add-timers-for-packet-generators-in-dataplane/458 "2022-08-25T07:15:12Z")

</div>

Hello, I am wondering whether it is possible to add/delete timers for packet generation in data plane. For example, can the switch start a timer when receive some specific packets and generates another packet when timeo…

[Previous page](https://forum.p4.org/c/getting-started-with-p4/13.md?page=4)

[Next page](https://forum.p4.org/c/getting-started-with-p4/13.md?page=6)
