From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id DEEF1A48C for ; Wed, 14 Mar 2018 18:11:40 +0100 (CET) Received: by mail-wr0-f194.google.com with SMTP id n12so5558771wra.2 for ; Wed, 14 Mar 2018 10:11: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=ut7FMAEdcdCPGTybkCwGoiLsv7nrVraS0sQxdVU0vas=; b=RaK/6Oza0/dozI6n8zZOr/QYu0BnZF9imS4gQGXSeFO8UDPbjxhqt1/0NevNTWffJP ENgAU2kaKM8vIGjokBI2MEIkr/cvpYCACaToag4Q/hFNd9u+kdBSDuhz0oiKi7Cou1eA i0tyvkyriVvFW3J4FDnzHuez2TMZQEOY+kuvldeBic/k+khV7EZ0Tf42SIQFNa3z7qat 6z/r9FmLCc1/Zca2H8VcbZCmhrDa7HYOJirk6y8+G3HD+udQbnvyqtaxtV4TQIe6Mhbb Xnz/FPJgUFMDPfr2wVMm5NJiBS+1qJlhqbjLAMA/p6V975gGgW6dMENEe0MxyB+7eiZC OZDw== 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=ut7FMAEdcdCPGTybkCwGoiLsv7nrVraS0sQxdVU0vas=; b=olILTP18jUtpuADoiRCzxPgE2EuEhweLV6SAe+FIuzySMgwx8P2aTz5qD25YmgS0Ic 1usw2DETY4vwQesJjCLV1DBpSAGPgvVHEiCb9ieWyS5a3trouh09kAOYxbN8KLxrbhZk 7ldDdV+8svMtEXgKIX+pl5fyxe4kHVUKoqoPq+7LxxEHKg4EbbzP+6cPMy0qnMkDvlsi Q8IcJkp6T2k7i/Qeio1g4J3KC/BR8muwbncFUp+PZDVebOT8CxHZT5VREHkhWZilqvSB XZrQTC+cZ+onYHOT0LcUgdBfTiI7Pp+anRl0dhfX9GnvGWC0+QQFG48POuS1FeWp6G/8 MzBQ== X-Gm-Message-State: AElRT7Gx+hCzVCISz53UEOBoubC/PFAJOeBxMmMV6LBrzhEtE8IilXXh kNh9WLNIXsDfZw5DJS3GoZRxhA== X-Google-Smtp-Source: AG47ELvsCT4n36KhJviZtWSqyQE7Hor4Q89PSjGcZzxFuILokxA+AhF0j2jaaJWffK338m29/OcQtg== X-Received: by 10.223.150.111 with SMTP id c44mr4661805wra.90.1521047500417; Wed, 14 Mar 2018 10:11: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 y111sm3575373wrc.0.2018.03.14.10.11.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 10:11:39 -0700 (PDT) Date: Wed, 14 Mar 2018 18:11:26 +0100 From: Adrien Mazarguil To: Nelio Laranjeiro Cc: Yongseok Koh , dev@dpdk.org Message-ID: <20180314171125.GP3994@6wind.com> References: <4f7edc1bf7163c274f6ea60d2f813b4963f1a968.1520944256.git.nelio.laranjeiro@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4f7edc1bf7163c274f6ea60d2f813b4963f1a968.1520944256.git.nelio.laranjeiro@6wind.com> Subject: Re: [dpdk-dev] [PATCH 5/5] net/mlx5: add a parameter for Netlink support in VF 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: Wed, 14 Mar 2018 17:11:41 -0000 On Tue, Mar 13, 2018 at 01:50:39PM +0100, Nelio Laranjeiro wrote: > All Netlink request the PMD will do can also be done by a iproute2 command > line interface, letting the operator configure the VF behavior without > having to modify the application nor reaching PMD limits (e.g. MAC > address number limit). > > Signed-off-by: Nelio Laranjeiro Some nits, please see below. > --- > doc/guides/nics/mlx5.rst | 13 ++++++++++++ > drivers/net/mlx5/mlx5.c | 7 ++++++ > drivers/net/mlx5/mlx5.h | 1 + > drivers/net/mlx5/mlx5_vf.c | 53 ++++++++++++++++++++++++++++++++++++++++++++-- > 4 files changed, 72 insertions(+), 2 deletions(-) > > diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst > index 46d26e4c8..54e6f327b 100644 > --- a/doc/guides/nics/mlx5.rst > +++ b/doc/guides/nics/mlx5.rst > @@ -135,6 +135,11 @@ Limitations > - Flows with a VXLAN Network Identifier equal (or ends to be equal) > to 0 are not supported. > - VXLAN TSO and checksum offloads are not supported on VM. > +- VF: Flow rules matching a specific MAC address are only triggers if the MAC > + has been previously added by the application. Rewording suggestion: Flow rules created on VF devices can only match traffic targeted at the configured MAC addresses (see ``rte_eth_dev_mac_addr_add()``). > + Adding more than MLX5_MAX_MAC_ADDRESSES MAC addresses is not supported in VF > + mode. **Note** needs a Linux kernel v4.16 or higher or Mellanox OFED > + installed. I think this last bit is kind of redundant since applications already can't add more MAC addresses than what a PMD allows. It's not a new limitation. > > Statistics > ---------- > @@ -335,6 +340,14 @@ Run-time configuration > > Enabled by default. > > +- ``vf_nl_en`` parameter [int] > + > + A nonzero value enables Netlink requests from the VF to add/remove MAC > + addresses or/and enable/disable promiscuous/allmulticast on the Netdevice. > + Otherwise the according configuration must be run with Linux iproute2 tools. You might add that it's a necessary prerequisite to receive the traffic in question. > + > + Enabled by default on VF. => VF devices. > + > Prerequisites > ------------- > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index e966884bd..d1ca0837c 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -68,6 +68,9 @@ > /* Device parameter to enable hardware Rx vector. */ > #define MLX5_RX_VEC_EN "rx_vec_en" > > +/* Activate Netlink support in VF mode. */ > +#define MLX5_VF_NL_EN "vf_nl_en" > + > #ifndef HAVE_IBV_MLX5_MOD_MPW > #define MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED (1 << 2) > #define MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW (1 << 3) > @@ -414,6 +417,8 @@ mlx5_args_check(const char *key, const char *val, void *opaque) > config->tx_vec_en = !!tmp; > } else if (strcmp(MLX5_RX_VEC_EN, key) == 0) { > config->rx_vec_en = !!tmp; > + } else if (strcmp(MLX5_VF_NL_EN, key) == 0) { > + config->vf_nl_en = !!tmp; > } else { > DRV_LOG(WARNING, "%s: unknown parameter", key); > rte_errno = EINVAL; > @@ -445,6 +450,7 @@ mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs) > MLX5_TXQ_MAX_INLINE_LEN, > MLX5_TX_VEC_EN, > MLX5_RX_VEC_EN, > + MLX5_VF_NL_EN, > NULL, > }; > struct rte_kvargs *kvlist; > @@ -750,6 +756,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > .txq_inline = MLX5_ARG_UNSET, > .txqs_inline = MLX5_ARG_UNSET, > .inline_max_packet_sz = MLX5_ARG_UNSET, > + .vf_nl_en = 1, > }; > > len = snprintf(name, sizeof(name), PCI_PRI_FMT, > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h > index 245235641..8c3e925af 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -88,6 +88,7 @@ struct mlx5_dev_config { > unsigned int tx_vec_en:1; /* Tx vector is enabled. */ > unsigned int rx_vec_en:1; /* Rx vector is enabled. */ > unsigned int mpw_hdr_dseg:1; /* Enable DSEGs in the title WQEBB. */ > + unsigned int vf_nl_en:1; /* Enable Netlink request in VF mode. */ request => requests > unsigned int tso_max_payload_sz; /* Maximum TCP payload for TSO. */ > unsigned int ind_table_max_size; /* Maximum indirection table size. */ > int txq_inline; /* Maximum packet size for inlining. */ > diff --git a/drivers/net/mlx5/mlx5_vf.c b/drivers/net/mlx5/mlx5_vf.c > index cf71e79d9..18b02365d 100644 > --- a/drivers/net/mlx5/mlx5_vf.c > +++ b/drivers/net/mlx5/mlx5_vf.c > @@ -361,7 +361,16 @@ mlx5_vf_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac) > int i; > int mac_index = MLX5_MAX_MAC_ADDRESSES; > int ret; > + struct priv *priv = dev->data->dev_private; > > + if (!priv->config.vf_nl_en) { > + DRV_LOG(WARNING, > + "port %u Netlink requests are disabled, add the MAC" > + " though bridge command: bridge fdb add dev" > + " ", > + dev->data->port_id); Log level should be INFO (even "PROTIP" if such a thing existed :) Also I'm not sure it should be done for each call, printing it once during startup should be enough. > + return 0; > + } > ret = mlx5_vf_mac_addr_list(dev, &macs, &macs_n); > if (ret) > return ret; > @@ -399,7 +408,16 @@ mlx5_vf_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac) > int i; > int mac_index = MLX5_MAX_MAC_ADDRESSES; > int ret; > + struct priv *priv = dev->data->dev_private; > > + if (!priv->config.vf_nl_en) { > + DRV_LOG(WARNING, > + "port %u Netlink requests are disabled, delete the MAC" > + " though bridge command: bridge fdb del dev" > + " ", > + dev->data->port_id); Same here. > + return 0; > + } > ret = mlx5_vf_mac_addr_list(dev, &macs, &macs_n); > if (ret) > return ret; > @@ -432,7 +450,16 @@ mlx5_vf_mac_addr_flush(struct rte_eth_dev *dev) > { > int i; > const struct ether_addr mac_null = { .addr_bytes = { 0 }, }; > + struct priv *priv = dev->data->dev_private; > > + if (!priv->config.vf_nl_en) { > + DRV_LOG(WARNING, > + "port %u Netlink requests are disabled, flush added" > + " MAC though bridge command: bridge fdb del dev" > + " ", > + dev->data->port_id); Ditto. > + return 0; > + } > /* Skip the default mac at index 0. */ > for (i = 1; i != MLX5_MAX_MAC_ADDRESSES; ++i) { > struct ether_addr *m = &dev->data->mac_addrs[i]; > @@ -516,8 +543,19 @@ mlx5_vf_device_flags(struct rte_eth_dev *dev, uint32_t flags, int enable) > int > mlx5_vf_promisc(struct rte_eth_dev *dev, int enable) > { > - int ret = mlx5_vf_device_flags(dev, IFF_PROMISC, enable); > + int ret; > + struct priv *priv = dev->data->dev_private; > > + if (!priv->config.vf_nl_en) { > + DRV_LOG(WARNING, > + "port %u Netlink requests are disabled, %s promisc" > + " though ip link command: ip link set promisc" > + " %s", > + dev->data->port_id, enable ? "enable" : "disable", > + enable ? "on" : "off"); Ditto. > + return 0; > + } > + ret = mlx5_vf_device_flags(dev, IFF_PROMISC, enable); > if (ret) > DRV_LOG(DEBUG, > "port %u cannot %s promisc mode: Netlink error %s", > @@ -540,8 +578,19 @@ mlx5_vf_promisc(struct rte_eth_dev *dev, int enable) > int > mlx5_vf_allmulti(struct rte_eth_dev *dev, int enable) > { > - int ret = mlx5_vf_device_flags(dev, IFF_ALLMULTI, enable); > + int ret; > + struct priv *priv = dev->data->dev_private; > > + if (!priv->config.vf_nl_en) { > + DRV_LOG(WARNING, > + "port %u Netlink requests are disabled, %s allmulti" > + " though ip link command: ip link set " > + " allmulticast %s", > + dev->data->port_id, enable ? "enable" : "disable", > + enable ? "on" : "off"); Ditto. > + return 0; > + } > + ret = mlx5_vf_device_flags(dev, IFF_ALLMULTI, enable); > if (ret) > DRV_LOG(DEBUG, > "port %u cannot %s allmulti mode: Netlink error %s", > -- > 2.11.0 > -- Adrien Mazarguil 6WIND