> On Apr 21, 2017, at 8:34 AM, Jarno Rajahalme <[email protected]> wrote:
> 
>> 
>> On Mar 31, 2017, at 8:11 PM, nickcooper-zhangtonghao <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> When a bridge stp enabled, we assign sequentially element
>> of stp_port array (in stp struct) to bridge ports. That is
>> ok when no ports are added to bridge. When adding a port
>> to bridge which stp enabled, the ovs-vswitchd will assign
>> stp_port sequentially again. Then the stp_port belonging
>> to one port may belong to other one.
> 
> Could you elaborate the problem with this STP port renumbering?

When we add a port to bridge which stp is enabled, the stp ports are renumbered.

For example:
p0 is mapped to one array element of struct stp_port ports[STP_MAX_PORTS] (e.g. 
ports[0])
p1 is mapped to one array element of struct stp_port ports[STP_MAX_PORTS] (e.g. 
ports[1])

When we add a port p2 to bridge, the p2 may be mapped to ports[0], p0 is mapped 
to ports[1], and  p1 is mapped to ports[2].
But we hope that p2 may be mapped to ports[2], p0 is mapped to ports[0], and  
p1 is mapped to ports[1].
If not, the stp ports of bridge will converge. As a general rule, the state of 
new port should be changed
(e.g goto forwarding state or blocking.) and other stp ports remain the same.


Test shell:

#!/bin/bash
ovs-vsctl add-br br0
ovs-vsctl add-br br1

ovs-appctl vlog/set ofproto_dpif:dbg

ovs-vsctl add-port br0 p1 -- \
    set interface p1 type=dummy options:pstream=punix:/tmp/p1.sock 
ofport_request=1

ovs-vsctl add-port br0 p2 -- \
    set interface p2 type=dummy options:pstream=punix:/tmp/p2.sock 
ofport_request=2

ovs-vsctl add-port br1 p6 -- \
    set interface p6 type=dummy options:stream=unix:/tmp/p1.sock 
ofport_request=6

ovs-vsctl add-port br1 p7 -- \
    set interface p7 type=dummy options:stream=unix:/tmp/p2.sock 
ofport_request=7

ovs-ofctl add-flow br0 action=normal
ovs-ofctl add-flow br1 action=normal

ovs-appctl netdev-dummy/set-admin-state up

ovs-vsctl set port br0 other_config:stp-enable=false -- \
    set bridge br0 stp_enable=true other-config:hwaddr=aa:66:aa:66:00:00

ovs-vsctl set port br1 other_config:stp-enable=false -- \
    set bridge br1 stp_enable=true other-config:hwaddr=aa:66:aa:66:00:01


# ovs-appctl stp/show
<---cut--->
Bridge ID:
        stp-priority    32768
        stp-system-id   aa:66:aa:66:00:01
        stp-hello-time  2s
        stp-max-age     20s
        stp-fwd-delay   15s

        Interface  Role       State      Cost  Pri.Nbr
        ---------- ---------- ---------- ----- -------
        p6         alternate  blocking   19    128.1
        p7         root       forwarding 19    128.2


# ovs-vsctl add-port br1 p8
# ovs-appctl stp/show
<---cut--->
Bridge ID:
        stp-priority    32768
        stp-system-id   aa:66:aa:66:00:01
        stp-hello-time  2s
        stp-max-age     20s
        stp-fwd-delay   15s

        Interface  Role       State      Cost  Pri.Nbr
        ---------- ---------- ---------- ----- -------
        p8         alternate  blocking   19    128.1
        p6         root       forwarding 19    128.2
        p7         designated listening  19    128.3


After adding the p8 port, p8 uses the p6 state, p6 uses the p7 state, and p7 
uses the new state.
The rstp works well without elaboration.

>> This patch uses the
>> OpenFlow port numbers instead of sequence numbers to avoid
>> it.
>> 
> 
> Using OpenFlow port numbers (32-bit) as STP port numbers (8-bit) seems wrong 
> to me. Besides, you can always use the other-config stp-port-num in ovsdb to 
> specify which STP port number you want, if you do not want them to be 
> numbered automatically.

Yes, the max number of stp ports on bridge is STP_MAX_PORTS(255), and this 
should not be problem. Assigning the openflow port num to stp port is simple. 
But we can use other way to assign stp port number. If you have any idea, 
please let me know.









_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to