# Getting Started with P4

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

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

**Page:** 5

---

## [Header MQTT Protocol](https://forum.p4.org/t/header-mqtt-protocol/675)

<div class="topic-metadata">

**Author:** [@brunac279](https://forum.p4.org/u/brunac279)\
**Replies:** 2\
**Last updated:** [May 9, 2023, 3:20pm UTC](https://forum.p4.org/t/header-mqtt-protocol/675 "2023-05-09T15:20:53Z")

</div>

Hello. I’m new to P4 and I’m trying to extract information from the MQTT header. Initially, I would just like to work with the fixed part, of 2 bytes. I defined: header mqtt\_t { bit\<4\> type; bit\<4\> flags; bit\<8\> rem…

---

## [Built-in library for existed network protocols](https://forum.p4.org/t/built-in-library-for-existed-network-protocols/773)

<div class="topic-metadata">

**Author:** [@elwinzhao](https://forum.p4.org/u/elwinzhao)\
**Replies:** 1\
**Last updated:** [May 8, 2023, 6:39pm UTC](https://forum.p4.org/t/built-in-library-for-existed-network-protocols/773 "2023-05-08T18:39:28Z")

</div>

Does P4 support existed network protocols? For example, suppose I want to use P4 to implement ICMP protocol, do I need to rewrite all packet forwarding logic? Or I can just use built-in library?

---

## [Is there any way to get the queue depth information of different priority queues?](https://forum.p4.org/t/is-there-any-way-to-get-the-queue-depth-information-of-different-priority-queues/770)

<div class="topic-metadata">

**Author:** [@tuananh01](https://forum.p4.org/u/tuananh01)\
**Replies:** 0\
**Last updated:** [May 8, 2023, 6:10am UTC](https://forum.p4.org/t/is-there-any-way-to-get-the-queue-depth-information-of-different-priority-queues/770 "2023-05-08T06:10:14Z")

</div>

Hello everyone, This is a shorter version of: Queue depth of different priority queues - Getting Started with P4 - P4 Programming Language My topology: From h1 & h2, I send 10 packets from each host to h3, 1 second …

---

## [Queue depth of different priority queues](https://forum.p4.org/t/queue-depth-of-different-priority-queues/769)

<div class="topic-metadata">

**Author:** [@tuananh01](https://forum.p4.org/u/tuananh01)\
**Replies:** 0\
**Last updated:** [May 5, 2023, 4:16pm UTC](https://forum.p4.org/t/queue-depth-of-different-priority-queues/769 "2023-05-05T16:16:44Z")

</div>

Hello everyone, I’m working on a project which implements priority queues with the MRI exercise. I use simple\_switch. This is the topology: First, I did some experiments on the original MRI exercise (i.e single queu…

---

## [Issue in p4-learning/examples/recirculate](https://forum.p4.org/t/issue-in-p4-learning-examples-recirculate/767)

<div class="topic-metadata">

**Author:** [@tuananh01](https://forum.p4.org/u/tuananh01)\
**Replies:** 3\
**Last updated:** [May 3, 2023, 3:52am UTC](https://forum.p4.org/t/issue-in-p4-learning-examples-recirculate/767 "2023-05-03T03:52:54Z")

</div>

Hello everyone, I’m doing the recirculate example in the p4-learning repo. When I run the program, I got this error: I’ve checked the directory /usr/local/share/p4c/p4include/v1model.p4 and I see that the recirculat…

---

## [How do I access the data of ingress in egress？](https://forum.p4.org/t/how-do-i-access-the-data-of-ingress-in-egress/758)

<div class="topic-metadata">

**Author:** [@PinesL](https://forum.p4.org/u/PinesL)\
**Replies:** 3\
**Last updated:** [April 24, 2023, 1:19am UTC](https://forum.p4.org/t/how-do-i-access-the-data-of-ingress-in-egress/758 "2023-04-24T01:19:14Z")

</div>

I calculate a data in ingress and I want to obtain this data in egree. Is there any way?

---

## [Mininet Integration for behavioral-model](https://forum.p4.org/t/mininet-integration-for-behavioral-model/753)

<div class="topic-metadata">

**Author:** [@SpecialGuest](https://forum.p4.org/u/SpecialGuest)\
**Replies:** 3\
**Last updated:** [April 22, 2023, 11:36am UTC](https://forum.p4.org/t/mininet-integration-for-behavioral-model/753 "2023-04-22T11:36:43Z")

</div>

Hello everyone, I need help with the Mininet integration of the behavioral-model. We have a 1sw\_demo.py file provided that only builds a single switch topology. What would be the procedure if I wanted to create a topolo…

---

## [Priority queueing](https://forum.p4.org/t/priority-queueing/743)

<div class="topic-metadata">

**Author:** [@tuananh01](https://forum.p4.org/u/tuananh01)\
**Replies:** 1\
**Last updated:** [April 17, 2023, 6:50pm UTC](https://forum.p4.org/t/priority-queueing/743 "2023-04-17T18:50:59Z")

</div>

Hello everyone, I’m using the latest Development VM released in April and working on p4-learning repo. I’ve read the BMv2 Simple Switch article and also looked into the multiqueuing.p4 example. They all said that if I…

---

## [After I add the extern object, how do I modify the utils tool so that it still works?](https://forum.p4.org/t/after-i-add-the-extern-object-how-do-i-modify-the-utils-tool-so-that-it-still-works/737)

<div class="topic-metadata">

**Author:** [@Duang](https://forum.p4.org/u/Duang)\
**Replies:** 0\
**Last updated:** [April 14, 2023, 3:06am UTC](https://forum.p4.org/t/after-i-add-the-extern-object-how-do-i-modify-the-utils-tool-so-that-it-still-works/737 "2023-04-14T03:06:40Z")

</div>

I introduced an extern function in my p4 program, in order to verify the usage of extern. However, I found that when I introduced extern and used utils again to create a mininet network and started it with the make run c…

---

## [Filtering UDP traffic using p4rtshell](https://forum.p4.org/t/filtering-udp-traffic-using-p4rtshell/716)

<div class="topic-metadata">

**Author:** [@JanRepka](https://forum.p4.org/u/JanRepka)\
**Replies:** 2\
**Last updated:** [April 13, 2023, 1:22pm UTC](https://forum.p4.org/t/filtering-udp-traffic-using-p4rtshell/716 "2023-04-13T13:22:29Z")

</div>

Hello, I’m trying to use traffic filter example on P4Pi with t4p4s target to filter UDP packets by their source port. When I filter by IPv4 source address the packets drop correctly. To add filters I’m using p4rtshell a…

---

## [Creating queues in P4](https://forum.p4.org/t/creating-queues-in-p4/726)

<div class="topic-metadata">

**Author:** [@tuananh01](https://forum.p4.org/u/tuananh01)\
**Replies:** 4\
**Last updated:** [April 12, 2023, 6:18am UTC](https://forum.p4.org/t/creating-queues-in-p4/726 "2023-04-12T06:18:01Z")

</div>

Hello everyone, I want to implement some Active Queue Management algorithms in a P4 program, such as queue priority. But I don’t know how to express a queue in P4 code and whether it is possible to create multiple queue…

---

## [Questions about simple\_switch](https://forum.p4.org/t/questions-about-simple-switch/603)

<div class="topic-metadata">

**Author:** [@kspimparkar](https://forum.p4.org/u/kspimparkar)\
**Replies:** 8\
**Last updated:** [April 7, 2023, 2:03am UTC](https://forum.p4.org/t/questions-about-simple-switch/603 "2023-04-07T02:03:32Z")

</div>

Hello, I have started the simple\_switch on an ubuntu server with the command (sudo simple\_switch\_grpc -i 0@enp0s25 app.json (where app.json is the json got from the compilation of p4 program from p4c)). The interface t…

---

## [How to implement softwared P4 switch in PC or general server to achieve better performance？](https://forum.p4.org/t/how-to-implement-softwared-p4-switch-in-pc-or-general-server-to-achieve-better-performance/698)

<div class="topic-metadata">

**Author:** [@JYT](https://forum.p4.org/u/JYT)\
**Replies:** 7\
**Last updated:** [April 6, 2023, 3:53am UTC](https://forum.p4.org/t/how-to-implement-softwared-p4-switch-in-pc-or-general-server-to-achieve-better-performance/698 "2023-04-06T03:53:39Z")

</div>

I am new to P4 and I want to deploy P4 switches in a virtual environment (among multiple VMS, select the middle VM as the P4 switch) and I would like to ask if there is a better way to do this, for example SONiC has supp…

---

## [Getting ONOS controller container to communicate with BMV2 mn container](https://forum.p4.org/t/getting-onos-controller-container-to-communicate-with-bmv2-mn-container/721)

<div class="topic-metadata">

**Author:** [@urib](https://forum.p4.org/u/urib)\
**Replies:** 2\
**Last updated:** [April 5, 2023, 1:05pm UTC](https://forum.p4.org/t/getting-onos-controller-container-to-communicate-with-bmv2-mn-container/721 "2023-04-05T13:05:51Z")

</div>

Greetings, I am trying to connect containerized onos controller to the mn-stratum BMV2 container and am confused about how the switch and controller make the first connection, (I did the EX3 of NG-SDN Tutorial which wo…

---

## [Sending metrics to controller](https://forum.p4.org/t/sending-metrics-to-controller/658)

<div class="topic-metadata">

**Author:** [@jvm](https://forum.p4.org/u/jvm)\
**Replies:** 6\
**Last updated:** [April 3, 2023, 11:31am UTC](https://forum.p4.org/t/sending-metrics-to-controller/658 "2023-04-03T11:31:06Z")

</div>

Hello, I am writing a P4 program in bmv2. I would like that every time a packet is processed and forwarded, another one is sent to the controller with relevant metrics about the processed packet, like timestamps or info…

---

## [How does forwarding mechanism in P4 Switch compare to CEF?](https://forum.p4.org/t/how-does-forwarding-mechanism-in-p4-switch-compare-to-cef/714)

<div class="topic-metadata">

**Author:** [@sakar](https://forum.p4.org/u/sakar)\
**Replies:** 1\
**Last updated:** [March 30, 2023, 4:00pm UTC](https://forum.p4.org/t/how-does-forwarding-mechanism-in-p4-switch-compare-to-cef/714 "2023-03-30T16:00:09Z")

</div>

CEF maintains FIB and Adjacency table with specific data structure for faster and efficient route lookup and L2 header swap. Does P4 switch also maintain similar table in the backend? Can P4 match-action table provide si…

---

## [How to tune the bmv2 parameter so that it can get a larger cache and maximum number of processors when running p4 programs？](https://forum.p4.org/t/how-to-tune-the-bmv2-parameter-so-that-it-can-get-a-larger-cache-and-maximum-number-of-processors-when-running-p4-programs/700)

<div class="topic-metadata">

**Author:** [@Duang](https://forum.p4.org/u/Duang)\
**Replies:** 2\
**Last updated:** [March 26, 2023, 10:54am UTC](https://forum.p4.org/t/how-to-tune-the-bmv2-parameter-so-that-it-can-get-a-larger-cache-and-maximum-number-of-processors-when-running-p4-programs/700 "2023-03-26T10:54:30Z")

</div>

When I run the p4 program through simple\_switch, when I use the iperf tool for udp testing, I find that only one process is working with the top command, and the cpu usage of a single process quickly reaches 100%, but th…

---

## [FCS verification in P4 switch](https://forum.p4.org/t/fcs-verification-in-p4-switch/686)

<div class="topic-metadata">

**Author:** [@sakar](https://forum.p4.org/u/sakar)\
**Replies:** 3\
**Last updated:** [March 20, 2023, 2:18pm UTC](https://forum.p4.org/t/fcs-verification-in-p4-switch/686 "2023-03-20T14:18:15Z")

</div>

How can I perform Ethernet FCS verification in P4? I have looked at many examples and I can’t find any example implementing FCS verification, is it something P4 does not handle and left to the hardware?

---

## [Loading a Binary onto a P4 switch](https://forum.p4.org/t/loading-a-binary-onto-a-p4-switch/656)

<div class="topic-metadata">

**Author:** [@bedenham](https://forum.p4.org/u/bedenham)\
**Replies:** 8\
**Last updated:** [March 16, 2023, 6:54pm UTC](https://forum.p4.org/t/loading-a-binary-onto-a-p4-switch/656 "2023-03-16T18:54:58Z")

</div>

Hello, I have a question about the way in which a P4 binary is loaded onto a switch. Say I have written a program that I want to place on a specific P4 switch, I assume I compile the P4 program on my local machine to cr…

---

## [What is the role of Control Plane in the concept of P4-programming?](https://forum.p4.org/t/what-is-the-role-of-control-plane-in-the-concept-of-p4-programming/680)

<div class="topic-metadata">

**Author:** [@tuananh01](https://forum.p4.org/u/tuananh01)\
**Replies:** 3\
**Last updated:** [March 13, 2023, 3:41pm UTC](https://forum.p4.org/t/what-is-the-role-of-control-plane-in-the-concept-of-p4-programming/680 "2023-03-13T15:41:22Z")

</div>

Hello everyone, I am a last year student at university and my thesis defense is about P4-programmable data plane. In this beginning period, I’ve just only read about basic concepts of P4-programming and I’ve bumped into…

---

## [Problems encountered with p4runtime](https://forum.p4.org/t/problems-encountered-with-p4runtime/677)

<div class="topic-metadata">

**Author:** [@Duang](https://forum.p4.org/u/Duang)\
**Replies:** 11\
**Last updated:** [March 12, 2023, 6:03am UTC](https://forum.p4.org/t/problems-encountered-with-p4runtime/677 "2023-03-12T06:03:47Z")

</div>

I plan to use P4runtime to assume forwarding rules for my switch, but I ran into the following problem。 and my code is following: p4info\_helper = p4runtime\_lib.helper.P4InfoHelper(p4info\_file\_path) try: …

---

## [Is it possible to modify the metadata variable before storing it in the register?](https://forum.p4.org/t/is-it-possible-to-modify-the-metadata-variable-before-storing-it-in-the-register/671)

<div class="topic-metadata">

**Author:** [@eason2018](https://forum.p4.org/u/eason2018)\
**Replies:** 3\
**Last updated:** [March 8, 2023, 1:01pm UTC](https://forum.p4.org/t/is-it-possible-to-modify-the-metadata-variable-before-storing-it-in-the-register/671 "2023-03-08T13:01:43Z")

</div>

I want to write a program to calculate the minimum tcp/udp header length for each network flow. To achieve this goal,I am using three registers to simulate a count min sketch. Since the header length that needs to be st…

---

## [Binding physical interfaces to T4P4S?](https://forum.p4.org/t/binding-physical-interfaces-to-t4p4s/664)

<div class="topic-metadata">

**Author:** [@kspimparkar](https://forum.p4.org/u/kspimparkar)\
**Replies:** 0\
**Last updated:** [February 28, 2023, 1:02am UTC](https://forum.p4.org/t/binding-physical-interfaces-to-t4p4s/664 "2023-02-28T01:02:36Z")

</div>

I am referring to P4Pi to run T4P4S and BmV2 - I know the command to start simple\_switch and bind physical interface to the switch with option -i 0@\<INT\_NAME\>. Is there any way to bind physical interface with T4P4S or do…

---

## [T4P4S vs BmV2 performance](https://forum.p4.org/t/t4p4s-vs-bmv2-performance/663)

<div class="topic-metadata">

**Author:** [@kspimparkar](https://forum.p4.org/u/kspimparkar)\
**Replies:** 0\
**Last updated:** [February 28, 2023, 12:10am UTC](https://forum.p4.org/t/t4p4s-vs-bmv2-performance/663 "2023-02-28T00:10:15Z")

</div>

T4P4S vs BmV2? Why performance of T4P4S is so good compared to BmV2 framework switches (Simple Switch)?

---

## [Sum QoS throughout](https://forum.p4.org/t/sum-qos-throughout/648)

<div class="topic-metadata">

**Author:** [@guy-davidi](https://forum.p4.org/u/guy-davidi)\
**Replies:** 6\
**Last updated:** [February 22, 2023, 4:44pm UTC](https://forum.p4.org/t/sum-qos-throughout/648 "2023-02-22T16:44:11Z")

</div>

Hi, I’m trying to assign a value to each packet, and eventually I want to hold a counter that sums this value for every packet that passes through my switch. ( I want to measure the throughput kind of) I tried reading …

---

## [ONOS control plane](https://forum.p4.org/t/onos-control-plane/278)

<div class="topic-metadata">

**Author:** [@ppavlidis](https://forum.p4.org/u/ppavlidis)\
**Replies:** 7\
**Last updated:** [February 22, 2023, 11:55am UTC](https://forum.p4.org/t/onos-control-plane/278 "2023-02-22T11:55:06Z")

</div>

Hello, I don’t know if this is the perfect spot to make this question but does anyone know a good tutorial about ONOS with P4 and if possible some interesting topics about them for a diploma thesis?

---

## [Check the packet counter on simple switch port](https://forum.p4.org/t/check-the-packet-counter-on-simple-switch-port/649)

<div class="topic-metadata">

**Author:** [@kspimparkar](https://forum.p4.org/u/kspimparkar)\
**Replies:** 1\
**Last updated:** [February 19, 2023, 4:47am UTC](https://forum.p4.org/t/check-the-packet-counter-on-simple-switch-port/649 "2023-02-19T04:47:52Z")

</div>

I wanted to see the packet count on the simple\_switch\_grpc switch ports. I could not find right way to do it. Please help me with getting the packet count on a specific port with p4runtime on simple switch. Thanks!

---

## [Is there some error in my json file?](https://forum.p4.org/t/is-there-some-error-in-my-json-file/646)

<div class="topic-metadata">

**Author:** [@Duang](https://forum.p4.org/u/Duang)\
**Replies:** 3\
**Last updated:** [February 19, 2023, 2:47am UTC](https://forum.p4.org/t/is-there-some-error-in-my-json-file/646 "2023-02-19T02:47:52Z")

</div>

One of the simplest route forwarding： h1 \<-\> s1 \<-\> h2 My json file is as follows: { "hosts": { "h1": {"ip": "10.0.1.1/24", "mac": "08:00:00:00:01:11", "commands":\["route add default gw 10.…

---

## [Is it because my P4 version too old?](https://forum.p4.org/t/is-it-because-my-p4-version-too-old/644)

<div class="topic-metadata">

**Author:** [@Duang](https://forum.p4.org/u/Duang)\
**Replies:** 4\
**Last updated:** [February 15, 2023, 9:05am UTC](https://forum.p4.org/t/is-it-because-my-p4-version-too-old/644 "2023-02-15T09:05:49Z")

</div>

I encountered the following error when compiling my P4 program： main.p4(214): \[--Werror=type-error\] error: Field miss is not a member of structure struct local\_route if (local\_route.apply().miss){ …

---

## [Problems encountered in program compilation](https://forum.p4.org/t/problems-encountered-in-program-compilation/643)

<div class="topic-metadata">

**Author:** [@Duang](https://forum.p4.org/u/Duang)\
**Replies:** 4\
**Last updated:** [February 15, 2023, 1:30am UTC](https://forum.p4.org/t/problems-encountered-in-program-compilation/643 "2023-02-15T01:30:27Z")

</div>

I encountered this error when compiling the program “\[–Werror=invalid\] error: MyIngress.packet\_route: Invalid Program can not be implemented on this taret since it contains a path from table MyIngress.packet\_route back …

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

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