-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add drop reason example #7
base: main
Are you sure you want to change the base?
Conversation
ae0e39b
to
6ac97e2
Compare
6ac97e2
to
9366871
Compare
digest/README.md
Outdated
@@ -0,0 +1,254 @@ | |||
# digest | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
digest/README.md
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/dropped/dropped and event sent to the control plane with reason set to blah
digest/README.md
Outdated
|
||
run TC monitor for digest events: | ||
`$TC mon p4 digest` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to see the events here..
digest/README.md
Outdated
Compile the parser and control blocks programs if you have not already | ||
|
||
`make` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldnt you compile first before you modprobe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't matter
I can modprobe before or after
digest/README.md
Outdated
`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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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/README.md
Outdated
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/rejected/rejected and event blah blah sent to the control plane.
digest/digest_metadata.p4
Outdated
parser_rejected = 1, | ||
table_miss = 2 | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the DROP_REASON be capitalized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would work also
digest/generated/digest.json
Outdated
"bitwidth" : 8 | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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