| 393 | } |
| 394 | |
| 395 | static __rte_always_inline void |
| 396 | inbound_sp_sa(struct sp_ctx *sp, struct sa_ctx *sa, struct traffic_type *ip, |
| 397 | uint16_t lim, struct ipsec_spd_stats *stats) |
| 398 | { |
| 399 | struct rte_mbuf *m; |
| 400 | uint32_t i, j, res, sa_idx; |
| 401 | |
| 402 | if (ip->num == 0 || sp == NULL) |
| 403 | return; |
| 404 | |
| 405 | rte_acl_classify((struct rte_acl_ctx *)sp, ip->data, ip->res, |
| 406 | ip->num, DEFAULT_MAX_CATEGORIES); |
| 407 | |
| 408 | j = 0; |
| 409 | for (i = 0; i < ip->num; i++) { |
| 410 | m = ip->pkts[i]; |
| 411 | res = ip->res[i]; |
| 412 | if (res == BYPASS) { |
| 413 | ip->pkts[j++] = m; |
| 414 | stats->bypass++; |
| 415 | continue; |
| 416 | } |
| 417 | if (res == DISCARD) { |
| 418 | free_pkts(&m, 1); |
| 419 | stats->discard++; |
| 420 | continue; |
| 421 | } |
| 422 | |
| 423 | /* Only check SPI match for processed IPSec packets */ |
| 424 | if (i < lim && ((m->ol_flags & RTE_MBUF_F_RX_SEC_OFFLOAD) == 0)) { |
| 425 | stats->discard++; |
| 426 | free_pkts(&m, 1); |
| 427 | continue; |
| 428 | } |
| 429 | |
| 430 | sa_idx = res - 1; |
| 431 | if (!inbound_sa_check(sa, m, sa_idx)) { |
| 432 | stats->discard++; |
| 433 | free_pkts(&m, 1); |
| 434 | continue; |
| 435 | } |
| 436 | ip->pkts[j++] = m; |
| 437 | stats->protect++; |
| 438 | } |
| 439 | ip->num = j; |
| 440 | } |
| 441 | |
| 442 | static __rte_always_inline uint32_t |
| 443 | get_hop_for_offload_pkt(struct rte_mbuf *pkt, int is_ipv6) |
no test coverage detected