* *process* function for tunnel packets */
| 572 | * *process* function for tunnel packets |
| 573 | */ |
| 574 | static inline uint16_t |
| 575 | tun_process(struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], |
| 576 | uint32_t sqn[], uint32_t dr[], uint16_t num, uint8_t sqh_len) |
| 577 | { |
| 578 | uint32_t adj, i, k, tl, bytes; |
| 579 | uint32_t hl[num], to[num]; |
| 580 | struct rte_esp_tail espt[num]; |
| 581 | struct rte_mbuf *ml[num]; |
| 582 | const void *outh; |
| 583 | void *inh; |
| 584 | |
| 585 | /* |
| 586 | * remove icv, esp trailer and high-order |
| 587 | * 32 bits of esn from packet length |
| 588 | */ |
| 589 | const uint32_t tlen = sa->icv_len + sizeof(espt[0]) + sqh_len; |
| 590 | const uint32_t cofs = sa->ctp.cipher.offset; |
| 591 | |
| 592 | /* |
| 593 | * to minimize stalls due to load latency, |
| 594 | * read mbufs metadata and esp tail first. |
| 595 | */ |
| 596 | for (i = 0; i != num; i++) |
| 597 | process_step1(mb[i], tlen, &ml[i], &espt[i], &hl[i], &to[i]); |
| 598 | |
| 599 | k = 0; |
| 600 | bytes = 0; |
| 601 | for (i = 0; i != num; i++) { |
| 602 | |
| 603 | adj = hl[i] + cofs; |
| 604 | tl = tlen + espt[i].pad_len; |
| 605 | |
| 606 | /* check that packet is valid */ |
| 607 | if (tun_process_check(mb[i], &ml[i], &to[i], espt[i], adj, tl, |
| 608 | sa->proto) == 0) { |
| 609 | |
| 610 | outh = rte_pktmbuf_mtod_offset(mb[i], uint8_t *, |
| 611 | mb[i]->l2_len); |
| 612 | |
| 613 | /* modify packet's layout */ |
| 614 | inh = tun_process_step2(mb[i], ml[i], hl[i], adj, |
| 615 | to[i], tl, sqn + k); |
| 616 | |
| 617 | /* update inner ip header */ |
| 618 | update_tun_inb_l3hdr(sa, outh, inh); |
| 619 | |
| 620 | /* update mbuf's metadata */ |
| 621 | tun_process_step3(mb[i], sa->tx_offload.msk, |
| 622 | sa->tx_offload.val); |
| 623 | k++; |
| 624 | bytes += mb[i]->pkt_len; |
| 625 | } else |
| 626 | dr[i - k] = i; |
| 627 | } |
| 628 | |
| 629 | sa->statistics.count += k; |
| 630 | sa->statistics.bytes += bytes; |
| 631 | return k; |
nothing calls this directly
no test coverage detected