From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 63F531B81A for ; Tue, 10 Apr 2018 17:28:34 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id 66so20675074wmd.3 for ; Tue, 10 Apr 2018 08:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=zTrPhHdcd7iF9RGsR2BywHMKi/ljjSu/fsoXR/+leOU=; b=vUla54m3VgDhE9R/ftAeZPIFntrTJSnuHVEUMwyeWoTzNuMzR8HBcMnPlZggo7+urS 9TxEfmxCzrUzFzcW4PtaaC4fEq6+erZBeul2cr1ru0Kq2vFgkK9GnnXpqNhn+WDXcGvN +oPU/Xzmd5DmUhYqu7HODvSG4X/ZQRBauskEL/LeSc1lj9/f0hQsu8G57OoATpAac+xJ o2xD2yNZQeSeFO8DtcY1tkxrk/87t9NWJVaehMPtmIRhDCgO+jH3YOGAScmqQ1w5bsJB gRrjMM0p3Hoiw+bmYNG6USBsoGpgKOGMx0TArbORVCGQRzlzsxXgf8L7ahbDF2Ngo7WM QRHg== 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=zTrPhHdcd7iF9RGsR2BywHMKi/ljjSu/fsoXR/+leOU=; b=MlYUwRnxjZxirvM/zHnhJ2SRJUtNri2lza+ukt+qEdTiFOzgj4AuP4f203hqj6zOR4 /dnuHzV/12nrf2LJIHMdH50Zo0cDZUK9aMpXF91gcx199yuQEsUnocVbkT4YTKTOeeyC /W6qDLHCQC59aFjzAbJJhTmw71Ju9w2PfSUCUymv9eAuIwF3/JSHaoQZ4klFC9nS92c/ lgwd7s/fJFalC6MXsDZrAnTOYoKAJGX/T07TOxmC/LAE+oM75nrloYIeoy2tLZrGarEg feEik4nru/D4rwuS9pguQS4II0uusf05i/CVvfAVH7tulrSEA6EoZpo7yKuvUeZb/4s3 yE3g== X-Gm-Message-State: ALQs6tBL41RPytLh1LF1p+Ln00HU8F4LQXTvA6lisi81bDhNgKgI6Urt 9wOulV2rWccv/0Ir8/aA8xm0 X-Google-Smtp-Source: AIpwx4/JREkhOr2Kba9EGrezo9PMc0I31U4qvLW1Vc+msJaa82WZpcJFRg2PDI5H1esbzisdGVmCXQ== X-Received: by 10.28.209.15 with SMTP id i15mr2040964wmg.106.1523374114113; Tue, 10 Apr 2018 08:28:34 -0700 (PDT) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 39sm6063122wry.89.2018.04.10.08.28.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Apr 2018 08:28:33 -0700 (PDT) Date: Tue, 10 Apr 2018 17:28:51 +0200 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: Xueming Li Cc: Shahaf Shuler , dev@dpdk.org Message-ID: <20180410152851.kxkd7txbfkcbd2t2@laranjeiro-vm.dev.6wind.com> References: <20180410133415.189905-1-xuemingl@mellanox.com> <20180410133415.189905-7-xuemingl@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180410133415.189905-7-xuemingl@mellanox.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v2 06/15] net/mlx5: split flow RSS handling logic 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: Tue, 10 Apr 2018 15:28:34 -0000 On Tue, Apr 10, 2018 at 09:34:06PM +0800, Xueming Li wrote: > This patch split out flow RSS hash field handling logic to dedicate > function. > > Signed-off-by: Xueming Li Acked-by: Nelio Laranjeiro > --- > drivers/net/mlx5/mlx5_flow.c | 94 +++++++++++++++++++++++++------------------- > 1 file changed, 53 insertions(+), 41 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index b3ad6dc85..64658bc0e 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -992,13 +992,6 @@ mlx5_flow_update_priority(struct rte_eth_dev *dev, > static void > mlx5_flow_convert_finalise(struct mlx5_flow_parse *parser) > { > - const unsigned int ipv4 = > - hash_rxq_init[parser->layer].ip_version == MLX5_IPV4; > - const enum hash_rxq_type hmin = ipv4 ? HASH_RXQ_TCPV4 : HASH_RXQ_TCPV6; > - const enum hash_rxq_type hmax = ipv4 ? HASH_RXQ_IPV4 : HASH_RXQ_IPV6; > - const enum hash_rxq_type ohmin = ipv4 ? HASH_RXQ_TCPV6 : HASH_RXQ_TCPV4; > - const enum hash_rxq_type ohmax = ipv4 ? HASH_RXQ_IPV6 : HASH_RXQ_IPV4; > - const enum hash_rxq_type ip = ipv4 ? HASH_RXQ_IPV4 : HASH_RXQ_IPV6; > unsigned int i; > > /* Remove any other flow not matching the pattern. */ > @@ -1011,40 +1004,6 @@ mlx5_flow_convert_finalise(struct mlx5_flow_parse *parser) > } > return; > } > - if (parser->layer == HASH_RXQ_ETH) { > - goto fill; > - } else { > - /* > - * This layer becomes useless as the pattern define under > - * layers. > - */ > - rte_free(parser->queue[HASH_RXQ_ETH].ibv_attr); > - parser->queue[HASH_RXQ_ETH].ibv_attr = NULL; > - } > - /* Remove opposite kind of layer e.g. IPv6 if the pattern is IPv4. */ > - for (i = ohmin; i != (ohmax + 1); ++i) { > - if (!parser->queue[i].ibv_attr) > - continue; > - rte_free(parser->queue[i].ibv_attr); > - parser->queue[i].ibv_attr = NULL; > - } > - /* Remove impossible flow according to the RSS configuration. */ > - if (hash_rxq_init[parser->layer].dpdk_rss_hf & > - parser->rss_conf.types) { > - /* Remove any other flow. */ > - for (i = hmin; i != (hmax + 1); ++i) { > - if ((i == parser->layer) || > - (!parser->queue[i].ibv_attr)) > - continue; > - rte_free(parser->queue[i].ibv_attr); > - parser->queue[i].ibv_attr = NULL; > - } > - } else if (!parser->queue[ip].ibv_attr) { > - /* no RSS possible with the current configuration. */ > - parser->rss_conf.queue_num = 1; > - return; > - } > -fill: > /* > * Fill missing layers in verbs specifications, or compute the correct > * offset to allocate the memory space for the attributes and > @@ -1107,6 +1066,56 @@ mlx5_flow_convert_finalise(struct mlx5_flow_parse *parser) > } > > /** > + * Update flows according to pattern and RSS hash fields. > + * > + * @param[in, out] parser > + * Internal parser structure. > + * > + * @return > + * 0 on success, a negative errno value otherwise and rte_errno is set. > + */ > +static int > +mlx5_flow_convert_rss(struct mlx5_flow_parse *parser) > +{ > + const unsigned int ipv4 = > + hash_rxq_init[parser->layer].ip_version == MLX5_IPV4; > + const enum hash_rxq_type hmin = ipv4 ? HASH_RXQ_TCPV4 : HASH_RXQ_TCPV6; > + const enum hash_rxq_type hmax = ipv4 ? HASH_RXQ_IPV4 : HASH_RXQ_IPV6; > + const enum hash_rxq_type ohmin = ipv4 ? HASH_RXQ_TCPV6 : HASH_RXQ_TCPV4; > + const enum hash_rxq_type ohmax = ipv4 ? HASH_RXQ_IPV6 : HASH_RXQ_IPV4; > + const enum hash_rxq_type ip = ipv4 ? HASH_RXQ_IPV4 : HASH_RXQ_IPV6; > + unsigned int i; > + > + if (parser->layer == HASH_RXQ_ETH) > + return 0; > + /* This layer becomes useless as the pattern define under layers. */ > + rte_free(parser->queue[HASH_RXQ_ETH].ibv_attr); > + parser->queue[HASH_RXQ_ETH].ibv_attr = NULL; > + /* Remove opposite kind of layer e.g. IPv6 if the pattern is IPv4. */ > + for (i = ohmin; i != (ohmax + 1); ++i) { > + if (!parser->queue[i].ibv_attr) > + continue; > + rte_free(parser->queue[i].ibv_attr); > + parser->queue[i].ibv_attr = NULL; > + } > + /* Remove impossible flow according to the RSS configuration. */ > + if (hash_rxq_init[parser->layer].dpdk_rss_hf & > + parser->rss_conf.types) { > + /* Remove any other flow. */ > + for (i = hmin; i != (hmax + 1); ++i) { > + if (i == parser->layer || !parser->queue[i].ibv_attr) > + continue; > + rte_free(parser->queue[i].ibv_attr); > + parser->queue[i].ibv_attr = NULL; > + } > + } else if (!parser->queue[ip].ibv_attr) { > + /* no RSS possible with the current configuration. */ > + parser->rss_conf.queue_num = 1; > + } > + return 0; > +} > + > +/** > * Validate and convert a flow supported by the NIC. > * > * @param dev > @@ -1214,6 +1223,9 @@ mlx5_flow_convert(struct rte_eth_dev *dev, > * configuration. > */ > if (!parser->drop) > + ret = mlx5_flow_convert_rss(parser); > + if (ret) > + goto exit_free; > mlx5_flow_convert_finalise(parser); > mlx5_flow_update_priority(dev, parser, attr); > exit_free: > -- > 2.13.3 > -- Nélio Laranjeiro 6WIND