From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by dpdk.org (Postfix) with ESMTP id 32FCE1B74B for ; Thu, 10 May 2018 22:26:54 +0200 (CEST) Received: by mail-pg0-f68.google.com with SMTP id n9-v6so1438979pgq.5 for ; Thu, 10 May 2018 13:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L6EAK5K543Dj0xyXtBXOG4l9v1V4dkCqnigAXW0jg8Y=; b=vNTkNdljFRxx4FmiVXbm8kCmHPhK5j7a13aSliN0dl5dob2QIbnBPwQJ8yOGNlN1aR 2U09ukozGz4A7f6Q4acx3JQyXdEMr00r8iXV7LYZUzyImfRdio/4ZPxrFVv7YEwyBkRO Yqc60RFylNzBVFNYNyoCBqMag/3DaaL0Hu5+GCkZe95eJYolr5v9p/sw7ILsZMph4AO7 UE+zNHtkkiiNmIr9o/E35Pymzrmjaj3BjFcKzKuIYXjujTNVfJugeJML9IRlaQIM0hvb SbXFybt0S757gFlfVoFkeFpX1MM8nfCm7NGRfIbfmIBmI+IBWNEZcFxfYs7wsTkDW4HU gG7g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=L6EAK5K543Dj0xyXtBXOG4l9v1V4dkCqnigAXW0jg8Y=; b=WKzDjSXPPJskI3qqS+ksgQyoGPohKyk+RXnu3zWHUHc6cb1G3oxHJGP5YSm8yiC+TM urGBc1KqRGnineYEAjAMxqkrKJH8xRHUjlinyMgvP6x58KWKO5jH4tAN8M/UGM6UOBGu IXlS3ycK0p5KJbEChowvKx1yxusjY4/TcU+k3EMnNF5mFYyBbbd+pJ3nnrC2g2t00BSW vr9ggA2l1E1kgQpqK8kXAlMdjFgvzgQw9yCK5PMy4MUGB5D7VD6c2ZKmfUljBIwnnEK9 KCPgPh9DCv3w+kJdLzBUORJ8k9DauIaBdg2srzjHi2V4q4pvb5QjUby1hgMH8LQeMTbS mdRA== X-Gm-Message-State: ALKqPwefrdvS+IELevrLSDqELtK0hLUImAe5KtlUY8zT4fvyBw+yHQCk A7mkDCms1y/HvieXq15bz6f7AcGigoU= X-Google-Smtp-Source: AB8JxZqOAY9RfahC5T3rb9ZGHVIkGlwJhuimLuqL9lD/qjXZ2jrv6qf1T5HTVIKr+RqG9NsyFTzgdw== X-Received: by 2002:a62:3f81:: with SMTP id z1-v6mr2708194pfj.216.1525984013338; Thu, 10 May 2018 13:26:53 -0700 (PDT) Received: from xeon-e3 (204-195-35-107.wavecable.com. [204.195.35.107]) by smtp.gmail.com with ESMTPSA id d23-v6sm3021532pfn.3.2018.05.10.13.26.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 13:26:53 -0700 (PDT) Date: Thu, 10 May 2018 13:26:46 -0700 From: Stephen Hemminger To: Thomas Monjalon Cc: dev@dpdk.org, Matan Azrad , stable@dpdk.org Message-ID: <20180510132646.5aeb3467@xeon-e3> In-Reply-To: <20180509094337.26112-7-thomas@monjalon.net> References: <20180509094337.26112-1-thomas@monjalon.net> <20180509094337.26112-7-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 06/11] ethdev: allow ownership operations on unused port 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, 10 May 2018 20:26:54 -0000 On Wed, 9 May 2018 11:43:32 +0200 Thomas Monjalon wrote: > - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + if (port_id >= RTE_MAX_ETHPORTS || ethdev->data->name[0] == '\0') { Since name being empty now has significance, why not introduce an macro or inline function to make the test. Also, static checkers don't like pointers which maybe outside valid range (sometimes). static inline bool rte_ethdev_is_unused(const struct rte_ethdev *ethdev) { return ethdev->data->name[0] == '\0'; } #define RTE_ETH_UNUSED_OR_ERR_RET(ethdev, retval) do { \ if (!rte_ethdev_is_unused(ethdev)) { \ RTE_PMD_DEBUG_TRACE("Port already in use=%d\n", ethdev->port_id); \ return retval; \ } } while(0)