@@ -2607,6 +2607,54 @@ static void mlx5e_redirect_rqts_to_drop(struct mlx5e_priv *priv)
2607
2607
mlx5e_redirect_rqts (priv , drop_rrp );
2608
2608
}
2609
2609
2610
+ static const struct mlx5e_tirc_config tirc_default_config [MLX5E_NUM_INDIR_TIRS ] = {
2611
+ [MLX5E_TT_IPV4_TCP ] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV4 ,
2612
+ .l4_prot_type = MLX5_L4_PROT_TYPE_TCP ,
2613
+ .rx_hash_fields = MLX5_HASH_IP_L4PORTS ,
2614
+ },
2615
+ [MLX5E_TT_IPV6_TCP ] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV6 ,
2616
+ .l4_prot_type = MLX5_L4_PROT_TYPE_TCP ,
2617
+ .rx_hash_fields = MLX5_HASH_IP_L4PORTS ,
2618
+ },
2619
+ [MLX5E_TT_IPV4_UDP ] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV4 ,
2620
+ .l4_prot_type = MLX5_L4_PROT_TYPE_UDP ,
2621
+ .rx_hash_fields = MLX5_HASH_IP_L4PORTS ,
2622
+ },
2623
+ [MLX5E_TT_IPV6_UDP ] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV6 ,
2624
+ .l4_prot_type = MLX5_L4_PROT_TYPE_UDP ,
2625
+ .rx_hash_fields = MLX5_HASH_IP_L4PORTS ,
2626
+ },
2627
+ [MLX5E_TT_IPV4_IPSEC_AH ] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV4 ,
2628
+ .l4_prot_type = 0 ,
2629
+ .rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI ,
2630
+ },
2631
+ [MLX5E_TT_IPV6_IPSEC_AH ] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV6 ,
2632
+ .l4_prot_type = 0 ,
2633
+ .rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI ,
2634
+ },
2635
+ [MLX5E_TT_IPV4_IPSEC_ESP ] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV4 ,
2636
+ .l4_prot_type = 0 ,
2637
+ .rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI ,
2638
+ },
2639
+ [MLX5E_TT_IPV6_IPSEC_ESP ] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV6 ,
2640
+ .l4_prot_type = 0 ,
2641
+ .rx_hash_fields = MLX5_HASH_IP_IPSEC_SPI ,
2642
+ },
2643
+ [MLX5E_TT_IPV4 ] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV4 ,
2644
+ .l4_prot_type = 0 ,
2645
+ .rx_hash_fields = MLX5_HASH_IP ,
2646
+ },
2647
+ [MLX5E_TT_IPV6 ] = { .l3_prot_type = MLX5_L3_PROT_TYPE_IPV6 ,
2648
+ .l4_prot_type = 0 ,
2649
+ .rx_hash_fields = MLX5_HASH_IP ,
2650
+ },
2651
+ };
2652
+
2653
+ struct mlx5e_tirc_config mlx5e_tirc_get_default_config (enum mlx5e_traffic_types tt )
2654
+ {
2655
+ return tirc_default_config [tt ];
2656
+ }
2657
+
2610
2658
static void mlx5e_build_tir_ctx_lro (struct mlx5e_params * params , void * tirc )
2611
2659
{
2612
2660
if (!params -> lro_en )
@@ -2623,24 +2671,12 @@ static void mlx5e_build_tir_ctx_lro(struct mlx5e_params *params, void *tirc)
2623
2671
}
2624
2672
2625
2673
void mlx5e_build_indir_tir_ctx_hash (struct mlx5e_params * params ,
2626
- enum mlx5e_traffic_types tt ,
2674
+ const struct mlx5e_tirc_config * ttconfig ,
2627
2675
void * tirc , bool inner )
2628
2676
{
2629
2677
void * hfso = inner ? MLX5_ADDR_OF (tirc , tirc , rx_hash_field_selector_inner ) :
2630
2678
MLX5_ADDR_OF (tirc , tirc , rx_hash_field_selector_outer );
2631
2679
2632
- #define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\
2633
- MLX5_HASH_FIELD_SEL_DST_IP)
2634
-
2635
- #define MLX5_HASH_IP_L4PORTS (MLX5_HASH_FIELD_SEL_SRC_IP |\
2636
- MLX5_HASH_FIELD_SEL_DST_IP |\
2637
- MLX5_HASH_FIELD_SEL_L4_SPORT |\
2638
- MLX5_HASH_FIELD_SEL_L4_DPORT)
2639
-
2640
- #define MLX5_HASH_IP_IPSEC_SPI (MLX5_HASH_FIELD_SEL_SRC_IP |\
2641
- MLX5_HASH_FIELD_SEL_DST_IP |\
2642
- MLX5_HASH_FIELD_SEL_IPSEC_SPI)
2643
-
2644
2680
MLX5_SET (tirc , tirc , rx_hash_fn , mlx5e_rx_hash_fn (params -> rss_hfunc ));
2645
2681
if (params -> rss_hfunc == ETH_RSS_HASH_TOP ) {
2646
2682
void * rss_key = MLX5_ADDR_OF (tirc , tirc ,
@@ -2651,88 +2687,12 @@ void mlx5e_build_indir_tir_ctx_hash(struct mlx5e_params *params,
2651
2687
MLX5_SET (tirc , tirc , rx_hash_symmetric , 1 );
2652
2688
memcpy (rss_key , params -> toeplitz_hash_key , len );
2653
2689
}
2654
-
2655
- switch (tt ) {
2656
- case MLX5E_TT_IPV4_TCP :
2657
- MLX5_SET (rx_hash_field_select , hfso , l3_prot_type ,
2658
- MLX5_L3_PROT_TYPE_IPV4 );
2659
- MLX5_SET (rx_hash_field_select , hfso , l4_prot_type ,
2660
- MLX5_L4_PROT_TYPE_TCP );
2661
- MLX5_SET (rx_hash_field_select , hfso , selected_fields ,
2662
- MLX5_HASH_IP_L4PORTS );
2663
- break ;
2664
-
2665
- case MLX5E_TT_IPV6_TCP :
2666
- MLX5_SET (rx_hash_field_select , hfso , l3_prot_type ,
2667
- MLX5_L3_PROT_TYPE_IPV6 );
2668
- MLX5_SET (rx_hash_field_select , hfso , l4_prot_type ,
2669
- MLX5_L4_PROT_TYPE_TCP );
2670
- MLX5_SET (rx_hash_field_select , hfso , selected_fields ,
2671
- MLX5_HASH_IP_L4PORTS );
2672
- break ;
2673
-
2674
- case MLX5E_TT_IPV4_UDP :
2675
- MLX5_SET (rx_hash_field_select , hfso , l3_prot_type ,
2676
- MLX5_L3_PROT_TYPE_IPV4 );
2677
- MLX5_SET (rx_hash_field_select , hfso , l4_prot_type ,
2678
- MLX5_L4_PROT_TYPE_UDP );
2679
- MLX5_SET (rx_hash_field_select , hfso , selected_fields ,
2680
- MLX5_HASH_IP_L4PORTS );
2681
- break ;
2682
-
2683
- case MLX5E_TT_IPV6_UDP :
2684
- MLX5_SET (rx_hash_field_select , hfso , l3_prot_type ,
2685
- MLX5_L3_PROT_TYPE_IPV6 );
2686
- MLX5_SET (rx_hash_field_select , hfso , l4_prot_type ,
2687
- MLX5_L4_PROT_TYPE_UDP );
2688
- MLX5_SET (rx_hash_field_select , hfso , selected_fields ,
2689
- MLX5_HASH_IP_L4PORTS );
2690
- break ;
2691
-
2692
- case MLX5E_TT_IPV4_IPSEC_AH :
2693
- MLX5_SET (rx_hash_field_select , hfso , l3_prot_type ,
2694
- MLX5_L3_PROT_TYPE_IPV4 );
2695
- MLX5_SET (rx_hash_field_select , hfso , selected_fields ,
2696
- MLX5_HASH_IP_IPSEC_SPI );
2697
- break ;
2698
-
2699
- case MLX5E_TT_IPV6_IPSEC_AH :
2700
- MLX5_SET (rx_hash_field_select , hfso , l3_prot_type ,
2701
- MLX5_L3_PROT_TYPE_IPV6 );
2702
- MLX5_SET (rx_hash_field_select , hfso , selected_fields ,
2703
- MLX5_HASH_IP_IPSEC_SPI );
2704
- break ;
2705
-
2706
- case MLX5E_TT_IPV4_IPSEC_ESP :
2707
- MLX5_SET (rx_hash_field_select , hfso , l3_prot_type ,
2708
- MLX5_L3_PROT_TYPE_IPV4 );
2709
- MLX5_SET (rx_hash_field_select , hfso , selected_fields ,
2710
- MLX5_HASH_IP_IPSEC_SPI );
2711
- break ;
2712
-
2713
- case MLX5E_TT_IPV6_IPSEC_ESP :
2714
- MLX5_SET (rx_hash_field_select , hfso , l3_prot_type ,
2715
- MLX5_L3_PROT_TYPE_IPV6 );
2716
- MLX5_SET (rx_hash_field_select , hfso , selected_fields ,
2717
- MLX5_HASH_IP_IPSEC_SPI );
2718
- break ;
2719
-
2720
- case MLX5E_TT_IPV4 :
2721
- MLX5_SET (rx_hash_field_select , hfso , l3_prot_type ,
2722
- MLX5_L3_PROT_TYPE_IPV4 );
2723
- MLX5_SET (rx_hash_field_select , hfso , selected_fields ,
2724
- MLX5_HASH_IP );
2725
- break ;
2726
-
2727
- case MLX5E_TT_IPV6 :
2728
- MLX5_SET (rx_hash_field_select , hfso , l3_prot_type ,
2729
- MLX5_L3_PROT_TYPE_IPV6 );
2730
- MLX5_SET (rx_hash_field_select , hfso , selected_fields ,
2731
- MLX5_HASH_IP );
2732
- break ;
2733
- default :
2734
- WARN_ONCE (true, "%s: bad traffic type!\n" , __func__ );
2735
- }
2690
+ MLX5_SET (rx_hash_field_select , hfso , l3_prot_type ,
2691
+ ttconfig -> l3_prot_type );
2692
+ MLX5_SET (rx_hash_field_select , hfso , l4_prot_type ,
2693
+ ttconfig -> l4_prot_type );
2694
+ MLX5_SET (rx_hash_field_select , hfso , selected_fields ,
2695
+ ttconfig -> rx_hash_fields );
2736
2696
}
2737
2697
2738
2698
void mlx5e_modify_tirs_hash (struct mlx5e_priv * priv , void * in , int inlen )
@@ -2746,8 +2706,9 @@ void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen)
2746
2706
2747
2707
for (tt = 0 ; tt < MLX5E_NUM_INDIR_TIRS ; tt ++ ) {
2748
2708
memset (tirc , 0 , ctxlen );
2749
- mlx5e_build_indir_tir_ctx_hash (& priv -> channels .params , tt , tirc ,
2750
- false);
2709
+ mlx5e_build_indir_tir_ctx_hash (& priv -> channels .params ,
2710
+ & tirc_default_config [tt ],
2711
+ tirc , false);
2751
2712
mlx5_core_modify_tir (mdev , priv -> indir_tir [tt ].tirn , in , inlen );
2752
2713
}
2753
2714
@@ -2756,8 +2717,9 @@ void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen)
2756
2717
2757
2718
for (tt = 0 ; tt < MLX5E_NUM_INDIR_TIRS ; tt ++ ) {
2758
2719
memset (tirc , 0 , ctxlen );
2759
- mlx5e_build_indir_tir_ctx_hash (& priv -> channels .params , tt , tirc ,
2760
- true);
2720
+ mlx5e_build_indir_tir_ctx_hash (& priv -> channels .params ,
2721
+ & tirc_default_config [tt ],
2722
+ tirc , true);
2761
2723
mlx5_core_modify_tir (mdev , priv -> inner_indir_tir [tt ].tirn , in ,
2762
2724
inlen );
2763
2725
}
@@ -2816,7 +2778,8 @@ static void mlx5e_build_inner_indir_tir_ctx(struct mlx5e_priv *priv,
2816
2778
MLX5_SET (tirc , tirc , indirect_table , priv -> indir_rqt .rqtn );
2817
2779
MLX5_SET (tirc , tirc , tunneled_offload_en , 0x1 );
2818
2780
2819
- mlx5e_build_indir_tir_ctx_hash (& priv -> channels .params , tt , tirc , true);
2781
+ mlx5e_build_indir_tir_ctx_hash (& priv -> channels .params ,
2782
+ & tirc_default_config [tt ], tirc , true);
2820
2783
}
2821
2784
2822
2785
static int mlx5e_set_mtu (struct mlx5_core_dev * mdev ,
@@ -3208,7 +3171,9 @@ static void mlx5e_build_indir_tir_ctx(struct mlx5e_priv *priv,
3208
3171
3209
3172
MLX5_SET (tirc , tirc , disp_type , MLX5_TIRC_DISP_TYPE_INDIRECT );
3210
3173
MLX5_SET (tirc , tirc , indirect_table , priv -> indir_rqt .rqtn );
3211
- mlx5e_build_indir_tir_ctx_hash (& priv -> channels .params , tt , tirc , false);
3174
+
3175
+ mlx5e_build_indir_tir_ctx_hash (& priv -> channels .params ,
3176
+ & tirc_default_config [tt ], tirc , false);
3212
3177
}
3213
3178
3214
3179
static void mlx5e_build_direct_tir_ctx (struct mlx5e_priv * priv , u32 rqtn , u32 * tirc )
0 commit comments