The patch adds a new action to support packet truncation. The new action
is formatted as 'output(port=n,max_len=m)', as output to port n, with
packet size being MIN(original_size, m).
One use case is to enable port mirroring to send smaller packets to the
destination port so that only useful packet information is mirrored/copied,
saving some performance overhead of copying entire packet payload. Example
use case is below as well as shown in the testcases:
- Output to port 1 with max_len 100 bytes.
- The output packet size on port 1 will be MIN(original_packet_size, 100).
# ovs-ofctl add-flow br0 'actions=output(port=1,max_len=100)'
- The scope of max_len is limited to output action itself. The following
packet size of output:1 and output:2 will be intact.
# ovs-ofctl add-flow br0 \
'actions=output(port=1,max_len=100),output:1,output:2'
- The Datapath actions shows:
# Datapath actions: trunc(100),1,1,2
Implementation/Limitaions:
- The patch adds a new OpenFlow extension action OFPACT_OUTPUT_TRUNC, and
a new datapath action, OVS_ACTION_ATTR_TRUNC. An OFPACT_OUTPUT_TRUNC
will translate into a datapath truncate action, followed by a datapath
output action.
- The OVS_ACTION_ATTR_TRUNC action only marks the packet with a truncate
size (max_len). Actual truncation happens when the packet is about to
be transmitted.
- Only "output(port=[0-9]*,max_len=<N>)" is supported. Output to any
OFPUTIL_NAMED_PORTS or patch port are not supported.
- Compatibility: If the openvswitch kernel module does not support
OVS_ACTION_ATTR_TRUNC, it falls back to userspace slow path, do the
packet truncation and send to the output port.
v5->v6
- Add sample snaplen and sFlow usecase
- Add mirror snaplen usecase
v4->v5
- Disallow truncate and output to a patch port
- Add additional testcases
- Fix sparse warnings
v4: https://patchwork.ozlabs.org/patch/626486/
v3->v4
- Save the bytes to removed in datapath, instead of max_len
- Fix issues in test cases
- Add truncate support when upcall to userspace
v3: https://patchwork.ozlabs.org/patch/618573/
v2->v3
- Separate the truncate action and output action in datapath.
- Add truncate support for tunnel push and pop.
- Fix clang error.
- Use pskb_trim instead of skb_trim.
- Fallback to userspace truncate action when the
openvswitch kernel module does not support.
- Disallow truncate port to be any OFPUTIL_NAMED_PORTS.
- Add more testcases.
v2: https://patchwork.ozlabs.org/patch/605082/
William Tu (3):
ofp-actions: Add truncate action.
ofproto-dpif-sflow: Add snaplen for sample action and sFlow.
ofproto-dpif-mirror: Add mirror snaplen support.
datapath/actions.c | 36 ++-
datapath/datapath.c | 25 +-
datapath/datapath.h | 4 +
datapath/flow_netlink.c | 9 +
datapath/linux/compat/include/linux/openvswitch.h | 8 +
datapath/vport.c | 1 +
include/openvswitch/ofp-actions.h | 11 +
lib/dp-packet.c | 1 +
lib/dp-packet.h | 26 ++
lib/dpif-netdev.c | 33 +-
lib/dpif-netlink.c | 4 +-
lib/dpif.c | 23 ++
lib/dpif.h | 1 +
lib/netdev-bsd.c | 5 +
lib/netdev-dpdk.c | 6 +
lib/netdev-dummy.c | 5 +
lib/netdev-linux.c | 5 +
lib/netdev.c | 8 +-
lib/odp-execute.c | 11 +
lib/odp-util.c | 23 ++
lib/ofp-actions.c | 118 ++++++-
ofproto/ofproto-dpif-mirror.c | 9 +-
ofproto/ofproto-dpif-mirror.h | 4 +-
ofproto/ofproto-dpif-sflow.c | 20 +-
ofproto/ofproto-dpif-sflow.h | 2 +
ofproto/ofproto-dpif-upcall.c | 22 +-
ofproto/ofproto-dpif-xlate.c | 112 ++++++-
ofproto/ofproto-dpif.c | 58 +++-
ofproto/ofproto-dpif.h | 3 +
ofproto/ofproto.h | 2 +
tests/odp.at | 3 +
tests/ofp-actions.at | 11 +-
tests/ofproto-dpif.at | 365 ++++++++++++++++++++++
tests/ovs-ofctl.at | 28 +-
tests/system-traffic.at | 213 +++++++++++++
tests/system-userspace-macros.at | 9 +
vswitchd/bridge.c | 6 +
vswitchd/vswitch.ovsschema | 7 +-
vswitchd/vswitch.xml | 9 +
39 files changed, 1202 insertions(+), 44 deletions(-)
--
2.5.0
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev