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

Function route4_pkts

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

Source from the content-addressed store, hash-verified

468}
469
470static __rte_always_inline void
471route4_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[],
472 uint32_t nb_pkts, uint64_t tx_offloads, bool ip_cksum)
473{
474 uint32_t hop[MAX_PKT_BURST * 2];
475 uint32_t dst_ip[MAX_PKT_BURST * 2];
476 struct rte_ether_hdr *ethhdr;
477 uint32_t pkt_hop = 0;
478 uint16_t i, offset;
479 uint16_t lpm_pkts = 0;
480 unsigned int lcoreid = rte_lcore_id();
481 struct rte_mbuf *pkt;
482 uint16_t port;
483
484 if (nb_pkts == 0)
485 return;
486
487 /* Need to do an LPM lookup for non-inline packets. Inline packets will
488 * have port ID in the SA
489 */
490
491 for (i = 0; i < nb_pkts; i++) {
492 pkt = pkts[i];
493 if (!(pkt->ol_flags & RTE_MBUF_F_TX_SEC_OFFLOAD)) {
494 /* Security offload not enabled. So an LPM lookup is
495 * required to get the hop
496 */
497 offset = offsetof(struct ip, ip_dst);
498 dst_ip[lpm_pkts] = *rte_pktmbuf_mtod_offset(pkt,
499 uint32_t *, offset);
500 dst_ip[lpm_pkts] = rte_be_to_cpu_32(dst_ip[lpm_pkts]);
501 lpm_pkts++;
502 }
503 }
504
505 rte_lpm_lookup_bulk((struct rte_lpm *)rt_ctx, dst_ip, hop, lpm_pkts);
506
507 lpm_pkts = 0;
508
509 for (i = 0; i < nb_pkts; i++) {
510 pkt = pkts[i];
511 if (pkt->ol_flags & RTE_MBUF_F_TX_SEC_OFFLOAD) {
512 /* Read hop from the SA */
513 pkt_hop = get_hop_for_offload_pkt(pkt, 0);
514 } else {
515 /* Need to use hop returned by lookup */
516 pkt_hop = hop[lpm_pkts++];
517 }
518
519 if ((pkt_hop & RTE_LPM_LOOKUP_SUCCESS) == 0) {
520 core_statistics[lcoreid].lpm4.miss++;
521 free_pkts(&pkt, 1);
522 continue;
523 }
524
525 port = pkt_hop & 0xff;
526
527 /* Update minimum offload data */

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
rte_ipv4_cksumFunction · 0.85
free_pktsFunction · 0.70
send_single_packetFunction · 0.70
memcpyFunction · 0.50

Tested by

no test coverage detected