copied from rte_pktmbuf_clone */
| 1534 | |
| 1535 | /* copied from rte_pktmbuf_clone */ |
| 1536 | static inline struct rte_mbuf * |
| 1537 | pktmbuf_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 | |
| 1574 | static inline void |
| 1575 | ff_add_vlan_tag(struct rte_mbuf * rtem) |
no test coverage detected