diff options
author | Yuanhan Liu <yliu@fridaylinux.org> | 2018-06-25 16:21:03 +0300 |
---|---|---|
committer | Ian Stokes <ian.stokes@intel.com> | 2018-07-06 10:32:52 +0100 |
commit | 241bad15d99a422dce71a6ec6116a2d7b9c31796 (patch) | |
tree | 8080b6fb84ecedd92f2d4bef2b1540ac19164143 /lib/netdev.h | |
parent | e0fe1594aa80416d581e0eda8c95c5c06f9c0cc3 (diff) | |
download | openvswitch-241bad15d99a422dce71a6ec6116a2d7b9c31796.tar.gz |
dpif-netdev: associate flow with a mark id
Most modern NICs have the ability to bind a flow with a mark, so that
every packet matches such flow will have that mark present in its
descriptor.
The basic idea of doing that is, when we receives packets later, we could
directly get the flow from the mark. That could avoid some very costly
CPU operations, including (but not limiting to) miniflow_extract, emc
lookup, dpcls lookup, etc. Thus, performance could be greatly improved.
Thus, the major work of this patch is to associate a flow with a mark
id (an uint32_t number). The association in netdev datapath is done
by CMAP, while in hardware it's done by the rte_flow MARK action.
One tricky thing in OVS-DPDK is, the flow tables is per-PMD. For the
case there is only one phys port but with 2 queues, there could be 2
PMDs. In other words, even for a single mega flow (i.e. udp,tp_src=1000),
there could be 2 different dp_netdev flows, one for each PMD. That could
results to the same mega flow being offloaded twice in the hardware,
worse, we may get 2 different marks and only the last one will work.
To avoid that, a megaflow_to_mark CMAP is created. An entry will be
added for the first PMD that wants to offload a flow. For later PMDs,
it will see such megaflow is already offloaded, then the flow will not
be offloaded to HW twice.
Meanwhile, the mark to flow mapping becomes to 1:N mapping. That is
what the mark_to_flow CMAP is for. When the first PMD wants to offload
a flow, it allocates a new mark and performs the flow offload by reusing
the ->flow_put method. When it succeeds, a "mark to flow" entry will be
added. For later PMDs, it will get the corresponding mark by above
megaflow_to_mark CMAP. Then, another "mark to flow" entry will be added.
Signed-off-by: Yuanhan Liu <yliu@fridaylinux.org>
Co-authored-by: Finn Christensen <fc@napatech.com>
Signed-off-by: Finn Christensen <fc@napatech.com>
Co-authored-by: Shahaf Shuler <shahafs@mellanox.com>
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Diffstat (limited to 'lib/netdev.h')
-rw-r--r-- | lib/netdev.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/netdev.h b/lib/netdev.h index c941f1e1e..556676046 100644 --- a/lib/netdev.h +++ b/lib/netdev.h @@ -201,6 +201,12 @@ void netdev_send_wait(struct netdev *, int qid); struct offload_info { const struct dpif_class *dpif_class; ovs_be16 tp_dst_port; /* Destination port for tunnel in SET action */ + + /* + * The flow mark id assigened to the flow. If any pkts hit the flow, + * it will be in the pkt meta data. + */ + uint32_t flow_mark; }; struct dpif_class; struct netdev_flow_dump; |