35
35
#define MLX5_CT_STATE_REPLY_BIT BIT(4)
36
36
#define MLX5_CT_STATE_RELATED_BIT BIT(5)
37
37
#define MLX5_CT_STATE_INVALID_BIT BIT(6)
38
+ #define MLX5_CT_STATE_NEW_BIT BIT(7)
38
39
39
40
#define MLX5_CT_LABELS_BITS MLX5_REG_MAPPING_MBITS(LABELS_TO_REG)
40
41
#define MLX5_CT_LABELS_MASK MLX5_REG_MAPPING_MASK(LABELS_TO_REG)
@@ -721,12 +722,14 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv,
721
722
DECLARE_MOD_HDR_ACTS_ACTIONS (actions_arr , MLX5_CT_MIN_MOD_ACTS );
722
723
DECLARE_MOD_HDR_ACTS (mod_acts , actions_arr );
723
724
struct flow_action_entry * meta ;
725
+ enum ip_conntrack_info ctinfo ;
724
726
u16 ct_state = 0 ;
725
727
int err ;
726
728
727
729
meta = mlx5_tc_ct_get_ct_metadata_action (flow_rule );
728
730
if (!meta )
729
731
return - EOPNOTSUPP ;
732
+ ctinfo = meta -> ct_metadata .cookie & NFCT_INFOMASK ;
730
733
731
734
err = mlx5_get_label_mapping (ct_priv , meta -> ct_metadata .labels ,
732
735
& attr -> ct_attr .ct_labels_id );
@@ -742,7 +745,8 @@ mlx5_tc_ct_entry_create_mod_hdr(struct mlx5_tc_ct_priv *ct_priv,
742
745
ct_state |= MLX5_CT_STATE_NAT_BIT ;
743
746
}
744
747
745
- ct_state |= MLX5_CT_STATE_ESTABLISHED_BIT | MLX5_CT_STATE_TRK_BIT ;
748
+ ct_state |= MLX5_CT_STATE_TRK_BIT ;
749
+ ct_state |= ctinfo == IP_CT_NEW ? MLX5_CT_STATE_NEW_BIT : MLX5_CT_STATE_ESTABLISHED_BIT ;
746
750
ct_state |= meta -> ct_metadata .orig_dir ? 0 : MLX5_CT_STATE_REPLY_BIT ;
747
751
err = mlx5_tc_ct_entry_set_registers (ct_priv , & mod_acts ,
748
752
ct_state ,
@@ -1181,16 +1185,12 @@ mlx5_tc_ct_block_flow_offload_add(struct mlx5_ct_ft *ft,
1181
1185
struct mlx5_tc_ct_priv * ct_priv = ft -> ct_priv ;
1182
1186
struct flow_action_entry * meta_action ;
1183
1187
unsigned long cookie = flow -> cookie ;
1184
- enum ip_conntrack_info ctinfo ;
1185
1188
struct mlx5_ct_entry * entry ;
1186
1189
int err ;
1187
1190
1188
1191
meta_action = mlx5_tc_ct_get_ct_metadata_action (flow_rule );
1189
1192
if (!meta_action )
1190
1193
return - EOPNOTSUPP ;
1191
- ctinfo = meta_action -> ct_metadata .cookie & NFCT_INFOMASK ;
1192
- if (ctinfo == IP_CT_NEW )
1193
- return - EOPNOTSUPP ;
1194
1194
1195
1195
spin_lock_bh (& ct_priv -> ht_lock );
1196
1196
entry = rhashtable_lookup_fast (& ft -> ct_entries_ht , & cookie , cts_ht_params );
@@ -1443,7 +1443,7 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv,
1443
1443
struct mlx5_ct_attr * ct_attr ,
1444
1444
struct netlink_ext_ack * extack )
1445
1445
{
1446
- bool trk , est , untrk , unest , new , rpl , unrpl , rel , unrel , inv , uninv ;
1446
+ bool trk , est , untrk , unnew , unest , new , rpl , unrpl , rel , unrel , inv , uninv ;
1447
1447
struct flow_rule * rule = flow_cls_offload_flow_rule (f );
1448
1448
struct flow_dissector_key_ct * mask , * key ;
1449
1449
u32 ctstate = 0 , ctstate_mask = 0 ;
@@ -1489,15 +1489,18 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv,
1489
1489
rel = ct_state_on & TCA_FLOWER_KEY_CT_FLAGS_RELATED ;
1490
1490
inv = ct_state_on & TCA_FLOWER_KEY_CT_FLAGS_INVALID ;
1491
1491
untrk = ct_state_off & TCA_FLOWER_KEY_CT_FLAGS_TRACKED ;
1492
+ unnew = ct_state_off & TCA_FLOWER_KEY_CT_FLAGS_NEW ;
1492
1493
unest = ct_state_off & TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED ;
1493
1494
unrpl = ct_state_off & TCA_FLOWER_KEY_CT_FLAGS_REPLY ;
1494
1495
unrel = ct_state_off & TCA_FLOWER_KEY_CT_FLAGS_RELATED ;
1495
1496
uninv = ct_state_off & TCA_FLOWER_KEY_CT_FLAGS_INVALID ;
1496
1497
1497
1498
ctstate |= trk ? MLX5_CT_STATE_TRK_BIT : 0 ;
1499
+ ctstate |= new ? MLX5_CT_STATE_NEW_BIT : 0 ;
1498
1500
ctstate |= est ? MLX5_CT_STATE_ESTABLISHED_BIT : 0 ;
1499
1501
ctstate |= rpl ? MLX5_CT_STATE_REPLY_BIT : 0 ;
1500
1502
ctstate_mask |= (untrk || trk ) ? MLX5_CT_STATE_TRK_BIT : 0 ;
1503
+ ctstate_mask |= (unnew || new ) ? MLX5_CT_STATE_NEW_BIT : 0 ;
1501
1504
ctstate_mask |= (unest || est ) ? MLX5_CT_STATE_ESTABLISHED_BIT : 0 ;
1502
1505
ctstate_mask |= (unrpl || rpl ) ? MLX5_CT_STATE_REPLY_BIT : 0 ;
1503
1506
ctstate_mask |= unrel ? MLX5_CT_STATE_RELATED_BIT : 0 ;
@@ -1515,12 +1518,6 @@ mlx5_tc_ct_match_add(struct mlx5_tc_ct_priv *priv,
1515
1518
return - EOPNOTSUPP ;
1516
1519
}
1517
1520
1518
- if (new ) {
1519
- NL_SET_ERR_MSG_MOD (extack ,
1520
- "matching on ct_state +new isn't supported" );
1521
- return - EOPNOTSUPP ;
1522
- }
1523
-
1524
1521
if (mask -> ct_zone )
1525
1522
mlx5e_tc_match_to_reg_match (spec , ZONE_TO_REG ,
1526
1523
key -> ct_zone , MLX5_CT_ZONE_MASK );
0 commit comments