Realtek 8366RB driver & DDWRT?

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions
Author Message
biana2007
DD-WRT Novice


Joined: 07 Sep 2010
Posts: 2

PostPosted: Tue Sep 07, 2010 3:51    Post subject: Realtek 8366RB driver & DDWRT? Reply with quote
Hi all,

I would like to use DDWRT in my board as Router development. My board uses Power PC (AMCC chip).


I got the RTL8366rb version 0.2.0 at (http://projects.qi-hardware.com/index.php/p/qi-kernel/source/tree/master/drivers/net/phy/rtl8366rb.c). I modified a bit source code for MDIO read & write.

I also add a section code to active PHY feature. Code as below: (If I didn't add this code at reset function, I can not ping to this interface. Ex: eth0)


Code:

static int rtl8366rb_force_link(struct switch_dev *dev, int port, int speed, int duplex)
{
   u32 macData;
   u32 regBits;
   u32 regAddr;
   u32 regData;
   int link = 1, txPause = 1, rxPause = 1;

   rtl8366rb_write (dev, 0x000D, 0x0280); /* Added to fix PHYs link-up with 1000M */
   /*prepare force status first*/
   macData = (speed == SPEED_1000 ? 2 : speed == SPEED_100 ? 1 : 0);
   macData = macData | (duplex<<2);
   macData = macData | (link<<4);
   macData = macData | (txPause<<5);
   macData = macData | (rxPause<<6);
   macData = macData <<(8*(port&0x01));
   regBits = 0xFF << (8*(port&0x01));
   regAddr = RTL8368S_PORT_ABILITY_BASE + (port>>1);
   rtl8366rb_read (dev, regAddr, &regData);
   
   regData = regData & (~regBits);
   regData = regData | (macData & regBits);
   rtl8366rb_write (dev, regAddr, regData);

   /* Set register value */
   rtl8366rb_read (dev, RTL8368S_MAC_FORCE_CTRL_REG, &regData);
   regData = regData | (1<<port);
   rtl8366rb_write (dev, RTL8368S_MAC_FORCE_CTRL_REG, regData);
   
   return 0;
}


After adding this section, I can config as steps below (RTL8366RB has 5 ports.)

WAN: port 0
LAN: port 1, 2, 3, 5.

Code:

Add virtual VLAN:

#vconfig add eth0 1
#vconfig add eth0 2

Config switch:

#swconfig dev rtl8366rb set reset 1
#swconfig dev rtl8366rb set enable_vlan 1
#swconfig dev rtl8366rb vlan 1 set ports "1 2 3 4 5t"
#swconfig dev rtl8366rb vlan 2 set ports "0 5t"

#udhcpc -i eth1.2 -> The board can get the IP dynamic.

#dnsmasq --conf-file=/tmp/dnsmasq.conf --user=root -> The board can assign IP to another device plug in LAN ports. (In our case: I plug-in my Laptop to test.


Forward IP:
#echo "1" > /proc/sys/net/ipv4/ip_forward
#iptables -t nat -A POSTROUTING -o eth1.2 -j MASQUERADE
->> I can ping from my Laptop to Internet (google.com, yahoo.com, ...)




Ping testing is OK. But another protocols & applications such as wget, ssh, web browser ... it can not load.
- ssh to local server: login, logout are ok. But vi some files or use ll command to list all file, the terminal will hang. I use the Wireshark to dump the packet, it seem lost packets.

- web browser: open some text pages is OK. All most pages is loading forever.

Could you give a idea to fix it or anyone have meet it please help.

Thanks in advance.
Sponsor
Sash
DD-WRT Guru


Joined: 20 Sep 2006
Posts: 17638
Location: Hesse/Germany

PostPosted: Tue Sep 07, 2010 10:17    Post subject: Reply with quote
i dont know what u are trying to tell us
_________________
Forum Guidelines...How to get help
&
Forum Rules
&
RTFM/STFW
&
Throw some buzzwords into the WIKI search Exclamation
_________________
I'm NOT rude, just offer pure facts!
_________________
Atheros (TP-Link & Clones, etc ) debrick service in EU
_________________
Guide on HowTo be Safe, Secure and Protect Your Online Anonymity!
biana2007
DD-WRT Novice


Joined: 07 Sep 2010
Posts: 2

PostPosted: Wed Sep 08, 2010 2:49    Post subject: Reply with quote
Sash wrote:
i dont know what u are trying to tell us


Sorry for not clear in my presentation.

1. Environment:
[My PC] <--[LAN Port]--> My Router (Use RLT8366RB] <---[WAN Port] ---> [ADSL Modem] ---> Internet or LAN network.

My Router use AMCC chip & RTL8366RB.

I got the RTL8366RB driver at http://projects.qi-hardware.com/index.php/p/qi-kernel/source/tree/master/drivers/net/phy/rtl8366rb.c.
Then modified a bit for MDIO read & write function suitable for AMCC Chip.

2. Results:
2.1 I can config my Router as Switch. Set & enable VLAN... Everything is OK.
2.2 Config 1 port as WAN, other ports as LAN. I can ping from me PC to internet (google, yahoo, ...)

Then problem I met:
When config as 2.2, I do some testing from my PC as diagram above:
- Ping local LAN network or web pages (google, yahoo, ..) is OK.
- ssh: I can login, logout, but terminal is hang when use ll or vi, ... commands.
- Open web pages by browser: The page loading forever & nothing showing.

All the commands are used to testing as the previous my post (pls refer)

So could you help to give a idea to solve those problems ?

Thanks a lot.
Sash
DD-WRT Guru


Joined: 20 Sep 2006
Posts: 17638
Location: Hesse/Germany

PostPosted: Sat Sep 11, 2010 10:17    Post subject: Reply with quote
so where is dd-wrt involved?!
_________________
Forum Guidelines...How to get help
&
Forum Rules
&
RTFM/STFW
&
Throw some buzzwords into the WIKI search Exclamation
_________________
I'm NOT rude, just offer pure facts!
_________________
Atheros (TP-Link & Clones, etc ) debrick service in EU
_________________
Guide on HowTo be Safe, Secure and Protect Your Online Anonymity!
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum