On Tue, Apr 16, 2019 at 04:51:26PM +0100, Ferruh Yigit wrote: > The vlan_insert() is buggy when it tires to handle the shared mbufs, > instead don't support inserting VLAN tag into shared mbufs and return > an error for that case. > > Signed-off-by: Ferruh Yigit <ferruh.yi...@intel.com> > --- > Cc: Stephen Hemminger <step...@networkplumber.org> > Cc: Chas Williams <ch...@att.com> > > This is another approach to RFC to fix the vlan_insert: > https://patches.dpdk.org/patch/51870/ > > vlan_insert() mostly used by drivers to insert VLAN tag into packet > data in Tx path, drivers creating new copies of mbufs in Tx path may > result unexpected behavior, like not freed or double freed mbufs. > --- > lib/librte_net/rte_ether.h | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > So what is the API to be used if one does want to insert a vlan tag into a shared mbuf?
Also, why is it such a problem to create new copies of data inside the driver if that is necessary? You create a copy and use that, freeing the original (i.e. in all likelyhood decrememting the ref-count since you no longer use it). You already have the pointer to the mbuf pool from the original buffer so you can get a copy from the same place. I'm curious to know why it would be impossible to do a functionally correct implementation? /Bruce