[ovs-dev] [PATCH 2/7] dpif-netdev: retrieve flow directly from the flow mark
Yuanhan Liu
yliu at fridaylinux.org
Wed Aug 23 06:24:17 UTC 2017
So that we could skip the heavy emc processing. A simple PHY-PHY
forwarding testing shows almost 80% performance improvement.
Signed-off-by: Yuanhan Liu <yliu at fridaylinux.org>
Signed-off-by: Finn Christensen <fc at napatech.com>
---
lib/dp-packet.h | 13 +++++++++++++
lib/dpif-netdev.c | 17 +++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/lib/dp-packet.h b/lib/dp-packet.h
index bb3f9db..7ecabcc 100644
--- a/lib/dp-packet.h
+++ b/lib/dp-packet.h
@@ -687,6 +687,19 @@ reset_dp_packet_checksum_ol_flags(struct dp_packet *p)
#define reset_dp_packet_checksum_ol_flags(arg)
#endif
+static inline bool
+dp_packet_has_flow_mark(struct dp_packet *p OVS_UNUSED,
+ uint32_t *mark OVS_UNUSED)
+{
+#ifdef DPDK_NETDEV
+ if (p->mbuf.ol_flags & PKT_RX_FDIR_ID) {
+ *mark = p->mbuf.hash.fdir.hi;
+ return true;
+ }
+#endif
+ return false;
+}
+
enum { NETDEV_MAX_BURST = 32 }; /* Maximum number packets in a batch. */
struct dp_packet_batch {
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index aaeb7c2..b5f157e 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -4765,6 +4765,7 @@ emc_processing(struct dp_netdev_pmd_thread *pmd,
DP_PACKET_BATCH_REFILL_FOR_EACH (i, size, packet, packets_) {
struct dp_netdev_flow *flow;
+ uint32_t flow_mark;
if (OVS_UNLIKELY(dp_packet_size(packet) < ETH_HEADER_LEN)) {
dp_packet_delete(packet);
@@ -4772,6 +4773,22 @@ emc_processing(struct dp_netdev_pmd_thread *pmd,
continue;
}
+ if (dp_packet_has_flow_mark(packet, &flow_mark)) {
+ flow = dp_netdev_pmd_find_flow_by_mark(pmd, flow_mark);
+ if (flow) {
+ /* FIXME: this fake mf won't update tcp_flags */
+ struct miniflow fake_mf = {
+ FLOWMAP_EMPTY_INITIALIZER,
+ miniflow_values(&fake_mf),
+ miniflow_values(&fake_mf) + FLOW_U64S
+ };
+
+ dp_netdev_queue_batches(packet, flow, &fake_mf, batches,
+ n_batches);
+ continue;
+ }
+ }
+
if (i != size - 1) {
struct dp_packet **packets = packets_->packets;
/* Prefetch next packet data and metadata. */
--
2.7.4
More information about the dev
mailing list