Modify

Opened 6 years ago

Last modified 2 years ago

#7977 assigned enhancement

Enhance rtl8366rb driver

Reported by: lultimouomo@… Owned by: juhosg
Priority: normal Milestone: Barrier Breaker 14.07
Component: kernel Version: Trunk
Keywords: Cc:

Description

The GPL sources for Belkin F5D8235 contain a driver for the rtl8366rb switch that exposes many interesting features, like maximum packet length setting, port bandwidth control, port priority and more.
It would be nice if these controls were available in swcontrol.
I created a patch to control the maximum packet length (jumbo frames), but I can't test is as I later discovered that only one of my gigabit ethernet devices supports long frames.

The sources can be downloaded at:
https://www.belkin.com/support/opensource/files/F5D8235v2-2.01.07-GPL.tar.gz
The driver is at:
Belkin_F5D8235-4_v2000_v2.01.07/Uboot_SDK_3200/drivers/rtl8366RB/
in the archive

Attachments (7)

rtl8366rb.patch (1.6 KB) - added by lultimouomo@… 6 years ago.
Enable swcontrol setting for jumbo frames in rtl8366rb
rtl8366rb.2.patch (7.4 KB) - added by lultimouomo@… 6 years ago.
Implement advanced controls for rtl8366rb
rtl8366rb.3.patch (7.5 KB) - added by lultimouomo@… 6 years ago.
Implement advanced controls for rtl8366rb (corrects cosmetic bug)
patch (13.5 KB) - added by lultimouomo@… 6 years ago.
Rebase against r23144, add storm filtering
rtl8366rb.forcephy.patch (2.8 KB) - added by sagemol 5 years ago.
Force speed/duplex via swconfig patch
rtl8366rb.forcephy.patch2 (2.8 KB) - added by sagemol 4 years ago.
force phy patch rtl8366rb
rtl8366rb.c.patch (692 bytes) - added by lars@… 2 years ago.
Default maximum packet length to 9216 bytes

Download all attachments as: .zip

Change History (37)

Changed 6 years ago by lultimouomo@…

Enable swcontrol setting for jumbo frames in rtl8366rb

comment:1 Changed 6 years ago by eymert@…

WOW! I am (at present) not able to patch sources, but if the features in the rtl8366rb driver of belkin could be incorporated in that of OpenWRT (driver as well as toolset), that would be great!

It disturbs me now that you can not set a MTU of >1500 on interfaces and that, everytime someone is asking for this, it is denied! Because it not only concerns traffic TO or FROM the router itself, but also traffic passing through the switch! So If I connect my gigabit-enabled PC and NAS to the router (in my case a TP-Link WR1043ND) and have both devices at a MTU of, eg, 7000.... traffic blocks!

comment:2 Changed 6 years ago by lultimouomo@…

I prepared a new patch that implements jumbo frame control, port bandwidth limitation and port priority.
Of these the only one that I have been able to test thoroughly is bandwidth limitation, and it works fine.
I've checked the other two don't wreck havoc.

The switch has plenty of cool features, like power saving, QoS, ACL and storm filtering, but for various reason I didn't implement them:
for the first, the original driver does some undocumented voodoo and I don't feel comfortable about it; QoS and ACL require more complex controls than swcontrol provides; and for storm filtering I felt lazy (I might do it in the future).

Changed 6 years ago by lultimouomo@…

Implement advanced controls for rtl8366rb

Changed 6 years ago by lultimouomo@…

Implement advanced controls for rtl8366rb (corrects cosmetic bug)

comment:3 Changed 6 years ago by eymert@…

Okay :) I just checked out Trunk and applied your patch to the rtl8366rb driver :D. Chosen build target was the TP-Link WR1043ND. The driver built fine and so did the firmware! Switch is also working.

Unfortunately, the max_length option seems to have no effect for me :S. I see it in the "swconfig dev rtl8366rb show" output, but it is at "1". When I try tot set it to eg. 7000 in the 'switch' section of /etc/config/network and reboot, it still stays at 1.

comment:4 Changed 6 years ago by lul

The router supports only maximum lengths, use
swconfig dev rtl8366rb set max_length 3
to set it to 9216 bytes (headers included, I think).
I doesn't need to match your MTU, it just needs to be bigger.
swconfig dev rtl8366rb help will explain the other options and values.
If you reboot, the maximum length will be reset to 1, i.e. 1536 bytes, so you need to set the option in /etc/config/network if you want to make it permanent.

comment:5 Changed 6 years ago by lultimouomo@…

Err, the first line should have read:
the switch supports 4 possible maximum lengths, etc.

comment:6 Changed 6 years ago by eymert@…

Aaah, so then I just interpreted the meaning of that config option completely wrong ;). Sorry about that. When I have some spare time next weekend, I will test it again.

And I might try if this patch will also work on the 8366rb driver in the Backfire branch. Trunk is, at this moment, too experimental (and without luci interface) for me ;). At least for a device that also needs to support my infra and must be configurable easily.

I also do have multiple devices that support jumbo frames (even a l2 switch from Linksys).

comment:7 Changed 6 years ago by eymert@…

I have tried again, and now I can set (and remember) the max_length setting successfully! I have put it at 3.

Unfortunately this does not affect which MTU's I can set using IFCONFIG, though :(. I still can not get higher than a MTU of 1500 on either ethX itself (eth0), nor eg. eth0.1 or eth0.2.

It's either:
"ifconfig: SIOCSIFMTU: Numerical result out of range" (for eth0.1)

or

"ifconfig: SIOCSIFMTU: Invalid argument" (for eth0)

comment:8 Changed 6 years ago by lultimouomo@…

That's because ar71xx doesn't support jumbo frames itself, only the switch does. You should still be able to use jumbo frames on devices attached to it.

comment:9 Changed 6 years ago by eymert@…

Ackaroo :P

A shame for people who want to use the router itself as a NAS, but for me nog the biggest issue (although it would create a lot of fragmentation requests on the network if I send large amounts of data from my PC with a MTU of 7000 to the router :S ).

But indeed, you did it! Previously, I was not able to exchange data between my NAS and other high MTU devices when they were attached to the router's gigabit ports. And now, it works!!!! With MTU's of up to 9000, no probs.

With my PC and NAS set to 7000, I can send ICMP echo requests with a -s of up to 6972 without fragmentation. The Ethernet frame is then exactly 7000 and the ICMP echo request/reply length is 6980.

From 6973, I see my PC (the sender of the ICMP requests) is fragmenting the packets (both the same ID, one with a length of 6996 and another with a length of 25. The ICMP echo request/reply length is 6976. The second request/reply is 5 (which would lead me to believe there is 20 bytes overhead for encapsulating each fragment?? :).

So this seems all good. When receive HTTP responses from my NAS, they all come in with a nice length of 7000 without double ID's, so no fragmentation (only the normal continuations in further packets).

Oh by the way: I added you patch to the generic-patches directory in my local checkout of the Backfire branch, with it's sequence number just after the phy_8366 patches and during the firmware build, it nicely apply's :D

So bottom line: Your patch also works on the 8366rb driver in the Backfire branch. Which I would expect because all 8366rb improvements in trunk are also backported to backfire.

I am relatively new to this patch contribution process and procedures, but is your patch meant to get officially merged in the trunk and backported to the Backfire branch? :)

comment:10 Changed 6 years ago by eymert@…

Hmmmmpf,

Maybe I cheered to early :S. The router just hung itself :S. I can not ping it on it's IP address anymore and all packets bigger than 1500 are not going through anymore.

The stupid thing, though: All packets with MTU 1500 ARE passed through :o. So it almost seems that, when the router gets hung for some reason, the max_length looses it's effect but the switch itself keeps working.

And I don't even see why that should happen because normally, with large transfers between my PC and NAS, the CPU of the router does not seem to see anything (sirq in "top" stays at zero).

comment:11 Changed 6 years ago by lultimouomo@…

Are you sure that is related to the switch drivers?
I've been using your same router with the max_length=3 for days without problems.
The fact that the MTU has come back to 1500 makes me think that the switch was reset in some way (the switch driver init code sets max_length to 1); the settings are stored in the switch registers, not in the router.

comment:12 Changed 6 years ago by eymert@…

My suspicion is a switch reset, indeed. But that remains strange: There are many more config registers in the switch, that should also survive potential switch resets (enable_vlan, vlan4k, etc.). How do these settings manage that? Or better: How should openwrt handle a switch reset?

To be honest, I don't really know if this is related to the switch driver or not but I thought maybe you could have some clue, inspecting the code :). It could also well be some other bug, maybe in more recent revisions or so.

Or it is just the fact that, although the patch applies cleanly, putting your patch over the "Backfire" rtl8366rb driver is still a little blunt... :)

I am reverting back to an older build I have for the time being (without your patch) because I need the router as "main router" again, in stead of just an overdone "l2-switch", for which I have been using it until now. My NAS and other PC's are now connected to another l2-switch (linksys) which also supports jumbo frames.

But I still hope your patch will get in to the main line :).

Changed 6 years ago by lultimouomo@…

Rebase against r23144, add storm filtering

comment:13 Changed 6 years ago by anonymous

to which the kernel is this patch? The last patch 06/02/1932 rather not want to compile

comment:14 Changed 6 years ago by anonymous

was to be 2.6.32

comment:15 Changed 6 years ago by loswillios

  • Owner changed from developers to juhosg
  • Status changed from new to assigned

comment:16 follow-up: Changed 5 years ago by anonymous

Can you please apply this patch to the file target/linux/generic/files/drivers/net/phy/rtl8366s.c too, so that the wndr3700 can enjoy the jumbo frame ?

comment:17 in reply to: ↑ 16 Changed 5 years ago by anonymous

Replying to anonymous:

Can you please apply this patch to the file target/linux/generic/files/drivers/net/phy/rtl8366s.c too, so that the wndr3700 can enjoy the jumbo frame ?

If you look to apply only the jumbo frame part of the patch changes are really straigthforward.

comment:18 Changed 5 years ago by sagemol

Could You please be so kind and implement an additional feature request:

Full management of switch ports rtl8366rb with swconfig
e.g. 10BaseT-Fullduplex setting with autonegotiation off

see also: https://forum.openwrt.org/viewtopic.php?id=27296

regrards
Ralph

comment:19 Changed 5 years ago by sagemol

See update in forum thread:

https://forum.openwrt.org/viewtopic.php?id=27296

regards,
Ralph

comment:20 Changed 5 years ago by anonymous

Patch reviewed and updated:

https://forum.openwrt.org/viewtopic.php?id=27296

regards, Ralph

Changed 5 years ago by sagemol

Force speed/duplex via swconfig patch

comment:21 Changed 5 years ago by anonymous

Patch attached.

regards,
Ralph

comment:22 follow-up: Changed 5 years ago by hawkeye@…

Why are these patches are not included in the official release of openwrt?
They are very helpful!

comment:23 Changed 4 years ago by sagemol

Force speed/duplex via swconfig patch
Rebased against trunk 32741

Regards, Ralph

Changed 4 years ago by sagemol

force phy patch rtl8366rb

comment:24 in reply to: ↑ 22 ; follow-up: Changed 4 years ago by Maarten

Replying to hawkeye@…:

Why are these patches are not included in the official release of openwrt?
They are very helpful!

I am looking for an openwrt image for the that incorporates this patch as well. Does anybody know about such images?

Thanks,

Maarten

comment:25 in reply to: ↑ 24 Changed 4 years ago by SiruS

Replying to Maarten:

I am looking for an openwrt image for the that incorporates this patch as well. Does anybody know about such images?

Thanks,

Maarten

Take a look here: http://eko.one.pl/?p=openwrt-backfire
but I didn't test it yet.

comment:26 Changed 3 years ago by anonymous

Would it be possible to extend the forcephy-patch so that it is possible to completely shutdown a link? If I disable a port X using "swconfig dev rtl8366rb port X set disable 1" the LED on the router goes off but the LED on the counterpart port is still active and the link is still powered. I need the possibility to power down phy with the same effect like unplugging the network cable.

Here someone implemented this for another hardware platform: http://patchwork.openwrt.org/patch/2594/
Can this also be done with the rtl8366b? Implementing such a feature would also allow to save energy which can be crucial in scenarios, where power-saving is important.

By the way, here are also two patches from the same author that use a different way to implement the possibility to force a port to a specific speed:
http://patchwork.openwrt.org/patch/2587/
http://patchwork.openwrt.org/patch/2588/

comment:27 Changed 3 years ago by anonymous

Hello,

I'm compiling my own firmware based on AA branch.

I know it's probably a basic question, but this is my first time. Where to i copy the .patch files?

Thx!

Patrick

comment:28 Changed 2 years ago by anonymous

What's the current state of this?

A while ago, I made a modification to rtl8366rb.c for Attitude Adjustment myself that basically just set the default max packet length to 9216 bytes instead of 1536 bytes. No swconfig support, just a hardcoded value.

That worked OK but in Barrier Breaker rtl8366rb.c was updated, and the line I edited in the older version wasn't longer there. I figured out that maybe it wasn't longer needed but haven't tried to use jumbo frames since.

So well, now I run Barrier Breaker on my routers and switches and want to use jumbo frames again. How should I proceed? Is this patch included in OpenWRT's codebase already? I don't see a max_length option in swconfig.

comment:29 Changed 2 years ago by lars@…

I tried patching rtl8366rb.c with the patch file from the attachements, but it seems it is not up to date:

patching file target/linux/generic/files/drivers/net/phy/rtl8366rb.c
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 181.
Hunk #3 succeeded at 205 (offset 13 lines).
Hunk #4 FAILED at 701.
Hunk #5 succeeded at 803 (offset 4 lines).
Hunk #6 FAILED at 898.
Hunk #7 FAILED at 925.
Hunk #8 FAILED at 939.
Hunk #9 FAILED at 968.
Hunk #10 FAILED at 1080.
Hunk #11 succeeded at 1328 (offset 197 lines).
Hunk #12 FAILED at 1467.
9 out of 12 hunks FAILED -- saving rejects to file target/linux/generic/files/drivers/net/phy/rtl8366rb.c.rej

Changed 2 years ago by lars@…

Default maximum packet length to 9216 bytes

comment:30 Changed 2 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as assigned .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.