| 415 | } |
| 416 | |
| 417 | void |
| 418 | rte_ipsec_sad_destroy(struct rte_ipsec_sad *sad) |
| 419 | { |
| 420 | struct rte_tailq_entry *te; |
| 421 | struct rte_ipsec_sad_list *sad_list; |
| 422 | |
| 423 | if (sad == NULL) |
| 424 | return; |
| 425 | |
| 426 | sad_list = RTE_TAILQ_CAST(rte_ipsec_sad_tailq.head, |
| 427 | rte_ipsec_sad_list); |
| 428 | rte_mcfg_tailq_write_lock(); |
| 429 | TAILQ_FOREACH(te, sad_list, next) { |
| 430 | if (te->data == (void *)sad) |
| 431 | break; |
| 432 | } |
| 433 | if (te != NULL) |
| 434 | TAILQ_REMOVE(sad_list, te, next); |
| 435 | |
| 436 | rte_mcfg_tailq_write_unlock(); |
| 437 | |
| 438 | rte_hash_free(sad->hash[RTE_IPSEC_SAD_SPI_ONLY]); |
| 439 | rte_hash_free(sad->hash[RTE_IPSEC_SAD_SPI_DIP]); |
| 440 | rte_hash_free(sad->hash[RTE_IPSEC_SAD_SPI_DIP_SIP]); |
| 441 | rte_free(sad); |
| 442 | rte_free(te); |
| 443 | } |
| 444 | |
| 445 | /* |
| 446 | * @internal helper function |