MCPcopy Create free account
hub / github.com/F-Stack/f-stack / route6_pkts

Function route6_pkts

dpdk/examples/ipsec-secgw/ipsec_worker.h:559–634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557}
558
559static __rte_always_inline void
560route6_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint32_t nb_pkts)
561{
562 int32_t hop[MAX_PKT_BURST * 2];
563 uint8_t dst_ip[MAX_PKT_BURST * 2][16];
564 struct rte_ether_hdr *ethhdr;
565 uint8_t *ip6_dst;
566 uint32_t pkt_hop = 0;
567 uint16_t i, offset;
568 uint16_t lpm_pkts = 0;
569 unsigned int lcoreid = rte_lcore_id();
570 struct rte_mbuf *pkt;
571 uint16_t port;
572
573 if (nb_pkts == 0)
574 return;
575
576 /* Need to do an LPM lookup for non-inline packets. Inline packets will
577 * have port ID in the SA
578 */
579
580 for (i = 0; i < nb_pkts; i++) {
581 pkt = pkts[i];
582 if (!(pkt->ol_flags & RTE_MBUF_F_TX_SEC_OFFLOAD)) {
583 /* Security offload not enabled. So an LPM lookup is
584 * required to get the hop
585 */
586 offset = offsetof(struct ip6_hdr, ip6_dst);
587 ip6_dst = rte_pktmbuf_mtod_offset(pkt, uint8_t *,
588 offset);
589 memcpy(&dst_ip[lpm_pkts][0], ip6_dst, 16);
590 lpm_pkts++;
591 }
592 }
593
594 rte_lpm6_lookup_bulk_func((struct rte_lpm6 *)rt_ctx, dst_ip, hop,
595 lpm_pkts);
596
597 lpm_pkts = 0;
598
599 for (i = 0; i < nb_pkts; i++) {
600 pkt = pkts[i];
601 if (pkt->ol_flags & RTE_MBUF_F_TX_SEC_OFFLOAD) {
602 /* Read hop from the SA */
603 pkt_hop = get_hop_for_offload_pkt(pkt, 1);
604 } else {
605 /* Need to use hop returned by lookup */
606 pkt_hop = (uint16_t)hop[lpm_pkts++];
607 }
608
609 if (pkt_hop == BAD_PORT) {
610 core_statistics[lcoreid].lpm6.miss++;
611 free_pkts(&pkt, 1);
612 continue;
613 }
614
615 port = pkt_hop & 0xff;
616

Callers 4

process_pktsFunction · 0.85

Calls 7

rte_lcore_idFunction · 0.85
get_hop_for_offload_pktFunction · 0.85
rte_pktmbuf_prependFunction · 0.85
free_pktsFunction · 0.70
send_single_packetFunction · 0.70
memcpyFunction · 0.50

Tested by

no test coverage detected