Request for comments Subject: OVS data-path classifier offload
Versions:
OVS master.
DPDK 17.05.1.
Purpose & Scope
This RFC describes the flows’ hardware offloading over DPDK .
The motivation of hardware flows’ offloading is accelerating
the OVS DPDK data plane.The classification is done by the hardware.
A flow tag that represents the matched rule in the hardware,
received by the OVS and saves the lookup time.
OVS data-path classifier has to support additional functionality.
If the hardware supports flows table offloading and the user
activates the feature,the classifier rules are offloaded to the hardware
classifier in addition to the data-path classifier.
When flows are removed from the classifier the flows have to be removed
from the hardware flows table.
In the OVS classification data-path there are 4 stages:
Read packets from DPDK-PMD by OVS.
Find Matching flows.
Group packets by flows.
Execute action.
The suggested design intervene in the first two stages
the 3rd and 4th stages left untouched.
OVS additional code new file lib/hw-pipeline.c
new file lib/hw-pipeline.h
The hw-pipeline.c implements three significant objects.
An offloading thread, a pipe and flow tag pool.
Inserting and removing classifiers rules to/from the hardware requires time
which is translated to latency. A new OVS thread takes care of the
insertion/deletion
of rules and prevents blocking the PMD thread context.
A pipe ( mkpipe() ) transfers the classifier rules to the new thread context.
For each classifier rule, it is required to add a unique flow tag.
This same tag is attached later to the packet metadata by DPDK PMD if there is
a match
in the hardware. OVS uses this tag as an index to find the relevant software
flow.
The lookup processing becomes very efficient .In order to generate a unique tag,
the design is introducing a new flow tag pool.
A flow tag pool is a list implemented in an array.
The flow tag is generated and returned efficiently.
OVS changes
lib/dpif-netdev.c changes:
1) ceate_dp_netdev() initializes the new flow tag pool data base,
the classifier offload thread and pipe.
2) dp_netdev_free() frees the new flow tag pool data base,
the classifier offload thread and pipe.
3) dp_netdev_pmd_remove_flow() if the feature exists and active,
the function sends the classifier rule through the mkpipe to new thread.
The new thread removes the rule from the hardware.
4) dp_netdev_flow_add() if the feature exists and active,
the function sends the classifier rule through the mkpipe to new thread.
The new thread inserts the rule to the hardware.
5) emc_processing() if the feature exists and active & OVS received
a valid tag from the hardware: OVS skips emc processing.
6) fast_path_processing() if the feature exists and active and the function
received a valid tag from the hardware:
a.OVS looks for the tag that is attached to the packet metadata and then
OVS finds the flow according to the tag.
b.The functions:
dp_netdev_pmd_lookup_flow(), dpcls_lookup() are not called by OVS.
c.Group packets by flow and executing the action are done
the same way as before.
In the file lib/netdev-dpdk.c:
struct netdev_class is enhanced .
The structure has additional pointer to a function called get_pipeline().
A new function is introduced called netdev_dpdk_get_pipeline.
The function netdev_dpdk_get_pipeline reads the received tag from the hardware
if there is a match between the packet and the inserted rules.
if (mbuf->ol_flags & PKT_RX_FDIR_ID) {
ppl_md->id = HW_OFFLOAD_PIPELINE;
ppl_md->flow_tag = mbuf->hash.fdir.hi;
}
The source code:
https://github.com/openvswitch/ovs/compare/master...shacharbe:dp-cls-offload-no-tunnel-rfc?expand=1
References Intel work:
https://patchwork.ozlabs.org/patch/701623/
OVS presentation: fall 2016 summit:
http://openvswitch.org/support/ovscon2016/7/1450-stringer.pdf
Shachar Beiser (11):
ovs/dp-cls: fetching the mark id from hw
ovs/dp-cls: moving structures to dpif-netdev.h
ovs/dp-cls: saving rx queue identifier
ovs/dp-cls: initializing HW pipeline
ovs/dp-cls: free HW pipeline
ovs/dp-cls: remove data-path classifier rule
ovs/dp-cls: inserting data-path classifier rule
ovs/dp-cls: tag lookup and processing
ovs/dp-cls: flow tag read
ovs/dp-cls: removing flow from HW in the dp-cls offload thread
ovs/dp-cls: inserting rule to HW from offloading thread context
lib/automake.mk | 4 +-
lib/dp-packet.h | 1 +
lib/dpif-netdev.c | 300 +++++--------
lib/dpif-netdev.h | 298 ++++++++++++-
lib/hw-pipeline.c | 1146 +++++++++++++++++++++++++++++++++++++++++++++++++
lib/hw-pipeline.h | 48 +++
lib/netdev-bsd.c | 1 +
lib/netdev-dpdk.c | 49 +++
lib/netdev-dpdk.h | 22 +-
lib/netdev-dummy.c | 1 +
lib/netdev-linux.c | 1 +
lib/netdev-provider.h | 7 +-
lib/netdev-vport.c | 1 +
lib/netdev.c | 2 +
14 files changed, 1684 insertions(+), 197 deletions(-)
create mode 100644 lib/hw-pipeline.c
create mode 100644 lib/hw-pipeline.h
--
1.8.3.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev