From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by dpdk.org (Postfix) with ESMTP id 8FE482B9E for ; Mon, 22 Feb 2016 19:19:33 +0100 (CET) Received: by mail-wm0-f50.google.com with SMTP id g62so176376036wme.0 for ; Mon, 22 Feb 2016 10:19:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uIL7XBE8GNyBr9SA8hnmM0LFOkBYZrafG5DzLa9zx0c=; b=xlxPAxTZ9tkxbVWdYZwovlKhMofvimFc//1H9GArnvXdcD/FvXo+v9JFtLFwPabEd7 grHvs+2Zf4kbDOz1SwxdEsv4rPPYAD2sflZuSYVurE0tKLyzO3cnWH6OUo+0V9x/IvCn CJPgmJybACM7w/PIqw92kNTbAhpp1tpZ1MofItZqAiWmkDbQiL8AndtkENchJke38lNS XcTRjFQGlgemilvX5jPyQUR/l7EdQep+rcxiPFRkmxwbbbIlSl05ll97KhRMBNrAKdZ6 ypKREqauAku4G/EJMcfvbfx6QHG1b1r2vSsInnwk6LMNW5f3hQtsTlKOXvkdGWaVmedh TK0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uIL7XBE8GNyBr9SA8hnmM0LFOkBYZrafG5DzLa9zx0c=; b=QbVdvuqMl0LyMcAP9xkcWK5xujb51al7llBMQ/Mdxz3LZfmIYz3Jg+u0KA+rSWp8Al TGiZ/yRWTOk5kOCV6wCY8oxnnGcjsDYC/utMbNdMvHN+Gno1yPntJJGahaKBDpekkas0 8cDZ9jcWW5YuqpOjO7M8T5hl4FINmkjNHQfkf+WYM1iDfT9CyHkUHTnuxnMFNrHNRy+5 IYUl/tP27Ed5gjabGqC833OMETMvpw1WoiMPdDU3fHAmMXvNIqVuHjUyadKuF9bNeLgK zyyhZ2Y5hJZ1kN3Cx3YPxBCNbbktYKBy2Bi/WucxX+CMDXq0rqWDZ8sq+/rteXXGBbDg 96YQ== X-Gm-Message-State: AG10YOTMGpzPqX7PP7Wn/v51npWFxm2thrIA+zdooDdEYtdvmZ2jSTUkjBjMvsXR/tqt47cf X-Received: by 10.28.98.84 with SMTP id w81mr13331247wmb.57.1456165173449; Mon, 22 Feb 2016 10:19:33 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id ct2sm25914294wjb.46.2016.02.22.10.19.32 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Feb 2016 10:19:32 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Mon, 22 Feb 2016 19:19:07 +0100 Message-Id: <1456165148-28416-4-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456165148-28416-1-git-send-email-adrien.mazarguil@6wind.com> References: <1456165148-28416-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 3/4] mlx5: add support for HW packet padding X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2016 18:19:33 -0000 From: Olga Shern Environment variable MLX5_PMD_ENABLE_PADDING enables HW packet padding in PCI bus transactions. When packet size is cache aligned and CRC stripping is enabled, 4 fewer bytes are written to the PCI bus. Enabling padding makes such packets aligned again. In cases where PCI bandwidth is the bottleneck, padding can improve performance by 10%. This is disabled by default since this can also decrease performance for unaligned packet sizes. Signed-off-by: Olga Shern --- doc/guides/nics/mlx5.rst | 14 ++++++++++++++ doc/guides/rel_notes/release_16_04.rst | 5 +++++ drivers/net/mlx5/Makefile | 5 +++++ drivers/net/mlx5/mlx5.c | 19 +++++++++++++++++++ drivers/net/mlx5/mlx5.h | 4 ++++ drivers/net/mlx5/mlx5_rxq.c | 10 ++++++++++ 6 files changed, 57 insertions(+) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index df07146..66fe0d9 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -155,6 +155,20 @@ Environment variables lower performance when there is no backpressure, it is not enabled by default. +- ``MLX5_PMD_ENABLE_PADDING`` + + Enables HW packet padding in PCI bus transactions. + + When packet size is cache aligned and CRC stripping is enabled, 4 fewer + bytes are written to the PCI bus. Enabling padding makes such packets + aligned again. + + In cases where PCI bandwidth is the bottleneck, padding can improve + performance by 10%. + + This is disabled by default since this can also decrease performance for + unaligned packet sizes. + Run-time configuration ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 08f7592..a3a30fd 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -87,6 +87,11 @@ This section should contain new features added in this release. Sample format: Implemented TX support in secondary processes (like mlx4). +* **mlx5: Added optional packet padding by HW.** + + Added an option to make PCI bus transactions rounded to multiple of 64 + bytes for better cache alignment. + Resolved Issues --------------- diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 7076ae3..712c0a9 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -137,6 +137,11 @@ mlx5_autoconf.h: $(RTE_SDK)/scripts/auto-config-h.sh infiniband/verbs.h \ enum IBV_EXP_CQ_RX_TCP_PACKET \ $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_EXP_CREATE_WQ_FLAG_RX_END_PADDING \ + infiniband/verbs.h \ + enum IBV_EXP_CREATE_WQ_FLAG_RX_END_PADDING \ + $(AUTOCONF_OUTPUT) $(SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD):.c=.o): mlx5_autoconf.h diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 998e6f0..8baef28 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -68,6 +68,25 @@ #include "mlx5_defs.h" /** + * Retrieve integer value from environment variable. + * + * @param[in] name + * Environment variable name. + * + * @return + * Integer value, 0 if the variable is not set. + */ +int +mlx5_getenv_int(const char *name) +{ + const char *val = getenv(name); + + if (val == NULL) + return 0; + return atoi(val); +} + +/** * DPDK callback to close the device. * * Destroy all queues and objects, free memory. diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index bad9283..436b70b 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -159,6 +159,10 @@ priv_unlock(struct priv *priv) rte_spinlock_unlock(&priv->lock); } +/* mlx5.c */ + +int mlx5_getenv_int(const char *); + /* mlx5_ethdev.c */ struct priv *mlx5_get_priv(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 3d84f41..0efa7a3 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1258,6 +1258,16 @@ rxq_setup(struct rte_eth_dev *dev, struct rxq *rxq, uint16_t desc, 0), #endif /* HAVE_EXP_DEVICE_ATTR_VLAN_OFFLOADS */ }; + +#ifdef HAVE_EXP_CREATE_WQ_FLAG_RX_END_PADDING + if (mlx5_getenv_int("MLX5_PMD_ENABLE_PADDING")) { + INFO("%p: packet padding is enabled on queue %p", + (void *)dev, (void *)rxq); + attr.wq.flags = IBV_EXP_CREATE_WQ_FLAG_RX_END_PADDING; + attr.wq.comp_mask |= IBV_EXP_CREATE_WQ_FLAGS; + } +#endif /* HAVE_EXP_CREATE_WQ_FLAG_RX_END_PADDING */ + tmpl.wq = ibv_exp_create_wq(priv->ctx, &attr.wq); if (tmpl.wq == NULL) { ret = (errno ? errno : EINVAL); -- 2.1.4