From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 942EAA00E6 for ; Tue, 16 Apr 2019 18:28:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 93A9F1B521; Tue, 16 Apr 2019 18:28:31 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id B5D0F1B520 for ; Tue, 16 Apr 2019 18:28:29 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Apr 2019 09:28:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,358,1549958400"; d="scan'208";a="143232070" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.220.103]) by orsmga003.jf.intel.com with SMTP; 16 Apr 2019 09:28:25 -0700 Received: by (sSMTP sendmail emulation); Tue, 16 Apr 2019 17:28:25 +0100 Date: Tue, 16 Apr 2019 17:28:24 +0100 From: Bruce Richardson To: Ferruh Yigit Cc: Olivier Matz , dev@dpdk.org, Stephen Hemminger , Chas Williams Message-ID: <20190416162824.GA1886@bricha3-MOBL.ger.corp.intel.com> References: <20190416155126.26438-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline In-Reply-To: <20190416155126.26438-1-ferruh.yigit@intel.com> User-Agent: Mutt/1.11.4 (2019-03-13) Subject: Re: [dpdk-dev] [PATCH] net: do not insert VLAN tag to shared mbufs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190416162824.-9ujE7si_4duOlTpogYqqIstDiLAMuM2SJ7WY_KUF6Q@z> 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 > --- > Cc: Stephen Hemminger > Cc: Chas Williams > > 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