Bug fix for iMX28 L2 switch can't work in 10Base-T network -blog archive

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug fix for iMX28 L2 switch can't work in 10Base-T network -blog archive

3,713 Views
qiang_li-mpu_se
NXP Employee
NXP Employee

    For L2.6.35_10.12.01_SDK iMX28 BSP, the L2 switch driver can't work in 10Base-T network, because the default driver hasn't identify the network conditions for different PHY setting, it just used the default 100Mbps setting.

    And there is also another issue, if you run command "ifconfig eth0 down"; then run "ifconfig eth0 up", the L2 switch driver will not work. The root cause is that when the L2 switch driver stops, it will set PHY to power down mode in switch_enet_close(), but when the L2 switch driver re-started, in function switch_enet_open(), it will not set the PHY out of power down mode.

 

    Attached is the updated driver for the above two issues. The file position "linux\drivers\net\". All modifid codes are marked with flag "qiang_debug".

(The old code was removed, please use the followed new patch "fec_switch_update_for_L2.6.35_10.12.01_BSP.zip")

 

    A new issue was found in the L2 switch driver.

    When we connected half duplex and full duplex network on two ethernet connectors for iMX28, the performance will be poor.

    Root cause: The driver had save the two ethernet phy link speed into the same paramenter (full_duplex), then in the above case, this parameter is always in changing, and the driver will think the link state is in changing, it will loop to re-config the PHY.

    Attached is the new updated L2 switch driver for iMX28 L2.6.35_10.12.01 BSP.

Original Attachment has been moved to: fec_switch_update_for_L2.6.35_10.12.01_BSP.zip

Labels (2)
Tags (1)
0 Kudos
Reply
12 Replies

2,126 Views
erickang
Contributor II

Dear Qiang Li,

I have a question for L2 Switch.

Finaly, I want to switch the L2Switch mode and Ethernet mode in the same kernel.

I found the below items,

- I couldn't switch the mode(L2Switch.Mode ~ Ethernet.Mode)

   . because the kernel can perform just one of the modes.

- I could find each mode was configured in kernel(no module, M)

So I think I can perform switching between L2Switch and Ethernet mode like as below,

(For your more understanding, I commented the similar topic site of FSL Community.)

1) select Mode in APP

    : How I can change L2 Switch mode and bypass mode by APP with iMX287?  ( by v.hwang )

      https://community.freescale.com/message/328949#328949

2) select Mode by loading the corresponding module

    : L2 Switch driver module ( by Eric )

      https://community.freescale.com/message/329431#329431

First of all,

I'm converting the configured driver to the module driver like as "2) select Mode by loading the corresponding module".

Could you tell me how to switch the Mode between L2Switch and Ethernet?

And Could you give me any guide for these method?

Best Regards,

Eric.

0 Kudos
Reply

2,127 Views
qiang_li-mpu_se
NXP Employee
NXP Employee

As I know, the l2 switch driver also has the ethernet function, it seems you don't need the fec driver if you had already enabled the L2 switch driver.

0 Kudos
Reply

2,127 Views
erickang
Contributor II

Dear Qiang Li,

In the i.MX28RM, the L2 Switch mode support the both operations, Switch mode and Passthrough mode.

Can be configured to operate as a 3-Port Switch (Switch Mode) or as two independent ports (Passthrough Mode).

in the 29.1 3-Port Ethernet Switch Features of i.MX28RM.

But I couldn't find the detailed information how to configure the operation.

Could you give me the guide to configure the operation?

I want to switch both mode on run-time, Switch and Passthrough mode.

1) run Switch mode

2) run Passthrough mode

3) repeat "1) ~ 2)" on run-time

Best Regards,

Eric.

0 Kudos
Reply

2,127 Views
qiang_li-mpu_se
NXP Employee
NXP Employee

Hi Eric,
I don't know how to set the switch to passthrough mode too.

0 Kudos
Reply

2,127 Views
erickang
Contributor II

