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 93D9AA04BC; Thu, 8 Oct 2020 20:11:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C81301B677; Thu, 8 Oct 2020 20:11:51 +0200 (CEST) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by dpdk.org (Postfix) with ESMTP id EA0681B677 for ; Thu, 8 Oct 2020 20:11:49 +0200 (CEST) Received: by mail-wm1-f46.google.com with SMTP id d81so7406319wmc.1 for ; Thu, 08 Oct 2020 11:11:49 -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=7/RgG2Quj/HYIspYtJ8W9abulYwH0ctnSRu4Uwr/25g=; b=bH1geaStRvrp08IM5KxH8w4dCa7aACdyGpf7P2wDWPBgqmLXEFNOBtsWjsOWWFI9u6 bjY1O5sXxTkp15cAYKdN0I7R5Og03BKmFxMufZpxuaE6GKFTDAxebAwhyOBdMoTeuIAe q5xQR5j50LA6+bAjpLFBqaeS3VxdThtpZ50BuSEta0grc7IDzy+2haBWYnegQ8GLPDD4 CDcJujwmEFrFa7Gv3+HEXLq/PNcZDLWHs9kzpcZs5IGnCbVyQJQZK8lZG1b5aXvpI17a m00gPkLb9wGW8jqv+Dzcw8swluH0f4iZK0O8HrTtnTPc+21BnLZbwQFsT3A3CamPMaF3 NL/g== 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=7/RgG2Quj/HYIspYtJ8W9abulYwH0ctnSRu4Uwr/25g=; b=HZxQLxPqvHPVBNp303vxUYggmKIpimaNv0myOC7bZPJzpVXHBxVjWJpQcaRL5SzICO Uy7e9P4TV+RoUM4z4SGn81xPbWhOD3dJc18b2j4dLlxATm6ZD08YQFVomYfFV2e+11LG 76eUK80f5KmsWkeOzE7h4F3PWmNF7aydBbjaYCj5AF0ZLDLZh4uczpk/7CRRryeNxCF1 8mIcpMsHzdI2xBvpubuU4qcbY50EabjF+LH99I4D2dLsXoxVTDv6fKPKyWihWHY9tBsx YScDXB6iGcncYfrWwaSKdGTeA00hP3AK+CFGOH8VjGFEdwWmvxE53hk5/WA0Z51EgBnc psMg== X-Gm-Message-State: AOAM5308zkN4hoFJOovIUIccabWvxly8axUAUM3ADwx71AqScF4EXMDh utHVQ5y2VclSRg0rCXbEytlIgg== X-Google-Smtp-Source: ABdhPJyu/gMlePU4BkSqa2RCz3344+QO1Fndg2wDAd8wPsHLrZhOPIfzO2kTcbkTZY2ZjUlhrzyXmw== X-Received: by 2002:a7b:cb47:: with SMTP id v7mr10262773wmj.150.1602180708435; Thu, 08 Oct 2020 11:11:48 -0700 (PDT) Received: from localhost.localdomain ([101.50.93.132]) by smtp.gmail.com with ESMTPSA id l3sm7833718wmh.27.2020.10.08.11.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 11:11:47 -0700 (PDT) From: Sarosh Arif To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Sarosh Arif Date: Thu, 8 Oct 2020 23:11:17 +0500 Message-Id: <20201008181117.367923-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 v4] 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 --- v2: display all speed capabilities in a single line remove switch case v3: add missing speeds make a function for displaying speed capabilities v4: make device_infos_display_speeds() function static --- app/test-pmd/config.c | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 30bee3324..c3a4d8d5f 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,7 +558,9 @@ 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]; + uint32_t speed_capa; memset(&da, 0, sizeof(da)); if (!identifier) @@ -569,6 +611,9 @@ device_infos_display(const char *identifier) &mac_addr); rte_eth_dev_get_name_by_port(port_id, name); printf("\n\tDevice name: %s", name); + rte_eth_dev_info_get(port_id, &dev_info); + speed_capa = dev_info.speed_capa; + device_infos_display_speeds(speed_capa); printf("\n"); } } -- 2.25.1