Skip to contentSkip to conversation

nfp: flower: support case of match on ct_state(0/0x3f)

PATCH Applied Simon Horman 2 participants 2 messages Aug 23, 2022 – Aug 25, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfp: flower: support case of match on ct_state(0/0x3f)

From: Wenjuan Geng <[email protected]>

is_post_ct_flow() function will process only ct_state ESTABLISHED, then offload_pre_check() function will check FLOW_DISSECTOR_KEY_CT flag. When config tc filter match ct_state(0/0x3f), dissector->used_keys with FLOW_DISSECTOR_KEY_CT bit, function offload_pre_check() will return false, so not offload. This is a special case that can be handled safely.

Therefore, modify to let initial packet which won't go through conntrack can be offloaded, as long as the cared ct fields are all zero.

---
 drivers/net/ethernet/netronome/nfp/flower/offload.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/netronome/nfp/flower/offload.c +7 -2
index 83c97154c0c7..3ab3e4536b99 100644
@@ -1301,9 +1301,14 @@ static bool offload_pre_check(struct flow_cls_offload *flow)
 {
 	struct flow_rule *rule = flow_cls_offload_flow_rule(flow);
 	struct flow_dissector *dissector = rule->match.dissector;
+	struct flow_match_ct ct;
 
-	if (dissector->used_keys & BIT(FLOW_DISSECTOR_KEY_CT))
-		return false;
+	if (dissector->used_keys & BIT(FLOW_DISSECTOR_KEY_CT)) {
+		flow_rule_match_ct(rule, &ct);
+		/* Allow special case where CT match is all 0 */
+		if (memchr_inv(ct.key, 0, sizeof(*ct.key)))
+			return false;
+	}
 
 	if (flow->common.chain_index)
 		return false;
Signature · 1 line
2.30.2
#1 lore raw
This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:

Quoted 10 lines · On Tue, 23 Aug 2022 11:01:22 +0200 you wrote:

From: Wenjuan Geng <[email protected]>

is_post_ct_flow() function will process only ct_state ESTABLISHED, then offload_pre_check() function will check FLOW_DISSECTOR_KEY_CT flag. When config tc filter match ct_state(0/0x3f), dissector->used_keys with FLOW_DISSECTOR_KEY_CT bit, function offload_pre_check() will return false, so not offload. This is a special case that can be handled safely.

[...]

Here is the summary with links:
- [net-next] nfp: flower: support case of match on ct_state(0/0x3f)

    https://git.kernel.org/netdev/net-next/c/ff763011ee7b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html