[ovs-dev] [PATCH v2 0/2] xlate: optimize dp flow action in case of error in multi-bridge setup
Zoltan Balogh
zoltan.balogh at ericsson.com
Wed Dec 6 10:55:26 UTC 2017
If several bridges are connected via patch ports or the packet is sent
via tunnel and an error occurs during translation in a subsequent bridge,
e.g. Ethernet header cannot be pushed to the packet due to lack of
prerequisites in the second bridge and there were flow actions already
translated in first bridge, it can happen that the installed datapath
flow contains actions which are going to be performed for all received
packets, however the packets are going to be dropped in the end. This
is waste of processing resource.
There are two points in the code where we can fix such datapath flows.
1) During translation of OF actions on a bridge, we can store the last
valid state of translated actions while iterating over the OF actions
and revert to it in case of error. This can be performed in the
do_xlate_actions() funtion.
2) When all OF actions have been translated, there could be actions at
the end of list of odp actions which are not needed to be executed.
So, the list can be normalized at the end of xlate_actions().
Let's have a config like this and inject L2 Ethernet packets into br0
via LOCAL port:
->-+
| LOCAL LOCAL LOCAL
+-o-------+ +-------o-+ +---------+ +-------o-+
| br0 | | br1 | | br2 | | br3 |
+-------o-+ +-o-----o-+ +-o-----o-+ +-o-------+
p01 | p10 | | p12 p21 | | p23 p32 |
+-----------+ +-----------+ +-----------+
netdev at ovs-netdev: hit:17754528 missed:57
br0:
br0 65534/1: (tap)
p01 10/none: (patch: peer=p10)
br1:
br1 65534/2: (tap)
p10 20/none: (patch: peer=p01)
p12 30/none: (patch: peer=p21)
br2:
br2 65534/3: (tap)
p21 40/none: (patch: peer=p12)
p23 50/none: (patch: peer=p32)
br3:
br3 65534/4: (tap)
p32 60/none: (patch: peer=p23)
- OpenFlow rules:
"br0"
OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x0, duration=15.601s, table=0, n_packets=20739, n_bytes=2032422,
reset_counts in_port=LOCAL actions=dec_ttl,output:10
"br1"
OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x0, duration=15.568s, table=0, n_packets=20739, n_bytes=2032422,
reset_counts ip,in_port=20
actions=dec_ttl,dec_ttl,dec_ttl,dec_ttl,LOCAL,
set_field:ee:ee:ee:ff:ff:01->eth_dst,output:30
"br2"
OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x0, duration=15.536s, table=0, n_packets=20739, n_bytes=2032422,
ip,in_port=40
actions=dec_ttl,dec_ttl,dec_ttl,dec_ttl,dec_ttl,
set_field:aa:aa:aa:bb:bb:ff->eth_src,encap(ethernet),dec_ttl,output:50
"br3"
OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x0, duration=15.502s, table=0, n_packets=0, n_bytes=0,
reset_counts in_port=60 actions=LOCAL
- Installed datapath flow:
flow-dump from non-dpdk interfaces:
recirc_id(0),in_port(1),packet_type(ns=0,id=0),
eth(src=aa:dd:dd:ee:ee:f9,dst=aa:aa:aa:bb:bb:00),eth_type(0x0800),
ipv4(ttl=255,frag=no), packets:20738, bytes:2032324, used:5.176s,
actions:set(ipv4(ttl=250)),2,
set(eth(src=aa:aa:aa:bb:bb:ff,dst=ee:ee:ee:ff:ff:01)),set(ipv4(ttl=245))
In this case, encap(ethernet) action cannot be performed, because of the
packet is L2 Ethernet packet. By looking at the datapath flow, you can
see, that setting MAC addresses and TTL at the end is actually not needed,
since the packet is not transmitted anywhere after these actions.
With this series, these actions are omitted.
Zoltan Balogh (2):
xlate: rollback to valid known state in case of ctx->error on
translation
xlate: normalize the actions after translation
ofproto/ofproto-dpif-xlate.c | 204 ++++++++++++++++++++++++++++++++++++++
tests/ofproto-dpif.at | 227 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 431 insertions(+)
--
2.14.1
More information about the dev
mailing list