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 934931E40F for ; Thu, 14 Jun 2018 10:35:18 +0200 (CEST) Received: by mail-wr0-f194.google.com with SMTP id e18-v6so5456246wrs.5 for ; Thu, 14 Jun 2018 01:35:18 -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=xLu3gnQ5zQUkUpZFgcgJizivfiIyQhz5ETjbX1E10og=; b=xT0PnnUepM0apcy6e5lJxukiJKSq0xPTM0Eo2xarGvRT1bMoV51mLijubBtOJwQjY6 BEAynqJInAtACX2JW4WDRd7CV2nXVDzOAbqi8e3t7sBBnfQHf0g1mWyRj6P5Ph/B1GHE nVEsMu5Zh7br2pMVyAMU2UHwoEhinzuLa40TCTsn84Mw4iiX34TBigE7Bpd3GC23LcYT DP8GLqhQIjwx5xXwFcc2ItnRx2Ze/zthHbT0oVozp+5odT9kU5FjCCIKRG/4bXGF0ZL8 ZVkBal6QO0Na7N5sBiY9SW/PBK78QzMGsx0h73kkt1D3JAwtzQJdn3wR7+TZsMOAkXk0 DZ/Q== 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=xLu3gnQ5zQUkUpZFgcgJizivfiIyQhz5ETjbX1E10og=; b=YiuMTr9VBfF4v0h97DihY+DW2lXRGtGrCctmLpB+46EMngiCKxUbOyaUMEXgP1afwb Q9VU52tey/kX2omC7Tp28cIVYzfkL+6k/MWJyIMBBFG9OMcO7ARcF2cOVpvGwyPF57VT cOgZs0yb4ZpRRswFjKP1iewj0KeLtNGAJ92+RzS5r7XP0QdGH7qE4QizuVDM7YXHeB8A zsrM/CzLHSbfAflQESdjHE9d/tQ6HwXwE0JOCdB5k3zHYJTsQdssO5lqDb9Pl4aW8JeM r0EemoUc9oCkHfwee2pnvSeR12AHPhLDYkKtOBmeMqJIlvC8fTivb7te91+koaBAkMeK 4COQ== X-Gm-Message-State: APt69E2Ye2ZKBpASNvCX/VHjdzaCGCLMqnei/lWUVcFuKNCYmn3paB69 ULkGduZYLExeLkEMmB8tolI8O8yZ X-Google-Smtp-Source: ADUXVKLMKtVuus7TUVpotvXjx28YSDHYBQFF+k/F2PbFyF5cxTadAmvpQMI4+GSOsB8zd9ZWa3nn0A== X-Received: by 2002:adf:fb92:: with SMTP id a18-v6mr1247230wrr.278.1528965318361; Thu, 14 Jun 2018 01:35:18 -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 c11-v6sm4848506wrm.65.2018.06.14.01.35.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 01:35:17 -0700 (PDT) Date: Thu, 14 Jun 2018 10:35:02 +0200 From: Adrien Mazarguil To: Shahaf Shuler Cc: dev@dpdk.org Message-ID: <20180614083047.10812-8-adrien.mazarguil@6wind.com> References: <20180525161814.13873-1-adrien.mazarguil@6wind.com> <20180614083047.10812-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180614083047.10812-1-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v2 7/7] net/mlx5: add parameter for port representors 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: Thu, 14 Jun 2018 08:35:18 -0000 Prior to this patch, all port representors detected on a given device were probed and Ethernet devices instantiated for each of them. This patch adds support for the standard "representor" parameter, which implies that port representors are not probed by default anymore, except for the list provided through device arguments. (Patch based on prior work from Yuanhan Liu) Signed-off-by: Adrien Mazarguil -- v2 changes: - Added error message for when rte_eth_devargs_parse() fails. --- doc/guides/nics/mlx5.rst | 12 ++++++++++++ doc/guides/prog_guide/poll_mode_drv.rst | 2 ++ drivers/net/mlx5/mlx5.c | 29 ++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 79c982e29..5229e546c 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -388,6 +388,18 @@ Run-time configuration Disabled by default. +- ``representor`` parameter [list] + + This parameter can be used to instantiate DPDK Ethernet devices from + existing port (or VF) representors configured on the device. + + It is a standard parameter whose format is described in + :ref:`ethernet_device_standard_device_arguments`. + + For instance, to probe port representors 0 through 2:: + + representor=[0-2] + Firmware configuration ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst index af82352a0..58d49ba0f 100644 --- a/doc/guides/prog_guide/poll_mode_drv.rst +++ b/doc/guides/prog_guide/poll_mode_drv.rst @@ -365,6 +365,8 @@ Ethernet Device API The Ethernet device API exported by the Ethernet PMDs is described in the *DPDK API Reference*. +.. _ethernet_device_standard_device_arguments: + Ethernet Device Standard Device Arguments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 716c9d9a5..26e61d99d 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -91,6 +91,9 @@ /* Activate Netlink support in VF mode. */ #define MLX5_VF_NL_EN "vf_nl_en" +/* Select port representors to instantiate. */ +#define MLX5_REPRESENTOR "representor" + #ifndef HAVE_IBV_MLX5_MOD_MPW #define MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED (1 << 2) #define MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW (1 << 3) @@ -423,6 +426,9 @@ mlx5_args_check(const char *key, const char *val, void *opaque) struct mlx5_dev_config *config = opaque; unsigned long tmp; + /* No-op, port representors are processed in mlx5_dev_spawn(). */ + if (!strcmp(MLX5_REPRESENTOR, key)) + return 0; errno = 0; tmp = strtoul(val, NULL, 0); if (errno) { @@ -495,6 +501,7 @@ mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs) MLX5_RX_VEC_EN, MLX5_L3_VXLAN_EN, MLX5_VF_NL_EN, + MLX5_REPRESENTOR, NULL, }; struct rte_kvargs *kvlist; @@ -1173,13 +1180,34 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, struct rte_eth_dev **eth_list = NULL; struct ibv_context *ctx; struct ibv_device_attr_ex attr; + struct rte_eth_devargs eth_da; void *tmp; unsigned int i; unsigned int j = 0; unsigned int n = 0; int ret; + if (dpdk_dev->devargs) { + ret = rte_eth_devargs_parse(dpdk_dev->devargs->args, ð_da); + if (ret) { + rte_errno = -ret; + DRV_LOG(ERR, "failed to process device arguments: %s", + strerror(rte_errno)); + goto error; + } + } else { + memset(ð_da, 0, sizeof(eth_da)); + } next: + if (j) { + unsigned int k; + + for (k = 0; k < eth_da.nb_representor_ports; ++k) + if (eth_da.representor_ports[k] == j - 1) + break; + if (k == eth_da.nb_representor_ports) + goto skip; + } errno = 0; ctx = mlx5_glue->open_device(ibv_dev[j]); if (!ctx) { @@ -1218,6 +1246,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, goto error; ++n; } +skip: if (ibv_dev[++j]) goto next; eth_list[n] = NULL; -- 2.11.0