Comments on the P4 book

オープン
#55 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
領域
documentation

調査の方向性

book/text/src/01-02-hello_world.md と book/text/src/02-01-vlan-switch.md を読み、関連する P4 言語仕様およびアーキテクチャ仕様に照らして、記載されている parser と assignment の動作を確認してください。parser の説明、誤字、VLAN 例の文言または初期化が、文書化された動作を反映していれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Most of these are nits, but thought I would mention them after reading through the book so far:

==========
File https://github.com/oxidecomputer/p4/blob/main/book/text/src/01-02-hello_world.md

"Parsers can also transition to the implicit reject state. This means that the packet will be dropped and not go on to any further processing."

Note that v1model, PSA, PNA, and TNA architectures all define that packets that go to the reject state in the parser actually do go to ingress (or main for PNA) processing after parsing is complete, but they also document that typically your P4 code is likely to want to drop the packet in ingress/main controls if that happens. I can imagine in some debug situations one would like to punt a copy of packets experiencing a parser error to the CPU.

Tofino I believe has chip-wide config to drop packets that reach a parser reject state, without going to ingress/egress processing after that, but I believe it is not the default option.

Typo: "I prime example" -> "A prime example"

=========
File https://github.com/oxidecomputer/p4/blob/main/book/text/src/02-01-vlan-switch.md

Kind of a subtle point, but I believe from the language spec point of view, the assignment of false to vlan_ok before calling vlan.apply() is a "dead" assignment. No matter what value it has before vlan.apply(), the copy-out behavior of vlan.apply() should overwrite that value. Since the vlan control never assigns false to this out parameter, and only sometimes assigns true, the end value of vlan_ok could be undefined garbage. Perhaps in your implementation all bool values are predictably initialized to false?

In any case, the way to write this more portably in P4 would be to initialize match = false; before the port_vlan.apply(); call in the body of the vlan control.

主要言語
Rust
スター
140
フォーク
14
平均マージ
3日 18時間
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

oxidecomputer/p4 のほかの issue

oxidecomputer/p4 の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。