[ovs-dev] [PATCH] datapath: Update netdev_port_receive() for 2.6.39 rx handler API change.

Andrew Evans aevans at nicira.com
Thu Apr 7 01:47:08 UTC 2011


netdev_rx_handler_register() changed the type of the skb argument to the
callback function as well as the return type. Special-case
netdev_port_receive() to do the right thing on 2.6.39 and later.

Signed-off-by: Andrew Evans <aevans at nicira.com>
---
 datapath/vport-netdev.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
index 2583566..18fc5fe 100644
--- a/datapath/vport-netdev.c
+++ b/datapath/vport-netdev.c
@@ -38,7 +38,23 @@ MODULE_PARM_DESC(vlan_tso, "Enable TSO for VLAN packets");
 
 static void netdev_port_receive(struct vport *vport, struct sk_buff *skb);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
+/* Called with rcu_read_lock and bottom-halves disabled. */
+static rx_handler_result_t netdev_frame_hook(struct sk_buff **pskb)
+{
+	struct sk_buff *skb = *pskb;
+	struct vport *vport;
+
+	if (unlikely(skb->pkt_type == PACKET_LOOPBACK))
+		return RX_HANDLER_PASS;
+
+	vport = netdev_get_vport(skb->dev);
+
+	netdev_port_receive(vport, skb);
+
+	return RX_HANDLER_CONSUMED;
+}
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
 /* Called with rcu_read_lock and bottom-halves disabled. */
 static struct sk_buff *netdev_frame_hook(struct sk_buff *skb)
 {
-- 
1.7.2.5




More information about the dev mailing list