From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by dpdk.org (Postfix) with ESMTP id 8C6E74CA2 for ; Tue, 18 Sep 2018 11:00:10 +0200 (CEST) Received: by mail-wr1-f65.google.com with SMTP id w11-v6so1190963wrc.5 for ; Tue, 18 Sep 2018 02:00:10 -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; bh=FthOnb3/DGgrmjStDr4E/FvDP0BEJGLzqcpYXURtqts=; b=Amb4bSRgKXVnjbfywyrRjMjnSKnD2LipzBEycWOs9siMdibPEZkfB4+OfvDXk+CbtK WWEtYATWEuaNDd+9K3m9zFQEFkmvUSIT/mJABflsC/eQy8WZlyo0NMitvb2N3cwoiEJ2 QnX3qIKd9TDvgiNxPXffiCo0yXN4UCTGiXsSo2mc8OSLwR19m/Q6oiCGuFJCag0FK+mE sq4XQ3kzMOL6hToWASp9EjnbrnNWpxDdAdDwtZE/rEySQEEupH9vSqiaN7Vb7+/7moOw R+1+k0T1HVCMbd3drPj355NzTB3CjmY7wIk4qJ4V2mrUSiHcOfPXQZfoIR/pmTnBjzyA MvSA== 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; bh=FthOnb3/DGgrmjStDr4E/FvDP0BEJGLzqcpYXURtqts=; b=fb6JUL4cFBl0oJ2DKSIj8RI1Baw+abR7s6INqVJlNwWFNc2do7Ek1nRn8dNPHCwp8L MqVdTID71tIdKWAf0fcc8Gzz6eQrSp4Wk9u+X2K7nAV+hOA54nYO5B3UKcmEGZLSoaE/ UNlzxPnMNTxLGuJSrFsNBzV0UyR6ds870tX21NpZ29k1YMbCrSYGARnseVGCke1eEnrB kX9xZX1cOK1mbk+m81jHcKRb1ypKDgfIFieie2t7a2QfBuDmU9mTJ4Mt8F9IJ4duOrKf +oZjwSXhct0BVgMqnRUWccRDN1EICqAORg9TYp54dOAR5k7KvQsh75eeWPxjcutjzlrY Reyg== X-Gm-Message-State: APzg51Dt5/lHFwqTEwfPkqZALVy7p0NMq8elZTYdcpyMxAtgzr4sIkVV balvr4mxLXOyWQN1sLVtvaWRhPaUn3E= X-Google-Smtp-Source: ANB0VdaxY70ssZzBP7BNGAqDGhSqy0ajw6WAT0NzCzzmW0X5ICt1n2em4ogrOugN/Hg2m/WRCBYDVA== X-Received: by 2002:adf:f24e:: with SMTP id b14-v6mr20466860wrp.184.1537261209789; Tue, 18 Sep 2018 02:00:09 -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 r6-v6sm15059629wrt.92.2018.09.18.02.00.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Sep 2018 02:00:08 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 18 Sep 2018 10:59:46 +0200 Message-Id: <01e0e0ffd6a796a73150588823cf3434aafa7c50.1537261084.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.18.0 Subject: [dpdk-dev] [PATCH v1] testpmd: 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: Tue, 18 Sep 2018 09:00:10 -0000 The interactive command show port eeprom will dump the content of the EEPROM for the selected port. Dumping 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 a7c0e622a..0801e7e74 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 eeprom (port_id)\n" + " Display port 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" @@ -7202,6 +7205,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, "eeprom")) + port_eeprom_display(res->portnum); } cmdline_parse_token_string_t cmd_showport_show = @@ -7211,7 +7216,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#eeprom"); cmdline_parse_token_num_t cmd_showport_portnum = TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, UINT16); @@ -7219,7 +7224,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|eeprom " "", .tokens = { (void *)&cmd_showport_show, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 14ccd6864..af1a7d37a 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" @@ -739,6 +740,37 @@ port_offload_cap_display(portid_t port_id) } } +void +port_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 %hhu 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..bf817bdcf 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_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.18.0