From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f171.google.com (mail-wr0-f171.google.com [209.85.128.171]) by dpdk.org (Postfix) with ESMTP id 4C0DC913D for ; Wed, 2 Aug 2017 09:52:33 +0200 (CEST) Received: by mail-wr0-f171.google.com with SMTP id y43so15374740wrd.3 for ; Wed, 02 Aug 2017 00:52:33 -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=xDiJndek/cNkABbY8EnltZCZkn7alK0+nbF5b0EnN84=; b=NkEePIOZ4RczrazdM2FFiPngNwGiVb0QmklOP1SG96OkChXNMZWFKlUQUH5AXwO4ma c1U2tL4KxFF6QTxADL4+3LCYepYdp3ZnOK/9N2/c1kGwZTEiDvMOrjFVHylw1mh2Bsvu QH9lRnEz45ZLmN/BtwA+kY6FubOPDMveVVapznIxGAHLpqQEcRtswOMSolpICyRGBZkE zIar2KDdc+98nZtdDB8vydCu6ZScUhnmpwEfY795seGw1lcIlrSAGmmMKnwX3pTSld57 FR13y1addfjjQol521+J/oshEYEdXvXxJyngRzCYZfey1DWY91P0Q3nI8NQu2XOfLmdT RK9w== 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=xDiJndek/cNkABbY8EnltZCZkn7alK0+nbF5b0EnN84=; b=Xbnjv69W1Yi1faoNEIX7BS3zIPZk+uXIwK8KGfox7X4UzYWfmAPIYOle00d6a6YrTx U8clFb3gxhVKf/Hk+sx+8AMD6LaCkF+CNtUxwme5j0XWgljx9lYtatzY3gMuXq+Pz8In t3xWNiRWqfWBVWp6fu+UXYAZUNjRnTg4WWsOHqiOldabgwm6sD6WyH2bZBrZmQOLpcaf V00OgQnNVrtIthOt5EAATyk4lDX3iLGM96QspHWwkB/LF2wqqVxG8QqJ+yBeZO0Oa7Gu OETQAWV/I53/7eBixTEX3nbuOaGjk0Y6ojVJhftw5kOnARoFgFdaIJnyywfU6VH2XqwK DWuw== X-Gm-Message-State: AIVw113zdD2lwvpzUwh5w7FpU3ribEZBDZPksARpWQQ8tXzHCOskc3AS xUFixRC2UtMkLsiY X-Received: by 10.223.174.90 with SMTP id u26mr15025077wrd.237.1501660352868; Wed, 02 Aug 2017 00:52:32 -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 g72sm254274wmc.31.2017.08.02.00.52.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2017 00:52:32 -0700 (PDT) Date: Wed, 2 Aug 2017 09:52:23 +0200 From: Adrien Mazarguil To: "Legacy, Allain" Cc: "dev@dpdk.org" , =?utf-8?Q?Ga=C3=ABtan?= Rivet Message-ID: <20170802075223.GW19852@6wind.com> References: <04ea7bf54d1ddba834fb187ae169b3de79b5aaa0.1501598384.git.adrien.mazarguil@6wind.com> <70A7408C6E1BFB41B192A929744D8523969F2112@ALA-MBD.corp.ad.wrs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <70A7408C6E1BFB41B192A929744D8523969F2112@ALA-MBD.corp.ad.wrs.com> Subject: Re: [dpdk-dev] [PATCH v1 03/48] net/mlx4: check max number of ports dynamically 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: Wed, 02 Aug 2017 07:52:33 -0000 On Tue, Aug 01, 2017 at 05:35:30PM +0000, Legacy, Allain wrote: > > -----Original Message----- > > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > > Sent: Tuesday, August 01, 2017 12:54 PM > <...> > > @@ -5946,12 +5949,11 @@ mlx4_arg_parse(const char *key, const char *val, > > void *out) > > return -errno; > > } > > if (strcmp(MLX4_PMD_PORT_KVARG, key) == 0) { > > - if (tmp >= MLX4_PMD_MAX_PHYS_PORTS) { > > - ERROR("invalid port index %lu (max: %u)", > > - tmp, MLX4_PMD_MAX_PHYS_PORTS - 1); > > + if (!(conf->ports.present & (1 << tmp))) { > > + ERROR("invalid port index %lu", tmp); > > The original error included the max value. Wouldn't it be useful to report this to the > user to help them understand their mistake? Makes sense, I'll add it back. > > @@ -6085,16 +6092,16 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, > > struct rte_pci_device *pci_dev) > > } > > INFO("%u port(s) detected", device_attr.phys_port_cnt); > > > > + for (i = 0; i < device_attr.phys_port_cnt; ++i) > > + conf.ports.present |= 1 << i; > > The loop could be avoided with: > > conf.ports.present = (1 << device_attr.phys_port_cnt) - 1; I will also make that change in the next iteration, thanks. -- Adrien Mazarguil 6WIND