DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anubhav Choudhary <achoudhary@sandvine.com>
To: "Xing, Beilei" <beilei.xing@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>, "users@dpdk.org" <users@dpdk.org>
Subject: Re: [dpdk-dev] Garbage value is returned while reading moudle eeprom for i40e (PF) with DPDK 18.11
Date: Wed, 1 Apr 2020 07:12:49 +0000	[thread overview]
Message-ID: <8ec8418c517f4589aaf3f5a9534ab6e7@sandvine.com> (raw)
In-Reply-To: <e153faa57b32417f8871f027b8bb57cd@sandvine.com>

Hi,
I found a bug in i40e driver which caused the issue shown in the mail chain. Here is the patch for this :

Author: Anubhav Choudhary <achoudhary@sandvine.com>
Date:   Sun Mar 29 07:27:20 2020 -0400

    BUG: Fix i40e_get_module_eeprom function in i40e driver

    In the implementation of i40e_get_module_eeprom, while calling the
    i40e_aq_get_phy_register, the parameters are not passed in right
    order. The position of page-change and offset has been swapped due
    to which garbage value was returned in place of module EEPROM data.

    Reviewed-By: Daniel Romell

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index dca61f03a..fd84b57cc 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11919,7 +11919,7 @@ static int i40e_get_module_eeprom(struct rte_eth_dev *dev,
                }
                status = i40e_aq_get_phy_register(hw,
                                I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE,
-                               addr, offset, 1, &value, NULL);
+                               addr, 1, offset, &value, NULL);
                if (status)
                        return -EIO;
                data[i] = (uint8_t)value;

Regards,
Anubhav

From: Anubhav Choudhary
Sent: Thursday, March 19, 2020 11:51 AM
To: Xing, Beilei
Subject: Re: Garbage value is returned while reading moudle eeprom for i40e (PF) with DPDK 18.11


