DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
	dev@dpdk.org, Chas Williams <chas3@att.com>,
	"John W. Linville" <linville@tuxdriver.com>
Subject: Re: [dpdk-dev] [PATCH v2] net/af_packet: fix vlan_insert corruption
Date: Tue, 16 Apr 2019 16:13:51 +0100	[thread overview]
Message-ID: <20190416151351.GA1875@bricha3-MOBL.ger.corp.intel.com> (raw)
Message-ID: <20190416151351.4CKEiFtROd4_vGCa1qhYYasvMWPwrtrIrvcysQJTsYY@z> (raw)
In-Reply-To: <20190416080336.3b8e16a6@xps13.lan>

On Tue, Apr 16, 2019 at 08:03:36AM -0700, Stephen Hemminger wrote:
> On Tue, 16 Apr 2019 10:42:13 +0100
> Bruce Richardson <bruce.richardson@intel.com> wrote:
> 
> > On Tue, Apr 16, 2019 at 10:37:07AM +0100, Ferruh Yigit wrote:
> > > On 4/12/2019 11:08 PM, Stephen Hemminger wrote:  
> > > > On Fri, 12 Apr 2019 17:28:17 +0100
> > > > Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > > >   
> > > >> On 4/8/2019 5:41 PM, Stephen Hemminger wrote:  
> > > >>> If the af_packet transmit is sending a VLAN packet,
> > > >>> and the transmit path to the kernel os full, then it would
> > > >>> mismanage the outgoing mbuf. The original mbuf would end up
> > > >>> being freed twice, once by AF_PACKET PMD and once by caller.    
> > > >>
> > > >> This comment is valid with your new patch [1] that updates 'rte_vlan_insert()'
> > > >> to duplicate the mbuf, right?
> > > >>
> > > >> That patch looks like won't make the release, so I suggest this one wait that
> > > >> patch, although this is harmless on its own, commit log is misleading.
> > > >>
> > > >> [1]
> > > >> https://patches.dpdk.org/patch/51870/  
> > > > 
> > > > It was always true, even with existing vlan_insert.
> > > > Existing vlan_insert has issues if it ever creates a clone packet.
> > > > Existing vlan_insert can duplicate mbuf through clone
> > > >   
> > > 
> > > Right, existing vlan_insert has same issue on af_packet.
> > > 
> > > But, should vlan_insert try to duplicate the mbuf when it is shared, does it
> > > worth the complexity it brings? And when that support removed this patch won't
> > > be needed.  
> > 
> > I don't think vlan insert or other mbuf manipulation APIs should be
> > checking for shared state or not - that's the job of the app. We could have
> > cases where the user does want to modify a shared mbuf.
> > 
> > Regards,
> > /Bruce
> 
> The vlan_insert code is called on transmit, and there are lots of
> cases where a transmit mbuf might be shared (like TCP stack). And in that
> case inserting the vlan must be non-destructive to the original mbuf.
> 
> Whether you want to push the problem to the driver or do it in the
> library, it is still a problem.

Yes, I agree it's a problem. I'd prefer see it done in the driver than in the
library, since it's higher in the SW stack and has more context information
as to what is safe or not.

/Bruce.

  parent reply	other threads:[~2019-04-16 15:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 16:04 [dpdk-dev] [PATCH] " Stephen Hemminger
2019-04-08 16:04 ` Stephen Hemminger
2019-04-08 16:41 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2019-04-08 16:41   ` Stephen Hemminger
2019-04-12 16:28   ` Ferruh Yigit
2019-04-12 16:28     ` Ferruh Yigit
2019-04-12 22:08     ` Stephen Hemminger
2019-04-12 22:08       ` Stephen Hemminger
2019-04-16  9:37       ` Ferruh Yigit
2019-04-16  9:37         ` Ferruh Yigit
2019-04-16  9:42         ` Bruce Richardson
2019-04-16  9:42           ` Bruce Richardson
2019-04-16 15:03           ` Stephen Hemminger
2019-04-16 15:03             ` Stephen Hemminger
2019-04-16 15:13             ` Bruce Richardson [this message]
2019-04-16 15:13               ` Bruce Richardson
2019-07-04 18:43               ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190416151351.GA1875@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=chas3@att.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=linville@tuxdriver.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).