Initialize exact match (hash) parameters. 8< */
| 964 | |
| 965 | /* Initialize exact match (hash) parameters. 8< */ |
| 966 | void |
| 967 | setup_hash(const int socketid) |
| 968 | { |
| 969 | struct rte_hash_parameters ipv4_l3fwd_hash_params = { |
| 970 | .name = NULL, |
| 971 | .entries = L3FWD_HASH_ENTRIES, |
| 972 | .key_len = sizeof(union ipv4_5tuple_host), |
| 973 | .hash_func = ipv4_hash_crc, |
| 974 | .hash_func_init_val = 0, |
| 975 | }; |
| 976 | |
| 977 | struct rte_hash_parameters ipv6_l3fwd_hash_params = { |
| 978 | .name = NULL, |
| 979 | .entries = L3FWD_HASH_ENTRIES, |
| 980 | .key_len = sizeof(union ipv6_5tuple_host), |
| 981 | .hash_func = ipv6_hash_crc, |
| 982 | .hash_func_init_val = 0, |
| 983 | }; |
| 984 | |
| 985 | char s[64]; |
| 986 | |
| 987 | /* create ipv4 hash */ |
| 988 | snprintf(s, sizeof(s), "ipv4_l3fwd_hash_%d", socketid); |
| 989 | ipv4_l3fwd_hash_params.name = s; |
| 990 | ipv4_l3fwd_hash_params.socket_id = socketid; |
| 991 | ipv4_l3fwd_em_lookup_struct[socketid] = |
| 992 | rte_hash_create(&ipv4_l3fwd_hash_params); |
| 993 | if (ipv4_l3fwd_em_lookup_struct[socketid] == NULL) |
| 994 | rte_exit(EXIT_FAILURE, |
| 995 | "Unable to create the l3fwd hash on socket %d\n", |
| 996 | socketid); |
| 997 | |
| 998 | /* create ipv6 hash */ |
| 999 | snprintf(s, sizeof(s), "ipv6_l3fwd_hash_%d", socketid); |
| 1000 | ipv6_l3fwd_hash_params.name = s; |
| 1001 | ipv6_l3fwd_hash_params.socket_id = socketid; |
| 1002 | ipv6_l3fwd_em_lookup_struct[socketid] = |
| 1003 | rte_hash_create(&ipv6_l3fwd_hash_params); |
| 1004 | if (ipv6_l3fwd_em_lookup_struct[socketid] == NULL) |
| 1005 | rte_exit(EXIT_FAILURE, |
| 1006 | "Unable to create the l3fwd hash on socket %d\n", |
| 1007 | socketid); |
| 1008 | |
| 1009 | /* |
| 1010 | * Use data from ipv4/ipv6 l3fwd config file |
| 1011 | * directly to initialize the hash table. |
| 1012 | */ |
| 1013 | if (ipv6 == 0) { |
| 1014 | /* populate the ipv4 hash */ |
| 1015 | populate_ipv4_flow_into_table( |
| 1016 | ipv4_l3fwd_em_lookup_struct[socketid]); |
| 1017 | } else { |
| 1018 | /* populate the ipv6 hash */ |
| 1019 | populate_ipv6_flow_into_table( |
| 1020 | ipv6_l3fwd_em_lookup_struct[socketid]); |
| 1021 | } |
| 1022 | } |
| 1023 | /* >8 End of initialization of hash parameters. */ |
nothing calls this directly
no test coverage detected