From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 79CC61BB9A; Thu, 18 Apr 2019 19:43:58 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 20D70200E3; Thu, 18 Apr 2019 13:43:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 18 Apr 2019 13:43:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=Ha4S+xBbGvpQe3dtR1tdx38iE6J4PYqetuyBpPTgeds=; b=huUEe18XHVLD lx1i4U3ahGlVzf41/G2rg9fdqjDg4td1V+FFoGddRLJjWQnvA1xf0PTWkIEtLJ96 NmfOelx47oiK1jcS92VPJL1tal1eu6PSfVjUMu22OVBwluJE7R3tQdN2IIIUfy2t dIwKdS+Vk+qpCYamjH5vHGkRhE1475M= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=Ha4S+xBbGvpQe3dtR1tdx38iE6J4PYqetuyBpPTge ds=; b=c4IdoceAIpT8cTAtg7ly3/+SgvyEf8/vgvCiCUxgNRAu3ltk5+oUAhQ7X woiSFAKDPOyNJa6aM2/nIU4jbGPTjTGTIHUU1qjHrzHj8YmGnwukn1RNDcNDUTeT 2vNcNULJGROsUav8Z2mjQXCNoSqz/yEH8X3ImCD/mrawU22F/rtM3iDA5E8CprIP ottblvDP8ldqlvhN/Vcf0H+Ri+j+bv1cfF0WZelt45i0hKm33kCEctkLwLcuHFDf sXSeqiMr5w8xWSEYMGMGr3cMAqOsUU4znMS2tIcaFdEJTKDZaOC+YtQD+nQLv7oI PRfK4PjgRR2Q1os4zxu9VrxEXZKbA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrfeehgdehfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhho mhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 0534DE432B; Thu, 18 Apr 2019 13:43:55 -0400 (EDT) From: Thomas Monjalon To: Adrien Mazarguil Cc: dev@dpdk.org, Gaetan Rivet , Ferruh Yigit , David Marchand , stable@dpdk.org, Ali Alnubani Date: Thu, 18 Apr 2019 19:43:54 +0200 Message-ID: <2870707.KpDQPYjszy@xps> In-Reply-To: <20190418170903.GI4889@6wind.com> References: <20190418130419.25675-1-adrien.mazarguil@6wind.com> <1609324.Zy8sxAcIVK@xps> <20190418170903.GI4889@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v2] net/failsafe: fix source port ID in Rx packets 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: , X-List-Received-Date: Thu, 18 Apr 2019 17:43:58 -0000 18/04/2019 19:09, Adrien Mazarguil: > On Thu, Apr 18, 2019 at 06:54:22PM +0200, Thomas Monjalon wrote: > > > > > > > > > "slave" is a wording from bonding. > > > > > In failsafe, it is sub-device, isn't it? > > > > > > I don't mind, although grep shows a couple of comments talking about slaves > > > already. Either way I think it fits as those are failsafe's pets, as in > > > failsafe does whatever it wants to them and they don't have a say :) > > > > > > Does it warrant a v3? > > > > Yes please, except if Ferruh is already doing the change on apply. > > Will do. > > > > > > > I'm afraid the performance drop to be hard. > > > > > > Mbufs are still hot from the oven at this stage, so it's not *that* > > > expensive. I don't see a more efficient approach. > > > > Yes, Ali did some quick tests showing no perf drop. > > Great. > > > > > > How the port id in mbuf is used exactly? > > > > > > Applications that dissociate Rx itself from packet processing, or whenever a > > > networking stack is involved. Basically every time some code wonders where a > > > packet comes from due to lack of context and looks at m->port for the > > > answer (e.g. checking that a packet arrives on the right port given its > > > destination address). > > > > > > > > What crash are you seeing? > > > > > > None, thankfully. In my specific use case, 6WINDGate's stack simply drops > > > traffic coming from unknown ports. > > > > > > However nothing prevents applications from using m->port as an index of some > > > array they allocated to quickly retrieve port context without looking it > > > up. They wouldn't expect indices they do not know about in there; assuming > > > it will result in a crash is not far fetched. > > > > > > > Another way to fix it without performance drop would be to add > > > > a new driver op to set the top-level port id. > > > > This top-level id would be stored in the private structure of the port, > > > > initialized with the port id of the port itself, and used to fill mbufs. > > > > > > > > Thoughts? > > > > > > Adding a new devop as a fix would be a problem for stable releases, so this > > > patch is definitely needed, at least as a first step. > > > > > > I'm not against a new API, however would it be worth the trouble? Especially > > > considering it would only be used by failsafe-like drivers with something to > > > hide from applications which is not the main use case. > > > > > > For some PMDs, this operation could only be done at init time before port ID > > > is stored in private Rx queue data for fast retrieval. Retrieving it through > > > a pointer so it can be updated anytime would make it more expensive than > > > necessary for them. > > > > I don't understand this comment. > > The port id is currently retrieved via some pointers already. > > I suggest to look at private structure, it is not different. > > See "rep->port = rxq->port_id" in mlx4_rxtx.c for instance. Port ID is > cached in private queue data structure (struct rxq) and retrieved there to > avoid looking it up in non-local data structure rxq->priv->dev_data->port. > In fact rxq->priv is not accessed even once during Rx. OK, thanks for the explanation. > > > It's understood that having failsafe in the dataplane has a cost, but even > > > with the proposed fix, that cost is dwarfed by the amount of work done by a > > > true PMD (and the application) for Rx processing. > > > > > > My suggestion is to wait for someone to complain about the performance > > > compared to what they had before that fix, only then see what we can do. > > > > OK 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 7706AA00E6 for ; Thu, 18 Apr 2019 19:44:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8AE531BC1E; Thu, 18 Apr 2019 19:44:00 +0200 (CEST) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 79CC61BB9A; Thu, 18 Apr 2019 19:43:58 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 20D70200E3; Thu, 18 Apr 2019 13:43:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 18 Apr 2019 13:43:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=Ha4S+xBbGvpQe3dtR1tdx38iE6J4PYqetuyBpPTgeds=; b=huUEe18XHVLD lx1i4U3ahGlVzf41/G2rg9fdqjDg4td1V+FFoGddRLJjWQnvA1xf0PTWkIEtLJ96 NmfOelx47oiK1jcS92VPJL1tal1eu6PSfVjUMu22OVBwluJE7R3tQdN2IIIUfy2t dIwKdS+Vk+qpCYamjH5vHGkRhE1475M= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=Ha4S+xBbGvpQe3dtR1tdx38iE6J4PYqetuyBpPTge ds=; b=c4IdoceAIpT8cTAtg7ly3/+SgvyEf8/vgvCiCUxgNRAu3ltk5+oUAhQ7X woiSFAKDPOyNJa6aM2/nIU4jbGPTjTGTIHUU1qjHrzHj8YmGnwukn1RNDcNDUTeT 2vNcNULJGROsUav8Z2mjQXCNoSqz/yEH8X3ImCD/mrawU22F/rtM3iDA5E8CprIP ottblvDP8ldqlvhN/Vcf0H+Ri+j+bv1cfF0WZelt45i0hKm33kCEctkLwLcuHFDf sXSeqiMr5w8xWSEYMGMGr3cMAqOsUU4znMS2tIcaFdEJTKDZaOC+YtQD+nQLv7oI PRfK4PjgRR2Q1os4zxu9VrxEXZKbA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrfeehgdehfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhho mhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 0534DE432B; Thu, 18 Apr 2019 13:43:55 -0400 (EDT) From: Thomas Monjalon To: Adrien Mazarguil Cc: dev@dpdk.org, Gaetan Rivet , Ferruh Yigit , David Marchand , stable@dpdk.org, Ali Alnubani Date: Thu, 18 Apr 2019 19:43:54 +0200 Message-ID: <2870707.KpDQPYjszy@xps> In-Reply-To: <20190418170903.GI4889@6wind.com> References: <20190418130419.25675-1-adrien.mazarguil@6wind.com> <1609324.Zy8sxAcIVK@xps> <20190418170903.GI4889@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2] net/failsafe: fix source port ID in Rx packets 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: <20190418174354.Nih14XrvX4qaV-LBHeCWRV2MiJ1udvPxRjRxAYVCDIg@z> 18/04/2019 19:09, Adrien Mazarguil: > On Thu, Apr 18, 2019 at 06:54:22PM +0200, Thomas Monjalon wrote: > > > > > > > > > "slave" is a wording from bonding. > > > > > In failsafe, it is sub-device, isn't it? > > > > > > I don't mind, although grep shows a couple of comments talking about slaves > > > already. Either way I think it fits as those are failsafe's pets, as in > > > failsafe does whatever it wants to them and they don't have a say :) > > > > > > Does it warrant a v3? > > > > Yes please, except if Ferruh is already doing the change on apply. > > Will do. > > > > > > > I'm afraid the performance drop to be hard. > > > > > > Mbufs are still hot from the oven at this stage, so it's not *that* > > > expensive. I don't see a more efficient approach. > > > > Yes, Ali did some quick tests showing no perf drop. > > Great. > > > > > > How the port id in mbuf is used exactly? > > > > > > Applications that dissociate Rx itself from packet processing, or whenever a > > > networking stack is involved. Basically every time some code wonders where a > > > packet comes from due to lack of context and looks at m->port for the > > > answer (e.g. checking that a packet arrives on the right port given its > > > destination address). > > > > > > > > What crash are you seeing? > > > > > > None, thankfully. In my specific use case, 6WINDGate's stack simply drops > > > traffic coming from unknown ports. > > > > > > However nothing prevents applications from using m->port as an index of some > > > array they allocated to quickly retrieve port context without looking it > > > up. They wouldn't expect indices they do not know about in there; assuming > > > it will result in a crash is not far fetched. > > > > > > > Another way to fix it without performance drop would be to add > > > > a new driver op to set the top-level port id. > > > > This top-level id would be stored in the private structure of the port, > > > > initialized with the port id of the port itself, and used to fill mbufs. > > > > > > > > Thoughts? > > > > > > Adding a new devop as a fix would be a problem for stable releases, so this > > > patch is definitely needed, at least as a first step. > > > > > > I'm not against a new API, however would it be worth the trouble? Especially > > > considering it would only be used by failsafe-like drivers with something to > > > hide from applications which is not the main use case. > > > > > > For some PMDs, this operation could only be done at init time before port ID > > > is stored in private Rx queue data for fast retrieval. Retrieving it through > > > a pointer so it can be updated anytime would make it more expensive than > > > necessary for them. > > > > I don't understand this comment. > > The port id is currently retrieved via some pointers already. > > I suggest to look at private structure, it is not different. > > See "rep->port = rxq->port_id" in mlx4_rxtx.c for instance. Port ID is > cached in private queue data structure (struct rxq) and retrieved there to > avoid looking it up in non-local data structure rxq->priv->dev_data->port. > In fact rxq->priv is not accessed even once during Rx. OK, thanks for the explanation. > > > It's understood that having failsafe in the dataplane has a cost, but even > > > with the proposed fix, that cost is dwarfed by the amount of work done by a > > > true PMD (and the application) for Rx processing. > > > > > > My suggestion is to wait for someone to complain about the performance > > > compared to what they had before that fix, only then see what we can do. > > > > OK