From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrien Mazarguil Subject: Re: [PATCH 7/7] net/mlx5: add parameter for port representors Date: Tue, 12 Jun 2018 15:20:43 +0200 Message-ID: <20180612132043.GZ4025@6wind.com> References: <20180525161814.13873-1-adrien.mazarguil@6wind.com> <20180525161814.13873-8-adrien.mazarguil@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Shahaf Shuler , "dev@dpdk.org" To: "Xueming(Steven) Li" Return-path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 9F0281E3BA for ; Tue, 12 Jun 2018 15:20:59 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id e16-v6so20530117wmd.0 for ; Tue, 12 Jun 2018 06:20:59 -0700 (PDT) Content-Disposition: inline In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Jun 12, 2018 at 08:02:17AM +0000, Xueming(Steven) Li wrote: > Hi Adrien, > > > -----Original Message----- > > From: dev On Behalf Of Adrien Mazarguil > > Sent: Saturday, May 26, 2018 12:35 AM > > To: Shahaf Shuler > > Cc: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH 7/7] net/mlx5: add parameter for port representors > > > > 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 > > @@ -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; > > Not related to this patch, from this data structure, maximum representor count is 32, > customer might use VF on container environment, 32 is far from requirement. We need > additional work here. A workaround is that users call this api multiple times with different > representor IDs. 32 ought to be enough for anybody! Not sure I understand your concern actually. One can't instantiate more representors than there are DPDK ports because the limit for both is RTE_MAX_ETHPORTS (i.e. 1 representor = 1 DPDK port). Users who want to spawn more than 32 DPDK ports overall must increase RTE_MAX_ETHPORTS regardless. > > 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]); > > Need a range check for j here. I think it's properly checked. j == 0 stands for "master device", always found at index 0 and probed. Representors devices, if any, start at index 1 which triggers the previous block. This block makes sure that a given representor is indeed enabled before either spawning the related device (pass through with a valid "j") or skipping it altogether (goto skip). I intend to leave this patch as is for v2. -- Adrien Mazarguil 6WIND