From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id 0CB2D1B14E for ; Fri, 5 Oct 2018 23:59:23 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id 185-v6so3171726wmt.2 for ; Fri, 05 Oct 2018 14:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bs3W321CLPVojDhz84hljOLk3cApuEohGrB6pf3K8Tg=; b=2UHpc+Ic9DddpoJG9bAgK0RPEIezdNiCnl0rIrbxRfbD/wWLZX8Ea5y94bSQBFFO49 45QyaHtzjssawaY3pStDhhez8in06c0M7ATTuWVu17LaBHw5+jdua1j7WpHYdSDpAW8r 222uG4MaB8hJ66F7VZPwVuaWAAvJx0EvC/LIklvTu6mRWGYvD4M+aVuEZlTA3QHgiNQ1 gV2618aq9cq7SKeHi7P/93ShhBmxzJ6DFwHy6766BDCVtSiwtNHsKzLmApIHlQlxDI5T FjzcGmfW6D1UGMSqoWNRAH0SlHJUih39Cza87TGhWWB4YuGTVySMIMtOMzQ/V9kd5nKv SVMg== 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=bs3W321CLPVojDhz84hljOLk3cApuEohGrB6pf3K8Tg=; b=KxmESdrq5Z2ppsorqNFAXivzF/+LAnBs4iX+VqZpNM6LpVouROsgn6L0+KZG17G/kn 57lfL6XEwEPKd7jlMQq6UsbNLHHJETuQUqIBvXX7cXk3kmn/EpQA41+VVCmICYUkiVq2 ZFRKektbu6vuq4Ph0VfArBmAbRPnGvkGN01Ycqc2HDICNlKLOEEaR4yqHjfoqvrevNHN LEYBdCffg7WzVEsNcuM4dmJS4zUoSrEwBUcEFgjOyGhe3LkKFvS+fBPBHXCnIe+clT+h NJMFcA10SKOOzA5VlfJO9dAxCFg8iA2SnvTwmVfxbnpaBELoJiOJqXhsEOhMfv/2lW/6 wjyQ== X-Gm-Message-State: ABuFfogxMCmMhkskQ2vb0X0ej1sTDSf+fkttoiQ40Xum30/rvngQzjT1 Dwcn/DRAWoxCu9OVC5+MafElyUddQlk= X-Google-Smtp-Source: ACcGV62HdUeyCTbLaFZexQ54YN19tq4C2kJ8AnRAbE03ZQjMIYzR7Wkj2LQZ42rpNnrg0WadU8tdpA== X-Received: by 2002:a1c:1649:: with SMTP id 70-v6mr8226997wmw.2.1538776762025; Fri, 05 Oct 2018 14:59:22 -0700 (PDT) Received: from bidouze.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id j6-v6sm713763wmd.29.2018.10.05.14.59.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Oct 2018 14:59:21 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet , Ferruh Yigit Date: Fri, 5 Oct 2018 23:58:57 +0200 Message-Id: <8fccc9432769b39d66e909945501ee4a0027f538.1538776598.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <01e0e0ffd6a796a73150588823cf3434aafa7c50.1537261084.git.gaetan.rivet@6wind.com> References: <01e0e0ffd6a796a73150588823cf3434aafa7c50.1537261084.git.gaetan.rivet@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] testpmd: sfp eeprom display 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: Fri, 05 Oct 2018 21:59:23 -0000 The interactive command show port sfp_eeprom will dump the content of the SFP EEPROM for the selected port. Dumping SFP eeprom of all ports at once is not supported. Signed-off-by: Gaetan Rivet --- app/test-pmd/cmdline.c | 9 +++++++-- app/test-pmd/config.c | 32 ++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 1 + 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 0c5399dc4..cc3dd1373 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -170,6 +170,9 @@ static void cmd_help_long_parsed(void *parsed_result, "show port (info|stats|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)\n" " Display information for port_id, or all.\n\n" + "show port sfp_eeprom (port_id)\n" + " Display SFP EEPROM for port_id.\n\n" + "show port X rss reta (size) (mask0,mask1,...)\n" " Display the rss redirection table entry indicated" " by masks on port X. size is used to indicate the" @@ -7237,6 +7240,8 @@ static void cmd_showport_parsed(void *parsed_result, port_dcb_info_display(res->portnum); else if (!strcmp(res->what, "cap")) port_offload_cap_display(res->portnum); + else if (!strcmp(res->what, "sfp_eeprom")) + port_sfp_eeprom_display(res->portnum); } cmdline_parse_token_string_t cmd_showport_show = @@ -7246,7 +7251,7 @@ cmdline_parse_token_string_t cmd_showport_port = TOKEN_STRING_INITIALIZER(struct cmd_showport_result, port, "port"); cmdline_parse_token_string_t cmd_showport_what = TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what, - "info#stats#xstats#fdir#stat_qmap#dcb_tc#cap"); + "info#stats#xstats#fdir#stat_qmap#dcb_tc#cap#sfp_eeprom"); cmdline_parse_token_num_t cmd_showport_portnum = TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, UINT16); @@ -7254,7 +7259,7 @@ cmdline_parse_inst_t cmd_showport = { .f = cmd_showport_parsed, .data = NULL, .help_str = "show|clear port " - "info|stats|xstats|fdir|stat_qmap|dcb_tc|cap " + "info|stats|xstats|fdir|stat_qmap|dcb_tc|cap|sfp_eeprom " "", .tokens = { (void *)&cmd_showport_show, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 794aa5268..24c4bbcad 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -49,6 +49,7 @@ #include #endif #include +#include #include #include "testpmd.h" @@ -757,6 +758,37 @@ port_offload_cap_display(portid_t port_id) } } +void +port_sfp_eeprom_display(portid_t port_id) +{ + struct rte_eth_dev_module_info minfo; + struct rte_dev_eeprom_info einfo; + char buf[1024]; + int ret; + + if (port_id == (portid_t)RTE_PORT_ALL) + return; + + ret = rte_eth_dev_get_module_info(port_id, &minfo); + if (ret) { + printf("Unable to get module info: %d\n", ret); + return; + } + + einfo.offset = 0; + einfo.length = minfo.eeprom_len; + einfo.data = buf; + + ret = rte_eth_dev_get_module_eeprom(port_id, &einfo); + if (ret) { + printf("Unable to get module EEPROM: %d\n", ret); + return; + } + + printf("Port %u SFP EEPROM:\n", port_id); + rte_hexdump(stdout, "hexdump", einfo.data, einfo.length); +} + int port_id_is_invalid(portid_t port_id, enum print_warning warning) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index a1f661472..edfee29bf 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -595,6 +595,7 @@ void nic_xstats_clear(portid_t port_id); void nic_stats_mapping_display(portid_t port_id); void port_infos_display(portid_t port_id); void port_offload_cap_display(portid_t port_id); +void port_sfp_eeprom_display(portid_t port_id); void rx_queue_infos_display(portid_t port_idi, uint16_t queue_id); void tx_queue_infos_display(portid_t port_idi, uint16_t queue_id); void fwd_lcores_config_display(void); -- 2.19.0