Skip to content
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

infra: packet tracing #81

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

christophefontaine
Copy link
Contributor

  • Prepend a common structure for all mbuf priv data Prepend to all mbuf_priv data a common structure, which will include data available for the whole life of the packet.

  • Add packet tracing infra, to log the packet traversal on each node. Add CLI to enable/disable packet tracing per interface. Add relevant trace function on nodes.

'show trace' command is destructive and empties the ring.

Sample output:

# show trace
--------- 19:08:04.169479762Z cpu 1 ---------
port_rx: p1q0 iface gi2dmo1
eth_input: IP4 ba:d0:ca:ca:00:01 -> f0:0d:ac:dc:00:01 iface gi2dmo1 vlan 0
ip_input: 172.16.1.2 -> 192.168.2.10 next proto: UDP ttl 64
ip_error_dest_unreach:
ip_output: 172.16.1.1 -> 172.16.1.2 next proto: ICMP ttl 64
eth_output: IP4 f0:0d:ac:dc:00:01 -> ba:d0:ca:ca:00:01 iface gi2dmo1 vlan 0
port_tx: p1q0

Copy link
Collaborator

@rjarry rjarry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Chris,

Thank you for this. This is a precious tool to help understanding packet flow.

In addition of my code review remarks, I think this series should be split at least in 4 or 5 commits. You already list multiple independent changes in your commit message. You can start with this, but I think more fine grain commits would help a lot.

Cheers

meson.build Outdated Show resolved Hide resolved
modules/infra/api/meson.build Outdated Show resolved Hide resolved
modules/infra/api/packet_trace.c Outdated Show resolved Hide resolved
modules/infra/api/packet_trace.c Outdated Show resolved Hide resolved
modules/infra/cli/graph.c Outdated Show resolved Hide resolved
modules/ip/datapath/ip_input.c Outdated Show resolved Hide resolved
modules/ip/datapath/ip_input.c Outdated Show resolved Hide resolved
modules/ip/datapath/ip_local.c Outdated Show resolved Hide resolved
modules/ip6/datapath/gr_ip6_datapath.h Outdated Show resolved Hide resolved
smoke/ip_forward_test.sh Outdated Show resolved Hide resolved
@christophefontaine christophefontaine force-pushed the packet_tracing branch 2 times, most recently from ed1ce08 to 09e1c0e Compare October 11, 2024 10:20
@christophefontaine christophefontaine force-pushed the packet_tracing branch 2 times, most recently from cc0445c to 5954b3e Compare October 11, 2024 13:54
@christophefontaine christophefontaine marked this pull request as draft October 11, 2024 15:47
@christophefontaine christophefontaine force-pushed the packet_tracing branch 2 times, most recently from 8cc6f57 to eeae9af Compare October 11, 2024 21:09
@christophefontaine christophefontaine marked this pull request as ready for review October 11, 2024 21:13
@christophefontaine
Copy link
Contributor Author

Added trace cli to enable/disable globally and per interface packet tracing.
This also enables / disable tracing for non interface source node (control_input).

modules/infra/datapath/gr_mbuf.h Show resolved Hide resolved
modules/infra/datapath/drop.c Show resolved Hide resolved
modules/infra/datapath/trace.c Outdated Show resolved Hide resolved
modules/ip/datapath/ip_input.c Outdated Show resolved Hide resolved
modules/ip/datapath/icmp_input.c Outdated Show resolved Hide resolved
modules/infra/datapath/eth_output.c Outdated Show resolved Hide resolved
modules/infra/datapath/eth_output.c Outdated Show resolved Hide resolved
modules/infra/datapath/eth_output.c Outdated Show resolved Hide resolved
@christophefontaine christophefontaine force-pushed the packet_tracing branch 3 times, most recently from 1f1e0f7 to 73d1c03 Compare October 17, 2024 12:38
Add packet tracing infrastructure, to log packet traversal on nodes.
Add CLI to enable/disable packet tracing per interface.

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Use trace api to enable/disable packet tracing for
control_input node.

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Add ethertype and ip proto format functions

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Implement tracing functions for ethernet nodes.
For vlan interfaces, enable tracing according to the user intent.

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Implement tracing function for arp input/output/output_request.

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Implement tracing for icmp_node node

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Implement tracing functions for ip nodes.
Update tests to enable and show traces.

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Implement tracing for ipip nodes

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Implement tracing for ip6/icmp6/ndp nodes.

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Implement tracing and trace aggregate for control output node.

Signed-off-by: Christophe Fontaine <cfontain@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants