From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by dpdk.org (Postfix) with ESMTP id 38D081B815 for ; Thu, 10 May 2018 22:26:54 +0200 (CEST) Received: by mail-pg0-f66.google.com with SMTP id x145-v6so1436794pgx.11 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=d0oGFy1kGimcl+ugoZeme1ca0bhn0e4xAD2jNXxh7at9YOXkOi43k0YIKzTQqSP0KH 5xF+cGpg6Zdh3m3txM51du3Cq2e2u7bXhruaR/tf2nFPJ5WsHRpak6KwLoyiJPh8KaQx Gl45ZADUM8PdKeqZbbQl1Lr8PrPolVAY0xWH8oPV2md3JzZUPFeNP7Ts6v/30CQy+TT7 P1goFQ1avBDDukuBNBOuSj7hzhpve+jSCWvmoo1NBsDfpgU07lSi/78q6pZ4TmNsrkQE R1l3tFw6kNz7xDf+RWELA9dgSlQCeppOOjchnEcJX9kp+th9nNanHpixMHzkBlpkL/QO iufA== X-Gm-Message-State: ALKqPweZGlTl+PRFY6Al6bBG3vXiBrhHjW1kyOarzO7v4xyiIJqA+hO6 9vlRjGnO61E/Aj2HnXkqPy20wA== 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-stable] [dpdk-dev] [PATCH 06/11] ethdev: allow ownership operations on unused port X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches 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)