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

Function route4_pkt

dpdk/examples/ipsec-secgw/ipsec_worker.c:274–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274static inline uint16_t
275route4_pkt(struct rte_mbuf *pkt, struct rt_ctx *rt_ctx)
276{
277 uint32_t dst_ip;
278 uint16_t offset;
279 uint32_t hop;
280 int ret;
281
282 offset = RTE_ETHER_HDR_LEN + offsetof(struct ip, ip_dst);
283 dst_ip = *rte_pktmbuf_mtod_offset(pkt, uint32_t *, offset);
284 dst_ip = rte_be_to_cpu_32(dst_ip);
285
286 ret = rte_lpm_lookup((struct rte_lpm *)rt_ctx, dst_ip, &hop);
287
288 if (ret == 0) {
289 /* We have a hit */
290 return hop;
291 }
292
293 /* else */
294 return RTE_MAX_ETHPORTS;
295}
296
297/* TODO: To be tested */
298static inline uint16_t

Callers 3

get_routeFunction · 0.85
ipsec_ev_route_ip_pktsFunction · 0.85

Calls 1

rte_lpm_lookupFunction · 0.50

Tested by

no test coverage detected