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

Function __l3t_get_entry

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

Source from the content-addressed store, hash-verified

919}
920
921static int32_t
922__l3t_get_entry(struct mlx5_l3t_tbl *tbl, uint32_t idx,
923 union mlx5_l3t_data *data)
924{
925 struct mlx5_l3t_level_tbl *g_tbl, *m_tbl;
926 struct mlx5_l3t_entry_word *w_e_tbl;
927 struct mlx5_l3t_entry_dword *dw_e_tbl;
928 struct mlx5_l3t_entry_qword *qw_e_tbl;
929 struct mlx5_l3t_entry_ptr *ptr_e_tbl;
930 void *e_tbl;
931 uint32_t entry_idx;
932
933 g_tbl = tbl->tbl;
934 if (!g_tbl)
935 return -1;
936 m_tbl = g_tbl->tbl[(idx >> MLX5_L3T_GT_OFFSET) & MLX5_L3T_GT_MASK];
937 if (!m_tbl)
938 return -1;
939 e_tbl = m_tbl->tbl[(idx >> MLX5_L3T_MT_OFFSET) & MLX5_L3T_MT_MASK];
940 if (!e_tbl)
941 return -1;
942 entry_idx = idx & MLX5_L3T_ET_MASK;
943 switch (tbl->type) {
944 case MLX5_L3T_TYPE_WORD:
945 w_e_tbl = (struct mlx5_l3t_entry_word *)e_tbl;
946 data->word = w_e_tbl->entry[entry_idx].data;
947 if (w_e_tbl->entry[entry_idx].data)
948 w_e_tbl->entry[entry_idx].ref_cnt++;
949 break;
950 case MLX5_L3T_TYPE_DWORD:
951 dw_e_tbl = (struct mlx5_l3t_entry_dword *)e_tbl;
952 data->dword = dw_e_tbl->entry[entry_idx].data;
953 if (dw_e_tbl->entry[entry_idx].data)
954 dw_e_tbl->entry[entry_idx].ref_cnt++;
955 break;
956 case MLX5_L3T_TYPE_QWORD:
957 qw_e_tbl = (struct mlx5_l3t_entry_qword *)e_tbl;
958 data->qword = qw_e_tbl->entry[entry_idx].data;
959 if (qw_e_tbl->entry[entry_idx].data)
960 qw_e_tbl->entry[entry_idx].ref_cnt++;
961 break;
962 default:
963 ptr_e_tbl = (struct mlx5_l3t_entry_ptr *)e_tbl;
964 data->ptr = ptr_e_tbl->entry[entry_idx].data;
965 if (ptr_e_tbl->entry[entry_idx].data)
966 ptr_e_tbl->entry[entry_idx].ref_cnt++;
967 break;
968 }
969 return 0;
970}
971
972int32_t
973mlx5_l3t_get_entry(struct mlx5_l3t_tbl *tbl, uint32_t idx,

Callers 1

mlx5_l3t_get_entryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected