Re: [dpdk-dev] Garbage value is returned while reading moudle eeprom for i40e (PF) with DPDK 18.11

2020-04-02 Thread Anubhav Choudhary
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 
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 
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  On Behalf Of Anubhav Choudhary
Sent: 2020年3月14日 23:56
To: dev@dpdk.org; us...@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: :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
0000403200706000067640a
0104946494e415320524f435052
020202e202065905446584c34313137
03033444342204c2020204120201e056300
0401a004c5530383732205620202020
050202020203131383036312020f068ce03
060
070
080
090
0a0
0b0
0c0
0d0
0e0
0f0
100004e00f3004900f888904871a08c3075
11004a64c1d409c1027e93d31062d31cb07
12077456400e93d9e

[dpdk-dev] Garbage value is returned while reading moudle eeprom for i40e (PF) with DPDK 18.11

2020-03-16 Thread Anubhav Choudhary
040404040404
06004040404040404040404040404040404
07004040404040404040404040404040404
08004040404040404040404040404040404
09004040404040404040404040404040404
0a004040404040404040404040404040404
0b004040404040404040404040404040404
0c004040404040404040404040404040404
0d004040404040404040404040404040404
0e004040404040404040404040404040404
0f004040404040404040404040404040404
100
110
120
130
140
150
160
170
180
190
1a0
1b0
1c0
1d0
1e0
1f00000
200

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.