@@ -778,48 +778,48 @@ static void list_add_flow_table(struct mlx5_flow_table *ft,
778778}
779779
780780static struct mlx5_flow_table * __mlx5_create_flow_table (struct mlx5_flow_namespace * ns ,
781+ struct mlx5_flow_table_attr * ft_attr ,
781782 enum fs_flow_table_op_mod op_mod ,
782- u16 vport , int prio ,
783- int max_fte , u32 level ,
784- u32 flags )
783+ u16 vport )
785784{
785+ struct mlx5_flow_root_namespace * root = find_root (& ns -> node );
786786 struct mlx5_flow_table * next_ft = NULL ;
787+ struct fs_prio * fs_prio = NULL ;
787788 struct mlx5_flow_table * ft ;
788- int err ;
789789 int log_table_sz ;
790- struct mlx5_flow_root_namespace * root =
791- find_root (& ns -> node );
792- struct fs_prio * fs_prio = NULL ;
790+ int err ;
793791
794792 if (!root ) {
795793 pr_err ("mlx5: flow steering failed to find root of namespace\n" );
796794 return ERR_PTR (- ENODEV );
797795 }
798796
799797 mutex_lock (& root -> chain_lock );
800- fs_prio = find_prio (ns , prio );
798+ fs_prio = find_prio (ns , ft_attr -> prio );
801799 if (!fs_prio ) {
802800 err = - EINVAL ;
803801 goto unlock_root ;
804802 }
805- if (level >= fs_prio -> num_levels ) {
803+ if (ft_attr -> level >= fs_prio -> num_levels ) {
806804 err = - ENOSPC ;
807805 goto unlock_root ;
808806 }
809807 /* The level is related to the
810808 * priority level range.
811809 */
812- level += fs_prio -> start_level ;
813- ft = alloc_flow_table (level ,
810+ ft_attr -> level += fs_prio -> start_level ;
811+ ft = alloc_flow_table (ft_attr -> level ,
814812 vport ,
815- max_fte ? roundup_pow_of_two (max_fte ) : 0 ,
813+ ft_attr -> max_fte ? roundup_pow_of_two (ft_attr -> max_fte ) : 0 ,
816814 root -> table_type ,
817- op_mod , flags );
815+ op_mod , ft_attr -> flags );
818816 if (!ft ) {
819817 err = - ENOMEM ;
820818 goto unlock_root ;
821819 }
822820
821+ ft -> underlay_qpn = ft_attr -> underlay_qpn ;
822+
823823 tree_init_node (& ft -> node , 1 , del_flow_table );
824824 log_table_sz = ft -> max_fte ? ilog2 (ft -> max_fte ) : 0 ;
825825 next_ft = find_next_chained_ft (fs_prio );
@@ -849,44 +849,56 @@ static struct mlx5_flow_table *__mlx5_create_flow_table(struct mlx5_flow_namespa
849849}
850850
851851struct mlx5_flow_table * mlx5_create_flow_table (struct mlx5_flow_namespace * ns ,
852- int prio , int max_fte ,
853- u32 level ,
854- u32 flags )
852+ struct mlx5_flow_table_attr * ft_attr )
855853{
856- return __mlx5_create_flow_table (ns , FS_FT_OP_MOD_NORMAL , 0 , prio ,
857- max_fte , level , flags );
854+ return __mlx5_create_flow_table (ns , ft_attr , FS_FT_OP_MOD_NORMAL , 0 );
858855}
859856
860857struct mlx5_flow_table * mlx5_create_vport_flow_table (struct mlx5_flow_namespace * ns ,
861858 int prio , int max_fte ,
862859 u32 level , u16 vport )
863860{
864- return __mlx5_create_flow_table (ns , FS_FT_OP_MOD_NORMAL , vport , prio ,
865- max_fte , level , 0 );
861+ struct mlx5_flow_table_attr ft_attr = {};
862+
863+ ft_attr .max_fte = max_fte ;
864+ ft_attr .level = level ;
865+ ft_attr .prio = prio ;
866+
867+ return __mlx5_create_flow_table (ns , & ft_attr , FS_FT_OP_MOD_NORMAL , 0 );
866868}
867869
868- struct mlx5_flow_table * mlx5_create_lag_demux_flow_table (
869- struct mlx5_flow_namespace * ns ,
870- int prio , u32 level )
870+ struct mlx5_flow_table *
871+ mlx5_create_lag_demux_flow_table ( struct mlx5_flow_namespace * ns ,
872+ int prio , u32 level )
871873{
872- return __mlx5_create_flow_table (ns , FS_FT_OP_MOD_LAG_DEMUX , 0 , prio , 0 ,
873- level , 0 );
874+ struct mlx5_flow_table_attr ft_attr = {};
875+
876+ ft_attr .level = level ;
877+ ft_attr .prio = prio ;
878+ return __mlx5_create_flow_table (ns , & ft_attr , FS_FT_OP_MOD_LAG_DEMUX , 0 );
874879}
875880EXPORT_SYMBOL (mlx5_create_lag_demux_flow_table );
876881
877- struct mlx5_flow_table * mlx5_create_auto_grouped_flow_table (struct mlx5_flow_namespace * ns ,
878- int prio ,
879- int num_flow_table_entries ,
880- int max_num_groups ,
881- u32 level ,
882- u32 flags )
882+ struct mlx5_flow_table *
883+ mlx5_create_auto_grouped_flow_table (struct mlx5_flow_namespace * ns ,
884+ int prio ,
885+ int num_flow_table_entries ,
886+ int max_num_groups ,
887+ u32 level ,
888+ u32 flags )
883889{
890+ struct mlx5_flow_table_attr ft_attr = {};
884891 struct mlx5_flow_table * ft ;
885892
886893 if (max_num_groups > num_flow_table_entries )
887894 return ERR_PTR (- EINVAL );
888895
889- ft = mlx5_create_flow_table (ns , prio , num_flow_table_entries , level , flags );
896+ ft_attr .max_fte = num_flow_table_entries ;
897+ ft_attr .prio = prio ;
898+ ft_attr .level = level ;
899+ ft_attr .flags = flags ;
900+
901+ ft = mlx5_create_flow_table (ns , & ft_attr );
890902 if (IS_ERR (ft ))
891903 return ft ;
892904
@@ -1828,12 +1840,18 @@ static void set_prio_attrs(struct mlx5_flow_root_namespace *root_ns)
18281840static int create_anchor_flow_table (struct mlx5_flow_steering * steering )
18291841{
18301842 struct mlx5_flow_namespace * ns = NULL ;
1843+ struct mlx5_flow_table_attr ft_attr = {};
18311844 struct mlx5_flow_table * ft ;
18321845
18331846 ns = mlx5_get_flow_namespace (steering -> dev , MLX5_FLOW_NAMESPACE_ANCHOR );
18341847 if (WARN_ON (!ns ))
18351848 return - EINVAL ;
1836- ft = mlx5_create_flow_table (ns , ANCHOR_PRIO , ANCHOR_SIZE , ANCHOR_LEVEL , 0 );
1849+
1850+ ft_attr .max_fte = ANCHOR_SIZE ;
1851+ ft_attr .level = ANCHOR_LEVEL ;
1852+ ft_attr .prio = ANCHOR_PRIO ;
1853+
1854+ ft = mlx5_create_flow_table (ns , & ft_attr );
18371855 if (IS_ERR (ft )) {
18381856 mlx5_core_err (steering -> dev , "Failed to create last anchor flow table" );
18391857 return PTR_ERR (ft );
0 commit comments