From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id 905A51BB72 for ; Thu, 18 Apr 2019 17:08:15 +0200 (CEST) Received: by mail-wm1-f68.google.com with SMTP id h18so3299960wml.1 for ; Thu, 18 Apr 2019 08:08:15 -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=tU91ZofNGeiR1JBOcShsDfhrTuHcdw26EdS4zXZ5y7o=; b=VLRjeXe9p27OF/4Skk90ULvKP2O2DDRWQ4rfBFAY1RUlgrxAb/QhzHTLqQCfweCpXt oVQOoAnRbRRvZUAYfiWpEw8FF7CJdpguKU7lCYOuKGxmYDO3HLvCS0s4GbUTvf7wydwE mUNhThBv3v0dWTm7/rEzWJllDllXqcVIH1SeiGgmzUfRCYg2Xd2nH3/K3sPUIVnyxFXo af9aJ3F7V6/8Rf2bE3o0VFqmAj1q0rtq+wcaZ+/U5UJeEJHgHLbwA3vSlor+Nq4Ddpku cTYXl52N9+YbgxBr2M9si2qySiMue0Zfrl6tI9hMG72AViEpAhDf/DIE1z/gt8wEKYjp uoUA== 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=tU91ZofNGeiR1JBOcShsDfhrTuHcdw26EdS4zXZ5y7o=; b=GYBUrCd95ZRb/NwJpf0mBfylz7DVnPkR9abW/aRxMI3lT5yBa0RpZClIRq/9ZERUtG fuJOJfK/+0B/vCfcpiFC8ajK8FBYl6LUGpQ8vnbNG4oNgR2J75y3JrA2TAaPQ+lkQH4L 6z8QUoBOqFiLY0S+THHpJ7TXW8PmRmGZQsBW1KdJGMBPMgC5sAYoXdKxKTI8Kn2JTLqi KXJeJUJ1HANp2PKy8aVHHGSAH7BzKAk8ihoXWRfkLAJOktLevtRv+UKPuWUj/HjrSmmG 9pJ1RI6lh9q7mCSq4bD3C2K8XEtM8y4etrlY223G7u6XnZOKLBIJptAl269Xe65IDRkI JPWg== X-Gm-Message-State: APjAAAVW0xKJx3ViUYxF+sBXaKH2dpEjCE8r8LtoW8CDaDvqgTNZTC83 84ty/9Fn0NregU+xGmeSj+zHnQ== X-Google-Smtp-Source: APXvYqy9y9+1+CZnTYLjCvc267RKSDs+MKEsVFzrPX1tbe+r3NAQ8tdP8FRRuSzuI/ojE7s3IgswbA== X-Received: by 2002:a1c:a010:: with SMTP id j16mr3745332wme.40.1555600095288; Thu, 18 Apr 2019 08:08:15 -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 y18sm2809939wro.80.2019.04.18.08.08.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 08:08:14 -0700 (PDT) Date: Thu, 18 Apr 2019 17:08:13 +0200 From: Adrien Mazarguil To: Ferruh Yigit Cc: Gaetan Rivet , dev@dpdk.org Message-ID: <20190418150813.GF4889@6wind.com> References: <20190418130419.25675-1-adrien.mazarguil@6wind.com> <23381495-84ea-a8ff-939a-cf56f4447072@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <23381495-84ea-a8ff-939a-cf56f4447072@intel.com> Subject: Re: [dpdk-dev] [PATCH] 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 15:08:15 -0000 On Thu, Apr 18, 2019 at 03:42:24PM +0100, Ferruh Yigit wrote: > On 4/18/2019 2:11 PM, Adrien Mazarguil wrote: > > When passed to the application, Rx packets retain the port ID value > > originally set by slave devices. Unfortunately these IDs have no meaning to > > applications, which are typically unaware of their existence. > > > > This confuses those caring about the source port field in mbufs (m->port) > > which experience issues ranging from traffic drop to crashes. > > > > Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD") > > Signed-off-by: Adrien Mazarguil > > --- > > drivers/net/failsafe/failsafe_rxtx.c | 21 +++++++++++++++++++++ > > 1 file changed, 21 insertions(+) > > > > diff --git a/drivers/net/failsafe/failsafe_rxtx.c b/drivers/net/failsafe/failsafe_rxtx.c > > index 231c83291..e78624127 100644 > > --- a/drivers/net/failsafe/failsafe_rxtx.c > > +++ b/drivers/net/failsafe/failsafe_rxtx.c > > @@ -61,6 +61,21 @@ failsafe_set_burst_fn(struct rte_eth_dev *dev, int force_safe) > > rte_wmb(); > > } > > > > +/* > > + * Override source port in Rx packets. > > + * > > + * Make Rx packets originate from this PMD instance instead of one of its > > + * slaves. This is mandatory to avoid breaking applications. > > + */ > > +static void > > +failsafe_rx_set_port(struct rte_mbuf **rx_pkts, uint16_t nb_pkts, uint16_t port) > > +{ > > + unsigned int i; > > + > > + for (i = 0; i != nb_pkts; ++i) > > + rx_pkts[i]->port = port; > > +} > > + > > uint16_t > > failsafe_rx_burst(void *queue, > > struct rte_mbuf **rx_pkts, > > @@ -87,6 +102,9 @@ failsafe_rx_burst(void *queue, > > sdev = sdev->next; > > } while (nb_rx == 0 && sdev != rxq->sdev); > > rxq->sdev = sdev; > > + if (nb_rx) > > + failsafe_rx_set_port(rx_pkts, nb_rx, > > + rxq->priv->dev->data->port_id); > > error: struct "fs_priv" has no field "dev" > > I guess intention is: "rxq->priv->data->port_id" Indeed, I validated this patch as is against v18.11 and overlooked a compilation check against master. I'll send an updated version with Cc stable and all, thanks! -- 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 BED34A00E6 for ; Thu, 18 Apr 2019 17:08:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A2AAC1BB92; Thu, 18 Apr 2019 17:08:16 +0200 (CEST) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id 905A51BB72 for ; Thu, 18 Apr 2019 17:08:15 +0200 (CEST) Received: by mail-wm1-f68.google.com with SMTP id h18so3299960wml.1 for ; Thu, 18 Apr 2019 08:08:15 -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=tU91ZofNGeiR1JBOcShsDfhrTuHcdw26EdS4zXZ5y7o=; b=VLRjeXe9p27OF/4Skk90ULvKP2O2DDRWQ4rfBFAY1RUlgrxAb/QhzHTLqQCfweCpXt oVQOoAnRbRRvZUAYfiWpEw8FF7CJdpguKU7lCYOuKGxmYDO3HLvCS0s4GbUTvf7wydwE mUNhThBv3v0dWTm7/rEzWJllDllXqcVIH1SeiGgmzUfRCYg2Xd2nH3/K3sPUIVnyxFXo af9aJ3F7V6/8Rf2bE3o0VFqmAj1q0rtq+wcaZ+/U5UJeEJHgHLbwA3vSlor+Nq4Ddpku cTYXl52N9+YbgxBr2M9si2qySiMue0Zfrl6tI9hMG72AViEpAhDf/DIE1z/gt8wEKYjp uoUA== 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=tU91ZofNGeiR1JBOcShsDfhrTuHcdw26EdS4zXZ5y7o=; b=GYBUrCd95ZRb/NwJpf0mBfylz7DVnPkR9abW/aRxMI3lT5yBa0RpZClIRq/9ZERUtG fuJOJfK/+0B/vCfcpiFC8ajK8FBYl6LUGpQ8vnbNG4oNgR2J75y3JrA2TAaPQ+lkQH4L 6z8QUoBOqFiLY0S+THHpJ7TXW8PmRmGZQsBW1KdJGMBPMgC5sAYoXdKxKTI8Kn2JTLqi KXJeJUJ1HANp2PKy8aVHHGSAH7BzKAk8ihoXWRfkLAJOktLevtRv+UKPuWUj/HjrSmmG 9pJ1RI6lh9q7mCSq4bD3C2K8XEtM8y4etrlY223G7u6XnZOKLBIJptAl269Xe65IDRkI JPWg== X-Gm-Message-State: APjAAAVW0xKJx3ViUYxF+sBXaKH2dpEjCE8r8LtoW8CDaDvqgTNZTC83 84ty/9Fn0NregU+xGmeSj+zHnQ== X-Google-Smtp-Source: APXvYqy9y9+1+CZnTYLjCvc267RKSDs+MKEsVFzrPX1tbe+r3NAQ8tdP8FRRuSzuI/ojE7s3IgswbA== X-Received: by 2002:a1c:a010:: with SMTP id j16mr3745332wme.40.1555600095288; Thu, 18 Apr 2019 08:08:15 -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 y18sm2809939wro.80.2019.04.18.08.08.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 08:08:14 -0700 (PDT) Date: Thu, 18 Apr 2019 17:08:13 +0200 From: Adrien Mazarguil To: Ferruh Yigit Cc: Gaetan Rivet , dev@dpdk.org Message-ID: <20190418150813.GF4889@6wind.com> References: <20190418130419.25675-1-adrien.mazarguil@6wind.com> <23381495-84ea-a8ff-939a-cf56f4447072@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline In-Reply-To: <23381495-84ea-a8ff-939a-cf56f4447072@intel.com> Subject: Re: [dpdk-dev] [PATCH] 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: <20190418150813.RkKsITzDt5A8Axf1Hlka7QGamdIH6s054R528zgDkBM@z> On Thu, Apr 18, 2019 at 03:42:24PM +0100, Ferruh Yigit wrote: > On 4/18/2019 2:11 PM, Adrien Mazarguil wrote: > > When passed to the application, Rx packets retain the port ID value > > originally set by slave devices. Unfortunately these IDs have no meaning to > > applications, which are typically unaware of their existence. > > > > This confuses those caring about the source port field in mbufs (m->port) > > which experience issues ranging from traffic drop to crashes. > > > > Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD") > > Signed-off-by: Adrien Mazarguil > > --- > > drivers/net/failsafe/failsafe_rxtx.c | 21 +++++++++++++++++++++ > > 1 file changed, 21 insertions(+) > > > > diff --git a/drivers/net/failsafe/failsafe_rxtx.c b/drivers/net/failsafe/failsafe_rxtx.c > > index 231c83291..e78624127 100644 > > --- a/drivers/net/failsafe/failsafe_rxtx.c > > +++ b/drivers/net/failsafe/failsafe_rxtx.c > > @@ -61,6 +61,21 @@ failsafe_set_burst_fn(struct rte_eth_dev *dev, int force_safe) > > rte_wmb(); > > } > > > > +/* > > + * Override source port in Rx packets. > > + * > > + * Make Rx packets originate from this PMD instance instead of one of its > > + * slaves. This is mandatory to avoid breaking applications. > > + */ > > +static void > > +failsafe_rx_set_port(struct rte_mbuf **rx_pkts, uint16_t nb_pkts, uint16_t port) > > +{ > > + unsigned int i; > > + > > + for (i = 0; i != nb_pkts; ++i) > > + rx_pkts[i]->port = port; > > +} > > + > > uint16_t > > failsafe_rx_burst(void *queue, > > struct rte_mbuf **rx_pkts, > > @@ -87,6 +102,9 @@ failsafe_rx_burst(void *queue, > > sdev = sdev->next; > > } while (nb_rx == 0 && sdev != rxq->sdev); > > rxq->sdev = sdev; > > + if (nb_rx) > > + failsafe_rx_set_port(rx_pkts, nb_rx, > > + rxq->priv->dev->data->port_id); > > error: struct "fs_priv" has no field "dev" > > I guess intention is: "rxq->priv->data->port_id" Indeed, I validated this patch as is against v18.11 and overlooked a compilation check against master. I'll send an updated version with Cc stable and all, thanks! -- Adrien Mazarguil 6WIND