# Documentation on simple\_switch

**URL:** <https://forum.p4.org/t/documentation-on-simple-switch/611>\
**Category:** Getting Started with P4\
**Created:** [January 18, 2023, 5:55pm UTC](https://forum.p4.org/t/documentation-on-simple-switch/611 "2023-01-18T17:55:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kspimparkar](https://avatars.discourse-cdn.com/v4/letter/k/eb8c5e/32.png) [@kspimparkar](https://forum.p4.org/u/kspimparkar)\
**Post date:** [January 18, 2023, 5:55pm UTC](https://forum.p4.org/t/documentation-on-simple-switch/611/1 "2023-01-18T17:55:29Z")

</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](https://github.com/p4lang/behavioral-model/blob/main/docs/simple_switch.md)) but it doesn’t specify the overall architecture. Does the simple switch uses the queue of the physical NIC driver that it binds to as a port?

---

<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:** [January 24, 2023, 7:01pm UTC](https://forum.p4.org/t/documentation-on-simple-switch/611/2 "2023-01-24T19:01:07Z")

</div>

I am not aware of any high level documentation of simple\_switch. There is the source code, of course, but I realize that is not a quick introduction.

When starting simple\_switch, it is typical for users to provide command line options of the form `-i 0@veth0 -i 1@eth17`, with one `-i` option per simulated switch port. One typically also runs simple\_switch with root privileges, e.g. using `sudo`.

I was not able to quickly find the source code in the behavioral-model repo that shows where packets are read from interfaces, or written to interfaces, but I am pretty sure it must be something available to user space processes running as root, perhaps putting the interface in promiscuous mode.

In case you were unaware, simple\_switch is NOT intended to achieve the highest possible performance that one can possibly do with a Linux user space process. It is intended for debug and development of P4 programs. See more details here: [behavioral-model/performance.md at main · p4lang/behavioral-model (github.com)](https://github.com/p4lang/behavioral-model/blob/main/docs/performance.md)

---

<div class="post-metadata">

**Author:** ![kspimparkar](https://avatars.discourse-cdn.com/v4/letter/k/eb8c5e/32.png) [@kspimparkar](https://forum.p4.org/u/kspimparkar)\
**Post date:** [January 24, 2023, 11:00pm UTC](https://forum.p4.org/t/documentation-on-simple-switch/611/3 "2023-01-24T23:00:31Z")

</div>

@andyfingerhut Thank you for your reply. Even I am not able to find a high level documentation of simple\_switch. Would be helpful if someone could point me to it if it was documented. Reading the source code directly is bit hard.
