From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 486681BC08 for ; Thu, 18 Apr 2019 19:09:06 +0200 (CEST) Received: by mail-wr1-f65.google.com with SMTP id t17so3808859wrw.13 for ; Thu, 18 Apr 2019 10:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CwUtat7c7Xi69Jge6HzdRaNiAuAaygQlhvExijpXXMo=; b=GYzSpTkg0FWoW0cHFamZCmq2NQCfR9Cu1ItvF2aLYsKuaGyq90azwZg20msAJ6/QHB Zo0FhnHroxRiBKkE+I7zRkPSZFcPyNs6YJas87o7FFOMGj3qF+NBJkgXn/IhzhzOdNsh bS1Jx1QYX2YsATJtFogGMb3jUbE8k0UoB5Jll3dEdDYlmk3AZ2yZim9i+Yg1xtFCPiwt bYMo2+WCfL2zYC5HqfYPrD8Xbd7MIAFkYAs6JXOSHk8o55qJnZzpKGSv5ytACAOo6+6r dHvsBqEMnqs7uCdDOGbt/W6cr0gpKTrnXUHW8ByeGYSDyNJDje7bIuKyhZ4MqfvE0MQN Qllw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CwUtat7c7Xi69Jge6HzdRaNiAuAaygQlhvExijpXXMo=; b=geoJ1V8aaY2SyNmX1P3gSnci0Sr1hxW1h+yrpx/te8a5vRV8kw7G88FaPZ9Ms1W4x1 rsZw4FzGXyd2Id1LmKn6yNI5yDgMEybuEd3Cyi68u5UdEs7azFCmO5ppQAKvZIxowiZd 0I/EcEl2KQYtuK43NYJT2hdriUYBSo7QoApcxEjbXsk2TyzkvJLtdsHgp2iK1Vmp0xck oXQ5qlXBpDkcgMUEf7yptfYmXOiBIWv+3Tx74zzDckNXD4v0b64qejfoWNpFV535Nm0r bWdpTtutMp8WXDc+Z9r4k5VfWh/V7bc4q9KtK1FLEjat3cBqpylB+dSimUWkrdu4O7P6 40hA== X-Gm-Message-State: APjAAAXPA421MZ3he2gk/TZ1sBqMfTSithTV6gIzCGGY6cGN2/BQY8xm phEqXL1CD8uNo+TS/Vdpp+CQKw== X-Google-Smtp-Source: APXvYqyQXD+0LX0voKg3fV4fixyFzZ3HNp5UdtZd/HiBYKU+vemjZ4225SZgY2wgoXsv3RTA4WBFCA== X-Received: by 2002:a5d:5745:: with SMTP id q5mr612038wrw.118.1555607345957; Thu, 18 Apr 2019 10:09:05 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id e1sm3319315wrw.66.2019.04.18.10.09.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 10:09:05 -0700 (PDT) Date: Thu, 18 Apr 2019 19:09:03 +0200 From: Adrien Mazarguil To: Thomas Monjalon Cc: dev@dpdk.org, Gaetan Rivet , Ferruh Yigit , David Marchand , stable@dpdk.org, Ali Alnubani Message-ID: <20190418170903.GI4889@6wind.com> References: <20190418130419.25675-1-adrien.mazarguil@6wind.com> <2732210.eFvFzSlaYO@xps> <20190418164624.GG4889@6wind.com> <1609324.Zy8sxAcIVK@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1609324.Zy8sxAcIVK@xps> 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:09:06 -0000 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. > > 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 > > -- Adrien Mazarguil 6WIND 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 668F7A00E6 for ; Thu, 18 Apr 2019 19:09:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5DBA81BC0E; Thu, 18 Apr 2019 19:09:07 +0200 (CEST) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 486681BC08 for ; Thu, 18 Apr 2019 19:09:06 +0200 (CEST) Received: by mail-wr1-f65.google.com with SMTP id t17so3808859wrw.13 for ; Thu, 18 Apr 2019 10:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CwUtat7c7Xi69Jge6HzdRaNiAuAaygQlhvExijpXXMo=; b=GYzSpTkg0FWoW0cHFamZCmq2NQCfR9Cu1ItvF2aLYsKuaGyq90azwZg20msAJ6/QHB Zo0FhnHroxRiBKkE+I7zRkPSZFcPyNs6YJas87o7FFOMGj3qF+NBJkgXn/IhzhzOdNsh bS1Jx1QYX2YsATJtFogGMb3jUbE8k0UoB5Jll3dEdDYlmk3AZ2yZim9i+Yg1xtFCPiwt bYMo2+WCfL2zYC5HqfYPrD8Xbd7MIAFkYAs6JXOSHk8o55qJnZzpKGSv5ytACAOo6+6r dHvsBqEMnqs7uCdDOGbt/W6cr0gpKTrnXUHW8ByeGYSDyNJDje7bIuKyhZ4MqfvE0MQN Qllw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CwUtat7c7Xi69Jge6HzdRaNiAuAaygQlhvExijpXXMo=; b=geoJ1V8aaY2SyNmX1P3gSnci0Sr1hxW1h+yrpx/te8a5vRV8kw7G88FaPZ9Ms1W4x1 rsZw4FzGXyd2Id1LmKn6yNI5yDgMEybuEd3Cyi68u5UdEs7azFCmO5ppQAKvZIxowiZd 0I/EcEl2KQYtuK43NYJT2hdriUYBSo7QoApcxEjbXsk2TyzkvJLtdsHgp2iK1Vmp0xck oXQ5qlXBpDkcgMUEf7yptfYmXOiBIWv+3Tx74zzDckNXD4v0b64qejfoWNpFV535Nm0r bWdpTtutMp8WXDc+Z9r4k5VfWh/V7bc4q9KtK1FLEjat3cBqpylB+dSimUWkrdu4O7P6 40hA== X-Gm-Message-State: APjAAAXPA421MZ3he2gk/TZ1sBqMfTSithTV6gIzCGGY6cGN2/BQY8xm phEqXL1CD8uNo+TS/Vdpp+CQKw== X-Google-Smtp-Source: APXvYqyQXD+0LX0voKg3fV4fixyFzZ3HNp5UdtZd/HiBYKU+vemjZ4225SZgY2wgoXsv3RTA4WBFCA== X-Received: by 2002:a5d:5745:: with SMTP id q5mr612038wrw.118.1555607345957; Thu, 18 Apr 2019 10:09:05 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id e1sm3319315wrw.66.2019.04.18.10.09.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 10:09:05 -0700 (PDT) Date: Thu, 18 Apr 2019 19:09:03 +0200 From: Adrien Mazarguil To: Thomas Monjalon Cc: dev@dpdk.org, Gaetan Rivet , Ferruh Yigit , David Marchand , stable@dpdk.org, Ali Alnubani Message-ID: <20190418170903.GI4889@6wind.com> References: <20190418130419.25675-1-adrien.mazarguil@6wind.com> <2732210.eFvFzSlaYO@xps> <20190418164624.GG4889@6wind.com> <1609324.Zy8sxAcIVK@xps> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline In-Reply-To: <1609324.Zy8sxAcIVK@xps> 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: <20190418170903.oIcBGUXhqMGFt1LBjgJ16a7Y599FHBLwy7gn15vZBGI@z> 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. > > 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 > > -- Adrien Mazarguil 6WIND