* Deletes a group of rules * * Note that the function rebuilds the lpm table, * rather than doing incremental updates like * the regular delete function */
| 1064 | * the regular delete function |
| 1065 | */ |
| 1066 | int |
| 1067 | rte_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. |