* *process* function for tunnel packets */
| 635 | * *process* function for tunnel packets |
| 636 | */ |
| 637 | static inline uint16_t |
| 638 | trs_process(struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], |
| 639 | uint32_t sqn[], uint32_t dr[], uint16_t num, uint8_t sqh_len) |
| 640 | { |
| 641 | char *np; |
| 642 | uint32_t i, k, l2, tl, bytes; |
| 643 | uint32_t hl[num], to[num]; |
| 644 | struct rte_esp_tail espt[num]; |
| 645 | struct rte_mbuf *ml[num]; |
| 646 | |
| 647 | /* |
| 648 | * remove icv, esp trailer and high-order |
| 649 | * 32 bits of esn from packet length |
| 650 | */ |
| 651 | const uint32_t tlen = sa->icv_len + sizeof(espt[0]) + sqh_len; |
| 652 | const uint32_t cofs = sa->ctp.cipher.offset; |
| 653 | |
| 654 | /* |
| 655 | * to minimize stalls due to load latency, |
| 656 | * read mbufs metadata and esp tail first. |
| 657 | */ |
| 658 | for (i = 0; i != num; i++) |
| 659 | process_step1(mb[i], tlen, &ml[i], &espt[i], &hl[i], &to[i]); |
| 660 | |
| 661 | k = 0; |
| 662 | bytes = 0; |
| 663 | for (i = 0; i != num; i++) { |
| 664 | |
| 665 | tl = tlen + espt[i].pad_len; |
| 666 | l2 = mb[i]->l2_len; |
| 667 | |
| 668 | /* check that packet is valid */ |
| 669 | if (trs_process_check(mb[i], &ml[i], &to[i], espt[i], |
| 670 | hl[i] + cofs, tl) == 0) { |
| 671 | |
| 672 | /* modify packet's layout */ |
| 673 | np = trs_process_step2(mb[i], ml[i], hl[i], cofs, |
| 674 | to[i], tl, sqn + k); |
| 675 | update_trs_l3hdr(sa, np + l2, mb[i]->pkt_len, |
| 676 | l2, hl[i] - l2, espt[i].next_proto); |
| 677 | |
| 678 | /* update mbuf's metadata */ |
| 679 | trs_process_step3(mb[i]); |
| 680 | k++; |
| 681 | bytes += mb[i]->pkt_len; |
| 682 | } else |
| 683 | dr[i - k] = i; |
| 684 | } |
| 685 | |
| 686 | sa->statistics.count += k; |
| 687 | sa->statistics.bytes += bytes; |
| 688 | return k; |
| 689 | } |
| 690 | |
| 691 | /* |
| 692 | * for group of ESP inbound packets perform SQN check and update. |
nothing calls this directly
no test coverage detected