Repository navigation
ethtool: add RX flow steering rule and table queries - #1233
Conversation
Add NetDevRxFlowGet to read a rule by location and decode its match, target queue and location into the types used by NetDevRxFlowInsert. Return an error wrapping ErrNotImplemented for unsupported match criteria and actions, so callers can distinguish unsupported rules from failures reading them. Honor extension flags and apply the existing matcher validation, including its rejection of IPv4-mapped IPv6 addresses. Test the decoder with distinct masks and active and ignored extension fields. Clarify the existing IPv6 input errors and the limited coverage of the loopback smoke test. Signed-off-by: Aaron Campbell <aaron@monkey.org>
Derive the rule-location buffer capacity from GRXCLSRLALL and rule_cnt instead of passing it separately. This lets the shared ioctl helper handle rule-table queries while keeping other commands fixed-size. Update the existing list caller and ABI tests. Signed-off-by: Aaron Campbell <aaron@monkey.org>
Add NetDevRxFlowTableGet to report the installed rule count, table size and support for automatic location selection with RX_CLS_LOC_ANY. Drivers may reject explicit locations or other special values. Some drivers, including mlx5, report the size only with GRXCLSRLALL. Follow ethtool and query it when the count reply omits the size, even for an empty table. Preserve the automatic-placement flag from the count reply. Test generic driver replies, changing rule counts and ioctl failures. Return those failures without retries. Signed-off-by: Aaron Campbell <aaron@monkey.org>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
RX flow serialization and validation ethtool_ntuple_linux.go, ethtool_ntuple_linux_test.go |
The list serializer now derives location capacity from the request. IPv6 validation rejects IPv4 and IPv4-mapped addresses. Insertion accepts queue-only actions. Tests cover serializer updates, action validation, IPv6 validation, and loopback outcomes. |
Table and action retrieval ethtool_ntuple_linux.go, ethtool_ntuple_linux_test.go |
Adds table metadata and action types and getters. Table retrieval falls back to a rule-list request when the count response has no size. Tests cover table parsing, fallback, ioctl errors, and action encodings. |
Typed RX flow rule decoding ethtool_ntuple_linux.go, ethtool_ntuple_linux_test.go |
Adds decoding for Ethernet and TCP/UDP IPv4 and IPv6 rules. Tests cover round trips, unsupported actions and extensions, and mapped IPv6 rejection. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Possibly related PRs
- vishvananda/netlink#1226: Adds the IPv6 matcher types and validation used by the RX flow rule decoder.
Suggested reviewers: aboch, acamatcisco
Merge Risk: 
Minimal · up to 4832f
-
No actionable issue remains from this review; the change is mergeable after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed -
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
Add Carrot credits or activate Agent usage billing to use Autofix |
Add NetDevRxFlowActionGet to report a rule's queue, RSS context, virtual function, drop or Wake-on-LAN action independently of its match criteria. This lets callers inspect rules that NetDevRxFlowGet does not support. Move Queue into NetDevRxFlow.Action so the rule's action is represented in one place. Keep insertion and NetDevRxFlowGet limited to direct queue actions, and reject other insertion actions before issuing the ioctl. Test queue-only actions and rejection of other action fields. Decode the special ring_cookie actions before the RSS flag and document that queue indices are relative to the VF when one is selected. Extend the action tests and unsupported-device smoke test. Reject unsupported action bits instead of silently interpreting driver-specific encodings as ordinary queue actions. Signed-off-by: Aaron Campbell <aaron@monkey.org>
0af512f to
4832fd3
Compare
|
Thanks @aarcamp please squash the commits into one |
I can do this, but each commit is already logically coherent, do you still want me to? FWIW I made 4 commits so each change could be reviewed independently, but posted as one PR to cut down on paperwork. :) |
|
LGTM |
Add NetDevRxFlowGet to read installed RX flow steering rules. Add NetDevRxFlowActionGet to inspect rule actions. Add NetDevRxFlowTableGet to query rule count, table capacity and automatic placement support.
These queries let callers reuse existing rules or choose valid insertion locations. Unit tests cover decoding, validation and both ethtool_rxnfc ABI layouts.
Validated on ConnectX-7 with IPv4/IPv6 rules, table exhaustion/recovery, and reuse of existing rules across Cilium agent restarts.
Summary by CodeRabbit
Summary by CodeRabbit