> -----Original Message----- > From: Take Ceara [mailto:dumitru.ceara at gmail.com] > Sent: Monday, July 18, 2016 4:26 PM > To: users at dpdk.org > Cc: Richardson, Bruce <bruce.richardson at intel.com> > Subject: [dpdk-users] Ring PMD - Should mbufs be copied instead of just > being added to the ring? > > Hi, > > I noticed that the Ring PMD directly enqueues the mbufs transmitted with > rte_eth_tx_burst (eth_ring_tx). > > I understand that this is the fastest way however, in some cases, the > receive side might rewrite part of the packet payload (e.g., change some > of the L2-3 headers). If the sender is still using the original packet > (e.g., having it cloned) the packet will be essentially corrupted. > > I really like the fact that the Ring based interfaces are mostly > transparent to the applications as they can just use the general > rte_eth_tx_burst/rx_burst but in the rewriting case we need to handle > sending (or receiving) in a special way and manually create an mbuf chain > copy of the original. > > Would it be an option to add a flag argument to rte_eth_from_rings to > specify whether the Ring PMD driver should enqueue the original or > actually send a copy of the original packet? > > Thanks, > Dumitru Ceara
Hi, that's a good point. However, my thinking is that any copying should probably be controlled via the refcnt field of the mbuf. If an mbuf has a refcnt of 1, then no copy should be needed. For packets with a refcnt of 2, yes, a copy may be necessary. /Bruce
