On Thu, May 23, 2024 at 04:21:48PM GMT, Simon Jones wrote:
> Hi all,
>
> I found a bug in OVS-DPDK(ovs-2.17.1, dpdk-21.11).
> Which is Miss setting port number in openflow while delete port and add
> port.
Hi Simon.
See my comments inline.
>
> 1. The process of problem is:
> ```
> add bridge;
> add port;
> add openflow, use port as in_port and output;
> delete port;
> openflow is error in port filed;
> add port;
> openflow is error in port filed;
> ```
>
> 2. How to produce:
> ```
> ### add bridge and port
>
> [root@bogon ~]# ovs-vsctl show
> 9f76671a-87a2-46f0-92a3-6c83f7b0ab86
> Bridge br-int
> datapath_type: netdev
> Port pf0hpf
> Interface pf0hpf
> type: dpdk
> options: {dpdk-devargs="0000:01:00.0,representor=[65535]"}
> Port bond0
> Interface bond0
> type: dpdk
> options: {dpdk-devargs=net_bonding-bond0}
> Port br-int
> Interface br-int
> type: internal
> ovs_version: "2.17.2"
>
> ### add openflow
>
> [root@bogon ~]# ovs-ofctl dump-flows br-int
> cookie=0x0, duration=6.338s, table=0, n_packets=0, n_bytes=0,
> in_port=pf0hpf actions=output:bond0
> cookie=0x0, duration=5.765s, table=0, n_packets=6, n_bytes=744,
> in_port=bond0 actions=output:pf0hpf
>
> ### delete port bond
>
> ovs-vsctl del-port br-int bond0
>
> [root@bogon ~]# ovs-ofctl dump-flows br-int
> cookie=0x0, duration=28.889s, table=0, n_packets=0, n_bytes=0,
> in_port=pf0hpf actions=output:2
> cookie=0x0, duration=28.316s, table=0, n_packets=25, n_bytes=3355,
> in_port=2 actions=output:pf0hpf
> [root@bogon ~]# ovs-ofctl show br-int
> OFPT_FEATURES_REPLY (xid=0x2): dpid:00002aa3ffcabe42
> n_tables:254, n_buffers:0
> capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
> actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src
> mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
> 1(pf0hpf): addr:02:0a:35:4c:1b:2c
> config: 0
> state: 0
> speed: 0 Mbps now, 0 Mbps max
> LOCAL(br-int): addr:2a:a3:ff:ca:be:42
> config: PORT_DOWN
> state: LINK_DOWN
> current: 10MB-FD COPPER
> speed: 10 Mbps now, 0 Mbps max
> OFPT_GET_CONFIG_REPLY (xid=0x4): frags=normal miss_send_len=0
>
> BUG:
> In openflow, the "output:bond0" change to "output:2".
> Why not delete the openflow related of bond0?
>
OVS does not delete OpenFlow flows. It is the controller's reponsibility
to configure a consistent and reasonsable flow list. There is no way OVS
can know if it makes sense to delete the flow, or redirect the packet to
some other port, etc.
In this case, the controller should delete or change the flows before
deleting the port.
> ### add bond0 back
>
> ovs-vsctl add-port br-int bond0 -- set interface bond0 type=dpdk
> options:dpdk-devargs=net_bonding-bond0
>
> [root@bogon ~]# ovs-ofctl dump-flows br-int
> cookie=0x0, duration=275.262s, table=0, n_packets=0, n_bytes=0,
> in_port=pf0hpf actions=output:2
> cookie=0x0, duration=274.689s, table=0, n_packets=25, n_bytes=3355,
> in_port=2 actions=output:pf0hpf
> (BUG: output:2 should change back to output:bond0, why NOT?)
> [root@bogon ~]# ovs-ofctl show br-int
> OFPT_FEATURES_REPLY (xid=0x2): dpid:00002aa3ffcabe42
> n_tables:254, n_buffers:0
> capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
> actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src
> mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
> 1(pf0hpf): addr:02:0a:35:4c:1b:2c
> config: 0
> state: 0
> speed: 0 Mbps now, 0 Mbps max
> 3(bond0): addr:a6:29:0d:b8:5b:3a
> config: 0
> state: 0
> current: AUTO_NEG
> speed: 0 Mbps now, 0 Mbps max
> LOCAL(br-int): addr:2a:a3:ff:ca:be:42
> config: PORT_DOWN
> state: LINK_DOWN
> current: 10MB-FD COPPER
> speed: 10 Mbps now, 0 Mbps max
> OFPT_GET_CONFIG_REPLY (xid=0x4): frags=normal miss_send_len=0
> (BUG: Why bond0 NOT use 2, but use 3)
>
OVS cannot know if it's really the same port. From OVS's perspective,
this is a new port. It doesn't make sense for OVS to store all the names
of previously added ports, and even it it dit, it's not safe to assume
it's the same interface just because it's called the same.
For that reason, if not tell otherwise, OVS will auto-assign an OpenFlow
Port (a.k.a ofport) number, in your case, it's 3.
You can tell OVS to use another ofport if you know what you're doing.
Try this:
ovs-vsctl add-port br-int bond0 -- {...} ofport_request=2
See ovs-vswitchd.conf.db(5) for more details.
> ### for "delete pf0hpf ", same result.
>
> [root@bogon ~]# ovs-vsctl del-port br-int pf0hpf
> [root@bogon ~]# ovs-ofctl dump-flows br-int
> cookie=0x0, duration=404.519s, table=0, n_packets=0, n_bytes=0, in_port=1
> actions=output:2
> cookie=0x0, duration=403.946s, table=0, n_packets=25, n_bytes=3355,
> in_port=2 actions=output:1
>
> ovs-vsctl add-port br-int pf0hpf -- set interface pf0hpf type=dpdk
> options:dpdk-devargs=0000:01:00.0,representor=[65535]
> [root@bogon ~]# ovs-ofctl dump-flows br-int
> cookie=0x0, duration=510.358s, table=0, n_packets=0, n_bytes=0, in_port=1
> actions=output:2
> cookie=0x0, duration=509.785s, table=0, n_packets=25, n_bytes=3355,
> in_port=2 actions=output:1
> [root@bogon ~]# ovs-ofctl show br-int
> OFPT_FEATURES_REPLY (xid=0x2): dpid:00002aa3ffcabe42
> n_tables:254, n_buffers:0
> capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
> actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src
> mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst
> 3(bond0): addr:a6:29:0d:b8:5b:3a
> config: 0
> state: 0
> current: AUTO_NEG
> speed: 0 Mbps now, 0 Mbps max
> 4(pf0hpf): addr:02:0a:35:4c:1b:2c
> config: 0
> state: 0
> speed: 0 Mbps now, 0 Mbps max
> LOCAL(br-int): addr:2a:a3:ff:ca:be:42
> config: PORT_DOWN
> state: LINK_DOWN
> current: 10MB-FD COPPER
> speed: 10 Mbps now, 0 Mbps max
> OFPT_GET_CONFIG_REPLY (xid=0x4): frags=normal miss_send_len=0
> ```
>
> 3. What's effect of this BUG
> ```
> Because of this BUG, packets will be drop.
> For example:
> After add bridge and port and openflow.
> send packet, could forward.
> After delete port(bond0 or pf0vf0), packets will be drop, this is OK.
> BUT, after add port back again, packets will still be drop!!!
> Because the number of port change, NOT same as openflow.
> ```
>
> 4. So my question is:
> - Is this a BUG?
> - Is this BUG has been fixed? Fixed in which commit?
>
I don't think this is a bug, it's just how OVS works.
Deleting OpenFlow flows and magically assigning ofports based on old
names would be way more problematic.
Thanks.
Adrián
> Thanks~
>
> ----
> Simon Jones
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev