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

Function rte_lpm6_delete_bulk_func

dpdk/lib/lpm/rte_lpm6.c:1066–1100  ·  view source on GitHub ↗

* Deletes a group of rules * * Note that the function rebuilds the lpm table, * rather than doing incremental updates like * the regular delete function */

Source from the content-addressed store, hash-verified

1064 * the regular delete function
1065 */
1066int
1067rte_lpm6_delete_bulk_func(struct rte_lpm6 *lpm,
1068 uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], uint8_t *depths,
1069 unsigned n)
1070{
1071 uint8_t masked_ip[RTE_LPM6_IPV6_ADDR_SIZE];
1072 unsigned i;
1073
1074 /* Check input arguments. */
1075 if ((lpm == NULL) || (ips == NULL) || (depths == NULL))
1076 return -EINVAL;
1077
1078 for (i = 0; i < n; i++) {
1079 ip6_copy_addr(masked_ip, ips[i]);
1080 ip6_mask_addr(masked_ip, depths[i]);
1081 rule_delete(lpm, masked_ip, depths[i]);
1082 }
1083
1084 /*
1085 * Set all the table entries to 0 (ie delete every rule
1086 * from the data structure.
1087 */
1088 memset(lpm->tbl24, 0, sizeof(lpm->tbl24));
1089 memset(lpm->tbl8, 0, sizeof(lpm->tbl8[0])
1090 * RTE_LPM6_TBL8_GROUP_NUM_ENTRIES * lpm->number_tbl8s);
1091 tbl8_pool_init(lpm);
1092
1093 /*
1094 * Add every rule again (except for the ones that were removed from
1095 * the rules table).
1096 */
1097 rebuild_lpm(lpm);
1098
1099 return 0;
1100}
1101
1102/*
1103 * Delete all rules from the LPM table.

Callers 2

test8Function · 0.50
test22Function · 0.50

Calls 6

memsetFunction · 0.85
ip6_copy_addrFunction · 0.70
ip6_mask_addrFunction · 0.70
rule_deleteFunction · 0.70
tbl8_pool_initFunction · 0.70
rebuild_lpmFunction · 0.70

Tested by 2

test8Function · 0.40
test22Function · 0.40