Add drop reason example#7
Conversation
ae0e39b to
6ac97e2
Compare
6ac97e2 to
9366871
Compare
| @@ -0,0 +1,254 @@ | |||
| # digest | |||
|
|
|||
There was a problem hiding this comment.
I am tempted to call this: drop_reason instead of digest. Then the opening statement here is:
This program demonstrates how to capture events from the datapath and logging them as events to the control plane. In this case we capture the reason why packets are dropped, what port they arrived on and what src mac address was observed on the packet. Packets could be dropped for two reasons:
- the parser was unable to parse the packet
- unable to find a matching entry on lookup of table nh_table.
| rejected. After the parser recognizes an ipv4 packet, the src ip address is used as a lookup | ||
| key for table *nh_table*. On a table hit, the programmed action *send_nh(port, srcMac, dstMac)* instance is executed. | ||
| The action first sets the src and destination mac address, then redirects the packet to a specified port, sets the ingress_port, sets `send_digest` to true and redirects the packet. On a table miss the packet is simply dropped. | ||
| `my_ingress_metadata_t` will hold the port on where the packet arrived and `send_digest`. `send_digest` signals to the deparser to send a digest message to user space. This digest message will hold the source mac address and the port where the packet arrived: |
There was a problem hiding this comment.
s/dropped/dropped and event sent to the control plane with reason set to blah
|
|
||
| run TC monitor for digest events: | ||
| `$TC mon p4 digest` | ||
|
|
There was a problem hiding this comment.
We need to see the events here..
| Compile the parser and control blocks programs if you have not already | ||
|
|
||
| `make` | ||
|
|
There was a problem hiding this comment.
Shouldnt you compile first before you modprobe?
There was a problem hiding this comment.
It doesn't matter
I can modprobe before or after
| `ping -I p4port0 10.0.1.2 -c 1` | ||
|
|
||
| Let's check some stats, below shows 3 packets dropped by the parser on <u>terminal 3</u>: | ||
|
|
There was a problem hiding this comment.
Shouldnt you point the user to terminal 2 at this point? And what they should expect to see?
And what was the packet dropped by the parser.
You are literally cutting and pasting other examples i had without thinking through what useful information is needed for the user..
There was a problem hiding this comment.
That's why I transformed it into a draft, because I needed to fix it given the new semantic
It's just copied and pasted at this point, I'm fixing and testing it before making the PR ready for review
| # digest | ||
|
|
||
| The *digest* program first parses ethernet <u>ipv4</u> packets. Any other packets are | ||
| rejected. After the parser recognizes an ipv4 packet, the src ip address is used as a lookup |
There was a problem hiding this comment.
s/rejected/rejected and event blah blah sent to the control plane.
| parser_rejected = 1, | ||
| table_miss = 2 | ||
| }; | ||
|
|
There was a problem hiding this comment.
Should the DROP_REASON be capitalized?
There was a problem hiding this comment.
I think that would work also
| "bitwidth" : 8 | ||
| } | ||
| ] | ||
| } |
There was a problem hiding this comment.
We need the drop reason not as a number but as a name for human consumption. Maybe i am missing something.
There was a problem hiding this comment.
We discussed offline and what we'd like would be for the compiler to emit in the JSON the mapping from integer to corresponding enum string (parser_rejected or table_miss)
42ec0a5 to
e10a2f5
Compare
Add drop reason example that drops a packet, and sends a digest message containing the ingress port (port where the packet arrived), the src mac address and the drop reason (PARSER_REJECTED or TABLE_MISS) If the packet is not dropped, it will be redirected
e10a2f5 to
fe5719a
Compare
Add drop reason example that drops a packet, and sends a digest message
containing the ingress port (port where the packet arrived), the src
mac address and the drop reason (PARSER_REJECTED or TABLE_MISS)
If the packet is not dropped, it will be redirected