Hi Beilei,
I have used ethtool (dpdk sample application: https://doc.dpdk.org/guides/sample_app_ug/ethtool.html) for dumping the eeprom data. It uses the following code for reading the data :
int


rte_ethtool_get_module_eeprom(uint16_t port_id, struct ethtool_eeprom *eeprom,


void *words)


{


struct rte_dev_eeprom_info eeprom_info;


int status;



if (eeprom == NULL || words == NULL)


return -EINVAL;



eeprom_info.offset = eeprom->offset;


eeprom_info.length = eeprom->len;


eeprom_info.data = words;



status = rte_eth_dev_get_module_eeprom(port_id, &eeprom_info);


if (status)


return status;



return 0;


}






Ref : https://github.com/DPDK/dpdk/blob/v18.11/examples/ethtool/lib/rte_ethtool.c#L190

________________________________
From: Xing, Beilei <beilei.xing@intel.com>
Sent: Thursday, March 19, 2020 11:28:33 AM
To: Anubhav Choudhary
Subject: RE: Garbage value is returned while reading moudle eeprom for i40e (PF) with DPDK 18.11

[EXTERNAL]

Hi,

Could you show me how you dumped eeprom in the script? Read the register?

BR,
Beilei

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Anubhav Choudhary
Sent: 2020年3月14日 23:56
To: dev@dpdk.org; users@dpdk.org
Subject: [dpdk-dev] Garbage value is returned while reading moudle eeprom for i40e (PF) with DPDK 18.11

Hi,
I am using Intel X710 along with FINISAR module (FTLX1471D3BCL). I am trying to read the module's eeprom but I am getting garbage values when DPDK is used. However, it is working perfectly fine when device is bound to the linux kernel. I have attached the device details along with the eeprom dumps. Note that I have executed the command in a VM where Intel X710 was using pci-passthrough. Let me know if more details are required to understand the issue.

Case 1 : When device used Linux Kernel

root@test-system:/home/anubhav# ethtool -i eth2
driver: i40e
version: 2.1.14-k
firmware-version: 7.10 0x800051a6 19.0.12
expansion-rom-version:
bus-info: 0000:00:0b.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: yes

root@test-system:/home/anubhav # ethtool -m eth2 raw on > module_eeprom_kernel.bin root@test-system:/home/anubhav # hexdump -x -v module_eeprom_kernel.bin
0000000    0403    2007    0000    0000    0000    0600    0067    640a
0000010    0000    0000    4946    494e    4153    2052    4f43    5052
0000020    202e    2020    0000    6590    5446    584c    3431    3137
0000030    3344    4342    204c    2020    2041    2020    1e05    6300
0000040    1a00    0000    4c55    3038    3732    2056    2020    2020
0000050    2020    2020    3131    3830    3631    2020    f068    ce03
0000060    0000    0000    0000    0000    0000    0000    0000    0000
0000070    0000    0000    0000    0000    0000    0000    0000    0000
0000080    0000    0000    0000    0000    0000    0000    0000    0000
0000090    0000    0000    0000    0000    0000    0000    0000    0000
00000a0    0000    0000    0000    0000    0000    0000    0000    0000
00000b0    0000    0000    0000    0000    0000    0000    0000    0000
00000c0    0000    0000    0000    0000    0000    0000    0000    0000
00000d0    0000    0000    0000    0000    0000    0000    0000    0000
00000e0    0000    0000    0000    0000    0000    0000    0000    0000
00000f0    0000    0000    0000    0000    0000    0000    0000    0000
0000100    004e    00f3    0049    00f8    8890    4871    a08c    3075
0000110    04a6    4c1d    409c    1027    e93d    3106    2d31    cb07
0000120    7745    6400    e93d    9e00    0000    0000    0000    0000
0000130    0000    0000    0000    0000    0000    0000    0000    0000
0000140    0000    0000    803f    0000    0000    0000    0001    0000
0000150    0001    0000    0001    0000    0001    0000    0000    7e00
0000160    2c20    2c82    1a42    c31d    681a    0000    0000    0030
0000170    0000    0000    0000    0000    ffff    ffff    ffff    01ff
0000180    0000    0000    0000    0000    0000    0000    0000    0000
0000190    0000    0000    0000    0000    0000    0000    0000    0000
00001a0    0000    0000    0000    0000    0000    0000    0000    0000
00001b0    0000    0000    0000    0000    0000    0000    0000    0000
00001c0    0000    0000    0000    0000    0000    0000    0000    0000
00001d0    0000    0000    0000    0000    0000    0000    0000    0000
00001e0    0000    0000    0000    0000    0000    0000    0000    0000
00001f0    0000    0000    0000    0000    0000    0000    0000    0000
0000200

Case 2: When device is used with DPDK (18.11)

root@test-system:/home/anubhav# ./ethtool
EAL: Detected 92 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Probing VFIO support...
EAL: WARNING: cpu flags constant_tsc=yes nonstop_tsc=no -> using unreliable clock cycles !
EAL: PCI device 0000:00:03.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:04.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:0b.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:1572 net_i40e
EAL: PCI device 0000:00:0b.1 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:1572 net_i40e
Number of NICs: 2
Init port 0..
Init port 1..
EthApp> drvinfo
Port 0 driver: net_i40e (ver: DPDK 18.11.5)
firmware-version: 7.10 0x800051a6 19.0.12
bus-info: 0000:00:0b.0
Port 1 driver: net_i40e (ver: DPDK 18.11.5)
firmware-version: 7.10 0x800051a6 19.0.12
bus-info: 0000:00:0b.1
EthApp> module-eeprom 0 module_eeprom_dpdk.bin
Total plugin module EEPROM length: 512 bytes
EthApp> quit

root@test-system:/home/anubhav# hexdump -x -v module_eeprom_dpdk.bin
0000000    0404    0404    0404    0404    0404    0404    0404    0404
0000010    0404    0404    0404    0404    0404    0404    0404    0404
0000020    0404    0404    0404    0404    0404    0404    0404    0404
0000030    0404    0404    0404    0404    0404    0404    0404    0404
0000040    0404    0404    0404    0404    0404    0404    0404    0404
0000050    0404    0404    0404    0404    0404    0404    0404    0404
0000060    0404    0404    0404    0404    0404    0404    0404    0404
0000070    0404    0404    0404    0404    0404    0404    0404    0404
0000080    0404    0404    0404    0404    0404    0404    0404    0404
0000090    0404    0404    0404    0404    0404    0404    0404    0404
00000a0    0404    0404    0404    0404    0404    0404    0404    0404
00000b0    0404    0404    0404    0404    0404    0404    0404    0404
00000c0    0404    0404    0404    0404    0404    0404    0404    0404
00000d0    0404    0404    0404    0404    0404    0404    0404    0404
00000e0    0404    0404    0404    0404    0404    0404    0404    0404
00000f0    0404    0404    0404    0404    0404    0404    0404    0404
0000100    0000    0000    0000    0000    0000    0000    0000    0000
0000110    0000    0000    0000    0000    0000    0000    0000    0000
0000120    0000    0000    0000    0000    0000    0000    0000    0000
0000130    0000    0000    0000    0000    0000    0000    0000    0000
0000140    0000    0000    0000    0000    0000    0000    0000    0000
0000150    0000    0000    0000    0000    0000    0000    0000    0000
0000160    0000    0000    0000    0000    0000    0000    0000    0000
0000170    0000    0000    0000    0000    0000    0000    0000    0000
0000180    0000    0000    0000    0000    0000    0000    0000    0000
0000190    0000    0000    0000    0000    0000    0000    0000    0000
00001a0    0000    0000    0000    0000    0000    0000    0000    0000
00001b0    0000    0000    0000    0000    0000    0000    0000    0000
00001c0    0000    0000    0000    0000    0000    0000    0000    0000
00001d0    0000    0000    0000    0000    0000    0000    0000    0000
00001e0    0000    0000    0000    0000    0000    0000    0000    0000
00001f0    0000    0000    0000    0000    0000    0000    0000    0000
0000200

Regards,
Anubhav Choudhary

Disclaimer:
This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is considered confidential, proprietary, sensitive and/or otherwise legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation.

  parent reply	other threads:[~2020-04-02 15:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-14 15:56 Anubhav Choudhary
     [not found] ` <BYAPR11MB35417A33538623679D6A45A5F7F40@BYAPR11MB3541.namprd11.prod.outlook.com>
     [not found]   ` <e153faa57b32417f8871f027b8bb57cd@sandvine.com>
2020-04-01  7:12     ` Anubhav Choudhary [this message]
2020-04-02  0:51       ` Xing, Beilei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ec8418c517f4589aaf3f5a9534ab6e7@sandvine.com \
    --to=achoudhary@sandvine.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).