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 B88361E318 for ; Tue, 12 Jun 2018 15:20:38 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id j15-v6so23375888wme.0 for ; Tue, 12 Jun 2018 06:20:38 -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=G6F8sa3u28s/G4YeBXqIxei8S1BcRzxQMKrm3RyLaaQ=; b=RpsCu7PR8Jq3rxPzq0/kb42qlvT2AZfQCpFIOaqQRRRVT9cVu45ofTWk9rUBHzeoXY EsONTwpbiadh6Lx9Q+BNeSqPofYGVYv7WoTHkOBmgyskcUR6ILvwbYZKqSAiBs+2jScW 5JtWdv8vpRPIuzQawNr4Lrnnhl3I2UTAQNF0IQrFp8zI5QhKoHelUB9U/Xq6NBZBhXHM CgDeR3NV6TZ4yAOCTtR5hu0UDC6azbS4nC6RMHsxXNlIyyUD57gEbkpk/SNhzwYfHR1h JoXXbOUHizTV1r+GWIw4MqusEBmAXKE3mvYiPHVEeCb1+c7fnm0C3irjXVVj3GgOIZOT p4Jw== 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=G6F8sa3u28s/G4YeBXqIxei8S1BcRzxQMKrm3RyLaaQ=; b=rOSQHAL02XVZv43QxzEFew0RiXVBWVSpQIY+bwvnM71zD/10yufMXdYZi00Ob+e30c MP45hUfrSS39utcw/qENrlyJ/qhg+xWq8JvkFVG6ZjofRjKrtuOm3cJM9Ynwen+hCXW/ dv/binPDQv/QvRcXPwc1qgQc7Ap2Ku98xTgg/HrpVqDMvqR8OYMDe7B++mY/chrel/VH MmLP9tJbVL+HEZdZ2mUEGHDh7arn/RnTehVJufScYGO+oXcoKq/ziebd+QjgNWyG1tgX MJilYQB4ZBA5NK/8VgIfwgEHPchC3Q/pD9VvCF9vZXxuyps4/GUOAJI+wB5A8kBsyhYf 81Mg== X-Gm-Message-State: APt69E1gp8sLYntRGDfkpuNPK9Pc1Tle50ENug+yL73fWD6rhEkCg7V/ FmSNZcqo++e8oDE60VjEquHtbA== X-Google-Smtp-Source: ADUXVKJOKM1PJ421oI7kqYU9sLTwWwlLwWc91R4lnJkD/SyAPh6eS/rfndR09V1Pau5eic+Y/pX8iw== X-Received: by 2002:a1c:8cc8:: with SMTP id o191-v6mr241600wmd.75.1528809638568; Tue, 12 Jun 2018 06:20:38 -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-v6sm654181wmh.22.2018.06.12.06.20.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 06:20:37 -0700 (PDT) Date: Tue, 12 Jun 2018 15:20:22 +0200 From: Adrien Mazarguil To: "Xueming(Steven) Li" Cc: Shahaf Shuler , "dev@dpdk.org" Message-ID: <20180612132022.GX4025@6wind.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [dpdk-dev] [dpdk-dev, 5/7] net/mlx5: add port representor awareness 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:38 -0000 On Mon, Jun 11, 2018 at 01:05:55PM +0000, Xueming(Steven) Li wrote: > Hi Adrien, > > Couldn't find your original email from inbox anyway, have to start a new thread here. > > +static int > > +mlx5_cmp_ibv_name(const void *a, const void *b) > > +{ > > + const char *name_a = (*(const struct ibv_device *const *)a)->name; > > + const char *name_b = (*(const struct ibv_device *const *)b)->name; > > + size_t i = 0; > > + > > + while (name_a[i] && name_a[i] == name_b[i]) > > + ++i; > > + return atoi(name_a + i) - atoi(name_b + i); > > Comparing "1" and "10" here will return 0, does this matter? Sure it does! The whole point of this function is precisely to avoid this kind of issues. I'll fix it for v2, thanks. > > + if (n > 1) { > > + /* > > + * The existence of several matching entries means port > > + * representors have been instantiated. No existing Verbs > > + * call nor /sys entries can tell them apart at this point. > > + * > > + * While definitely hackish, assume their names are numbered > > + * based on order of creation with master device first, > > + * followed by first port representor, followed by the > > + * second one and so on. > > + */ > > + DRV_LOG(WARNING, > > + "probing device with port representors involves" > > + " heuristics with uncertain outcome"); > > + qsort(ibv_match, n, sizeof(*ibv_match), mlx5_cmp_ibv_name); > > + DRV_LOG(WARNING, "assuming \"%s\" is the master device", > > + ibv_match[0]->name); > > + for (ret = 1; ret < n; ++ret) > > + DRV_LOG(WARNING, > > + "assuming \"%s\" is port representor #%d", > > + ibv_match[ret]->name, ret - 1); > > Such dump will appear when attaching each rep port, how about just > do it for PF in DEBUG level? It occurs only once when probing the master device and detecting the presence of representors, not for each of them. I prefer to leave it as a warning because this detection approach, while an undeniable improvement over not checking anything and ending up configuring the wrong netdevice, is unfortunately not 100% accurate. This will be improved, however users must be warned of possible issues in the meantime. -- Adrien Mazarguil 6WIND