MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mlx5_l3t_create

Function mlx5_l3t_create

dpdk/drivers/net/mlx5/mlx5_utils.c:828–879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

826}
827
828struct mlx5_l3t_tbl *
829mlx5_l3t_create(enum mlx5_l3t_type type)
830{
831 struct mlx5_l3t_tbl *tbl;
832 struct mlx5_indexed_pool_config l3t_ip_cfg = {
833 .trunk_size = 16,
834 .grow_trunk = 6,
835 .grow_shift = 1,
836 .need_lock = 0,
837 .release_mem_en = 1,
838 .malloc = mlx5_malloc,
839 .free = mlx5_free,
840 };
841
842 if (type >= MLX5_L3T_TYPE_MAX) {
843 rte_errno = EINVAL;
844 return NULL;
845 }
846 tbl = mlx5_malloc(MLX5_MEM_ZERO, sizeof(struct mlx5_l3t_tbl), 1,
847 SOCKET_ID_ANY);
848 if (!tbl) {
849 rte_errno = ENOMEM;
850 return NULL;
851 }
852 tbl->type = type;
853 switch (type) {
854 case MLX5_L3T_TYPE_WORD:
855 l3t_ip_cfg.size = sizeof(struct mlx5_l3t_entry_word);
856 l3t_ip_cfg.type = "mlx5_l3t_e_tbl_w";
857 break;
858 case MLX5_L3T_TYPE_DWORD:
859 l3t_ip_cfg.size = sizeof(struct mlx5_l3t_entry_dword);
860 l3t_ip_cfg.type = "mlx5_l3t_e_tbl_dw";
861 break;
862 case MLX5_L3T_TYPE_QWORD:
863 l3t_ip_cfg.size = sizeof(struct mlx5_l3t_entry_qword);
864 l3t_ip_cfg.type = "mlx5_l3t_e_tbl_qw";
865 break;
866 default:
867 l3t_ip_cfg.size = sizeof(struct mlx5_l3t_entry_ptr);
868 l3t_ip_cfg.type = "mlx5_l3t_e_tbl_tpr";
869 break;
870 }
871 rte_spinlock_init(&tbl->sl);
872 tbl->eip = mlx5_ipool_create(&l3t_ip_cfg);
873 if (!tbl->eip) {
874 rte_errno = ENOMEM;
875 mlx5_free(tbl);
876 tbl = NULL;
877 }
878 return tbl;
879}
880
881void
882mlx5_l3t_destroy(struct mlx5_l3t_tbl *tbl)

Callers 4

mlx5_flow_meter_createFunction · 0.85
mlx5_dev_spawnFunction · 0.85
mlx5_dev_spawnFunction · 0.85

Calls 4

mlx5_mallocFunction · 0.85
rte_spinlock_initFunction · 0.85
mlx5_ipool_createFunction · 0.85
mlx5_freeFunction · 0.85

Tested by

no test coverage detected