-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
DPDK rte_flow rules RSS support for more NICs - v2 #12317
base: master
Are you sure you want to change the base?
Conversation
Move and adjust the base of RSS configuration from util-dpdk-i40e.c to a new file that can be later utilized by other cards. RSS configuration can be configured via rte_flow rules. This is useful for possible future features such as specific header offload (vxlan, nvgre) also implemented via rte_flow rules, as rte_flow rules can be chained via groups and priorities. i40e uses multiple different rte_flow rules to setup RSS. At first, function DeviceSetRSSFlowQueues() is used to setup rx queues. This rule matches all types of traffic, so the equivalent to dpdk-testpmd pattern would be "pattern end" This rule can not contain hash types (ipv4, ipv6 etc.) nor hash key. The hash function used here is RTE_ETH_HASH_FUNCTION_DEFAULT. The syntax in dpdk-testpmd for this rule with attributes: port index == 0 used rx queue indices == 0 1 2 3 is as follows: "flow create 0 ingress pattern end actions rss queues 0 1 2 3 end func default / end" The other rules configured by i40eDeviceSetRSSFlowIPv4() and i40eDeviceSetRSSFlowIPv6() match specific type of traffic by l4 protocol (none, TCP, UDP, SCTP). For example, pattern to match l3 ipv4 with l4 tcp traffic in dpdk-testpmd syntax would be equivalent of "pattern eth / ipv4 / tcp / end". These rules can not have rx queues configured, but have hash types (ipv4 src dst / ipv6 src dst) and 52 bytes long symmetric hash key configured. The hash function RTE_ETH_HASH_FUNCTION_TOEPLITZ used in these rules hashes symmetricaly due to the symmetric hash key. The syntax in dpdk-testpmd for rule to match ipv4-tcp traffic with attributes: port index == 0 <hash_key> == 6d5a symmetric hash key is as follows: "flow create 0 ingress pattern eth / ipv4 / tcp / end actions rss types ipv4 end queues end key <hash_key> key_len 52 func toeplitz / end" (queues need to be set to NULL) Ticket: 7337
ixgbe driver requires different configuration of RSS rte_flow rule than i40e, with just one generic rule matching all traffic. The generic rule configured by DeviceCreateRSSFlowGeneric() has pattern equivalent to "pattern eth / end" in dpdk-testpmd syntax. The rule must have rx queues configured. The rule hashes traffic to different queues based on ipv4 and ipv6 hash types (ipv4 src dst / ipv6 src dst). The hash key is 40 bytes long symmetric hash key. ixgbe does not support any other hash function than RTE_ETH_HASH_FUNCTION_DEFAULT. The syntax in dpdk-testpmd for this rule with attributes: port index == 0 used rx queue indices == 0 1 2 3 <hash_key> == 6d5a symmetric hash key is as follows: "flow create 0 ingress pattern eth / end actions rss types ipv4 ipv6 end queues 0 1 2 3 end key <hash_key> key_len 40 func default / end" Ticket: 7337
ice driver requires 2 rte_flow rules for matching and redistributing incoming traffic with RSS. The rules set up by iceDeviceSetRSSFlowIPv4() and iceDeviceSetRSSFlowIPv6() are different only in the pattern ("pattern eth / ipv4 / end" or "pattern eth / ipv6 / end" in dpdk-testpmd syntax) and in the hash type (ipv4 src dst / ipv6 src dst). ice will match all ipv4 or ipv6 traffic independently of following l4 protocol. The rules can not have queues configured, implicitly they will use all queues available. The hash function is set to RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ as the hash key also can not be set explicitly. The syntax in dpdk-testpmd for rule to match all ipv4 traffic with attributes: port index == 0 is as follows: "flow create 0 ingress pattern eth / ipv4 / end actions rss types ipv4 end queues end func symmetric_toeplitz / end" (queues need to be set to NULL) Ticket: 7337
mlx5 driver uses only one generic rte_flow RSS rule to match all traffic The configuration of this rule is the same as for ixgbe driver except the hash function is not RTE_ETH_HASH_FUNCTION_DEFAULT but RTE_ETH_HASH_FUNCTION_TOEPLITZ. The syntax in dpdk-testpmd for this rule with attributes: port index == 0 used rx queue indices == 0 1 2 3 <hash_key> == 6d5a symmetric hash key is as follows: "flow create 0 ingress pattern eth / end actions rss types ipv4 ipv6 end queues 0 1 2 3 end key <hash_key> key_len 40 func toeplitz / end" Ticket: 7337
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #12317 +/- ##
==========================================
- Coverage 83.26% 83.17% -0.10%
==========================================
Files 912 915 +3
Lines 257643 257719 +76
==========================================
- Hits 214521 214352 -169
- Misses 43122 43367 +245
Flags with carried forward coverage won't be shown. Click here to find out more. |
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.
Some minor comments inline.
@lukashino can you review the logic?
if (retval != 0) { | ||
retval = rte_flow_flush(port_id, &flush_error); | ||
if (retval != 0) { | ||
SCLogError("Unable to flush rte_flow rules of %s: %s Flush error msg: %s", port_name, |
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 would like to see all error messages use a pattern of
0000:XXXX: unable to ...
, so use the interface identifier as a prefix.
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.
Okay, I will also update SCLogDebugs in src/util-dpdk-rss.c to match this pattern.
* \param rss_conf RSS configuration | ||
* \return int 0 on success, a negative errno value otherwise | ||
*/ | ||
int DeviceSetRSSFlowQueues(int port_id, const char *port_name, struct rte_flow_action_rss rss_conf) |
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.
these are public functions using the Device
prefix. I think we need a Dpdk
prefix here, as Device
has another meaning in our codebase.
I internally reviewed this before but I'll give it one more pass. Most of my comments were addressed. I'll also individually test it to make sure everything works. |
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.
[56025 - W#01-af:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#01-af:00.1) received packets 1200
[56026 - W#02-af:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#02-af:00.1) received packets 0
[56027 - W#03-af:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#03-af:00.1) received packets 0
[56028 - W#04-af:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#04-af:00.1) received packets 0
[56029 - W#01-19:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#01-19:00.1) received packets 602
[56030 - W#02-19:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#02-19:00.1) received packets 198
[56031 - W#03-19:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#03-19:00.1) received packets 198
[56032 - W#04-19:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#04-19:00.1) received packets 202
[56033 - W#01-3b:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#01-3b:00.1) received packets 602
[56034 - W#02-3b:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#02-3b:00.1) received packets 198
[56035 - W#03-3b:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#03-3b:00.1) received packets 198
[56036 - W#04-3b:00.1] 2025-01-12 18:55:33 Perf: dpdk: (W#04-3b:00.1) received packets 202
The testing shows that the ice
card is not distributing the traffic correctly. Tested on DPDK v22.11.1
Baseline results:
[56593 - W#01-af:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#01-af:00.1) received packets 602 # ice
[56594 - W#02-af:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#02-af:00.1) received packets 198
[56595 - W#03-af:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#03-af:00.1) received packets 198
[56596 - W#04-af:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#04-af:00.1) received packets 202
[56597 - W#01-19:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#01-19:00.1) received packets 200 # i40e
[56598 - W#02-19:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#02-19:00.1) received packets 200
[56599 - W#03-19:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#03-19:00.1) received packets 600
[56600 - W#04-19:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#04-19:00.1) received packets 200
[56601 - W#01-3b:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#01-3b:00.1) received packets 602 # mlx5
[56602 - W#02-3b:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#02-3b:00.1) received packets 198
[56603 - W#03-3b:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#03-3b:00.1) received packets 198
[56604 - W#04-3b:00.1] 2025-01-12 19:02:27 Perf: dpdk: (W#04-3b:00.1) received packets 202
Edit: finished testing of ixgbe
too, and that works ok.
Otherwise, the changes look good to me. |
Contribution style:
https://docs.suricata.io/en/latest/devguide/contributing/contribution-process.html
Our Contribution agreements:
https://suricata.io/about/contribution-agreement/ (note: this is only required once)
Changes (if applicable):
https://redmine.openinfosecfoundation.org/projects/suricata/issues
Link to ticket: https://redmine.openinfosecfoundation.org/issues/7337
Previous PR #12315
Describe changes:
v2
v1
Ticket: #7337