Skip to content

Commit ff76301

Browse files
gengwenjuanPaolo Abeni
authored andcommitted
nfp: flower: support case of match on ct_state(0/0x3f)
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. Signed-off-by: Wenjuan Geng <[email protected]> Reviewed-by: Louis Peens <[email protected]> Signed-off-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 35ffb66 commit ff76301

File tree

1 file changed

+7
-2
lines changed
  • drivers/net/ethernet/netronome/nfp/flower

1 file changed

+7
-2
lines changed

drivers/net/ethernet/netronome/nfp/flower/offload.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,9 +1301,14 @@ static bool offload_pre_check(struct flow_cls_offload *flow)
13011301
{
13021302
struct flow_rule *rule = flow_cls_offload_flow_rule(flow);
13031303
struct flow_dissector *dissector = rule->match.dissector;
1304+
struct flow_match_ct ct;
13041305

1305-
if (dissector->used_keys & BIT(FLOW_DISSECTOR_KEY_CT))
1306-
return false;
1306+
if (dissector->used_keys & BIT(FLOW_DISSECTOR_KEY_CT)) {
1307+
flow_rule_match_ct(rule, &ct);
1308+
/* Allow special case where CT match is all 0 */
1309+
if (memchr_inv(ct.key, 0, sizeof(*ct.key)))
1310+
return false;
1311+
}
13071312

13081313
if (flow->common.chain_index)
13091314
return false;

0 commit comments

Comments
 (0)