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

Function pktmbuf_deep_clone

lib/ff_dpdk_if.c:1536–1572  ·  view source on GitHub ↗

copied from rte_pktmbuf_clone */

Source from the content-addressed store, hash-verified

1534
1535/* copied from rte_pktmbuf_clone */
1536static inline struct rte_mbuf *
1537pktmbuf_deep_clone(const struct rte_mbuf *md,
1538 struct rte_mempool *mp)
1539{
1540 struct rte_mbuf *mc, *mi, **prev;
1541 uint32_t pktlen;
1542 uint8_t nseg;
1543
1544 if (unlikely ((mc = rte_pktmbuf_alloc(mp)) == NULL))
1545 return NULL;
1546
1547 mi = mc;
1548 prev = &mi->next;
1549 pktlen = md->pkt_len;
1550 nseg = 0;
1551
1552 do {
1553 nseg++;
1554 pktmbuf_deep_attach(mi, md);
1555 *prev = mi;
1556 prev = &mi->next;
1557 } while ((md = md->next) != NULL &&
1558 (mi = rte_pktmbuf_alloc(mp)) != NULL);
1559
1560 *prev = NULL;
1561 mc->nb_segs = nseg;
1562 mc->pkt_len = pktlen;
1563
1564 /* Allocation of new indirect segment failed */
1565 if (unlikely (mi == NULL)) {
1566 rte_pktmbuf_free(mc);
1567 return NULL;
1568 }
1569
1570 __rte_mbuf_sanity_check(mc, 1);
1571 return mc;
1572}
1573
1574static inline void
1575ff_add_vlan_tag(struct rte_mbuf * rtem)

Callers 1

ff_dpdk_if.cFile · 0.85

Calls 3

rte_pktmbuf_allocFunction · 0.85
pktmbuf_deep_attachFunction · 0.85
rte_pktmbuf_freeFunction · 0.85

Tested by

no test coverage detected