@@ -569,15 +569,29 @@ static void tx_destroy(struct mlx5_core_dev *mdev, struct mlx5e_ipsec_tx *tx,
569
569
mlx5_destroy_flow_table (tx -> ft .status );
570
570
}
571
571
572
- static int tx_create (struct mlx5_core_dev * mdev , struct mlx5e_ipsec_tx * tx ,
572
+ static void ipsec_tx_create_attr_set (struct mlx5e_ipsec * ipsec ,
573
+ struct mlx5e_ipsec_tx * tx ,
574
+ struct mlx5e_ipsec_tx_create_attr * attr )
575
+ {
576
+ attr -> prio = 0 ;
577
+ attr -> pol_level = 0 ;
578
+ attr -> sa_level = 1 ;
579
+ attr -> cnt_level = 2 ;
580
+ attr -> chains_ns = MLX5_FLOW_NAMESPACE_EGRESS_IPSEC ;
581
+ }
582
+
583
+ static int tx_create (struct mlx5e_ipsec * ipsec , struct mlx5e_ipsec_tx * tx ,
573
584
struct mlx5_ipsec_fs * roce )
574
585
{
586
+ struct mlx5_core_dev * mdev = ipsec -> mdev ;
587
+ struct mlx5e_ipsec_tx_create_attr attr ;
575
588
struct mlx5_flow_destination dest = {};
576
589
struct mlx5_flow_table * ft ;
577
590
u32 flags = 0 ;
578
591
int err ;
579
592
580
- ft = ipsec_ft_create (tx -> ns , 2 , 0 , 1 , 0 );
593
+ ipsec_tx_create_attr_set (ipsec , tx , & attr );
594
+ ft = ipsec_ft_create (tx -> ns , attr .cnt_level , attr .prio , 1 , 0 );
581
595
if (IS_ERR (ft ))
582
596
return PTR_ERR (ft );
583
597
tx -> ft .status = ft ;
@@ -590,7 +604,7 @@ static int tx_create(struct mlx5_core_dev *mdev, struct mlx5e_ipsec_tx *tx,
590
604
tx -> allow_tunnel_mode = mlx5_eswitch_block_encap (mdev );
591
605
if (tx -> allow_tunnel_mode )
592
606
flags = MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT ;
593
- ft = ipsec_ft_create (tx -> ns , 1 , 0 , 4 , flags );
607
+ ft = ipsec_ft_create (tx -> ns , attr . sa_level , attr . prio , 4 , flags );
594
608
if (IS_ERR (ft )) {
595
609
err = PTR_ERR (ft );
596
610
goto err_sa_ft ;
@@ -599,7 +613,7 @@ static int tx_create(struct mlx5_core_dev *mdev, struct mlx5e_ipsec_tx *tx,
599
613
600
614
if (mlx5_ipsec_device_caps (mdev ) & MLX5_IPSEC_CAP_PRIO ) {
601
615
tx -> chains = ipsec_chains_create (
602
- mdev , tx -> ft .sa , MLX5_FLOW_NAMESPACE_EGRESS_IPSEC , 0 , 0 ,
616
+ mdev , tx -> ft .sa , attr . chains_ns , attr . prio , attr . pol_level ,
603
617
& tx -> ft .pol );
604
618
if (IS_ERR (tx -> chains )) {
605
619
err = PTR_ERR (tx -> chains );
@@ -609,7 +623,7 @@ static int tx_create(struct mlx5_core_dev *mdev, struct mlx5e_ipsec_tx *tx,
609
623
goto connect_roce ;
610
624
}
611
625
612
- ft = ipsec_ft_create (tx -> ns , 0 , 0 , 2 , 0 );
626
+ ft = ipsec_ft_create (tx -> ns , attr . pol_level , attr . prio , 2 , 0 );
613
627
if (IS_ERR (ft )) {
614
628
err = PTR_ERR (ft );
615
629
goto err_pol_ft ;
@@ -656,7 +670,7 @@ static int tx_get(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
656
670
if (tx -> ft .refcnt )
657
671
goto skip ;
658
672
659
- err = tx_create (mdev , tx , ipsec -> roce );
673
+ err = tx_create (ipsec , tx , ipsec -> roce );
660
674
if (err )
661
675
return err ;
662
676
0 commit comments