[ovs-dev] [v3 4/4] datapath compact: Use lower network stack recursion limits

Andy Zhou azhou at nicira.com
Wed Aug 27 11:13:12 UTC 2014


For the out of tree OVS module, the network stack recursion limit are
some times lower than the default value enforced by dev.c.
example that the default

This patch implements a lower limit, than the limit enforced by dev,c,
to accommodate some OVS use cases that involves higher stack usage.
For example, OVS + IPsec.

Signed-off-by: Andy Zhou <azhou at nicira.com>
---
 datapath/linux/compat/vport.h | 24 ++++++++++++++++++++++++
 datapath/vport.c              |  4 ++--
 datapath/vport.h              |  8 +++++++-
 3 files changed, 33 insertions(+), 3 deletions(-)
 create mode 100644 datapath/linux/compat/vport.h

diff --git a/datapath/linux/compat/vport.h b/datapath/linux/compat/vport.h
new file mode 100644
index 0000000..772f2c5
--- /dev/null
+++ b/datapath/linux/compat/vport.h
@@ -0,0 +1,24 @@
+#ifndef __NET_OEPNVSWITCH_VPORT_WRAPPER_H
+#define __NET_OEPNVSWITCH_VPORT_WRAPPER_H
+
+#include_next "vport.h"
+
+DECLARE_PER_CPU(int, ovs_exec_actions_count);
+#define OVS_OUTPUT_LOOP_LIMIT 4
+
+static inline int rpl_ovs_vport_send(struct vport *p, struct sk_buff *skb)
+{
+	if (this_cpu_read(ovs_exec_actions_count) > OVS_OUTPUT_LOOP_LIMIT) {
+		if(net_ratelimit())
+			pr_info("OVS output loop limit reached, drop. \n");
+		kfree_skb(skb);
+		return 0;
+	}
+
+	return ovs_vport_send(p, skb);
+}
+
+#define ovs_vport_send rpl_ovs_vport_send
+
+#endif
+
diff --git a/datapath/vport.c b/datapath/vport.c
index 37e0edc..ac72ee0 100644
--- a/datapath/vport.c
+++ b/datapath/vport.c
@@ -499,7 +499,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
 }
 
 /**
- *	ovs_vport_send - send a packet on a device
+ *	ovs_vport_send_packet - send a packet on a device
  *
  * @vport: vport on which to send the packet
  * @skb: skb to send
@@ -507,7 +507,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
  * Sends the given packet and returns the length of data sent.  Either ovs
  * lock or rcu_read_lock must be held.
  */
-int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
+int ovs_vport_send_packet(struct vport *vport, struct sk_buff *skb)
 {
 	int sent = vport->ops->send(vport, skb);
 
diff --git a/datapath/vport.h b/datapath/vport.h
index 8c3da05..c1d6a80 100644
--- a/datapath/vport.h
+++ b/datapath/vport.h
@@ -55,7 +55,7 @@ int ovs_vport_set_upcall_portids(struct vport *, struct nlattr *pids);
 int ovs_vport_get_upcall_portids(const struct vport *, struct sk_buff *);
 u32 ovs_vport_find_upcall_portid(const struct vport *, struct sk_buff *);
 
-int ovs_vport_send(struct vport *, struct sk_buff *);
+int ovs_vport_send_packet(struct vport * vport, struct sk_buff * skb);
 
 int ovs_tunnel_get_egress_info(struct ovs_tunnel_info *egress_tun_info,
 			       struct net *net,
@@ -243,4 +243,10 @@ static inline void ovs_skb_postpush_rcsum(struct sk_buff *skb,
 	if (skb->ip_summed == CHECKSUM_COMPLETE)
 		skb->csum = csum_add(skb->csum, csum_partial(start, len, 0));
 }
+
+static inline int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
+{
+	return ovs_vport_send_packet(vport, skb);
+}
+
 #endif /* vport.h */
-- 
1.9.1




More information about the dev mailing list