Thank you for sharing the mstpd code, i am using this code for stp/rstp as 1st phase, then i can move to mstp.
i am using mv88e6131 h/w same link street as your are using, i am able to receive the packets in the mstpd code with proper port index, but while sending packets not able to see over the n/w (i think switch is not transmitting).
Then i gone through the below provided information by you,
1)
What the driver does - it creates N ethernet interfaces, each one corresponds to the physical port on the one of 88E6097s. Then it turns on "send control frames, including STP, to the CPU" feature in LinkStreet parts.Also it programs DSA feature of the LinkStreet parts so that driver knows on >>which physical interface the current frame (arrived to the CPU via MII) was originally received.
I have created the N interfaces and registered with switch through DSA driver code, which has provided in 2.6 (2.6.39.4 is i am using).As i am able to see log in mstpd code at packet_recv() function, so DSA is forwarding the packets to proper interface. is my understanding is correct?
2)
Then it listens to the incoming frames and routes STP frames to the corresponding ethXX interfaces. And vice versa, when mstpd (or Linux bridge) sends STP frame over one of those ethXX interfaces - the driver adds DSA tag so that it comes out of the corresponding physical port and then sends it over MII.
which driver (driver/net/ 'or' net/dsa/) need to take care of the above implementation, i assume the above functionality taken care by the DSA driver!
could you provide me more information on this. (i am new to this driver code)
3)
In the user-space I create a bridge which enslaves all that ethernet interfaces created by driver. And that bridge is controlled with mstpd. There is no actual frame switching done in the Linux bridge - I utilize only STP functionality of it, the actual switching is done in hardware.
i am using "brctl and ifconfig" commands to do this functionality, is am i sync with you?
Thank you in advance.
Last edit: satyanarayana 2012-07-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for sharing the mstpd code, i am using this code for stp/rstp as 1st phase, then i can move to mstp.
That's a good point to start with.
I have created the N interfaces and registered with switch through DSA driver code, which has provided in 2.6 (2.6.39.4 is i am using).As i am able to see log in mstpd code at packet_recv() function, so DSA is forwarding the packets to proper interface. is my understanding is correct?
Since you can see packets logged in packet_rcv() and with right interface number, then obviously receiving part is correct )
2)
Then it listens to the incoming frames and routes STP frames to the corresponding ethXX interfaces. And vice versa, when mstpd (or Linux bridge) sends STP frame over one of those ethXX interfaces - the driver adds DSA tag so that it comes out of the corresponding physical port and then sends it over MII.
which driver (driver/net/ 'or' net/dsa/) need to take care of the above implementation, i assume the above functionality taken care by the DSA driver!
could you provide me more information on this. (i am new to this driver code)
a) I do not use DSA driver, so I can not help you with it. Anyway, first you should check that mstpd actually sends something. Do you see sent BPDUs in mstpd's log?
b) Assuming mstpd actually sends BPDUs to the interfaces, I suppose DSA driver should take care of adding DSA tag and forwarding them to the hardware. Again, I'm not sure, I've never looked through DSA code and I'm not using it.
c) Even with DSA driver's help in BPDUs sending/receiving, you still need your own driver to setup your hardware. At least your driver should be able to set port STP states (blocking/listening/forwarding), set ageing time and remove MAC entries from ATU, i.e. be able to support functions driver_set_new_state(), driver_set_ageing_time() and driver_flush_all_fids() in the driver_deps.c file. I do DSA tags adding/stripping in that very driver, because I do not use DSA driver.
-
i am using "brctl and ifconfig" commands to do this functionality, is am i sync with you?
You can use whichever tool you prefer as long as it can create bridge interface, enslave other interfaces to it, bring it up and bring stp up ;)
I, personally, use brctl + ifconfig too, though it really doesn't matter.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
driver_set_ageing_time(): Actually, the standards (802.1Q-2005/2011) require setting ageing time for each port separately. At the moment this function is supposed to set the ageing time for the whole bridge, because the hardware I am working with does not support setting ageing time for the individual ports.
After consideration I decided that mstpd implementation should follow the standards. So I will change the semantic of driver_set_ageing_time() call so that it will be called for each port separately.
Thank you for making the point ;)
-
driver_flush_all_fids(): see the discussion on this function here: http://sourceforge.net/p/mstpd/discussion/general/thread/68c5f4c2/. Basically, it is called per-tree per-port. As long as you implement only (R)STP - you have only one tree, so you can consider it as per-port function.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am running mstpd in the desktop, with the following commands, let me know if any thing i am missing,
1) brctl addbr br0
2) brctl addif eth0
3) ifconfig br0 up
4) mstpd -d
5) mstpctl addbridge br0
6) mstpctl setforcevers br0 RSTP
i see the stp packet over the wireshark, and also i have observed in /var/log/kernel.log file, bridge log messages for hardware state changes (learning,blocking, forwarding)
Doubts:-
1) When the "bridge-stp" script will triggered by kernel, how to get know it is called by kernel.
2) when i enter "brctl stp br0 on", in wirehsark 2 parallel packets (stp and rstp packets) stp from the bridge and rstp from the mstpd,
that means bridge still have the control, so how can i get the kernel stp control to application.
Thank you in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
it must be "mstpctl setforcevers br0 rstp" - rstp must be in lowercase.
1) When the "bridge-stp" script will triggered by kernel, how to get know it is called by kernel.
You always can put some debugging output in that script, for example,
logger -t bridge-stp "Script called with params $1 $2"
and then check the syslog for this message.
2) when i enter "brctl stp br0 on", in wirehsark 2 parallel packets (stp and rstp packets) stp from the bridge and rstp from the mstpd,
that means bridge still have the control, so how can i get the kernel stp control to application.
Yes, there is a problem here. If you start mstpd with -d flag then the pid file mstpd.pid is not created. If mstpd.pid is not created then bridge_stp fails. If bridge_stp fails when called by kernel - the kernel assumes there is no user-space STP daemon and does the STP by itself. That is exactly the situation you are seeing.
Possible solutions:
Solution A: do not use "-d" flag in mstpd, start it in daemon mode always.
Solution B: edit bridge_stp script and remove checkpid line from it.
-
Meanwhile I will reconsider the decision of not creating pid file when mstpd is started in interactive (non-daemon) mode with "-d" flag. Actually, at the moment I can not say why I have done it this way - the only reason is that it was this way in the rstpd code. If you can give me some advice on the matter - should the pid file be created always or only in daemon mode - I will be grateful.
The quick search in google shows that it is common practice - to create pid file only in daemon mode.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Vitalii,
Thank you for sharing the mstpd code, i am using this code for stp/rstp as 1st phase, then i can move to mstp.
i am using mv88e6131 h/w same link street as your are using, i am able to receive the packets in the mstpd code with proper port index, but while sending packets not able to see over the n/w (i think switch is not transmitting).
Then i gone through the below provided information by you,
1)
I have created the N interfaces and registered with switch through DSA driver code, which has provided in 2.6 (2.6.39.4 is i am using).As i am able to see log in mstpd code at packet_recv() function, so DSA is forwarding the packets to proper interface. is my understanding is correct?
2)
which driver (driver/net/ 'or' net/dsa/) need to take care of the above implementation, i assume the above functionality taken care by the DSA driver!
could you provide me more information on this. (i am new to this driver code)
3)
i am using "brctl and ifconfig" commands to do this functionality, is am i sync with you?
Thank you in advance.
Last edit: satyanarayana 2012-07-02
Hello!
That's a good point to start with.
Since you can see packets logged in packet_rcv() and with right interface number, then obviously receiving part is correct )
a) I do not use DSA driver, so I can not help you with it. Anyway, first you should check that mstpd actually sends something. Do you see sent BPDUs in mstpd's log?
b) Assuming mstpd actually sends BPDUs to the interfaces, I suppose DSA driver should take care of adding DSA tag and forwarding them to the hardware. Again, I'm not sure, I've never looked through DSA code and I'm not using it.
c) Even with DSA driver's help in BPDUs sending/receiving, you still need your own driver to setup your hardware. At least your driver should be able to set port STP states (blocking/listening/forwarding), set ageing time and remove MAC entries from ATU, i.e. be able to support functions driver_set_new_state(), driver_set_ageing_time() and driver_flush_all_fids() in the driver_deps.c file. I do DSA tags adding/stripping in that very driver, because I do not use DSA driver.
-
You can use whichever tool you prefer as long as it can create bridge interface, enslave other interfaces to it, bring it up and bring stp up ;)
I, personally, use brctl + ifconfig too, though it really doesn't matter.
Hello Vitalii,
We must set the age time for all the ports that connected with bridge? this is applicable for driver_flush_all_fids() also.
Last edit: satyanarayana 2012-07-02
driver_set_ageing_time(): Actually, the standards (802.1Q-2005/2011) require setting ageing time for each port separately. At the moment this function is supposed to set the ageing time for the whole bridge, because the hardware I am working with does not support setting ageing time for the individual ports.
After consideration I decided that mstpd implementation should follow the standards. So I will change the semantic of driver_set_ageing_time() call so that it will be called for each port separately.
Thank you for making the point ;)
-
driver_flush_all_fids(): see the discussion on this function here: http://sourceforge.net/p/mstpd/discussion/general/thread/68c5f4c2/. Basically, it is called per-tree per-port. As long as you implement only (R)STP - you have only one tree, so you can consider it as per-port function.
I've just commited the change to the SVN. Now driver_set_ageing_time() is called on per-port basis.
The latest SVN revision is now 32.
Hello Vitalii,
I am running mstpd in the desktop, with the following commands, let me know if any thing i am missing,
1) brctl addbr br0
2) brctl addif eth0
3) ifconfig br0 up
4) mstpd -d
5) mstpctl addbridge br0
6) mstpctl setforcevers br0 RSTP
i see the stp packet over the wireshark, and also i have observed in /var/log/kernel.log file, bridge log messages for hardware state changes (learning,blocking, forwarding)
Doubts:-
1) When the "bridge-stp" script will triggered by kernel, how to get know it is called by kernel.
2) when i enter "brctl stp br0 on", in wirehsark 2 parallel packets (stp and rstp packets) stp from the bridge and rstp from the mstpd,
that means bridge still have the control, so how can i get the kernel stp control to application.
Thank you in advance.
it must be "brctl addif br0 eth0"
it must be "mstpctl setforcevers br0 rstp" - rstp must be in lowercase.
You always can put some debugging output in that script, for example,
and then check the syslog for this message.
Yes, there is a problem here. If you start mstpd with -d flag then the pid file mstpd.pid is not created. If mstpd.pid is not created then bridge_stp fails. If bridge_stp fails when called by kernel - the kernel assumes there is no user-space STP daemon and does the STP by itself. That is exactly the situation you are seeing.
Possible solutions:
Solution A: do not use "-d" flag in mstpd, start it in daemon mode always.
Solution B: edit bridge_stp script and remove checkpid line from it.
-
Meanwhile I will reconsider the decision of not creating pid file when mstpd is started in interactive (non-daemon) mode with "-d" flag. Actually, at the moment I can not say why I have done it this way - the only reason is that it was this way in the rstpd code. If you can give me some advice on the matter - should the pid file be created always or only in daemon mode - I will be grateful.
The quick search in google shows that it is common practice - to create pid file only in daemon mode.