Dear Qiang Li,

Thanks for your response.

I'll check how to set the switch to passthrough mode.

Best Regards,

Eric.

0 Kudos
Reply

2,127 Views
erickang
Contributor II

Dear Qiang Li,

I understood the i.MX287 L2 Switch mode consisted of Ethernet function and Switch function.

If the Device Connection is like as "[Device.#1] ~ [MX28] ~ [Device.#2]",

the packet will be transmitted between devices in the normal L2 Switch mode like as below.

1) Ethernet function : [Device.#1] <-> [MX28]  &  [MX28] <-> [Device.#2]

2) Switch function : [Device.#1] <-> [Device.#2]

In these functions, I want to control "2) Switch function", Enable/Disable.

If the Switch function is enable, the connect 1) and 2) will be possible.

If the Switch function is disable, the connect 1) will be possible and the connection 2) will be impossible.

For this, I changed the "29.9.9 ENET SWI Defines several global configuration settings" register.

HW_ENET_SWI_MODE_CONFIG(0x800F_8024) - SWITCH_EN (bit1).

Set this bit as '1' for the Switch function enable, and clear this bit as '0' for the Switch function disable.

I thought the Ethernet function will be operated regardless of the Switch function Disable/Enable.

But the Ethernet function didn't operate on the Switch function disable.

(The Ethernet function operated on the Switch function enable.)

How do I control the Switch function to enable/disable?

Best Regards,

Eric.

0 Kudos
Reply

2,127 Views
erickang
Contributor II

Dear Qiang Li,

Thanks for your response.

I know the L2Switch mode include the Ethernet function already.

I found any idea to perform my product function.

First of all, I understood the L2Switch mode like as below.

- Connection

   . [Device.#1] - [MX28.L2Switch] - [Device.#2]

- L2Switch mode
   1) [Device.#1] <-> [MX28]      : connection OK - Ethernet function
   2) [MX28] <-> [Device.#2]      : connection OK - Ethernet function
   3) [Device.#1] <-> [Device.#2] : connection OK - Switch function


But I want to control the "3) Switch function" in L2Switch mode.
The control is enable/disable the "3) Switch function".
One case is the "3) Switch function" Enable, and the other case is the "3) Switch function" Disable.
Our MX28 Product should not be transfer packets from [Device.#1] to [Device.#2] in any case.

Is it possible?

Best Regards,
Eric.

0 Kudos
Reply

2,127 Views
erickang
Contributor II

Dear Qiang Li,

Thanks for your patch file for L2 Switch.

I confirmed the eth0 re-start operation after applying your patch.

Best Regards,

Eric.

0 Kudos
Reply

2,127 Views
bba
Contributor III

Hello, thanks for you patch. I also got these from my FAE. So we made some tests with your patch. It seams to be working together with a 10MBit-Half-Duplex Hub. But I found, that the ARP reply does not work in all cases with your patch. So I've added my own modification according to

http://imxcommunity.org/group/imx28andimx28evk/forum/topics/l2-switch-arp-reply

Regards,

Birger

0 Kudos
Reply

2,127 Views
ArnaudM_
Contributor I
Thanks a lot.
0 Kudos
Reply

2,127 Views
qiang_li-mpu_se
NXP Employee
NXP Employee

The eth0 is just the interface for accessing the switch through command "ifconfig", but it support two physical ethernet interface. Details please reference to "Chapter 16 Programmable 3-Port Ethernet Switch Driver" of mx28_linux.pdf, this document can be found from the BSP document package, such as "L2.6.35_10.12.01_ER_docs.tar.gz".

And in LTIB BSP, there is also unit test code for L2 switch in package "imx-test-10.12.01.tar.gz". You can reference to it for how to use the switch.

0 Kudos
Reply

2,127 Views
ArnaudM_
Contributor I
Hello Quiang, eth1 is not working with your driver (ifconfig: SIOCSIFADDR: No such device). Is that correct ?
0 Kudos
Reply