datapath: Update netdev_frame_hook() for 2.6.39 rx handler API change.
authorAndrew Evans <aevans@nicira.com>
Thu, 7 Apr 2011 19:43:18 +0000 (19:43 +0000)
committerAndrew Evans <aevans@nicira.com>
Thu, 7 Apr 2011 20:27:32 +0000 (20:27 +0000)
netdev_rx_handler_register() changed the type of the skb argument to the
callback function as well as the return type. Special-case
netdev_frame_hook() to do the right thing on 2.6.39 and later.

Signed-off-by: Andrew Evans <aevans@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
datapath/vport-netdev.c

index 2583566..18fc5fe 100644 (file)
@@ -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)
 {