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 1A8FBA00E6 for ; Thu, 18 Apr 2019 16:08:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 375601B9A5; Thu, 18 Apr 2019 16:08:58 +0200 (CEST) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id E5EFA1B9A4 for ; Thu, 18 Apr 2019 16:08:56 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id o12so3176403wrn.2 for ; Thu, 18 Apr 2019 07:08:56 -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:content-transfer-encoding:in-reply-to :user-agent; bh=9MYqNvkm70bRXdqEhnn6mqfzG1U/fPGysoHeU+Tkk4U=; b=P1HEBUZWPzUzIayhqX8POC06fJE6grGSGYFIflT4uwhr+hLUb1MNsA4hSv/p6zqFoj vE6w2tgbbRjBogWzLaJBCD+w5eksR1CnFamxh4p+/C7ATxrzicE1L9m/lb7JkVa7qIIn Er8pwVVcIYkYgkKIfd2nRhJL51iR2IDsyET8vteQdAbVBi5EdU65rPYbZ5bg39/9Duk7 zChI47/fW0cG5YfbHxAqNFnbwrUcVJKrA08nPu/hEuIaOTfp5v6GT1jONXKoqc2vTZBl mMMELnuWSKfYjCiluhWZ69OUpMhs9cHn4uZ+H1TJmSsBNpiZf+DO24gq7gHImDzHhcSd cOQg== 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:content-transfer-encoding :in-reply-to:user-agent; bh=9MYqNvkm70bRXdqEhnn6mqfzG1U/fPGysoHeU+Tkk4U=; b=IYeQs/yMaxf5smXQAzlZ7HonM0O4HlJ3JdMB/aRDnN8pfn13F/5LfcI5xf2oC2pIgA ZQYFTLNipBx1YrdngZWwlX3GnVthcqt/9un2+tRKBKQjcY3COBQ9McuCFGt1AmCpHwfi TVZ+qrHAtINz5jH1NO0hp5vCwLjWfrnTNsjHkmWxoExX80sgCC1W8ofBbWQVA/92bXXV Cng9JhKBZn1qJ/IWy0yTThckVIkMUVERaCqQpjW87OtS2xMP+Qstj+IVtUUmcHNGuTRQ px9PjqYnFAaAHIby7/kHRpqhh+mz+oNlTNVoj9ZgyeV+I9mWCONhE6ZucRbMF5V0nByv jB9g== X-Gm-Message-State: APjAAAWYQ2b/xxjCA2KyYFukp3QKLAbtNmLMQPZLPvRwcm/l67OEAZW/ CrH+ffhOWuMxjOVS7xUzUaKT/Q== X-Google-Smtp-Source: APXvYqy8+PsMU52cUK9tZ/IaFNWOFE5hk4A6ExG9vDvPov7bfsMwojmut8Xd/V3+1uw01hUoaWcfyA== X-Received: by 2002:adf:97c5:: with SMTP id t5mr844798wrb.252.1555596536514; Thu, 18 Apr 2019 07:08:56 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id d6sm2384482wrp.9.2019.04.18.07.08.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Apr 2019 07:08:55 -0700 (PDT) Date: Thu, 18 Apr 2019 16:08:53 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Adrien Mazarguil Cc: Ferruh Yigit , dev@dpdk.org Message-ID: <20190418140851.ad3cny34oydl75jp@bidouze.vm.6wind.com> References: <20190418130419.25675-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190418130419.25675-1-adrien.mazarguil@6wind.com> User-Agent: NeoMutt/20170113 (1.7.2) 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: <20190418140853.7HAhyLN9LoDw9-hY_h0hUPZxfxtRcZexO0XQljAmTCI@z> On Thu, Apr 18, 2019 at 03:11:26PM +0200, 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 Missing a Cc: stable@dpdk.org no? Given that no one saw that until a slightly heavier application was used with the fail-safe, I guess few people will care, but still. Acked-by: Gaetan Rivet > --- > 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); > return nb_rx; > } > > @@ -112,6 +130,9 @@ failsafe_rx_burst_fast(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); > return nb_rx; > } > > -- > 2.11.0 -- Gaëtan Rivet 6WIND