From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id BBDDD1B1DB for ; Mon, 21 May 2018 18:08:40 +0200 (CEST) Received: by mail-wr0-f195.google.com with SMTP id i14-v6so16556735wre.2 for ; Mon, 21 May 2018 09:08:40 -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:in-reply-to; bh=czGzyuYoHyeU8MC7BJmKpi+Vhoe1Zf3ydBoJAv0IqqQ=; b=oUZVXJMwYi+EIf58YhhDr5qHO0zC9u7rUmb5uaC8BOcwl/1JpcuZpn37mKr6RFxUdE 3RSSwic07iqwWyJ6mzV/QpGS/9f6gI6+3jCbOWbUWWL5FNpl+XSe+cnhqHEyl8QEPW/G O/7UbAFu1xmOeKMT5d3uOC/d4ePk40Fst4P8ZEp7dMC2VjgygcgqixtxawSuACT1wd4y m+wUr+xJJ9Q7yBmEjiSTllolgeBlCoGiT3AwaQIekygBSaZ2U8095kXidxe6ivsaJsSq Tqw1gmWeP10hOVxaQaNfqlNbiHpZUaRrR2OG4sGT4QjFnhM9zuoWGYxNqu+nsGwKbRGH c9wQ== 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=czGzyuYoHyeU8MC7BJmKpi+Vhoe1Zf3ydBoJAv0IqqQ=; b=lfI2dgmlyNS9b9GVIU1lfJxR+wNec+GrDEHJ7eGDZwy3XA1oy1Foj+eCkKNeVlQEf+ JbMv2N37PVMkOgYrc45/PoF5GwIE4N8Y6rFrmlnZAoANf9mfdmQ8y/8DnM9ANx4uVI05 N6qXAjehXhzdIWzncxh1J51v6pW3igmrylfz2Jxd8Fku8lNGLGpTDxUCY+VPOGS60zfu 5LfFQ0BFrhcsHYH300XTmCrVJ8LNX6x6JHEx0+XLcOKOdA4yjTkw3u2GYw39LOOEOt1W RerbpEG7CERhJ3q+36YFhXARAbQFyO2waRQDvetM1Rr4aHax5eH448OTawjQos3O4Za8 /f1Q== X-Gm-Message-State: ALKqPwd3LY0dhAWXjCZTqDEvCADxngnjv5cIvFumoth/De5IhgubX4rc qbpAX/XHn0c33MOgikufha87ETal X-Google-Smtp-Source: AB8JxZo3IbbyfAXO9zKx5NEmLffN0eF61GS3bw/jahV/Q8hIO5FVm0mDnmK3O97YwTt1dM/NfCOQPw== X-Received: by 2002:adf:c613:: with SMTP id n19-v6mr15345725wrg.177.1526918920408; Mon, 21 May 2018 09:08:40 -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 i30-v6sm22497509wra.38.2018.05.21.09.08.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 May 2018 09:08:39 -0700 (PDT) Date: Mon, 21 May 2018 18:08:25 +0200 From: Adrien Mazarguil To: Ophir Munk Cc: dev@dpdk.org, Thomas Monjalon , Olga Shern , Shahaf Shuler Message-ID: <20180521160825.GU6497@6wind.com> References: <1526555080-19259-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526555080-19259-1-git-send-email-ophirmu@mellanox.com> Subject: Re: [dpdk-dev] [PATCH v1] net/mlx4: add an RSS hash update callback 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: Mon, 21 May 2018 16:08:40 -0000 On Thu, May 17, 2018 at 11:04:40AM +0000, Ophir Munk wrote: > Add an RSS hash update callback to eth_dev_ops. > > Signed-off-by: Ophir Munk This patch allows applications to configure legacy RSS past initial port configuration, but doesn't take input parameters into account. Its purpose is to silence errors instead of telling users it's unsupported. For this reason, I suggest to either withdraw this patch entirely, or fully implement legacy RSS configuration by making rss_hash_update more than a no-op and by adding rss_hash_conf_get, reta_update and reta_query as part of the same task for completeness. > --- > drivers/net/mlx4/Makefile | 1 + > drivers/net/mlx4/mlx4.c | 1 + > drivers/net/mlx4/mlx4.h | 7 ++++++ > drivers/net/mlx4/mlx4_rss.c | 59 +++++++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 68 insertions(+) > create mode 100644 drivers/net/mlx4/mlx4_rss.c > > diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile > index 73f9d40..eb89f6b 100644 > --- a/drivers/net/mlx4/Makefile > +++ b/drivers/net/mlx4/Makefile > @@ -23,6 +23,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_rxq.c > SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_rxtx.c > SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_txq.c > SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_utils.c > +SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_rss.c > > ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y) > INSTALL-$(CONFIG_RTE_LIBRTE_MLX4_PMD)-lib += $(LIB_GLUE) > diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c > index 9f8ecd0..7000511 100644 > --- a/drivers/net/mlx4/mlx4.c > +++ b/drivers/net/mlx4/mlx4.c > @@ -261,6 +261,7 @@ static const struct eth_dev_ops mlx4_dev_ops = { > .flow_ctrl_get = mlx4_flow_ctrl_get, > .flow_ctrl_set = mlx4_flow_ctrl_set, > .mtu_set = mlx4_mtu_set, > + .rss_hash_update = mlx4_rss_hash_update, > .filter_ctrl = mlx4_filter_ctrl, > .rx_queue_intr_enable = mlx4_rx_intr_enable, > .rx_queue_intr_disable = mlx4_rx_intr_disable, > diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h > index 300cb4d..6842a71 100644 > --- a/drivers/net/mlx4/mlx4.h > +++ b/drivers/net/mlx4/mlx4.h > @@ -50,6 +50,9 @@ > /** Port parameter. */ > #define MLX4_PMD_PORT_KVARG "port" > > +/** Supported RSS. */ > +#define MLX4_RSS_HF_MASK (~(ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP)) > + > enum { > PCI_VENDOR_ID_MELLANOX = 0x15b3, > }; > @@ -144,4 +147,8 @@ void mlx4_rxq_intr_disable(struct priv *priv); > int mlx4_rx_intr_disable(struct rte_eth_dev *dev, uint16_t idx); > int mlx4_rx_intr_enable(struct rte_eth_dev *dev, uint16_t idx); > > +/* mlx4_rss.c */ > + > +int mlx4_rss_hash_update(struct rte_eth_dev *dev, > + struct rte_eth_rss_conf *rss_conf); > #endif /* RTE_PMD_MLX4_H_ */ > diff --git a/drivers/net/mlx4/mlx4_rss.c b/drivers/net/mlx4/mlx4_rss.c > new file mode 100644 > index 0000000..656a00d > --- /dev/null > +++ b/drivers/net/mlx4/mlx4_rss.c > @@ -0,0 +1,59 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2015 6WIND S.A. > + * Copyright 2015 Mellanox Technologies, Ltd > + */ > + > +#include > +#include > +#include > +#include > + > +/* Verbs headers do not support -pedantic. */ > +/* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */ > +#ifdef PEDANTIC > +#pragma GCC diagnostic ignored "-Wpedantic" > +#endif > +#include > +#ifdef PEDANTIC > +#pragma GCC diagnostic error "-Wpedantic" > +#endif > + > +#include "mlx4.h" > +#include "mlx4_flow.h" > +#include "mlx4_utils.h" > + > +/** > + * DPDK callback to update the RSS hash configuration. > + * > + * @param dev > + * Pointer to Ethernet device structure. > + * @param[in] rss_conf > + * RSS configuration data. > + * > + * @return > + * 0 on success, a negative errno value otherwise and rte_errno is set. > + */ > +int > +mlx4_rss_hash_update(struct rte_eth_dev *dev, > + struct rte_eth_rss_conf *rss_conf) > +{ > + /* > + * limitation: MLX4 supports all of IP, UDP and TCP hash > + * functions together and not in partial combinations > + * Just make sure no unsupported HF is requested > + */ > + if (rss_conf->rss_hf & MLX4_RSS_HF_MASK) { > + rte_errno = EINVAL; > + return -rte_errno; > + } > + if (rss_conf->rss_key && rss_conf->rss_key_len) { > + /* > + * Currently mlx4 RSS key cannot be updated > + */ > + ERROR("port %u RSS key cannot be updated", > + dev->data->port_id); > + rte_errno = EINVAL; > + return -rte_errno; > + } > + return 0; > +} > -- > 2.7.4 > -- Adrien Mazarguil 6WIND