From mboxrd@z Thu Jan 1 00:00:00 1970 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) 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=xvMKJa7t3PTTYDP3IedaVwoQITzVom/SSnZPajYntFU=; b=qt3pqBlipmuCxj6HCIXxnLzlV/vVddapy2l0aVZqTafYLt+mfMKgEmvoHNoDco+EO1 89bHvKJc4gFSGspE7s9uL+bBmFEGWe1grvNLqtp08uMLTwR2kkZPmYf5nshLVdi1OKxY 1OFqDXsf47W0WVWCmcIB0EJGGM8fZNOPSarVmkKoZYoiRLKt9z4imfUXkZEvc1RVCaXx Hd08lRv08iJPO0WuEgzfZBUVWTFg3Kz02eq/zJjyFaDRFQTwz9ZPWZEJ3THhipPh1OTY fHPjZ1cHAWaUgiovgXqEYB50IrqP5u9Ed1o9xYxdwc5JZsiXZ52AjrUC1D67Aa55VeH9 AKJA== 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=xvMKJa7t3PTTYDP3IedaVwoQITzVom/SSnZPajYntFU=; b=Hezen5alyqectxj+KiO1ohdU63nsLm0c1BbSRJTe51Uqow9aitQFXKlvsE+/Rn29vy hID1dby6AonEPhSgBRgf924evbqdx/DXKCmXt1KuqlAElZZjSF/AnvZvrvxG7LVeVJEQ 6ff7r4TZw8lK/nKJ1XwKozzCneJlalC4w7OEUDLENQJ/xQsr//Jx3Oo3vDgSYmP591bN g6bspb1kH1Ug2K6Q+EYwwPwjo39UZLbhAYylIx7KOGo+DBBM9SikvaIPfaOUYXq/QNnD YuJT3traMdXjLDys0ttLWrPH6KWuRUezPNvUtIK1QihaOUzrCz+JmYy+GrokYInh+tLP Ievg== X-Gm-Message-State: APt69E19Pd/V1kqmM+/w5l/qRvwu4+TR6tq5M7nmFbYQjH5kbQ0GS0H9 uV67LZ2bQWrUWUGabVTul4WfzQ== X-Google-Smtp-Source: ADUXVKLnzr+57aJ3eVwQ106eVjyMmjm/gWM4NhFWXZGSV6shSHd6oVK1eK02/DsOFLzWLxnQUPCi0g== X-Received: by 2002:a1c:8cc8:: with SMTP id o191-v6mr242514wmd.75.1528809659458; Tue, 12 Jun 2018 06:20:59 -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 b204-v6sm655186wmh.22.2018.06.12.06.20.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 06:20:58 -0700 (PDT) Date: Tue, 12 Jun 2018 15:20:43 +0200 From: Adrien Mazarguil To: "Xueming(Steven) Li" Cc: Shahaf Shuler , "dev@dpdk.org" 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 Content-Disposition: inline In-Reply-To: Subject: Re: [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: Tue, 12 Jun 2018 13:20:59 -0000 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