ovs collector provides insights into the OpenVSwitch datapath, tracking packets through both kernel and userspace components.
Overview
Theovs collector is essential for debugging OpenVSwitch behavior. It tracks packets through the OVS datapath, including slow-path upcalls to the userspace daemon and fast-path processing in the kernel.
The
ovs collector is the most complex collector in Retis, tracking packets across kernel-userspace boundaries and maintaining correlation between events.What Data is Retrieved
Theovs collector retrieves:
- Upcalls: Packets sent to userspace for processing
- Flow lookups: Kernel datapath flow table queries
- Flow operations: Flow installation and modification from userspace
- Action execution: OVS actions applied to packets
- USDT events: Userspace daemon events (optional)
- Flow information: Datapath and OpenFlow flow details (optional)
Probe Installation
The
ovs collector automatically installs multiple probes: kernel tracepoints, kretprobes, and optionally USDT probes for userspace tracking.openvswitch:ovs_dp_upcall(tracepoint): Upcall eventsqueue_userspace_packet(kretprobe): Upcall enqueueingovs_dp_process_packet(kretprobe): Flow lookup resultsopenvswitch:ovs_do_execute_action(tracepoint): Action execution- USDT probes in
ovs-vswitchd(optional with--ovs-track)
Prerequisites
OpenVSwitch Module
Theovs collector requires the OpenVSwitch kernel module:
USDT Support (Optional)
For userspace tracking with--ovs-track, ovs-vswitchd must be compiled with USDT support.
See OVS USDT documentation for compilation instructions.
Check USDT support:
Flow Enrichment Requirements (Optional)
For--ovs-enrich-flows:
- OpenVSwitch >= 3.4
- Access to OVS unixctl socket (typically
/var/run/openvswitch/ovs-vswitchd.*.ctl)
Command-Line Options
--ovs-track
Enable OpenVSwitch upcall tracking using USDT probes.When enabled:
- Attaches to USDT probes in
ovs-vswitchd - Tracks packets through userspace processing
- Correlates userspace events with kernel events
- Generates queue identifiers for upcall tracking
ovs-vswitchdcompiled with USDT support- Retis must be in the same PID namespace as
ovs-vswitchd
--ovs-enrich-flows
Enable datapath flow enrichment by querying the OVS daemon.When enabled:
- Queries OVS for flow details using the unixctl interface
- Adds
ovs-detraceevent sections - Shows datapath flows and OpenFlow flows
- Rate-limited to prevent daemon overload
- OpenVSwitch >= 3.4
- Access to OVS control socket
--ovs-enrich-rate
Rate limit for flow enrichment queries (requests per second).Controls how many flow lookup requests are sent to the OVS daemon per second.Considerations:
- Higher rates provide more information but increase daemon load
- Lower rates reduce load but may miss some flows
- Default of 20 req/s is conservative for most deployments
How OpenVSwitch Works
Understanding OVS architecture helps interpret collector output:Kernel Datapath
- Fast Path: Packets matching existing flows are processed in kernel
- Flow Table: Kernel maintains a cache of datapath flows
- Actions: Each flow has associated actions (output, modify, etc.)
Userspace Daemon
- OpenFlow Tables: Complex rule processing in
ovs-vswitchd - Upcalls: Packets not matching kernel flows are sent to userspace
- Flow Installation: Daemon installs flows in kernel for future packets
Packet Flow
Event Types
Theovs collector generates several event types:
upcall
Packet sent to userspace (no kernel flow match):upcall_enqueue
Packet fragment enqueued to netlink socket:upcall_enqueue events.
upcall_recv
USDT probe whenovs-vswitchd receives packet:
flow_put
USDT probe when daemon installs a flow:flow_exec
USDT probe when daemon executes actions:flow_tbl_lookup
Kernel flow table lookup result:action_execute
Kernel executing an action:Usage Examples
Basic OVS Monitoring
Monitor OVS datapath:With Userspace Tracking
Track through userspace:With Flow Enrichment
Query flow details:Full Tracking
Complete packet tracking:With Filtering
Track specific traffic:Using Profiles
Example Output
From the OVS documentation, here’s a complete example of packet flow:Fast Path
Slow Path (Upcall)
q 2809249329 - this links kernel and userspace events.
Userspace Processing
Action Execution
OVS Tracking
The--ovs-track flag enables sophisticated packet tracking:
Queue Identifiers
Generated by Retis to correlate events:- Kernel upcall events
- Userspace processing events
- Re-injection and action execution
Cross-Boundary Tracking
Retis tracks packets even when:- Sent to userspace (upcall)
- Processed by
ovs-vswitchd - Re-injected into kernel
Flow Enrichment
With--ovs-enrich-flows, Retis queries OVS for flow details:
dpctl/get
Shows datapath flow for a UFID:ofproto/detrace
Shows OpenFlow flows (OVS 3.4+):Usage
This information is added asovs-detrace event sections and combined with flow_tbl_lookup events by retis sort.
OVS Actions
Actions reported inaction_execute events:
OVS_ACTION_ATTR_OUTPUT: Output to portOVS_ACTION_ATTR_USERSPACE: Send to userspaceOVS_ACTION_ATTR_SET: Set fieldOVS_ACTION_ATTR_PUSH_VLAN: Push VLAN tagOVS_ACTION_ATTR_POP_VLAN: Pop VLAN tagOVS_ACTION_ATTR_RECIRC: RecirculateOVS_ACTION_ATTR_HASH: Calculate hashOVS_ACTION_ATTR_PUSH_MPLS: Push MPLS labelOVS_ACTION_ATTR_POP_MPLS: Pop MPLS label- And more…
Integration with Other Collectors
skb
Essential for seeing packet content:skb-tracking
Complete packet flow:skb-drop
Debug OVS drops:ct (Conntrack)
Track conntrack through OVS:nft (Netfilter)
Firewall and OVS interaction:dev
Interface tracking:Use Cases
Debug Missing Flows
Performance Analysis
Flow Installation Issues
Action Debugging
OpenFlow Troubleshooting
Technical Details
Kernel Types
Theovs collector activates when these types appear in probe arguments:
struct sk_buff *
USDT Probes
When--ovs-track is enabled, attaches to:
dpif_recv:recv_upcall: Upcall receiptdpif_netlink_operate__:op_flow_put: Flow installationdpif_netlink_operate__:op_flow_execute: Action execution
Tracking Maps
The collector maintains BPF maps for:- In-flight upcalls
- In-flight flow operations
- Upcall batches
- Queue ID generation
Garbage Collection
A background thread runs every 5 seconds to clean up old tracking entries (older than 60 seconds).Source Code References
- Collector:
retis/src/collect/collector/ovs/ovs.rs - Flow enrichment:
retis/src/collect/collector/ovs/flow_info.rs - eBPF hooks:
retis/src/collect/collector/ovs/bpf/ - Event factory:
retis/src/collect/collector/ovs/bpf.rs
Best Practices
- Use
--ovs-trackfor debugging: Essential for understanding upcall flow - Combine with skb-tracking: See complete packet journey
- Filter traffic: OVS can generate many events
- Save to file: Use post-processing with
retis sort - Check USDT support: Verify before using
--ovs-track - Consider rate limits: Adjust
--ovs-enrich-ratebased on load - Use flow enrichment selectively: Only when you need OpenFlow details
Performance Considerations
- Multiple probes: Several kernel and USDT probes
- Tracking overhead: Maps and GC thread
- USDT impact: Userspace probes have overhead
- Enrichment cost: Flow queries add daemon load
- Production use: Test performance impact before deployment
Troubleshooting
No OVS Events
If OVS events aren’t appearing:-
Check module is loaded:
-
Verify traffic is going through OVS:
-
Ensure collector is enabled:
USDT Probes Fail
If--ovs-track fails:
-
Check USDT support:
-
Verify Retis is in same namespace:
- See OVS USDT documentation
Flow Enrichment Fails
If--ovs-enrich-flows fails:
-
Check OVS version:
-
Verify control socket:
-
Test manually:
Missing Queue IDs
If events aren’t correlated:- Ensure
--ovs-trackis enabled - Check USDT probes are working
- Verify tracking maps aren’t full (check logs)
See Also
- OVS collector documentation - This page
- OVS event format - Event format details
- skb-tracking collector - Packet tracking
- OpenVSwitch Documentation
