From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id 4A5DF1EADA for ; Thu, 14 Jun 2018 10:01:19 +0200 (CEST) Received: by mail-wr0-f196.google.com with SMTP id w10-v6so5326016wrk.9 for ; Thu, 14 Jun 2018 01:01:19 -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=uofV/rWSHcms4XPW6EuOABathZ3LSO4H9qVlhp+rtfk=; b=wM0q6evWtpCqlyN9f+cHTyf7sY3tEuNB3g8UvGCW8r3Z/0fSZGas5m6oJhi5Aiz3In Hhc/ruuBUBmBhjMXx9hWiVj4cyU5DVZ9a19qe9ILXLKSTm9ZAMoHcL37x/Ib0GeDFI+Y Rep4BBwq1T9N0eFeYhzso+legPwdV1b4UEdSslfyk/CQqdHGNfKpwAhxOhIMtMBv28TW SYmvsfrtuKfxonAoj15IcJYqaKlLkW9DYpv11/Ko9UfmLFJsby43wq7QNUgAcCtUu7yl oY918gqYZpa7w8QeSq6f+h1JLOBx7UbGLIcbm4HfvBys7ZafHLGOIwl0qS+9cmN0IsvH dOGw== 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=uofV/rWSHcms4XPW6EuOABathZ3LSO4H9qVlhp+rtfk=; b=PnUFsSV79Ij+4F/pnFop6dctzQi9cJQTNisXi/2aE5SAMAqqG+x8E9h/cvIU2SRyFW m1LhD3IQ7nxAnYAK+oIqOcNUU6w7vNoXrsHl4BwDRwADEu517BX5W5VJGftMDOFBryjU WPjv84mGbuqqmf+z5N+LZTwrZ3wP+Vpxw1vnU879SsSxLR14y/XCfTXUYELYVEYLCmXj Qm6DTSMx1oDixnO+tzbLi+E1FDmvfT4nqsMRwQP/FxpCGsH1Ktrq6IgpQtP5qouY9xV0 zuVHMH/YU5RSFC1l7NcFOwhOkLA9zKl4JCe9nNAAwLVv1z5kVrGcERcjOHzuay+Oz+Mo vKyw== X-Gm-Message-State: APt69E1SLroxbGEXRxOMsjeIotpiEr7GXabSDBYfM+CyfgN+l8YzsVZe orkmD715zTA9AqkcXhEzrCVkHvgd X-Google-Smtp-Source: ADUXVKLgEq1e+BI8dxjL4Xxws9vTCZ16bnJ/nohwy6rGcT+mnsWpKX2E+HXcYwYr5+hxMd31BHzNAQ== X-Received: by 2002:adf:9383:: with SMTP id 3-v6mr1167617wrp.220.1528963279080; Thu, 14 Jun 2018 01:01:19 -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 d5-v6sm5804034wrp.64.2018.06.14.01.01.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 01:01:18 -0700 (PDT) Date: Thu, 14 Jun 2018 10:01:02 +0200 From: Adrien Mazarguil To: "Xueming(Steven) Li" Cc: Shahaf Shuler , "dev@dpdk.org" Message-ID: <20180614080102.GL4025@6wind.com> References: <20180525161814.13873-1-adrien.mazarguil@6wind.com> <20180525161814.13873-8-adrien.mazarguil@6wind.com> <20180612132043.GZ4025@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: Thu, 14 Jun 2018 08:01:19 -0000 On Tue, Jun 12, 2018 at 01:43:18PM +0000, Xueming(Steven) Li wrote: > > > > 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). > > Yes, this code looks good. What I wanted to ask what if dev args specify an invalid rep id, e.g. 33. > This code walk through silently w/o warning, it works, but it better to have a warning if input id out of range. You're right. On the other hand this provides a means to spawn all representors without necessarily knowing how many can be instantiated first, e.g. by always providing a "representor=[0-31]" argument, since no special keyword is defined to request them all. Not saying it's a good or bad thing, but somewhat harmless. Just like specifying "-w {DBDF}" arguments with invalid addresses, nonexistent representors are silently ignored. In any case, this can be improved later. We're already seeing a couple of limitations with the representor argument, namely the lack of hot-plug support, which will need to be addressed as well. -- Adrien Mazarguil 6WIND