From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 5BA674C6F for ; Fri, 25 May 2018 18:35:42 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id x12-v6so33234705wmc.0 for ; Fri, 25 May 2018 09:35:42 -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=B16wupJqlfh1VMnoqsza+PMYnZDudtN6HFkB6npNUcI=; b=P0QtSMXY+9cIzks21hYdymSDEGWc4g6u3HoUXQrmEkb+DTxBJI7+1SDQSngnErxb04 cLx6Srp0Mi1LuftjQb23yP3TzKg/FIwh/SDMun0uESqz1TwcBZP6QCXOp6SLdGR3/zkv X+vuleXdM9trqoimSZJi1dPHzxBU9okO+X9XaiJ774VUZItz4AmsXDWCdQxqmcP1oz4z /SzCzTO/c6QUXL3wheiR1RJRxMqKSCSGtIVR6W9Z395M8A8T4DIpeKgl8RmnHilK0n5J YTV3dMQP2poM+JOC6GP81EKYPBRnL7byRd18r8hr3OfWvwXT95UiPcvAJqbFnmhsqdEG VuMA== 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=B16wupJqlfh1VMnoqsza+PMYnZDudtN6HFkB6npNUcI=; b=quhQEM8/RLM/NESTMSt35+ROn46ytngtHe1qOReWHfJan53FeGk66RPXV7A5A4UrUb +LU+Th7kEA3RxEGUHgDXA8QO45U24QNfihvD2FkUcpXb8TjTKBY4jtViAjOtwtOTNe6R Csy3DUf/tZU9tHgFnPCV0PufXqzw6lMCtmYukL7kgbuVKdUCiPqqVLpcQol6gQCT6dhg pBfYireWiJuF6DNpmiI3SnsVSzZxpZCBUq3DxIi5USdOUIZFAyOCR71akkCdKeTrcqcW q3gdrZlPgmPnVPbFp8SRPzh7/DLCqDB9p+4o8l2to2xipaeddZ8bvWvDDpnONSFQjtxL jLFw== X-Gm-Message-State: ALKqPwcUXdcWIqUFUgynByAbAzdW1E36L9jfl0EMlmxJgrWYupp+Yi5X vUfb3rCvnwB8tnRuG3sf1PLQMHax X-Google-Smtp-Source: ADUXVKJkxcNd/12aqvEWi/7uox2IBciLQWxyD9j3saDyz+wJKbGs7NtclrAzS+J+1+06Pf4quJP/BA== X-Received: by 2002:a1c:4584:: with SMTP id l4-v6mr2277769wmi.142.1527266142077; Fri, 25 May 2018 09:35:42 -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 y129-v6sm7890838wmg.44.2018.05.25.09.35.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 09:35:41 -0700 (PDT) Date: Fri, 25 May 2018 18:35:26 +0200 From: Adrien Mazarguil To: Shahaf Shuler Cc: dev@dpdk.org Message-ID: <20180525161814.13873-8-adrien.mazarguil@6wind.com> References: <20180525161814.13873-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180525161814.13873-1-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH 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: Fri, 25 May 2018 16:35:42 -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 --- doc/guides/nics/mlx5.rst | 12 ++++++++++++ doc/guides/prog_guide/poll_mode_drv.rst | 2 ++ drivers/net/mlx5/mlx5.c | 25 +++++++++++++++++++++++++ 3 files changed, 39 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 09afca63c..216753ba6 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -90,6 +90,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) @@ -420,6 +423,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) { @@ -492,6 +498,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; @@ -1142,13 +1149,30 @@ 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) + 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) { @@ -1187,6 +1211,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