From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0B234A04BC; Thu, 8 Oct 2020 20:26:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 084681B703; Thu, 8 Oct 2020 20:25:59 +0200 (CEST) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by dpdk.org (Postfix) with ESMTP id 4573E1B6F6 for ; Thu, 8 Oct 2020 20:25:57 +0200 (CEST) Received: by mail-wr1-f52.google.com with SMTP id w5so7664870wrp.8 for ; Thu, 08 Oct 2020 11:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DWmc1VGRkIFZ5sqqIpIYqitD7G2DA9XTl446lDvPJe0=; b=JTCJE1gmfDH+G992HH5iMG0aCR4rW8XKW3ns3Q9f897xthw+OQPi2NLtKxev9VMROv bYXy5lt0js0At1+EzXKrUg2LcYrhgEfAndh4Sg4YkGM7SYMal6tQCTcjBJ7s5HrsEjbV 4H96nO93j3s/k0Y5blvbET8wsklSVtZ//p/7C1glpclrx2wM9VPhscFEH4f8ROvV4EYk QuyiGbspIzW/RgG6RdEvs7kyW4vN9l6NY8k4cAVp36YPDEXACPhkYhnt2Wxobh5iO+G0 Ld0SDytQICKbcr9BOD/DacG7bQEER60IJ4lmjMByBw92tXPY2C9k7jx2ejVjgr1s4c5g QnhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DWmc1VGRkIFZ5sqqIpIYqitD7G2DA9XTl446lDvPJe0=; b=ACgmTSr87NM23pfWDDJBWgYiKqchdh7dmmmlz210ZjnFCy4JeZXpulzb3fx7nLE3UK TYJMSxAOGqjRMQ1ZzmA4jWFoQ0UjitM7r6CDX8D56NfCKIkExE6MkJa65ByRgZxARnt4 qdjGG5E34YvFK7Hd6XJF+lSEkZCdiYhZze7DsKbuxG2ITHBv2DLepSYeSeL8B/VjSaIc KL4IRgmk0tVpnFikR94XInjaWqf6dYVLx1WtBdVxF+hL9D9QczSRTeZt3ZX0onEyUTtK vqo5EoatCjSwzMXSEVcCshHVmhDIVyfKDGAbOS4PItBcP3ZeNNJs4kPIZvxs6LQggzvd qR2A== X-Gm-Message-State: AOAM531OUJpe0MMBmJ3WXqQqi+JVWw2wV9Eyb1C4x/ON1FlDP/h7k4cT WLJdlK+yGIgfcUqCx12FzjlJOQ== X-Google-Smtp-Source: ABdhPJzOO1bS44TvJpFD6wOzah7xtCvFpYDAJwehYB0TE4A6iGoEZoD9kyXfCHf9FcBLbQ9RNr5H9g== X-Received: by 2002:adf:f50c:: with SMTP id q12mr11594251wro.249.1602181555925; Thu, 08 Oct 2020 11:25:55 -0700 (PDT) Received: from localhost.localdomain ([101.50.93.132]) by smtp.gmail.com with ESMTPSA id w11sm8205740wrs.26.2020.10.08.11.25.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 11:25:54 -0700 (PDT) From: Sarosh Arif To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Sarosh Arif Date: Thu, 8 Oct 2020 23:25:13 +0500 Message-Id: <20201008182513.369420-1-sarosh.arif@emumba.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928100121.3332768-1-sarosh.arif@emumba.com> References: <20200928100121.3332768-1-sarosh.arif@emumba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5] testpmd: add speed capability in device 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Called rte_eth_dev_info_get() in testpmd, to get device info so that speed capabilities can be printed under "show device info" ​ Bugzilla ID: 496 Signed-off-by: Sarosh Arif --- app/test-pmd/config.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 30bee3324..68a7de7cf 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -507,6 +507,46 @@ static int bus_match_all(const struct rte_bus *bus, const void *data) return 0; } +static void +device_infos_display_speeds(uint32_t speed_capa) +{ + printf("\n\tDevice speed capability:"); + if (speed_capa == ETH_LINK_SPEED_AUTONEG) + printf(" Autonegotiate (all speeds)"); + if (speed_capa & ETH_LINK_SPEED_FIXED) + printf(" Disable autonegotiate (fixed speed) "); + if (speed_capa & ETH_LINK_SPEED_10M_HD) + printf(" 10 Mbps half-duplex "); + if (speed_capa & ETH_LINK_SPEED_10M) + printf(" 10 Mbps full-duplex "); + if (speed_capa & ETH_LINK_SPEED_100M_HD) + printf(" 100 Mbps half-duplex "); + if (speed_capa & ETH_LINK_SPEED_100M) + printf(" 100 Mbps full-duplex "); + if (speed_capa & ETH_LINK_SPEED_1G) + printf(" 1 Gbps "); + if (speed_capa & ETH_LINK_SPEED_2_5G) + printf(" 2.5 Gbps "); + if (speed_capa & ETH_LINK_SPEED_5G) + printf(" 5 Gbps "); + if (speed_capa & ETH_LINK_SPEED_10G) + printf(" 10 Gbps "); + if (speed_capa & ETH_LINK_SPEED_20G) + printf(" 20 Gbps "); + if (speed_capa & ETH_LINK_SPEED_25G) + printf(" 25 Gbps "); + if (speed_capa & ETH_LINK_SPEED_40G) + printf(" 40 Gbps "); + if (speed_capa & ETH_LINK_SPEED_50G) + printf(" 50 Gbps "); + if (speed_capa & ETH_LINK_SPEED_56G) + printf(" 56 Gbps "); + if (speed_capa & ETH_LINK_SPEED_100G) + printf(" 100 Gbps "); + if (speed_capa & ETH_LINK_SPEED_200G) + printf(" 200 Gbps "); +} + void device_infos_display(const char *identifier) { @@ -518,6 +558,7 @@ device_infos_display(const char *identifier) struct rte_device *dev; struct rte_devargs da; portid_t port_id; + struct rte_eth_dev_info dev_info; char devstr[128]; memset(&da, 0, sizeof(da)); @@ -569,6 +610,8 @@ device_infos_display(const char *identifier) &mac_addr); rte_eth_dev_get_name_by_port(port_id, name); printf("\n\tDevice name: %s", name); + if (rte_eth_dev_info_get(port_id, &dev_info) > 0) + device_infos_display_speeds(dev_info.speed_capa); printf("\n"); } } -- 2.25.1