From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by dpdk.org (Postfix) with ESMTP id 1F960F11 for ; Wed, 29 Aug 2018 07:36:56 +0200 (CEST) Received: by mail-oi0-f50.google.com with SMTP id k81-v6so937501oib.9 for ; Tue, 28 Aug 2018 22:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=7jB+igHXvEuB6E8UK/cP3i3NR1W2oDalph8i+DnnB14=; b=m+he4nHsbZiIUNUd5RdtnFBlswhDjnfSRon4FA4dCKYKjEiJqwAX9xWaSL7SJIVDLL D9xh00/TG+G3+yZSfy028CjN1Wa/oEZI00Ue0q5AYeIangj8Uf/wNDoC6Mfm1tIT+4++ 8yS5gCK3m83c7F6AYU588o4Rx/S74F+aje2COwMFehUteXuQl0TK5DciFsMe1pfs5Xy5 UzoCwkHmBgHHxCIV/8URGYEfs08/fXPvYEscu+qf27us7wnXWCyUskiT/UWUWLBOW/Ao GzCSZisB21xdKUBkzIQ1EeAok7gljXIwVQWr//nTR9axJYZ/kQoOU9dM86qD99XruYZu kE/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=7jB+igHXvEuB6E8UK/cP3i3NR1W2oDalph8i+DnnB14=; b=NiWFP8rY80e9xnV8KlUVhfKJHLx3v0piXrW/a3i/v222mpq1YzF5P+HPDki+v4+pze RzkJxpGBqo8KJIPxqozV7I6TUuCMecLR5V3fa72UmrQ19pgBoO1sz9TP/GgHyWDMfCV7 rh61o/Fam86InVe/9Qla6rl05nhVGIKLRr075ibnoYHf4T3UJb4H3xBS1RH4vuiMQByl DurJCMHx5yUFNBUa4J4KZ7rwTkKS8M2rCDdLUsF0vDuc0tOgEKPQ91V9i3SeIGtsMaO7 DDAhxzt0zbVzgzOp99ETyNuuTW65Wl5Pj5K15bC39AaV4LQRqbG6+HAxMiMN77gbo4cW 9B9w== X-Gm-Message-State: APzg51BxpajYz8zrDjcudFj0EAW5YKoHvqfKh7/AP6aVJhsSDgSts8Ga BNEPmcqx7kWiM6kJcBLRV9vdc4eiyDsA0yaRS9vAWyG0 X-Google-Smtp-Source: ANB0Vdba0VEh3b0EDZMEkqS245hjJ6ghKXnM9shjeBKH+jfIiOhJp3O9VJMOWfsmYbZf+WmFg7hh4YuJJ5rvaOpjdo0= X-Received: by 2002:aca:dbc2:: with SMTP id s185-v6mr1293634oig.251.1535521015408; Tue, 28 Aug 2018 22:36:55 -0700 (PDT) MIME-Version: 1.0 From: Rami Rosen Date: Wed, 29 Aug 2018 08:36:44 +0300 Message-ID: To: dev@dpdk.org Cc: emma.finn@intel.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v1] testpmd: add new command for show port info 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, 29 Aug 2018 05:36:56 -0000 Hi, Thanks for this patch, this patch is something needed. It seems to me that adding get_valid_ports() is not necessary, as you have rte_eth_dev_count_avail(), which is implemented the same; please look in rte_ethdev.[c,h; and actually, testpmd uses rte_eth_dev_count_avail(), for example, in attach_port() in testpmd.c. Besides, it should return uint16_t and not int, as DPDK ports are 16 bits, and count is defined as uint16_t. +int get_valid_ports(void) +{ + portid_t pid; + uint16_t count = 0; + + RTE_ETH_FOREACH_DEV(pid) { + count ++; + } + return count; +} and in rte_ethdev.c you have: uint16_t rte_eth_dev_count_avail(void) { uint16_t p; uint16_t count; count = 0; RTE_ETH_FOREACH_DEV(p) count++; return count; } Regards, Rami Rosen